Skip to content

Commit

Permalink
feat: Added support for "Returned for Corrections"
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccaeve committed Oct 16, 2024
1 parent 91a920d commit 644c50c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/projects/Request.jsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -37,7 +38,18 @@ export default function Request({ requestId, grantNumber }) {

return (
<div className="request">
{request.timeStatus != "current" ? (
{request.returnedForCorrections ?
<Alert color="warning">
<p>
Your request has been returned for corrections. These are the notes from the Allocations Team
</p>
<div className={style.returnedForCorrectionsNotes}>{request.returnedForCorrectionsNotes}</div>
<p className="mt-3">
Please address these issues by clicking the Edit button to edit your request.
</p>
</Alert>
: ""}
{request.timeStatus != "current" && !request.returnedForCorrections ? (
<Alert color="warning">
You are viewing {"aeiou".includes(displayStatus[0]) ? "an" : "a"}{" "}
{displayStatus} request.{" "}
Expand Down
8 changes: 8 additions & 0 deletions src/projects/Request.module.scss
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 4 additions & 0 deletions src/projects/helpers/apiSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/shared/StatusBadge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function StatusBadge({ status, title }) {
New: "secondary",
Pending: "secondary",
"Under Review": "secondary",
"Returned for Corrections": "secondary"
}[status] || "dark";
return (
<span className={`badge text-bg-${color} align-self-center`} title={title}>
Expand Down

0 comments on commit 644c50c

Please sign in to comment.