Skip to content

Commit

Permalink
CM-549: fix task tab in group page (#48)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan <[email protected]>
  • Loading branch information
jdolkowski and Jan authored Feb 20, 2024
1 parent ad85fd8 commit 0bfffae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/GroupTaskTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function GroupTaskTabLabel({
}

function GroupTaskTabPanel({
value, group, rights, classes,
value, group, rights, classes, groupIndividualIds,
}) {
if (!group) return null;
const modulesManager = useModulesManager();
Expand All @@ -43,7 +43,7 @@ function GroupTaskTabPanel({
>
<PublishedComponent
pubRef="tasksManagement.taskSearcher"
entityId={group?.id}
entityIds={groupIndividualIds}
rights={rights}
classes={classes}
contribution={filteredContribution}
Expand Down
10 changes: 9 additions & 1 deletion src/components/IndividualTabPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ const styles = (theme) => ({
});

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);

Expand Down Expand Up @@ -64,6 +71,7 @@ function IndividualTabPanel({
value={activeTab}
individual={individual}
group={group}
groupIndividualIds={groupIndividualIds}
setConfirmedAction={setConfirmedAction}
editedGroupIndividual={editedGroupIndividual}
setEditedGroupIndividual={setEditedGroupIndividual}
Expand Down
11 changes: 11 additions & 0 deletions src/pages/GroupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand Down Expand Up @@ -168,6 +177,7 @@ function GroupPage({
setEditedGroupIndividual={setEditedGroupIndividual}
editedGroupIndividual={editedGroupIndividual}
readOnly={readOnly}
groupIndividualIds={groupIndividualIds}
/>
</div>
)
Expand All @@ -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({
Expand Down

0 comments on commit 0bfffae

Please sign in to comment.