From d829213a6a024bb7a889215f93bf88a725b5e810 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 20 May 2024 12:42:53 +0100 Subject: [PATCH] updated naming convention meta and pdf fixes --- actions/azurestorage.js | 26 ++- components/case/representation/index.js | 33 ++- .../representation/representationAgent.js | 197 ++++++++++-------- .../case/representation/representationLPA.js | 63 ++++-- ...resentationLPAQuestionnaire_enforcement.js | 8 + .../representationLPAQuestionnaire_s78.js | 11 +- components/pdftemplates/finalComments_pdf.js | 2 +- .../pdftemplates/lpaQuestionnaire_pdf.js | 37 ++-- components/pdftemplates/other_pdf.js | 2 + components/pdftemplates/statement_pdf.js | 4 +- .../pdftemplates/writtenStatement_pdf.js | 2 +- locales/cy/myrepresentations.json | 1 + locales/en/myrepresentations.json | 1 + pages/api/endpoint/getcase_api.js | 4 +- pages/api/file/generatepdf.js | 4 +- pages/myportal/index.js | 2 +- 16 files changed, 254 insertions(+), 143 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 0ed55f4f..32e000c2 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -376,10 +376,22 @@ export const createRepPDFBlob = async ( const uploadBlobResponse = await blockBlobClient.uploadStream(content); + let whichLocation = + repName.indexOf("_IP_") > 0 + ? "Interested Party Representations" + : repName.indexOf("_Statement_") > 0 + ? "Main Party Statements" + : repName.indexOf("_Questionnaire_") > 0 + ? "Main Party Questionnaire" + : repName.indexOf("_Comments") > 0 + ? "Main Party Comments" + : "default"; + const tags = { containerid: containerName, caseID: caseID, - blobType: "Appeal PDF", + blobType: "Representation PDF", + ishareLocation: whichLocation, }; //console.log("the tags:", tags); @@ -466,11 +478,23 @@ export const uploadFile = async (formContent, containerName, foldername) => { "\n////////////////////////////" ); + let whichLocation = + files[prop][0].fieldName.indexOf("_IP_") > 0 + ? "Interested Party Representations" + : files[prop][0].fieldName.indexOf("_Statement_") > 0 + ? "Main Party Statements" + : files[prop][0].fieldName.indexOf("_Questionnaire_") > 0 + ? "Main Party Questionnaire" + : files[prop][0].fieldName.indexOf("_Comments_") > 0 + ? "Main Party Comments" + : "default"; + const tags = { containerid: containerName, caseID: foldername.split("/")[0], documentType: files[prop][0].fieldName.split(".")[1], blobType: "RepresentationFile", + ishareLocation: whichLocation, }; const withTags = await blockBlobClient.setTags(tags); const withMeta = await blockBlobClient.setMetadata(tags); diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 331631d7..abc1e7b2 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -423,9 +423,12 @@ let MakeRepresentation = (props) => { setRepresentationCapacity } setRepresentationSubmit={setRepresentationSubmit} + onHandleSubmit={onHandleSubmit} currentView={currentView} setSubmitBack={setSubmitBack} props={props} + caseReference={caseReference} + setRepFileName={setRepFileName} /> ); } @@ -495,9 +498,15 @@ let MakeRepresentation = (props) => { Object.assign(values, { "containerID": props.props.accountDetails.containerID, - "appealType": props.props.currentView.caseReference.appealType, - "incidentID": props.props.currentView.caseReference.incidentid, + "appealType": + props.props.currentView.caseReference.appealType || + props.props.currentView.caseReference.repDetails.appealType, + "incidentID": + props.props.currentView.caseReference.incidentid || + props.props.currentView.caseReference.repDetails.incidentid, "caseRef": props.props.currentView.caseReference.currentReference, + "casereference": + props.props.currentView.caseReference.currentReference, "pinswg_questionnaireduedate": detailsObj.pinswg_questionnaireduedate, "pinswg_statementduedate": detailsObj.pinswg_statementduedate, @@ -550,8 +559,14 @@ let MakeRepresentation = (props) => { "pinswg_name": props.props.currentView.caseReference.currentReference, "containerID": props.props.accountDetails.containerID, - "appealType": props.props.currentView.caseReference.appealType, - "incidentID": props.props.currentView.caseReference.incidentid, + "appealType": + props.props.currentView.caseReference.appealType || + props.props.currentView.caseReference.repDetails.appealType, + "casereference": + props.props.currentView.caseReference.currentReference, + "incidentID": + props.props.currentView.caseReference.incidentid || + props.props.currentView.caseReference.repDetails.incidentid, "caseRef": props.props.currentView.caseReference.currentReference, }); @@ -658,10 +673,16 @@ let MakeRepresentation = (props) => { (Object.assign(values, formObj.representationForm.values), Object.assign(values, { "containerID": props.props.accountDetails.containerID, - "appealType": props.props.currentView.caseReference.appealType, - "incidentID": props.props.currentView.caseReference.incidentid, + "appealType": + props.props.currentView.caseReference.appealType || + props.props.currentView.caseReference.repDetails.appealType, + "incidentID": + props.props.currentView.caseReference.incidentid || + props.props.currentView.caseReference.repDetails.incidentid, "caseRef": props.props.currentView.caseReference.currentReference, + "casereference": + props.props.currentView.caseReference.currentReference, "pinswg_questionnaireduedate": detailsObj.pinswg_questionnaireduedate, "pinswg_statementduedate": detailsObj.pinswg_statementduedate, diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js index 2a368d25..6a5f851e 100644 --- a/components/case/representation/representationAgent.js +++ b/components/case/representation/representationAgent.js @@ -81,103 +81,120 @@ const RepAgent = (props) => { )} - -
-
- -
-
- -
-
-

- {t("myrepresentations:enter-comment-label")} -

-
-
- {t("myrepresentations:comments-set-out-label")}: -
+ {(typeof props.representationType != "undefined" || + typeof formObj.representationForm.values.representationType != + "undefined") && ( + <> +
-
-
- {props.currentView.caseReference.hasOwnProperty( - "repDetails" - ) && - props.currentView.caseReference.repDetails.filesList - .length > 0 ? ( -
- {props.currentView.caseReference.repDetails.filesList.map( - (blob, i) => ( -
- {blob.name} +
- - {blob.name} ( - {bytesToSize(blob.size)}) - -
- ) +
+
+

+ {t("myrepresentations:enter-comment-label")} +

+
+
+ {t( + "myrepresentations:comments-set-out-label" + )} + : +
+
+ +

+ {t( + "myrepresentations:publish-policy-label" + )} + + https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html + +

+
+
+ +
+ {props.currentView.caseReference.hasOwnProperty( + "repDetails" + ) && + props.currentView.caseReference.repDetails + .filesList.length > 0 ? ( +
+ {props.currentView.caseReference.repDetails.filesList.map( + (blob, i) => ( +
+ {blob.name} + + + {blob.name} ( + {bytesToSize(blob.size)} + ) + +
+ ) + )} +
+ ) : ( + "" )} -
- ) : ( - "" - )} -
-
{" "} -
+ + {" "} + + + )}