Skip to content

Commit

Permalink
when current phase is full next milestone is from next phase (bcgov#1628
Browse files Browse the repository at this point in the history
)

* when current phase is full next milestone is from next phase

* remove console logs

* remove unused import
  • Loading branch information
jadmsaadaot authored Jan 10, 2024
1 parent 2e1e20c commit a60581c
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 122 deletions.
1 change: 0 additions & 1 deletion epictrack-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
249 changes: 128 additions & 121 deletions epictrack-web/src/components/workPlan/about/aboutDetails/WorkDetails.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<GrayBox>
<Grid container spacing={1}>
<Grid item xs={12} container>
<Grid item xs={12}>
<ETCaption1 color={Palette.neutral.main}>
WORK START DATE
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{dayjs(work?.created_at).format(MONTH_DAY_YEAR)}
</ETParagraph>
</Grid>
</Grid>
<Grid item xs={12}>
<Divider sx={{ paddingTop: "8px" }} />
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
ANTICIPATED REFERRAL DATE
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{work?.anticipated_decision_date ?? "-"}
</ETParagraph>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
CURRENT MILESTONE
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
NEXT MILESTONE
</ETCaption1>
</Grid>

<Grid item xs={6}>
<ETParagraph color={Palette.neutral.dark}>
{currentWorkPhase?.current_milestone ?? "-"}
</ETParagraph>
</Grid>

<Grid item xs={6}>
<ETParagraph color={Palette.neutral.dark}>
{currentWorkPhase?.next_milestone ?? "-"}
</ETParagraph>
</Grid>
<Grid item xs={4}>
<ETCaption1 bold color={Palette.primary.main}>
EA ACT
</ETCaption1>
</Grid>
<Grid item xs={4}>
<ETCaption1 bold color={Palette.primary.main}>
FEDERAL INVOLVEMENT
</ETCaption1>
</Grid>
<Grid item xs={4}>
<ETCaption1 bold color={Palette.primary.main}>
FEDERAL ACT
</ETCaption1>
</Grid>
<Grid item xs={4}>
<ETParagraph color={Palette.neutral.dark}>
{work?.ea_act?.name}
</ETParagraph>
</Grid>
<Grid item xs={4}>
<ETParagraph color={Palette.neutral.dark}>
{work?.federal_involvement?.name}
</ETParagraph>
</Grid>
<Grid item xs={4}>
<ETParagraph color={Palette.neutral.dark}>
{work?.substitution_act?.name}
</ETParagraph>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
RESPONSIBLE MINISTRY
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{work?.ministry?.name}
</ETParagraph>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
DECISION MAKER
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{work?.decision_by?.full_name}
</ETParagraph>
</Grid>
</Grid>
</GrayBox>
);
};

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 (
<GrayBox>
<Grid container spacing={1}>
<Grid item xs={12} container>
<Grid item xs={12}>
<ETCaption1 color={Palette.neutral.main}>
WORK START DATE
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{dayjs(work?.created_at).format(MONTH_DAY_YEAR)}
</ETParagraph>
</Grid>
</Grid>
<Grid item xs={12}>
<Divider sx={{ paddingTop: "8px" }} />
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
ANTICIPATED REFERRAL DATE
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{work?.anticipated_decision_date ?? "-"}
</ETParagraph>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
CURRENT MILESTONE
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
NEXT MILESTONE
</ETCaption1>
</Grid>

<Grid item xs={6}>
<ETParagraph color={Palette.neutral.dark}>
{currentWorkPhase?.current_milestone ?? "-"}
</ETParagraph>
</Grid>

<Grid item xs={6}>
<ETParagraph color={Palette.neutral.dark}>
{currentWorkPhase?.next_milestone ??
nextWorkPhase?.next_milestone ??
"-"}
</ETParagraph>
</Grid>
<Grid item xs={4}>
<ETCaption1 bold color={Palette.primary.main}>
EA ACT
</ETCaption1>
</Grid>
<Grid item xs={4}>
<ETCaption1 bold color={Palette.primary.main}>
FEDERAL INVOLVEMENT
</ETCaption1>
</Grid>
<Grid item xs={4}>
<ETCaption1 bold color={Palette.primary.main}>
FEDERAL ACT
</ETCaption1>
</Grid>
<Grid item xs={4}>
<ETParagraph color={Palette.neutral.dark}>
{work?.ea_act?.name}
</ETParagraph>
</Grid>
<Grid item xs={4}>
<ETParagraph color={Palette.neutral.dark}>
{work?.federal_involvement?.name}
</ETParagraph>
</Grid>
<Grid item xs={4}>
<ETParagraph color={Palette.neutral.dark}>
{work?.substitution_act?.name}
</ETParagraph>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
RESPONSIBLE MINISTRY
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{work?.ministry?.name}
</ETParagraph>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
DECISION MAKER
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETParagraph color={Palette.neutral.dark}>
{work?.decision_by?.full_name}
</ETParagraph>
</Grid>
</Grid>
</GrayBox>
);
};

export default WorkDetails;

0 comments on commit a60581c

Please sign in to comment.