|
1 |
| -import { Divider, Grid } from "@mui/material"; |
2 |
| -import { useContext } from "react"; |
3 |
| -import { WorkplanContext } from "../../WorkPlanContext"; |
4 |
| -import { ETCaption1, ETCaption2, ETParagraph, GrayBox } from "../../../shared"; |
5 |
| -import { Palette } from "../../../../styles/theme"; |
6 |
| -import dayjs from "dayjs"; |
7 |
| -import { MONTH_DAY_YEAR } from "../../../../constants/application-constant"; |
8 |
| - |
9 |
| -const WorkDetails = () => { |
10 |
| - const { work, workPhases } = useContext(WorkplanContext); |
11 |
| - |
12 |
| - const currentWorkPhase = workPhases?.find( |
13 |
| - (phase) => phase.work_phase.id === work?.current_work_phase_id |
14 |
| - ); |
15 |
| - |
16 |
| - return ( |
17 |
| - <GrayBox> |
18 |
| - <Grid container spacing={1}> |
19 |
| - <Grid item xs={12} container> |
20 |
| - <Grid item xs={12}> |
21 |
| - <ETCaption1 color={Palette.neutral.main}> |
22 |
| - WORK START DATE |
23 |
| - </ETCaption1> |
24 |
| - </Grid> |
25 |
| - <Grid item xs={12}> |
26 |
| - <ETParagraph color={Palette.neutral.dark}> |
27 |
| - {dayjs(work?.created_at).format(MONTH_DAY_YEAR)} |
28 |
| - </ETParagraph> |
29 |
| - </Grid> |
30 |
| - </Grid> |
31 |
| - <Grid item xs={12}> |
32 |
| - <Divider sx={{ paddingTop: "8px" }} /> |
33 |
| - </Grid> |
34 |
| - <Grid item xs={12}> |
35 |
| - <ETCaption1 bold color={Palette.primary.main}> |
36 |
| - ANTICIPATED REFERRAL DATE |
37 |
| - </ETCaption1> |
38 |
| - </Grid> |
39 |
| - <Grid item xs={12}> |
40 |
| - <ETParagraph color={Palette.neutral.dark}> |
41 |
| - {work?.anticipated_decision_date ?? "-"} |
42 |
| - </ETParagraph> |
43 |
| - </Grid> |
44 |
| - <Grid item xs={6}> |
45 |
| - <ETCaption1 bold color={Palette.primary.main}> |
46 |
| - CURRENT MILESTONE |
47 |
| - </ETCaption1> |
48 |
| - </Grid> |
49 |
| - <Grid item xs={6}> |
50 |
| - <ETCaption1 bold color={Palette.primary.main}> |
51 |
| - NEXT MILESTONE |
52 |
| - </ETCaption1> |
53 |
| - </Grid> |
54 |
| - |
55 |
| - <Grid item xs={6}> |
56 |
| - <ETParagraph color={Palette.neutral.dark}> |
57 |
| - {currentWorkPhase?.current_milestone ?? "-"} |
58 |
| - </ETParagraph> |
59 |
| - </Grid> |
60 |
| - |
61 |
| - <Grid item xs={6}> |
62 |
| - <ETParagraph color={Palette.neutral.dark}> |
63 |
| - {currentWorkPhase?.next_milestone ?? "-"} |
64 |
| - </ETParagraph> |
65 |
| - </Grid> |
66 |
| - <Grid item xs={4}> |
67 |
| - <ETCaption1 bold color={Palette.primary.main}> |
68 |
| - EA ACT |
69 |
| - </ETCaption1> |
70 |
| - </Grid> |
71 |
| - <Grid item xs={4}> |
72 |
| - <ETCaption1 bold color={Palette.primary.main}> |
73 |
| - FEDERAL INVOLVEMENT |
74 |
| - </ETCaption1> |
75 |
| - </Grid> |
76 |
| - <Grid item xs={4}> |
77 |
| - <ETCaption1 bold color={Palette.primary.main}> |
78 |
| - FEDERAL ACT |
79 |
| - </ETCaption1> |
80 |
| - </Grid> |
81 |
| - <Grid item xs={4}> |
82 |
| - <ETParagraph color={Palette.neutral.dark}> |
83 |
| - {work?.ea_act?.name} |
84 |
| - </ETParagraph> |
85 |
| - </Grid> |
86 |
| - <Grid item xs={4}> |
87 |
| - <ETParagraph color={Palette.neutral.dark}> |
88 |
| - {work?.federal_involvement?.name} |
89 |
| - </ETParagraph> |
90 |
| - </Grid> |
91 |
| - <Grid item xs={4}> |
92 |
| - <ETParagraph color={Palette.neutral.dark}> |
93 |
| - {work?.substitution_act?.name} |
94 |
| - </ETParagraph> |
95 |
| - </Grid> |
96 |
| - <Grid item xs={12}> |
97 |
| - <ETCaption1 bold color={Palette.primary.main}> |
98 |
| - RESPONSIBLE MINISTRY |
99 |
| - </ETCaption1> |
100 |
| - </Grid> |
101 |
| - <Grid item xs={12}> |
102 |
| - <ETParagraph color={Palette.neutral.dark}> |
103 |
| - {work?.ministry?.name} |
104 |
| - </ETParagraph> |
105 |
| - </Grid> |
106 |
| - <Grid item xs={12}> |
107 |
| - <ETCaption1 bold color={Palette.primary.main}> |
108 |
| - DECISION MAKER |
109 |
| - </ETCaption1> |
110 |
| - </Grid> |
111 |
| - <Grid item xs={12}> |
112 |
| - <ETParagraph color={Palette.neutral.dark}> |
113 |
| - {work?.decision_by?.full_name} |
114 |
| - </ETParagraph> |
115 |
| - </Grid> |
116 |
| - </Grid> |
117 |
| - </GrayBox> |
118 |
| - ); |
119 |
| -}; |
120 |
| - |
121 |
| -export default WorkDetails; |
| 1 | +import { Divider, Grid } from "@mui/material"; |
| 2 | +import { useContext } from "react"; |
| 3 | +import { WorkplanContext } from "../../WorkPlanContext"; |
| 4 | +import { ETCaption1, ETParagraph, GrayBox } from "../../../shared"; |
| 5 | +import { Palette } from "../../../../styles/theme"; |
| 6 | +import dayjs from "dayjs"; |
| 7 | +import { MONTH_DAY_YEAR } from "../../../../constants/application-constant"; |
| 8 | + |
| 9 | +const WorkDetails = () => { |
| 10 | + const { work, workPhases } = useContext(WorkplanContext); |
| 11 | + |
| 12 | + const currentWorkPhaseIndex = workPhases?.findIndex( |
| 13 | + (phase) => phase.work_phase.id === work?.current_work_phase_id |
| 14 | + ); |
| 15 | + const currentWorkPhase = workPhases?.[currentWorkPhaseIndex]; |
| 16 | + const nextWorkPhase = |
| 17 | + currentWorkPhaseIndex + 1 < workPhases.length |
| 18 | + ? workPhases?.[currentWorkPhaseIndex + 1] |
| 19 | + : null; |
| 20 | + |
| 21 | + return ( |
| 22 | + <GrayBox> |
| 23 | + <Grid container spacing={1}> |
| 24 | + <Grid item xs={12} container> |
| 25 | + <Grid item xs={12}> |
| 26 | + <ETCaption1 color={Palette.neutral.main}> |
| 27 | + WORK START DATE |
| 28 | + </ETCaption1> |
| 29 | + </Grid> |
| 30 | + <Grid item xs={12}> |
| 31 | + <ETParagraph color={Palette.neutral.dark}> |
| 32 | + {dayjs(work?.created_at).format(MONTH_DAY_YEAR)} |
| 33 | + </ETParagraph> |
| 34 | + </Grid> |
| 35 | + </Grid> |
| 36 | + <Grid item xs={12}> |
| 37 | + <Divider sx={{ paddingTop: "8px" }} /> |
| 38 | + </Grid> |
| 39 | + <Grid item xs={12}> |
| 40 | + <ETCaption1 bold color={Palette.primary.main}> |
| 41 | + ANTICIPATED REFERRAL DATE |
| 42 | + </ETCaption1> |
| 43 | + </Grid> |
| 44 | + <Grid item xs={12}> |
| 45 | + <ETParagraph color={Palette.neutral.dark}> |
| 46 | + {work?.anticipated_decision_date ?? "-"} |
| 47 | + </ETParagraph> |
| 48 | + </Grid> |
| 49 | + <Grid item xs={6}> |
| 50 | + <ETCaption1 bold color={Palette.primary.main}> |
| 51 | + CURRENT MILESTONE |
| 52 | + </ETCaption1> |
| 53 | + </Grid> |
| 54 | + <Grid item xs={6}> |
| 55 | + <ETCaption1 bold color={Palette.primary.main}> |
| 56 | + NEXT MILESTONE |
| 57 | + </ETCaption1> |
| 58 | + </Grid> |
| 59 | + |
| 60 | + <Grid item xs={6}> |
| 61 | + <ETParagraph color={Palette.neutral.dark}> |
| 62 | + {currentWorkPhase?.current_milestone ?? "-"} |
| 63 | + </ETParagraph> |
| 64 | + </Grid> |
| 65 | + |
| 66 | + <Grid item xs={6}> |
| 67 | + <ETParagraph color={Palette.neutral.dark}> |
| 68 | + {currentWorkPhase?.next_milestone ?? |
| 69 | + nextWorkPhase?.next_milestone ?? |
| 70 | + "-"} |
| 71 | + </ETParagraph> |
| 72 | + </Grid> |
| 73 | + <Grid item xs={4}> |
| 74 | + <ETCaption1 bold color={Palette.primary.main}> |
| 75 | + EA ACT |
| 76 | + </ETCaption1> |
| 77 | + </Grid> |
| 78 | + <Grid item xs={4}> |
| 79 | + <ETCaption1 bold color={Palette.primary.main}> |
| 80 | + FEDERAL INVOLVEMENT |
| 81 | + </ETCaption1> |
| 82 | + </Grid> |
| 83 | + <Grid item xs={4}> |
| 84 | + <ETCaption1 bold color={Palette.primary.main}> |
| 85 | + FEDERAL ACT |
| 86 | + </ETCaption1> |
| 87 | + </Grid> |
| 88 | + <Grid item xs={4}> |
| 89 | + <ETParagraph color={Palette.neutral.dark}> |
| 90 | + {work?.ea_act?.name} |
| 91 | + </ETParagraph> |
| 92 | + </Grid> |
| 93 | + <Grid item xs={4}> |
| 94 | + <ETParagraph color={Palette.neutral.dark}> |
| 95 | + {work?.federal_involvement?.name} |
| 96 | + </ETParagraph> |
| 97 | + </Grid> |
| 98 | + <Grid item xs={4}> |
| 99 | + <ETParagraph color={Palette.neutral.dark}> |
| 100 | + {work?.substitution_act?.name} |
| 101 | + </ETParagraph> |
| 102 | + </Grid> |
| 103 | + <Grid item xs={12}> |
| 104 | + <ETCaption1 bold color={Palette.primary.main}> |
| 105 | + RESPONSIBLE MINISTRY |
| 106 | + </ETCaption1> |
| 107 | + </Grid> |
| 108 | + <Grid item xs={12}> |
| 109 | + <ETParagraph color={Palette.neutral.dark}> |
| 110 | + {work?.ministry?.name} |
| 111 | + </ETParagraph> |
| 112 | + </Grid> |
| 113 | + <Grid item xs={12}> |
| 114 | + <ETCaption1 bold color={Palette.primary.main}> |
| 115 | + DECISION MAKER |
| 116 | + </ETCaption1> |
| 117 | + </Grid> |
| 118 | + <Grid item xs={12}> |
| 119 | + <ETParagraph color={Palette.neutral.dark}> |
| 120 | + {work?.decision_by?.full_name} |
| 121 | + </ETParagraph> |
| 122 | + </Grid> |
| 123 | + </Grid> |
| 124 | + </GrayBox> |
| 125 | + ); |
| 126 | +}; |
| 127 | + |
| 128 | +export default WorkDetails; |
0 commit comments