reps defect 43 - also handles not submitting reps when date passed

This commit is contained in:
2025-01-30 14:12:15 +00:00
parent 6fb4f5722a
commit 6dded01501
4 changed files with 192 additions and 34 deletions
+34 -15
View File
@@ -271,12 +271,24 @@ let MakeRepresentation = (props) => {
resultsObj = resultsObj[0]; resultsObj = resultsObj[0];
detailsObj = jsonpath( detailsObj = router.query.hasOwnProperty("state")
'$..[?(@.pinswg_name=="' + ? router.query.state == "edit"
currentView.caseReference.currentReference + ? jsonpath(
'")]', '$..[?(@.repfile_name =="' + router.query.created + '")]',
setCaseDetailsObj setCaseDetailsObj
); )
: jsonpath(
'$..[?(@.pinswg_name =="' +
currentView.caseReference.currentReference +
'")]',
setCaseDetailsObj
)
: jsonpath(
'$..[?(@.pinswg_name =="' +
currentView.caseReference.currentReference +
'")]',
setCaseDetailsObj
);
detailsObj = detailsObj[0]; detailsObj = detailsObj[0];
@@ -409,12 +421,11 @@ let MakeRepresentation = (props) => {
const whichControl = () => { const whichControl = () => {
if ( if (
isLPA && isLPA &&
_.isEmpty( _.isEmpty(currentView.representationCapacity)
currentView.representationCapacity || // ||
(currentView.caseReference.hasOwnProperty("repDetails") && // (isLPA &&
currentView.caseReference.repDetails // currentView.caseReference.hasOwnProperty("repDetails") &&
.representationCapacity) // !currentView.caseReference.repDetails.representationCapacity)
)
) { ) {
return ( return (
//setRepresentationCapacity("LPA"), //setRepresentationCapacity("LPA"),
@@ -502,7 +513,7 @@ let MakeRepresentation = (props) => {
// setRepresentationCapacity("LPA"); // setRepresentationCapacity("LPA");
// }, []); // }, []);
// console.log(currentView.caseReference.appealType); console.log(currentView.caseReference.appealType);
return ( return (
<RepLPA <RepLPA
formObj={formObj} formObj={formObj}
@@ -789,10 +800,14 @@ let MakeRepresentation = (props) => {
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
], ],
"_pinswg_localplanningauthority_value": "_pinswg_localplanningauthority_value":
detailsObj["_pinswg_localplanningauthority_value"], detailsObj["_pinswg_localplanningauthority_value"] ||
detailsObj["_pinswg_associatedlpa_value"],
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue": "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue":
detailsObj[ detailsObj[
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] ||
detailsObj[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
], ],
"representationCapacity": router.query.hasOwnProperty("state") "representationCapacity": router.query.hasOwnProperty("state")
? router.query.state == "edit" ? router.query.state == "edit"
@@ -970,10 +985,14 @@ let MakeRepresentation = (props) => {
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
], ],
"_pinswg_localplanningauthority_value": "_pinswg_localplanningauthority_value":
detailsObj["_pinswg_localplanningauthority_value"], detailsObj["_pinswg_localplanningauthority_value"] ||
detailsObj["_pinswg_associatedlpa_value"],
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue": "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue":
detailsObj[ detailsObj[
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] ||
detailsObj[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
], ],
"representationCapacity": router.query.hasOwnProperty("state") "representationCapacity": router.query.hasOwnProperty("state")
? router.query.state == "edit" ? router.query.state == "edit"
@@ -8,7 +8,16 @@ import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78"; import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
import Link from "next/link"; 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) => { const RepCompleteSubmit = (props) => {
let { t } = useTranslation(); let { t } = useTranslation();
@@ -30,6 +39,7 @@ const RepCompleteSubmit = (props) => {
showQuestionnaireSection, showQuestionnaireSection,
questionnaireCount, questionnaireCount,
finaliseAppealProcess, finaliseAppealProcess,
setCurrentReference,
} = props; } = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => ( const files = acceptedFiles.map((file) => (
@@ -203,6 +213,34 @@ const RepCompleteSubmit = (props) => {
}); });
let filterFiles = []; 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 ( return (
<> <>
{currentView.representationSubmitConfirmation == true ? ( {currentView.representationSubmitConfirmation == true ? (
@@ -291,7 +329,24 @@ const RepCompleteSubmit = (props) => {
className="govuk-link" className="govuk-link"
href="#" href="#"
onClick={() => { onClick={() => {
setSubmitBack(); // setSubmitBack();
setCurrentReference({
"ticketnumber":
repFormData.ticketnumber,
"currentReference":
repFormData.caseRef,
"currentType":
"myRepresentations",
"incidentid":
repFormData.incidentID,
"appealType":
repFormData.appealType,
"repDetails":
repFormData,
});
setRepresentationSubmit(
false
);
}} }}
> >
{t( {t(
@@ -326,7 +381,26 @@ const RepCompleteSubmit = (props) => {
className="govuk-link" className="govuk-link"
href="#" href="#"
onClick={() => { onClick={() => {
setSubmitBack(); // setSubmitBack();
setCurrentReference(
{
"ticketnumber":
repFormData.ticketnumber,
"currentReference":
repFormData.caseRef,
"currentType":
"myRepresentations",
"incidentid":
repFormData.incidentID,
"appealType":
repFormData.appealType,
"repDetails":
repFormData,
}
);
setRepresentationSubmit(
false
);
}} }}
> >
{t( {t(
@@ -365,7 +439,25 @@ const RepCompleteSubmit = (props) => {
className="govuk-link" className="govuk-link"
href="#" href="#"
onClick={() => { 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")} {t("common:change-link-label")}
@@ -427,7 +519,23 @@ const RepCompleteSubmit = (props) => {
setRepresentationSubmit( setRepresentationSubmit(
false 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")} {t("common:change-link-label")}
@@ -451,7 +559,6 @@ const RepCompleteSubmit = (props) => {
"myrepresentations:rep-check-tandc-para-one" "myrepresentations:rep-check-tandc-para-one"
)} )}
</p> </p>
<p> <p>
{t( {t(
"myrepresentations:rep-check-tandc-para-two" "myrepresentations:rep-check-tandc-para-two"
@@ -466,25 +573,47 @@ const RepCompleteSubmit = (props) => {
</Link> </Link>
. .
</p> </p>
<p> <p>
{t( {t(
"myrepresentations:rep-check-tandc-para-three" "myrepresentations:rep-check-tandc-para-three"
)} )}
</p> </p>
{checkRepDatePassed() ? (
{finaliseAppealProcess ? ( <div className="govuk-warning-text noticebanner">
<strong className="govuk-warning-text__text">
<span className="govuk-visually-hidden">
Warning
</span>
</strong>
<div>
<div className=" govuk-body-s">
<h2 className="govuk-heading-s">
{t(
"myrepresentations:rep-period-passed-heading"
)}
</h2>
<p className="govuk-body-s">
{t(
"myrepresentations:rep-period-notice-label"
)}
</p>
</div>
</div>
</div>
) : finaliseAppealProcess ? (
<div className=""> <div className="">
<h3 className="govuk-heading-m govuk-!-margin-top-9"> <h3 className="govuk-heading-m govuk-!-margin-top-9">
Finalising your representation {t(
submission "myrepresentations:rep-finalising-heading"
)}
</h3> </h3>
<p className="govuk-body"> <p className="govuk-body">
Currenly uploading files and finalising {t(
your representation submission "myrepresentations:rep-finalising-label"
)}
</p> </p>
<p className="govuk-body textloading"> <p className="govuk-body textloading">
Please wait {t("myrepresentations:rep-wait-label")}
</p> </p>
</div> </div>
) : ( ) : (
@@ -573,7 +702,11 @@ const mapStateToProps = (state) => {
}; };
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return {}; return {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(currentReference));
},
};
}; };
export default connect(mapStateToProps, mapDispatchToProps)(RepCompleteSubmit); export default connect(mapStateToProps, mapDispatchToProps)(RepCompleteSubmit);
@@ -21,6 +21,8 @@ import {
setRepresentationCapacity, setRepresentationCapacity,
setRepresentationSubmit, setRepresentationSubmit,
setFilesForRepresentations, setFilesForRepresentations,
setCurrentPage,
setCurrentReference,
} from "../../../store/currentView/action"; } from "../../../store/currentView/action";
let RepLPA = (props) => { let RepLPA = (props) => {
@@ -611,6 +613,9 @@ const mapDispatchToProps = (dispatch) => ({
setFilesForRepresentations: (fileList) => { setFilesForRepresentations: (fileList) => {
dispatch(setFilesForRepresentations(fileList)); dispatch(setFilesForRepresentations(fileList));
}, },
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(currentReference));
},
}); });
const mapStateToProps = (state, props) => { const mapStateToProps = (state, props) => {
+5 -4
View File
@@ -248,13 +248,14 @@ let BuildCheckSection = (props) => {
{finaliseAppealProcess ? ( {finaliseAppealProcess ? (
<div className=""> <div className="">
<h3 className="govuk-heading-m govuk-!-margin-top-9"> <h3 className="govuk-heading-m govuk-!-margin-top-9">
Finalising your appeal submission {t("newappeal:new-appeal-finalising-heading")}
</h3> </h3>
<p className="govuk-body"> <p className="govuk-body">
Currenly uploading files and finalising your appeal {t("newappeal:new-appeal-finalising-label")}
submission </p>
<p className="govuk-body textloading">
{t("newappeal:new-appeal-wait-label")}
</p> </p>
<p className="govuk-body textloading">Please wait</p>
</div> </div>
) : ( ) : (
<> <>