From b82a35c614b24cbd86d29da14f3a3c41a6ae593d Mon Sep 17 00:00:00 2001 From: Amy Chen Date: Thu, 13 Jun 2024 20:06:47 -0700 Subject: [PATCH] Bugfix/careplan date (#96) * 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 --- src/components/EnrollmentApp.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/EnrollmentApp.tsx b/src/components/EnrollmentApp.tsx index 7b6b4b7..6cc183d 100644 --- a/src/components/EnrollmentApp.tsx +++ b/src/components/EnrollmentApp.tsx @@ -36,6 +36,7 @@ type EnrollmenAppState = { carePlanStartDate: Date | null; selectedCarePlanStartDate: Date | null; startDateModalOpen: boolean; + loaded: boolean; } export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState> { @@ -50,6 +51,7 @@ export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState carePlanStartDate: null, selectedCarePlanStartDate: null, startDateModalOpen: true, + loaded: false }; } @@ -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 }); } } @@ -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}} > {"Please specify the CarePlan start date"} @@ -364,9 +376,10 @@ export default class EnrollmentApp extends React.Component<{}, EnrollmenAppState ); } render(): React.ReactNode { - if (!this.state || !this.context) return ; + if (!this.state || !this.context || !this.state.loaded) return ; let view = ; + if (!this.state.carePlanStartDate) { view = this.getCarePlanStartDateModalView(); } else if (this.state.activeCarePlan != null) {