Skip to content

Commit

Permalink
Merge branch 'DHIS2-18018' into DHIS2-17853
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed Jan 23, 2025
2 parents 0992767 + 91c1893 commit c5e743e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,16 @@ const LinkExistingResponse = ({
);
};

const LinkButton = withStyles(styles)(({ onLink, label, saveAttempted, errorMessages, dataTest, classes }) => {
const LinkButton = withStyles(styles)(({ onLink, label, errorMessages, dataTest, classes }) => {
if (!onLink) {
return null;
}

const disabled = saveAttempted && Object.values(errorMessages).filter(Boolean).length !== 0;
const disabled = Object.values(errorMessages).some(Boolean);

return (
<div className={classes.link}>
<Button secondary small onClick={onLink} disabled={disabled} dataTest={dataTest}>
<Button primary small onClick={onLink} disabled={disabled} dataTest={dataTest}>
{label}
</Button>
</div>
Expand Down Expand Up @@ -287,7 +287,6 @@ const RelatedStagesActionsPlain = ({
<LinkButton
onLink={onLink}
label={i18n.t('Schedule')}
saveAttempted={saveAttempted}
errorMessages={errorMessages}
dataTest="related-stages-buttons-schedule"
/>
Expand All @@ -306,7 +305,6 @@ const RelatedStagesActionsPlain = ({
<LinkButton
onLink={onLink}
label={i18n.t('Enter details')}
saveAttempted={saveAttempted}
errorMessages={errorMessages}
dataTest="related-stages-buttons-enter-details"
/>
Expand All @@ -326,7 +324,6 @@ const RelatedStagesActionsPlain = ({
<LinkButton
onLink={onLink}
label={i18n.t('Link')}
saveAttempted={saveAttempted}
errorMessages={errorMessages}
dataTest="related-stages-buttons-link-existing-response"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ export const createServerData = ({
relationship: ?Object,
enrollment: Object,
}) => {
const updatedEnrollment = { ...enrollment, events: [...enrollment.events, linkedEvent] };
if (linkedEvent) {
return {
enrollments: [updatedEnrollment],
events: [...enrollment.events, linkedEvent],
relationships: [relationship],
};
}
Expand Down

0 comments on commit c5e743e

Please sign in to comment.