forked from bcgov/EPIC.track
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when current phase is full next milestone is from next phase (bcgov#1628
) * when current phase is full next milestone is from next phase * remove console logs * remove unused import
- Loading branch information
1 parent
2e1e20c
commit a60581c
Showing
2 changed files
with
128 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
249 changes: 128 additions & 121 deletions
249
epictrack-web/src/components/workPlan/about/aboutDetails/WorkDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |