-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from jadmsaadaot/SUBMIT-task#188
Add the confirmation box in the review section
- Loading branch information
Showing
25 changed files
with
181 additions
and
15 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
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
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
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
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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
Box, | ||
Stack, | ||
StackProps, | ||
Typography, | ||
TypographyProps, | ||
} from "@mui/material"; | ||
import { ReactNode } from "@tanstack/react-router"; | ||
|
||
type LabelValuePairProps = { | ||
label?: string; | ||
value?: ReactNode; | ||
labelProps?: TypographyProps; | ||
valueProps?: TypographyProps; | ||
}; | ||
export const LabelValuePair = ({ | ||
label = "", | ||
value = "", | ||
labelProps = {}, | ||
valueProps = {}, | ||
...otherProps | ||
}: LabelValuePairProps & StackProps) => { | ||
return ( | ||
<Stack direction="row" alignItems={"center"} {...otherProps}> | ||
<Typography {...labelProps}>{label}:</Typography> | ||
<Box> | ||
<Typography color={"inherit"} {...valueProps}> | ||
{value} | ||
</Typography> | ||
</Box> | ||
</Stack> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Box, styled } from "@mui/material"; | ||
import { BCDesignTokens } from "epic.theme"; | ||
|
||
export const SuccessBox = styled(Box)({ | ||
border: `1px solid ${BCDesignTokens.supportBorderColorSuccess}`, | ||
borderRadius: "4px", | ||
display: "flex", | ||
alignItems: "flex-start", | ||
alignSelf: "stretch", | ||
color: BCDesignTokens.supportBorderColorSuccess, | ||
backgroundColor: BCDesignTokens.supportSurfaceColorSuccess, | ||
padding: "10px 10px 10px 12px", | ||
flexDirection: "column", | ||
gap: "4px", | ||
}); |
108 changes: 108 additions & 0 deletions
108
...ponents/SubmissionItem/ConsultationRecord/ConsultationRecordStaffView/NotificationBox.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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { LabelValuePair } from "@/components/Shared/LabelValuePair"; | ||
import { checkIfStaff } from "@/components/Shared/PermissionGate/utils"; | ||
import { SuccessBox } from "@/components/Shared/SuccessBox"; | ||
import { SubmissionStatusChip } from "@/components/SubmissionStatusChip"; | ||
import { getSubmissionItemForStaffQueryOptions } from "@/hooks/api/useItems"; | ||
import { SUBMISSION_STATUS } from "@/models/Submission"; | ||
import { SubmissionItem } from "@/models/SubmissionItem"; | ||
import { | ||
SUBMISSION_REVIEW_ENTRY_TYPE, | ||
SUBMISSION_REVIEW_STATUS, | ||
} from "@/models/SubmissionReview"; | ||
import { useAccount } from "@/store/accountStore"; | ||
import { Grid, Stack, Typography } from "@mui/material"; | ||
import { useQueryClient } from "@tanstack/react-query"; | ||
import { useParams } from "@tanstack/react-router"; | ||
|
||
export const NotificationBox = () => { | ||
const queryClient = useQueryClient(); | ||
const { roles } = useAccount(); | ||
const { submissionId: submissionItemId } = useParams({ | ||
from: "/staff/_staffLayout/projects/$projectId/_projectLayout/submission-packages/$submissionPackageId/_submissionLayout/submissions/$submissionId", | ||
}); | ||
|
||
const submissionItem = queryClient.getQueryData<SubmissionItem>( | ||
getSubmissionItemForStaffQueryOptions({ itemId: Number(submissionItemId) }) | ||
.queryKey, | ||
); | ||
|
||
const submissionReview = submissionItem?.review; | ||
const staffRecommendation = submissionReview?.entries?.find( | ||
(entry) => entry.type === SUBMISSION_REVIEW_ENTRY_TYPE.STAFF_RECOMMENDATION, | ||
); | ||
const managerConfirmation = submissionReview?.entries?.find( | ||
(entry) => entry.type === SUBMISSION_REVIEW_ENTRY_TYPE.MANAGER_CONFIRMATION, | ||
); | ||
|
||
const isStaff = checkIfStaff(roles); | ||
|
||
if (!submissionReview) { | ||
return <></>; | ||
} | ||
|
||
if ( | ||
isStaff && | ||
submissionReview.status === SUBMISSION_REVIEW_STATUS.PENDING_MANAGER_REVIEW | ||
) { | ||
return ( | ||
<SuccessBox m="2em 0"> | ||
<Typography variant="body1" color="inherit"> | ||
Your recommendation has been successfully sent to a Manager | ||
</Typography> | ||
</SuccessBox> | ||
); | ||
} | ||
|
||
if (submissionReview.status === SUBMISSION_REVIEW_STATUS.APPROVED) { | ||
return ( | ||
<SuccessBox m="2em 0"> | ||
<Stack direction="row" alignItems={"center"} spacing={2}> | ||
<Typography variant="body1" color="inherit"> | ||
The submission has been completed as: | ||
</Typography> | ||
<SubmissionStatusChip | ||
status={SUBMISSION_STATUS.PASSED_CONSULTATION_CHECK.value} | ||
/> | ||
</Stack> | ||
<Grid container color={"inherit"}> | ||
<Grid item xs={12} container> | ||
<Grid item container width="400px"> | ||
<Grid item xs={12}> | ||
<LabelValuePair | ||
label="Decision recommended by" | ||
value={"Placeholder"} | ||
labelProps={{ color: "inherit", width: "220px" }} | ||
/> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<LabelValuePair | ||
label="Confirmed by" | ||
value="Placeholder" | ||
labelProps={{ color: "inherit", width: "220px" }} | ||
/> | ||
</Grid> | ||
</Grid> | ||
<Grid item xs container> | ||
<Grid item xs={12}> | ||
<LabelValuePair | ||
label="Date" | ||
value={staffRecommendation?.updated_on} | ||
labelProps={{ color: "inherit", width: "50px" }} | ||
/> | ||
</Grid> | ||
<Grid item xs={12}> | ||
<LabelValuePair | ||
label="Date" | ||
value={managerConfirmation?.updated_on} | ||
labelProps={{ color: "inherit", width: "50px" }} | ||
/> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</SuccessBox> | ||
); | ||
} | ||
|
||
return <></>; | ||
}; |
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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