From f8b7d2280265b5bb82fd962e2a6854200e1d7d21 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 28 May 2024 18:44:52 +0100 Subject: [PATCH] show submitted reps on dashboard --- components/case/representation/index.js | 2 + .../representation/representationComplete.js | 22 ++++++++- .../representationCompleteSubmit.js | 1 + .../case/representation/representationLPA.js | 3 +- components/myportal.js | 14 +++++- components/myportal/topthree.js | 31 +++++++++++-- components/myportal/watchedcases.js | 28 ++++++++--- components/newappeal/buildCheckfield.js | 2 +- locales/cy/myportal.json | 1 + locales/en/myportal.json | 1 + pages/api/endpoint/deletewatchedcases_api.js | 2 + pages/api/endpoint/getwatchedcases_api.js | 2 +- pages/myportal/index.js | 46 +++++++++++++++++-- store/myRepresentations/action.js | 17 +++++++ store/myRepresentations/reducer.js | 21 +++++++++ 15 files changed, 174 insertions(+), 19 deletions(-) diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 9244c7ad..c07f1e31 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -38,6 +38,7 @@ import { uploadRepFiles, sendEmail, generateRepPDF, + createWatchedCases, } from "../../../actions"; import { formatDates } from "../../../components/utils"; import RepresentationProgress_s78 from "./representationProgress/representationProgress_s78"; @@ -527,6 +528,7 @@ let MakeRepresentation = (props) => { case 846040003: case 846040009: case 846040008: + case 846040017: return ( { @@ -51,6 +55,22 @@ const RepComplete = (props) => { props.repFormData.repfile_name ), sendEmail(templateId, emailAddress, personalisation, reference), + createWatchedCases({ + "pinswg_WatchedCase@odata.bind": + "/incidents(" + + props.props.currentView.caseReference.incidentid + + ")", + "pinswg_Contact@odata.bind": + "/contacts(" + + props.props.props.props.accountDetails.loggedinUserId + + ")", + "pinswg_appealcasetype": + props.props.currentView.caseReference.appealType, + "pinswg_representationsubmitted": new Date(Date.now()), + "pinswg_representationtype": + props.props.currentView.caseReference.repDetails + .representationType, + }), setRepresentationMessageSent(true)); }); return ( diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index e90ed7ed..6effa61d 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -107,6 +107,7 @@ const RepCompleteSubmit = (props) => { case 846040003: case 846040009: case 846040008: + case 846040017: return ( { case 846040003: case 846040009: case 846040008: + case 846040017: return ( { }} className="govuk-link" > - {t("common:back-link")}ss + {t("common:back-link")} )} diff --git a/components/myportal.js b/components/myportal.js index 26e60c0c..4f18dca8 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -147,6 +147,7 @@ const MyPortal = (props) => { currentView={props.currentView} watchedCases={props.watchedCases} isLPA={isLPA} + myReps={false} /> )} {props.myRepresentations.myRepresentations[ @@ -157,8 +158,19 @@ const MyPortal = (props) => { isLPA={isLPA} /> )} - {!isLPA && } + {props.myRepresentations.mySubmittedReps + .mySubmittedReps.length > 0 && ( + + )} + {!isLPA && } {/* */} diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index a002a68c..a1b99716 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -44,7 +44,9 @@ const TopThree = (props) => { let topthreeRow = []; - let showTopThreeArr = showTopThree.value; + let showTopThreeArr; + + showTopThreeArr = props.myReps ? showTopThree : showTopThree.value; Object.keys(showTopThreeArr).map((key, index) => { let createdDate = parseInt(showTopThreeArr[key].createdon); @@ -236,8 +238,6 @@ const TopThree = (props) => { )} - {/* {(topThreeType == "awaitingSubmission" || - topThreeType == "watchedCases") && ( */}
{t("myportal:appeal-type-label")}:{" "} {router.locale == "cy" @@ -336,8 +336,31 @@ const TopThree = (props) => { {" "} {raisedDate(showTopThreeArr[key].createdon)}
{" "} + {topThreeType == "watchedCases" && + props.myReps && + showTopThreeArr[key].pinswg_representationsubmitted != + null && ( +
+ {t("myportal:representation-submitted")}: + {" "} + {raisedDate( + showTopThreeArr[key] + .pinswg_representationsubmitted + )} +
+ )} + {topThreeType == "watchedCases" && + props.myReps && + showTopThreeArr[key].pinswg_representationtype != + null && ( +
+ {t("myportal:representation-type")}: + {" "} + {showTopThreeArr[key].pinswg_representationtype} +
+ )} - {topThreeType == "watchedCases" && ( + {topThreeType == "watchedCases" && !props.myReps && (