diff --git a/src/components/GroupTaskTab.js b/src/components/GroupTaskTab.js index 12b19c5..c99361e 100644 --- a/src/components/GroupTaskTab.js +++ b/src/components/GroupTaskTab.js @@ -22,7 +22,7 @@ function GroupTaskTabLabel({ } function GroupTaskTabPanel({ - value, group, rights, classes, + value, group, rights, classes, groupIndividualIds, }) { if (!group) return null; const modulesManager = useModulesManager(); @@ -43,7 +43,7 @@ function GroupTaskTabPanel({ > ({ }); function IndividualTabPanel({ - intl, rights, classes, individual, setConfirmedAction, group, editedGroupIndividual, setEditedGroupIndividual, + intl, + rights, + classes, + individual, + setConfirmedAction, + group, editedGroupIndividual, + setEditedGroupIndividual, + groupIndividualIds, }) { const [activeTab, setActiveTab] = useState(individual ? BENEFIT_PLANS_LIST_TAB_VALUE : INDIVIDUALS_LIST_TAB_VALUE); @@ -64,6 +71,7 @@ function IndividualTabPanel({ value={activeTab} individual={individual} group={group} + groupIndividualIds={groupIndividualIds} setConfirmedAction={setConfirmedAction} editedGroupIndividual={editedGroupIndividual} setEditedGroupIndividual={setEditedGroupIndividual} diff --git a/src/pages/GroupPage.js b/src/pages/GroupPage.js index a436f1b..a658be6 100644 --- a/src/pages/GroupPage.js +++ b/src/pages/GroupPage.js @@ -46,10 +46,12 @@ function GroupPage({ journalize, clearGroup, createGroupAndMoveIndividual, + groupIndividuals, }) { const [editedGroup, setEditedGroup] = useState({}); const [editedGroupIndividual, setEditedGroupIndividual] = useState(null); const [confirmedAction, setConfirmedAction] = useState(() => null); + const [groupIndividualIds, setGroupIndividualIds] = useState([]); const [readOnly, setReadOnly] = useState(null); const prevSubmittingMutationRef = useRef(); @@ -62,6 +64,13 @@ function GroupPage({ }; }, [groupUuid]); + useEffect(() => { + if (groupIndividuals) { + const ids = groupIndividuals.map((groupIndividual) => groupIndividual.id); + setGroupIndividualIds(ids); + } + }, [groupIndividuals]); + useEffect(() => { if (confirmed && confirmedAction) confirmedAction(); return () => confirmed && clearConfirm(null); @@ -168,6 +177,7 @@ function GroupPage({ setEditedGroupIndividual={setEditedGroupIndividual} editedGroupIndividual={editedGroupIndividual} readOnly={readOnly} + groupIndividualIds={groupIndividualIds} /> ) @@ -184,6 +194,7 @@ const mapStateToProps = (state, props) => ({ errorGroup: state.individual.errorGroup, submittingMutation: state.individual.submittingMutation, mutation: state.individual.mutation, + groupIndividuals: state?.individual?.groupIndividuals, }); const mapDispatchToProps = (dispatch) => bindActionCreators({