From a60581c156f4d39445792aeaad27542e3245355f Mon Sep 17 00:00:00 2001
From: jadmsaadaot <91914654+jadmsaadaot@users.noreply.github.com>
Date: Wed, 10 Jan 2024 12:33:10 -0800
Subject: [PATCH] when current phase is full next milestone is from next phase
(#1628)
* when current phase is full next milestone is from next phase
* remove console logs
* remove unused import
---
epictrack-web/src/App.tsx | 1 -
.../about/aboutDetails/WorkDetails.tsx | 249 +++++++++---------
2 files changed, 128 insertions(+), 122 deletions(-)
diff --git a/epictrack-web/src/App.tsx b/epictrack-web/src/App.tsx
index 293658014..bb2bfd479 100644
--- a/epictrack-web/src/App.tsx
+++ b/epictrack-web/src/App.tsx
@@ -19,7 +19,6 @@ export function App() {
const uiState = useAppSelector((state) => state.uiState);
const drawerWidth = uiState.drawerWidth;
React.useEffect(() => {
- console.log("Involed");
UserService.initKeycloak(dispatch);
}, [dispatch]);
return (
diff --git a/epictrack-web/src/components/workPlan/about/aboutDetails/WorkDetails.tsx b/epictrack-web/src/components/workPlan/about/aboutDetails/WorkDetails.tsx
index 04dcda007..1a88063f8 100644
--- a/epictrack-web/src/components/workPlan/about/aboutDetails/WorkDetails.tsx
+++ b/epictrack-web/src/components/workPlan/about/aboutDetails/WorkDetails.tsx
@@ -1,121 +1,128 @@
-import { Divider, Grid } from "@mui/material";
-import { useContext } from "react";
-import { WorkplanContext } from "../../WorkPlanContext";
-import { ETCaption1, ETCaption2, ETParagraph, GrayBox } from "../../../shared";
-import { Palette } from "../../../../styles/theme";
-import dayjs from "dayjs";
-import { MONTH_DAY_YEAR } from "../../../../constants/application-constant";
-
-const WorkDetails = () => {
- const { work, workPhases } = useContext(WorkplanContext);
-
- const currentWorkPhase = workPhases?.find(
- (phase) => phase.work_phase.id === work?.current_work_phase_id
- );
-
- return (
-
-
-
-
-
- WORK START DATE
-
-
-
-
- {dayjs(work?.created_at).format(MONTH_DAY_YEAR)}
-
-
-
-
-
-
-
-
- ANTICIPATED REFERRAL DATE
-
-
-
-
- {work?.anticipated_decision_date ?? "-"}
-
-
-
-
- CURRENT MILESTONE
-
-
-
-
- NEXT MILESTONE
-
-
-
-
-
- {currentWorkPhase?.current_milestone ?? "-"}
-
-
-
-
-
- {currentWorkPhase?.next_milestone ?? "-"}
-
-
-
-
- EA ACT
-
-
-
-
- FEDERAL INVOLVEMENT
-
-
-
-
- FEDERAL ACT
-
-
-
-
- {work?.ea_act?.name}
-
-
-
-
- {work?.federal_involvement?.name}
-
-
-
-
- {work?.substitution_act?.name}
-
-
-
-
- RESPONSIBLE MINISTRY
-
-
-
-
- {work?.ministry?.name}
-
-
-
-
- DECISION MAKER
-
-
-
-
- {work?.decision_by?.full_name}
-
-
-
-
- );
-};
-
-export default WorkDetails;
+import { Divider, Grid } from "@mui/material";
+import { useContext } from "react";
+import { WorkplanContext } from "../../WorkPlanContext";
+import { ETCaption1, ETParagraph, GrayBox } from "../../../shared";
+import { Palette } from "../../../../styles/theme";
+import dayjs from "dayjs";
+import { MONTH_DAY_YEAR } from "../../../../constants/application-constant";
+
+const WorkDetails = () => {
+ const { work, workPhases } = useContext(WorkplanContext);
+
+ const currentWorkPhaseIndex = workPhases?.findIndex(
+ (phase) => phase.work_phase.id === work?.current_work_phase_id
+ );
+ const currentWorkPhase = workPhases?.[currentWorkPhaseIndex];
+ const nextWorkPhase =
+ currentWorkPhaseIndex + 1 < workPhases.length
+ ? workPhases?.[currentWorkPhaseIndex + 1]
+ : null;
+
+ return (
+
+
+
+
+
+ WORK START DATE
+
+
+
+
+ {dayjs(work?.created_at).format(MONTH_DAY_YEAR)}
+
+
+
+
+
+
+
+
+ ANTICIPATED REFERRAL DATE
+
+
+
+
+ {work?.anticipated_decision_date ?? "-"}
+
+
+
+
+ CURRENT MILESTONE
+
+
+
+
+ NEXT MILESTONE
+
+
+
+
+
+ {currentWorkPhase?.current_milestone ?? "-"}
+
+
+
+
+
+ {currentWorkPhase?.next_milestone ??
+ nextWorkPhase?.next_milestone ??
+ "-"}
+
+
+
+
+ EA ACT
+
+
+
+
+ FEDERAL INVOLVEMENT
+
+
+
+
+ FEDERAL ACT
+
+
+
+
+ {work?.ea_act?.name}
+
+
+
+
+ {work?.federal_involvement?.name}
+
+
+
+
+ {work?.substitution_act?.name}
+
+
+
+
+ RESPONSIBLE MINISTRY
+
+
+
+
+ {work?.ministry?.name}
+
+
+
+
+ DECISION MAKER
+
+
+
+
+ {work?.decision_by?.full_name}
+
+
+
+
+ );
+};
+
+export default WorkDetails;