From 33df7e25d7281a24cb1302a1303f832d474776d9 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 29 Nov 2023 10:21:29 +0000 Subject: [PATCH] added in capacity details to pdf --- components/breadcrumbs.js | 1507 ++++++++--------- components/case/representation/index.js | 7 + .../representationCapacitySelection.js | 7 +- .../representation/representationElements.js | 325 ++-- components/myportal/topthree_reps.js | 23 +- components/pdftemplates/finalComments_pdf.js | 43 +- components/pdftemplates/statement_pdf.js | 34 + pages/api/file/generatepdf.js | 2 +- 8 files changed, 1065 insertions(+), 883 deletions(-) diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 0d6af9d8..b09a0db4 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -49,795 +49,767 @@ const Breadcrumbs = (props) => { const { data: session, status } = useSession(); - return <> - + + ); }; export default Breadcrumbs; diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 15eff4aa..eaf568da 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -204,6 +204,7 @@ let MakeRepresentation = (props) => { caseReference={caseReference} />; break; + case "appellant": case t( "myrepresentations:capacity-options-arr-appellant" ).toLocaleLowerCase(): @@ -248,6 +249,7 @@ let MakeRepresentation = (props) => { /> ); break; + case "agent": case t( "myrepresentations:capacity-options-arr-agent" ).toLowerCase(): @@ -519,6 +521,11 @@ let MakeRepresentation = (props) => { "incidentID": props.props.currentView.caseReference.incidentid, "caseRef": props.props.currentView.caseReference.currentReference, + "pinswg_questionnaireduedate": + detailsObj.pinswg_questionnaireduedate, + "pinswg_statementduedate": detailsObj.pinswg_statementduedate, + "pinswg_finalcommentsduedate": + detailsObj.pinswg_finalcommentsduedate, "pinswg_name": props.props.currentView.caseReference.currentReference, "firstname": diff --git a/components/case/representation/representationCapacitySelection.js b/components/case/representation/representationCapacitySelection.js index bf8dbbff..64a57017 100644 --- a/components/case/representation/representationCapacitySelection.js +++ b/components/case/representation/representationCapacitySelection.js @@ -13,6 +13,7 @@ import { RenderPickList, RenderTextfield, RenderRadioList, + RenderRadioListWithText, RenderMultiline, } from "./representationElements"; import { useDropzone } from "react-dropzone"; @@ -52,8 +53,8 @@ let RepCapacitySelection = (props) => { myRepresentations={props.props.myRepresentations} props={props} />{" "} -
-
+
+

{t( @@ -71,7 +72,7 @@ let RepCapacitySelection = (props) => { id="representationCapacity" className="govuk-radios__input" errorMsg={t("newappeal:select-an-option-label")} - component={RenderRadioList} + component={RenderRadioListWithText} validate={[required]} />

diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 55e08345..ae40409b 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -110,6 +110,127 @@ export const RenderRadioList = ({ ); }; +export const RenderRadioListWithText = ({ + datafieldname, + name, + label, + id, + errorMsg, + options, + input: { onChange, value }, + meta: { touched, error }, + ...custom +}) => { + const required = (value) => (value ? undefined : "Required"); + + return ( + <> +
+
+ + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} +
+ {Object.keys(options).map((key, index) => ( +
+ + + + {value === options[key] && ( +
+
+ + +
+
+ )} +
+ ))} +
+
+
+ + ); +}; + export const RenderCondtionalRadioList = ({ datafieldname, legend, @@ -871,116 +992,118 @@ export const RenderFileUpload = (field) => { }); }; - return <> - { - const renamedAcceptedFiles = filesToUpload.map( - (file) => - new File([file], `${file.name}`, { - type: file.type, - }) - ); - field.input.onChange(renamedAcceptedFiles); - }} - > - {({ getRootProps, getInputProps }) => ( - <> - {/* {field.hint != false && ( + return ( + <> + { + const renamedAcceptedFiles = filesToUpload.map( + (file) => + new File([file], `${file.name}`, { + type: file.type, + }) + ); + field.input.onChange(renamedAcceptedFiles); + }} + > + {({ getRootProps, getInputProps }) => ( + <> + {/* {field.hint != false && (
ss{t(field.hint)}
)}
*/} -
-
- {" "} - -
- {t( - "newappeal:new-appeal-fileupload-drop-label" - )} +
+
+ {" "} + +
+ {t( + "newappeal:new-appeal-fileupload-drop-label" + )} +
+ + ( + {t( + "newappeal:new-appeal-fileupload-file-list-label" + )} + ) +
- - ( - {t( - "newappeal:new-appeal-fileupload-file-list-label" - )} - ) - -
- -
- + + + + )} +
+ {field.meta.touched && field.meta.error && ( + {field.meta.error} )} -
- {field.meta.touched && field.meta.error && ( - {field.meta.error} - )} - {files && Array.isArray(files) && ( -
    - {files.map((file, i) => ( -
    - {file.name} - - {file.name} ({bytesToSize(file.size)}) + {files && Array.isArray(files) && ( +
      + {files.map((file, i) => ( +
      + {file.name} + + {file.name} ({bytesToSize(file.size)}) + +
      + ))} +
    + )} + {blobList.map((blob, i) => ( +
    +
    + { + deleteThisBlob( + field.containerID, + blob.name, + blob.hasheddeletepath, + blob.hashgetblobs, + field.ticketnumber + ); + }} + title="Remove this file" + > + −
    - ))} -
- )} - {blobList.map((blob, i) => ( -
-
- { - deleteThisBlob( - field.containerID, - blob.name, - blob.hasheddeletepath, - blob.hashgetblobs, - field.ticketnumber - ); - }} - title="Remove this file" + {blob.name} + + - − - + {blob.name}({bytesToSize(blob.contentLength)}) +
- {blob.name} - - - - {blob.name}({bytesToSize(blob.contentLength)}) - -
- ))}{" "} - ; + ))}{" "} + + ); }; export function FileUploadField(props) { diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js index ab8d610c..70ed771f 100644 --- a/components/myportal/topthree_reps.js +++ b/components/myportal/topthree_reps.js @@ -20,6 +20,8 @@ import { setWatchedCasesDetails, } from "../../store/watchedCases/action"; import { getFormCollectionByID } from "../utils"; +import jsonpath from "jsonpath"; +import transLookup from "../../data/lookuptranslations.json"; const TopThree = (props) => { let { t } = useTranslation(); @@ -177,10 +179,9 @@ const TopThree = (props) => { showTopThreeArr[key].appealType, "repDetails": showTopThreeArr[key], }); - }}> - + }} + > {showTopThreeArr[key].pinswg_name} -
@@ -199,9 +200,21 @@ const TopThree = (props) => { {repRaisedDate(showTopThreeArr[key].repfile_name)}
{" "}
- lpa: + LPA: {" "} - {repRaisedDate(showTopThreeArr[key].repfile_name)} + + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + showTopThreeArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : showTopThreeArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || ""}
diff --git a/components/pdftemplates/finalComments_pdf.js b/components/pdftemplates/finalComments_pdf.js index e6ce641a..a0a5e3ae 100644 --- a/components/pdftemplates/finalComments_pdf.js +++ b/components/pdftemplates/finalComments_pdf.js @@ -101,7 +101,7 @@ export const finalComments_pdf = ({ docProps }) => { } let values = docProps; - let datestr = values.pinswg_name.split("-"); + let datestr = values.repfile_name.split("-"); let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; let appealTypeValue = getFormCollectionByID(values.appealType); @@ -158,17 +158,48 @@ export const finalComments_pdf = ({ docProps }) => { marginBottom: 10, }} > - 1. + 1a. - {t( - "myrepresentations:s78-section-question-1" - )} - : + Case reference : {values.caseRef} + + + + Representation capacity: + + + {values.representationCapacity} + + + + + + Representation capacity{"\n"} details: + + + + { + values.conditional_representationCapacity_Comments + } + + + { {values.caseRef} + + 1a. + + Representation capacity: + + + {values.representationCapacity} + + + + 1c. + + Representation capacity details: + + + + { + values.conditional_representationCapacity_Comments + } + + +