diff --git a/src/projects/Request.jsx b/src/projects/Request.jsx index c0c0ffd..0e40ec9 100644 --- a/src/projects/Request.jsx +++ b/src/projects/Request.jsx @@ -1,5 +1,6 @@ import { useRequest, useProject } from "./helpers/hooks"; import config from "./helpers/config"; +import style from "./Request.module.scss"; import Tab from "react-bootstrap/Tab"; import Tabs from "react-bootstrap/Tabs"; @@ -37,7 +38,18 @@ export default function Request({ requestId, grantNumber }) { return (
- {request.timeStatus != "current" ? ( + {request.returnedForCorrections ? + +

+ Your request has been returned for corrections. These are the notes from the Allocations Team +

+
{request.returnedForCorrectionsNotes}
+

+ Please address these issues by clicking the Edit button to edit your request. +

+
+ : ""} + {request.timeStatus != "current" && !request.returnedForCorrections ? ( You are viewing {"aeiou".includes(displayStatus[0]) ? "an" : "a"}{" "} {displayStatus} request.{" "} diff --git a/src/projects/Request.module.scss b/src/projects/Request.module.scss new file mode 100644 index 0000000..0af5c28 --- /dev/null +++ b/src/projects/Request.module.scss @@ -0,0 +1,8 @@ +.returnedForCorrectionsNotes { + background-color: #fff; + font-size: 1em !important; + padding: 10px; + white-space: pre-wrap; + border-left: 20px solid #a70000; + border-radius: 0.375rem; +} \ No newline at end of file diff --git a/src/projects/helpers/apiSlice.js b/src/projects/helpers/apiSlice.js index 54240dd..92fbc37 100644 --- a/src/projects/helpers/apiSlice.js +++ b/src/projects/helpers/apiSlice.js @@ -162,6 +162,8 @@ const addRequest = ( .filter((res) => res.isCredit || res.allocated > 0) .sort(sortResources), resourcesReason: "", + returnedForCorrections: actions.find((action) => action.returnedForCorrections) ? true : false, + returnedForCorrectionsNotes: actions.map((action) => action.adminComments).join(','), showActionsModal: false, showConfirmModal: false, showResourcesModal: false, @@ -807,7 +809,9 @@ export const apiSlice = createSlice({ state.projectsList = action.payload.projectsList.map((project) => { const { grantNumber, requestMasterId, requests, status, title } = project; + const returnedForCorrections = project.requests.filter(r => r.actions.filter(a => a.returnedForCorrections).length > 0).length > 0 const projectStatus = + returnedForCorrections ? "Returned for Corrections" : status || (requests && (requests.find(({ timeStatus }) => timeStatus == "current") diff --git a/src/shared/StatusBadge.jsx b/src/shared/StatusBadge.jsx index 50cd510..0f20732 100644 --- a/src/shared/StatusBadge.jsx +++ b/src/shared/StatusBadge.jsx @@ -6,6 +6,7 @@ export default function StatusBadge({ status, title }) { New: "secondary", Pending: "secondary", "Under Review": "secondary", + "Returned for Corrections": "secondary" }[status] || "dark"; return (