From 6dded01501abd2abc5c45a6c9ff44b5c904107ec Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 30 Jan 2025 14:12:15 +0000 Subject: [PATCH] reps defect 43 - also handles not submitting reps when date passed --- components/case/representation/index.js | 49 ++++-- .../representationCompleteSubmit.js | 163 ++++++++++++++++-- .../case/representation/representationLPA.js | 5 + components/newappeal/buildchecksection.js | 9 +- 4 files changed, 192 insertions(+), 34 deletions(-) diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 9ec3af74..b060c141 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -271,12 +271,24 @@ let MakeRepresentation = (props) => { resultsObj = resultsObj[0]; - detailsObj = jsonpath( - '$..[?(@.pinswg_name=="' + - currentView.caseReference.currentReference + - '")]', - setCaseDetailsObj - ); + detailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? jsonpath( + '$..[?(@.repfile_name =="' + router.query.created + '")]', + setCaseDetailsObj + ) + : jsonpath( + '$..[?(@.pinswg_name =="' + + currentView.caseReference.currentReference + + '")]', + setCaseDetailsObj + ) + : jsonpath( + '$..[?(@.pinswg_name =="' + + currentView.caseReference.currentReference + + '")]', + setCaseDetailsObj + ); detailsObj = detailsObj[0]; @@ -409,12 +421,11 @@ let MakeRepresentation = (props) => { const whichControl = () => { if ( isLPA && - _.isEmpty( - currentView.representationCapacity || - (currentView.caseReference.hasOwnProperty("repDetails") && - currentView.caseReference.repDetails - .representationCapacity) - ) + _.isEmpty(currentView.representationCapacity) + // || + // (isLPA && + // currentView.caseReference.hasOwnProperty("repDetails") && + // !currentView.caseReference.repDetails.representationCapacity) ) { return ( //setRepresentationCapacity("LPA"), @@ -502,7 +513,7 @@ let MakeRepresentation = (props) => { // setRepresentationCapacity("LPA"); // }, []); - // console.log(currentView.caseReference.appealType); + console.log(currentView.caseReference.appealType); return ( { "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ], "_pinswg_localplanningauthority_value": - detailsObj["_pinswg_localplanningauthority_value"], + detailsObj["_pinswg_localplanningauthority_value"] || + detailsObj["_pinswg_associatedlpa_value"], "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue": detailsObj[ "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || + detailsObj[ + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ], "representationCapacity": router.query.hasOwnProperty("state") ? router.query.state == "edit" @@ -970,10 +985,14 @@ let MakeRepresentation = (props) => { "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ], "_pinswg_localplanningauthority_value": - detailsObj["_pinswg_localplanningauthority_value"], + detailsObj["_pinswg_localplanningauthority_value"] || + detailsObj["_pinswg_associatedlpa_value"], "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue": detailsObj[ "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || + detailsObj[ + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ], "representationCapacity": router.query.hasOwnProperty("state") ? router.query.state == "edit" diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index 6e53f348..2306107e 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -8,7 +8,16 @@ import RepComplete from "./representationComplete"; import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78"; import Link from "next/link"; -import { bytesToSize, getThumbnailIconByExtension } from "../../utils"; +import { + bytesToSize, + getThumbnailIconByExtension, + formatDates, +} from "../../utils"; + +import { + setCurrentReference, + setCurrentView, +} from "../../../store/currentView/action"; const RepCompleteSubmit = (props) => { let { t } = useTranslation(); @@ -30,6 +39,7 @@ const RepCompleteSubmit = (props) => { showQuestionnaireSection, questionnaireCount, finaliseAppealProcess, + setCurrentReference, } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => ( @@ -203,6 +213,34 @@ const RepCompleteSubmit = (props) => { }); let filterFiles = []; + + function showRepsEnded(endDate) { + let date = new Date(); + date = new Date(date.toDateString()); + const end = new Date(endDate); + return end > date ? false : true; + } + + const checkRepDatePassed = () => { + if (repFormData.representationType == "Questionnaire") { + return false; + } else { + if (repFormData.representationType == "Final comments") { + return repFormData.hasOwnProperty( + "pinswg_finalcommentsduedate" + ) && showRepsEnded(repFormData.pinswg_finalcommentsduedate) + ? true + : false; + } + if (repFormData.representationType == "Statement") { + return repFormData.hasOwnProperty("pinswg_statementduedate") && + showRepsEnded(repFormData.pinswg_statementduedate) + ? true + : false; + } + } + }; + return ( <> {currentView.representationSubmitConfirmation == true ? ( @@ -291,7 +329,24 @@ const RepCompleteSubmit = (props) => { className="govuk-link" href="#" onClick={() => { - setSubmitBack(); + // setSubmitBack(); + setCurrentReference({ + "ticketnumber": + repFormData.ticketnumber, + "currentReference": + repFormData.caseRef, + "currentType": + "myRepresentations", + "incidentid": + repFormData.incidentID, + "appealType": + repFormData.appealType, + "repDetails": + repFormData, + }); + setRepresentationSubmit( + false + ); }} > {t( @@ -326,7 +381,26 @@ const RepCompleteSubmit = (props) => { className="govuk-link" href="#" onClick={() => { - setSubmitBack(); + // setSubmitBack(); + setCurrentReference( + { + "ticketnumber": + repFormData.ticketnumber, + "currentReference": + repFormData.caseRef, + "currentType": + "myRepresentations", + "incidentid": + repFormData.incidentID, + "appealType": + repFormData.appealType, + "repDetails": + repFormData, + } + ); + setRepresentationSubmit( + false + ); }} > {t( @@ -365,7 +439,25 @@ const RepCompleteSubmit = (props) => { className="govuk-link" href="#" onClick={() => { - setSubmitBack(); + // setSubmitBack(); + + setCurrentReference({ + "ticketnumber": + repFormData.ticketnumber, + "currentReference": + repFormData.caseRef, + "currentType": + "myRepresentations", + "incidentid": + repFormData.incidentID, + "appealType": + repFormData.appealType, + "repDetails": + repFormData, + }); + setRepresentationSubmit( + false + ); }} > {t("common:change-link-label")} @@ -427,7 +519,23 @@ const RepCompleteSubmit = (props) => { setRepresentationSubmit( false )) - : setSubmitBack(); + : (setCurrentReference({ + "ticketnumber": + repFormData.ticketnumber, + "currentReference": + repFormData.caseRef, + "currentType": + "myRepresentations", + "incidentid": + repFormData.incidentID, + "appealType": + repFormData.appealType, + "repDetails": + repFormData, + }), + setRepresentationSubmit( + false + )); }} > {t("common:change-link-label")} @@ -451,7 +559,6 @@ const RepCompleteSubmit = (props) => { "myrepresentations:rep-check-tandc-para-one" )}

-

{t( "myrepresentations:rep-check-tandc-para-two" @@ -466,25 +573,47 @@ const RepCompleteSubmit = (props) => { .

-

{t( "myrepresentations:rep-check-tandc-para-three" )}

- - {finaliseAppealProcess ? ( + {checkRepDatePassed() ? ( +
+ + + Warning + + +
+
+

+ {t( + "myrepresentations:rep-period-passed-heading" + )} +

+

+ {t( + "myrepresentations:rep-period-notice-label" + )} +

+
+
+
+ ) : finaliseAppealProcess ? (

- Finalising your representation - submission + {t( + "myrepresentations:rep-finalising-heading" + )}

- Currenly uploading files and finalising - your representation submission + {t( + "myrepresentations:rep-finalising-label" + )}

- Please wait + {t("myrepresentations:rep-wait-label")}

) : ( @@ -573,7 +702,11 @@ const mapStateToProps = (state) => { }; const mapDispatchToProps = (dispatch) => { - return {}; + return { + setCurrentReference: (currentReference) => { + dispatch(setCurrentReference(currentReference)); + }, + }; }; export default connect(mapStateToProps, mapDispatchToProps)(RepCompleteSubmit); diff --git a/components/case/representation/representationLPA.js b/components/case/representation/representationLPA.js index 2ed5e0c9..5646ee95 100644 --- a/components/case/representation/representationLPA.js +++ b/components/case/representation/representationLPA.js @@ -21,6 +21,8 @@ import { setRepresentationCapacity, setRepresentationSubmit, setFilesForRepresentations, + setCurrentPage, + setCurrentReference, } from "../../../store/currentView/action"; let RepLPA = (props) => { @@ -611,6 +613,9 @@ const mapDispatchToProps = (dispatch) => ({ setFilesForRepresentations: (fileList) => { dispatch(setFilesForRepresentations(fileList)); }, + setCurrentReference: (currentReference) => { + dispatch(setCurrentReference(currentReference)); + }, }); const mapStateToProps = (state, props) => { diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js index 2d2e1dc0..d34f106f 100644 --- a/components/newappeal/buildchecksection.js +++ b/components/newappeal/buildchecksection.js @@ -248,13 +248,14 @@ let BuildCheckSection = (props) => { {finaliseAppealProcess ? (

- Finalising your appeal submission + {t("newappeal:new-appeal-finalising-heading")}

- Currenly uploading files and finalising your appeal - submission + {t("newappeal:new-appeal-finalising-label")} +

+

+ {t("newappeal:new-appeal-wait-label")}

-

Please wait

) : ( <>