Skip to content

Commit

Permalink
Bugfix/careplan date (#96)
Browse files Browse the repository at this point in the history
* careplan start date - use date picker

* Enrollment app - add state variable to ensure setting of careplan date

* fix modal dialog z index

---------

Co-authored-by: Amy Chen <amysbubble@MacBook-Pro-5.local>
  • Loading branch information
achen2401 and Amy Chen authored Jun 14, 2024
1 parent 8c527b3 commit b82a35c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/EnrollmentApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type EnrollmenAppState = {
carePlanStartDate: Date | null;
selectedCarePlanStartDate: Date | null;
startDateModalOpen: boolean;
loaded: boolean;
}

export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState> {
Expand All @@ -50,6 +51,7 @@ export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState
carePlanStartDate: null,
selectedCarePlanStartDate: null,
startDateModalOpen: true,
loaded: false
};
}

Expand Down Expand Up @@ -174,6 +176,15 @@ export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState
: existingCarePlan.created;
this.setState({
carePlanStartDate: new Date(startDate),
}, () => {
// make sure care plan date is set before presenting the view
this.setState({
loaded: true
});
});
} else {
this.setState({
loaded: true
});
}
}
Expand Down Expand Up @@ -259,6 +270,7 @@ export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState
onClose={handleClose}
aria-labelledby="careplan-date-dialog-title"
aria-describedby="careplan-date-dialog-description"
sx={{zIndex: 10}}
>
<DialogTitle id="careplan-date-dialog-title">
{"Please specify the CarePlan start date"}
Expand Down Expand Up @@ -364,9 +376,10 @@ export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState
);
}
render(): React.ReactNode {
if (!this.state || !this.context) return <CircularProgress />;
if (!this.state || !this.context || !this.state.loaded) return <CircularProgress />;

let view = <CircularProgress />;

if (!this.state.carePlanStartDate) {
view = this.getCarePlanStartDateModalView();
} else if (this.state.activeCarePlan != null) {
Expand Down

0 comments on commit b82a35c

Please sign in to comment.