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];
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 (
<RepLPA
formObj={formObj}
@@ -789,10 +800,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"
@@ -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"
@@ -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"
)}
</p>
<p>
{t(
"myrepresentations:rep-check-tandc-para-two"
@@ -466,25 +573,47 @@ const RepCompleteSubmit = (props) => {
</Link>
.
</p>
<p>
{t(
"myrepresentations:rep-check-tandc-para-three"
)}
</p>
{finaliseAppealProcess ? (
{checkRepDatePassed() ? (
<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="">
<h3 className="govuk-heading-m govuk-!-margin-top-9">
Finalising your representation
submission
{t(
"myrepresentations:rep-finalising-heading"
)}
</h3>
<p className="govuk-body">
Currenly uploading files and finalising
your representation submission
{t(
"myrepresentations:rep-finalising-label"
)}
</p>
<p className="govuk-body textloading">
Please wait
{t("myrepresentations:rep-wait-label")}
</p>
</div>
) : (
@@ -573,7 +702,11 @@ const mapStateToProps = (state) => {
};
const mapDispatchToProps = (dispatch) => {
return {};
return {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(currentReference));
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(RepCompleteSubmit);
@@ -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) => {
+5 -4
View File
@@ -248,13 +248,14 @@ let BuildCheckSection = (props) => {
{finaliseAppealProcess ? (
<div className="">
<h3 className="govuk-heading-m govuk-!-margin-top-9">
Finalising your appeal submission
{t("newappeal:new-appeal-finalising-heading")}
</h3>
<p className="govuk-body">
Currenly uploading files and finalising your appeal
submission
{t("newappeal:new-appeal-finalising-label")}
</p>
<p className="govuk-body textloading">
{t("newappeal:new-appeal-wait-label")}
</p>
<p className="govuk-body textloading">Please wait</p>
</div>
) : (
<>