From c627e100e1587cf74b375f02df035e067cd8b7a8 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Sat, 11 Jan 2025 08:13:18 +0000 Subject: [PATCH 01/16] uat defect 130, reps 14 --- components/pdftemplates/appealRow_pdf.js | 65 ++++++-- components/pdftemplates/enforcement_pdf.js | 145 ++++++++++++------ components/pdftemplates/finalComments_pdf.js | 20 ++- .../pdftemplates/lpaQuestionnaire_pdf.js | 123 +++++++++------ components/pdftemplates/other_pdf.js | 15 +- .../pdftemplates/planningappeals78_pdf.js | 2 + components/pdftemplates/statement_pdf.js | 22 ++- .../pdftemplates/writtenStatement_pdf.js | 16 +- 8 files changed, 288 insertions(+), 120 deletions(-) diff --git a/components/pdftemplates/appealRow_pdf.js b/components/pdftemplates/appealRow_pdf.js index 4609869a..662ec5de 100644 --- a/components/pdftemplates/appealRow_pdf.js +++ b/components/pdftemplates/appealRow_pdf.js @@ -8,7 +8,7 @@ import { } from "../../components/utils"; import fieldLookup from "../../data/crmfieldlookuptranslations.json"; -import { StyleSheet, Text, View } from "@react-pdf/renderer"; +import { StyleSheet, Text, View, Font } from "@react-pdf/renderer"; import Html from "react-pdf-html"; import { DOMParser, XMLSerializer } from "@xmldom/xmldom"; @@ -153,6 +153,16 @@ export const AppealRow_pdf = (props) => { let labelTrans = label; return labelTrans; }; + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } return ( <> @@ -187,6 +197,7 @@ export const AppealRow_pdf = (props) => { flexDirection: "row", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { } > - {props.props[ - datafieldname[0].value - ] || ""} + {CleanHTML( + props.props[ + datafieldname[0] + .value + ] + )} @@ -385,6 +401,7 @@ export const AppealRow_pdf = (props) => { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { case "{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": return ( - - {rows[0].value} - - - {props.props[ - datafieldname[0].value - ] == "true" - ? "Yes" - : "No"} - + + + {rows[0].value} + + + {props.props[ + datafieldname[0].value + ] == "true" + ? "Yes" + : "No"} + + ); break; diff --git a/components/pdftemplates/enforcement_pdf.js b/components/pdftemplates/enforcement_pdf.js index ef34ef8f..ac5722a7 100644 --- a/components/pdftemplates/enforcement_pdf.js +++ b/components/pdftemplates/enforcement_pdf.js @@ -5,6 +5,7 @@ import { StyleSheet, Text, View, + Font, } from "@react-pdf/renderer"; import Html from "react-pdf-html"; import { getFormCollectionByID, bytesToSize } from "../../components/utils"; @@ -98,6 +99,17 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { //console.log("//////////////////////\n docpropseeeee:".docProps); //console.log("sdffhjdhjdjdgkj: ", values.procedureType); + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } + return ( @@ -243,7 +255,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { "Written representations" && ( - {values.procedureTypeEvidence || ""} + {CleanHTML( + values.procedureTypeEvidence + )} )} @@ -294,8 +308,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.enterNeighbouringLandToViewSiteEvidence || - ""} + {CleanHTML( + values.enterNeighbouringLandToViewSiteEvidence + )} )} @@ -333,8 +348,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.enterNeighbouringLandAccessRequiredEvidence || - ""} + {CleanHTML( + values.enterNeighbouringLandAccessRequiredEvidence + )} )} @@ -366,8 +382,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.healthAndSafetyIssues == "Yes" && ( - {values.healthAndSafetyIssuesEvidence || - ""} + {CleanHTML( + values.healthAndSafetyIssuesEvidence + )} )} @@ -395,7 +412,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.LPAcontactDetails || ""} + {CleanHTML(values.LPAcontactDetails)} @@ -468,7 +485,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.feeExempt == "Yes" && ( - {values.feeExemptEvidence || ""} + {CleanHTML( + values.feeExemptEvidence + )} )} @@ -509,8 +528,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.previousGrantedCerts == "Yes" && ( - {values.previousGrantedCertsEvidence || - ""} + {CleanHTML( + values.previousGrantedCertsEvidence + )} )} @@ -533,7 +553,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.stopNoticeServed == "Yes" && ( - {values.stopNoticeServedEvidence || ""} + {CleanHTML( + values.stopNoticeServedEvidence + )} )} @@ -558,7 +580,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.relatedCases == "Yes" && ( - {values.relatedCasesEvidence || ""} + {CleanHTML(values.relatedCasesEvidence)} )} @@ -581,8 +603,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.previousEnforcement == "Yes" && ( - {values.previousEnforcementEvidence || - ""} + {CleanHTML( + values.previousEnforcementEvidence + )} )} @@ -605,7 +628,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.subjectArticle4 == "Yes" && ( - {values.subjectArticle4Evidence || ""} + {CleanHTML( + values.subjectArticle4Evidence + )} )} @@ -629,8 +654,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.previousPDRRestriction == "Yes" && ( - {values.previousPDRRestrictionEvidence || - ""} + {CleanHTML( + values.previousPDRRestrictionEvidence + )} )} @@ -663,7 +689,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.LPAldpAndMap || ""} + {CleanHTML(values.LPAldpAndMap)} @@ -681,7 +707,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.LPAlocalGuidance || ""} + {CleanHTML(values.LPAlocalGuidance)} @@ -757,7 +783,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.ROW == "Yes" && ( - {values.ROWEvidence || ""} + {CleanHTML(values.ROWEvidence)} )} @@ -788,8 +814,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.conservationArea == "Yes" && ( - {values.conservationAreaEvidence || - ""} + {CleanHTML( + values.conservationAreaEvidence + )} )} @@ -822,8 +849,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.affectListedBuilding == "Yes" && ( - {values.affectListedBuildingEvidence || - ""} + {CleanHTML( + values.affectListedBuildingEvidence + )} )} @@ -854,7 +882,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.TPO == "Yes" && ( - {values.TPOEvidence || ""} + {CleanHTML(values.TPOEvidence)} )} @@ -887,8 +915,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.natureConservationSite == "Yes" && ( - {values.natureConservationSiteEvidence || - ""} + {CleanHTML( + values.natureConservationSiteEvidence + )} )} @@ -919,8 +948,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.protectedSpecies == "Yes" && ( - {values.protectedSpeciesEvidence || - ""} + {CleanHTML( + values.protectedSpeciesEvidence + )} )} @@ -967,7 +997,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.floodingIssue == "Yes" && ( - {values.floodingIssueEvidence || ""} + {CleanHTML( + values.floodingIssueEvidence + )} )} @@ -1002,8 +1034,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.governmentDepartmentCommentsEvidence || - ""} + {CleanHTML( + values.governmentDepartmentCommentsEvidence + )} )} @@ -1073,8 +1106,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.developmentCarriedOutInAccordanceEvidence || - ""} + {CleanHTML( + values.developmentCarriedOutInAccordanceEvidence + )} )} @@ -1155,8 +1189,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.developmentAnyOtherConditionsEvidence || - ""} + {CleanHTML( + values.developmentAnyOtherConditionsEvidence + )} )} @@ -1200,8 +1235,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.copyOfEnforcementNoticeEvidence || - ""} + {CleanHTML( + values.copyOfEnforcementNoticeEvidence + )} @@ -1231,7 +1267,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.enforcementNoticePlan || ""} + {CleanHTML( + values.enforcementNoticePlan + )} @@ -1261,8 +1299,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.listOfNotifiedOfEnforcementEvidence || - ""} + {CleanHTML( + values.listOfNotifiedOfEnforcementEvidence + )} @@ -1294,8 +1333,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - {values.copyOfLetterOfAppealNotificationEvidence || - ""} + {CleanHTML( + values.copyOfLetterOfAppealNotificationEvidence + )} @@ -1327,7 +1367,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.lpaEIAOS == "Yes" && ( - {values.lpaEIAOSEvidence || ""} + {CleanHTML(values.lpaEIAOSEvidence)} )} @@ -1360,8 +1400,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.detailsOfOtherAppeals == "Yes" && ( - {values.detailsOfOtherAppealsEvidence || - ""} + {CleanHTML( + values.detailsOfOtherAppealsEvidence + )} )} @@ -1394,8 +1435,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.detailsOfPreviousAppeals == "Yes" && ( - {values.detailsOfPreviousAppealsEvidence || - ""} + {CleanHTML( + values.detailsOfPreviousAppealsEvidence + )} )} @@ -1427,8 +1469,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { {values.otherRelevantInformation == "Yes" && ( - {values.otherRelevantInformationEvidence || - ""} + {CleanHTML( + values.otherRelevantInformationEvidence + )} )} diff --git a/components/pdftemplates/finalComments_pdf.js b/components/pdftemplates/finalComments_pdf.js index 2cb13523..665c765e 100644 --- a/components/pdftemplates/finalComments_pdf.js +++ b/components/pdftemplates/finalComments_pdf.js @@ -120,6 +120,17 @@ export const finalComments_pdf = ({ docProps }) => { }) : []; + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } + return ( @@ -229,8 +240,9 @@ export const finalComments_pdf = ({ docProps }) => { - {values.conditional_representationCapacity_Comments || - ""} + {CleanHTML( + values.conditional_representationCapacity_Comments + )} @@ -321,7 +333,9 @@ export const finalComments_pdf = ({ docProps }) => { - {values.representationComments || ""} + {CleanHTML( + values.representationComments + )} diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js index 267a9a45..026846ba 100644 --- a/components/pdftemplates/lpaQuestionnaire_pdf.js +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -5,6 +5,7 @@ import { StyleSheet, Text, View, + Font, } from "@react-pdf/renderer"; import Html from "react-pdf-html"; import { getFormCollectionByID, bytesToSize } from "../../components/utils"; @@ -111,6 +112,18 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { let appealTypeValue = getFormCollectionByID(values.appealType); //console.log("sdffhjdhjdjdgkj: ", values.procedureType); + + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } + return ( @@ -239,7 +252,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { )} - {appealTypeValue.value || ""} + {appealTypeValue.value} @@ -282,14 +295,16 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { )} - {values.procedureType || ""} + {values.procedureType} {values.procedureType != "Written representations" && ( - {values.procedureTypeEvidence || ""} + {CleanHTML( + values.procedureTypeEvidence + )} )} @@ -309,7 +324,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { )} - {values.enterToView || ""} + {values.enterToView} @@ -344,8 +359,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.enterNeighbouringLandToViewSiteEvidence || - " "} + {CleanHTML( + values.enterNeighbouringLandToViewSiteEvidence + )} )} @@ -380,8 +396,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.enterNeighbouringLandAccessRequiredEvidence || - ""} + {CleanHTML( + values.enterNeighbouringLandAccessRequiredEvidence + )} )} @@ -408,14 +425,15 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { )} - {values.healthAndSafetyIssues || ""} + {values.healthAndSafetyIssues} {values.healthAndSafetyIssues == "Yes" && ( - {values.healthAndSafetyIssuesEvidence || - ""} + {CleanHTML( + values.healthAndSafetyIssuesEvidence + )} )} @@ -445,7 +463,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.LPAcontactDetails || ""} + {CleanHTML(values.LPAcontactDetails)} @@ -482,7 +500,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.LPAcaseFileAndReps || ""} + {CleanHTML(values.LPAcaseFileAndReps)} @@ -502,7 +520,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.LPAldpAndMap || ""} + {CleanHTML(values.LPAldpAndMap)} @@ -522,7 +540,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.LPAlocalGuidance || ""} + {CleanHTML(values.LPAlocalGuidance)} @@ -608,7 +626,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.ROW == "Yes" && ( - {values.ROWEvidence || ""} + {CleanHTML(values.ROWEvidence)} )} @@ -641,8 +659,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.conservationArea == "Yes" && ( - {values.conservationAreaEvidence || - ""} + {CleanHTML( + values.conservationAreaEvidence + )} )} @@ -675,8 +694,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.affectListedBuilding == "Yes" && ( - {values.affectListedBuildingEvidence || - ""} + {CleanHTML( + values.affectListedBuildingEvidence + )} )} @@ -709,7 +729,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.TPO == "Yes" && ( - {values.TPOEvidence || ""} + {CleanHTML(values.TPOEvidence)} )} @@ -742,8 +762,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.natureConservationSite == "Yes" && ( - {values.natureConservationSiteEvidence || - ""} + {CleanHTML( + values.natureConservationSiteEvidence + )} )} @@ -776,8 +797,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.protectedSpecies == "Yes" && ( - {values.protectedSpeciesEvidence || - ""} + {CleanHTML( + values.protectedSpeciesEvidence + )} )} @@ -829,8 +851,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.governmentDepartmentCommentsEvidence || - ""} + {CleanHTML( + values.governmentDepartmentCommentsEvidence + )} )} @@ -918,8 +941,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.developmentCarriedOutInAccordanceEvidence || - ""} + {CleanHTML( + values.developmentCarriedOutInAccordanceEvidence + )} )} @@ -989,8 +1013,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.developmentAnyOtherConditionsEvidence || - ""} + {CleanHTML( + values.developmentAnyOtherConditionsEvidence + )} )} @@ -1039,8 +1064,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.copyOfApplicantsCertificateEvidence || - ""} + {CleanHTML( + values.copyOfApplicantsCertificateEvidence + )} @@ -1072,7 +1098,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.advertismentGivenEvidence || ""} + {CleanHTML( + values.advertismentGivenEvidence + )} @@ -1105,8 +1133,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - {values.copyOfLetterOfAppealNotificationEvidence || - ""} + {CleanHTML( + values.copyOfLetterOfAppealNotificationEvidence + )} @@ -1138,7 +1167,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.lpaEIAOS == "Yes" && ( - {values.lpaEIAOSEvidence || ""} + {CleanHTML(values.lpaEIAOSEvidence)} )} @@ -1174,8 +1203,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { "Yes" && ( - {values.advertismentConsentDiscontinuanceNoticeEvidence || - ""} + {CleanHTML( + values.advertismentConsentDiscontinuanceNoticeEvidence + )} )} @@ -1208,8 +1238,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.detailsOfOtherAppeals == "Yes" && ( - {values.detailsOfOtherAppealsEvidence || - ""} + {CleanHTML( + values.detailsOfOtherAppealsEvidence + )} )} @@ -1242,8 +1273,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.detailsOfPreviousAppeals == "Yes" && ( - {values.detailsOfPreviousAppealsEvidence || - ""} + {CleanHTML( + values.detailsOfPreviousAppealsEvidence + )} )} @@ -1276,8 +1308,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { {values.otherRelevantInformation == "Yes" && ( - {values.otherRelevantInformationEvidence || - ""} + {CleanHTML( + values.otherRelevantInformationEvidence + )} )} diff --git a/components/pdftemplates/other_pdf.js b/components/pdftemplates/other_pdf.js index f8508bf8..c85a06cb 100644 --- a/components/pdftemplates/other_pdf.js +++ b/components/pdftemplates/other_pdf.js @@ -120,6 +120,17 @@ export const other_pdf = ({ docProps }) => { }) : []; + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } + return ( @@ -262,7 +273,9 @@ export const other_pdf = ({ docProps }) => { - {values.representationComments || ""} + {CleanHTML( + values.representationComments + )} diff --git a/components/pdftemplates/planningappeals78_pdf.js b/components/pdftemplates/planningappeals78_pdf.js index 0e599d70..f98ef065 100644 --- a/components/pdftemplates/planningappeals78_pdf.js +++ b/components/pdftemplates/planningappeals78_pdf.js @@ -143,6 +143,8 @@ export const planningappeals78_pdf = ({ docProps, pickListData }) => { //console.log("\n//////////\n The Case:\n", docProps.caseObj); + Font.registerHyphenationCallback((word) => [word]); + return ( diff --git a/components/pdftemplates/statement_pdf.js b/components/pdftemplates/statement_pdf.js index 2d8bd406..13cc8487 100644 --- a/components/pdftemplates/statement_pdf.js +++ b/components/pdftemplates/statement_pdf.js @@ -5,6 +5,7 @@ import { StyleSheet, Text, View, + Font, } from "@react-pdf/renderer"; import Html from "react-pdf-html"; import { getFormCollectionByID, bytesToSize } from "../../components/utils"; @@ -116,6 +117,17 @@ export const statement_pdf = ({ docProps }) => { }) : []; + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } + return ( @@ -224,8 +236,9 @@ export const statement_pdf = ({ docProps }) => { - {values.conditional_representationCapacity_Comments || - ""} + {CleanHTML( + values.conditional_representationCapacity_Comments + )} @@ -315,7 +328,10 @@ export const statement_pdf = ({ docProps }) => { - {values.representationComments || ""} + ( + {CleanHTML( + values.representationComments + )} diff --git a/components/pdftemplates/writtenStatement_pdf.js b/components/pdftemplates/writtenStatement_pdf.js index 235ec4d5..c9d5b8ab 100644 --- a/components/pdftemplates/writtenStatement_pdf.js +++ b/components/pdftemplates/writtenStatement_pdf.js @@ -5,6 +5,7 @@ import { StyleSheet, Text, View, + Font, } from "@react-pdf/renderer"; import Html from "react-pdf-html"; import { getFormCollectionByID, bytesToSize } from "../../components/utils"; @@ -104,6 +105,17 @@ export const writtenStatement_pdf = ({ docProps }) => { }) : []; + Font.registerHyphenationCallback((word) => [word]); + + function CleanHTML(htmlStr) { + let cleanStr = + typeof htmlStr === "string" + ? htmlStr.replace(/


<\/p>/g, "") + : ""; + + return cleanStr; + } + return ( @@ -239,7 +251,9 @@ export const writtenStatement_pdf = ({ docProps }) => { - {values.representationComments || ""} + {CleanHTML( + values.representationComments + )} From 8b175b114d5e7b0e94e96a214b7fa7401f8f9e03 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Sat, 11 Jan 2025 08:14:14 +0000 Subject: [PATCH 02/16] uat defect 124 --- actions/azurestorage.js | 1 + components/elements/index.js | 5 ++- components/newappeal/buildchecksection.js | 37 ++++++++++++----------- components/newappeal/buildsection.js | 2 ++ package.json | 4 +++ 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index d51cad93..472a806f 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -203,6 +203,7 @@ export const getBlobs = async (containerName, casefolderID) => { "caseObj": casefolderID + "/" + casefolderID + "_case.json", "isCurrentVersion": blob.isCurrentVersion, "contentLength": blob.properties.contentLength, + "size": blob.properties.contentLength, "contentType": blob.contentType, "lastModified": blob.properties.lastModified, "filepath": diff --git a/components/elements/index.js b/components/elements/index.js index ebcbbcb2..75e11112 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -2158,13 +2158,12 @@ const RenderFileUpload = (field) => { className="govuk-!-margin-bottom-5 fileThumb" > {" "} - {} - removeFile(file)} > − - + */} { let buildAppealFilesArray = []; //console.log("attached docs: - ", buildAppealFilesArray); - buildAppealFilesArray = props.props.form.appealForm.values.filesList || []; + buildAppealFilesArray = props.props.appealType.fileList?.value[0] || []; + //let filesUploadObj = buildAppealFilesArray; + // let filesUploadObj = props.appealType.fileList.hasOwnProperty("value") + // ? props.appealType.fileList.value[0] + // : []; - let filesUploadObj = props.appealType.fileList.hasOwnProperty("value") - ? props.appealType.fileList.value[0] - : []; - - for (let key in filesUploadObj) { - typeof filesUploadObj[key].name != "undefined" && - buildAppealFilesArray.push({ - "name": filesUploadObj[key].name, - "size": filesUploadObj[key].contentLength, - }); - } + // for (let key in filesUploadObj) { + // typeof filesUploadObj[key].name != "undefined" && + // buildAppealFilesArray.push({ + // "name": filesUploadObj[key].name, + // "size": filesUploadObj[key].contentLength, + // }); + // } buildAppealFilesArray.filter(function (item, idx) { return item.name; @@ -108,6 +108,7 @@ let BuildCheckSection = (props) => { let pdfObj = props.props.form.appealForm.values; Object.assign(pdfObj, { + "filesList": buildAppealFilesArray, "containerID": props.props.accountDetails.containerID, "casefolderID": props.appealType.caseReference.ticketnumber, }); @@ -151,12 +152,12 @@ let BuildCheckSection = (props) => { ) .then((data) => { console.log("have generated pdf:", data); - sendCaseCompleteMessage( - props.props.accountDetails.containerID, - props.appealType.caseReference.ticketnumber, - props.props.accountDetails.accountDetails - .pinswg_typeofinvolvement - ); + // sendCaseCompleteMessage( + // props.props.accountDetails.containerID, + // props.appealType.caseReference.ticketnumber, + // props.props.accountDetails.accountDetails + // .pinswg_typeofinvolvement + // ); }) .then(() => { //console.log("have sent complete message :"); diff --git a/components/newappeal/buildsection.js b/components/newappeal/buildsection.js index 9beaaf3b..98c000c2 100644 --- a/components/newappeal/buildsection.js +++ b/components/newappeal/buildsection.js @@ -104,6 +104,8 @@ let BuildSection = (props) => { return _.includes(key, "pinswg_fileUpload"); }); + fileListObj = []; + //console.log(fileListObj); // console.log( diff --git a/package.json b/package.json index 64288f94..d588389c 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,10 @@ "webpack": "^5.66.0", "xpath": "^0.0.32" }, + "resolutions": { + "@react-pdf/layout": "3.11.5", + "@react-pdf/pdfkit": "3.1.0" + }, "devDependencies": { "eslint": "^9.11.1", "eslint-config-next": "^15.0.3", From 61e74a5da8b749b1890a915b2c17df12a50f3a66 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Sat, 11 Jan 2025 08:22:33 +0000 Subject: [PATCH 03/16] uat defect 124 amend --- components/newappeal/buildchecksection.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js index df60a8bb..ce81dfdd 100644 --- a/components/newappeal/buildchecksection.js +++ b/components/newappeal/buildchecksection.js @@ -152,12 +152,12 @@ let BuildCheckSection = (props) => { ) .then((data) => { console.log("have generated pdf:", data); - // sendCaseCompleteMessage( - // props.props.accountDetails.containerID, - // props.appealType.caseReference.ticketnumber, - // props.props.accountDetails.accountDetails - // .pinswg_typeofinvolvement - // ); + sendCaseCompleteMessage( + props.props.accountDetails.containerID, + props.appealType.caseReference.ticketnumber, + props.props.accountDetails.accountDetails + .pinswg_typeofinvolvement + ); }) .then(() => { //console.log("have sent complete message :"); From 31026ffda695099f697f080e79b6371739951b43 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 14:24:51 +0000 Subject: [PATCH 04/16] questionniare defect 39 --- locales/cy/myrepresentations.json | 6 +++--- locales/en/myrepresentations.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/locales/cy/myrepresentations.json b/locales/cy/myrepresentations.json index cb871b1f..3e23b506 100644 --- a/locales/cy/myrepresentations.json +++ b/locales/cy/myrepresentations.json @@ -90,7 +90,7 @@ "s78-section-question-24d": "Ni chaiff unrhyw waith datblygu ddigwydd hyd nes y bydd cynllun i alluogi darparu seilwaith band eang all drosglwyddo data ar gyfradd gigadid o ffin y safle i’r anheddau/adeiladau a ganiateir drwy hyn wedi cael ei gyflwyno i’r awdurdod cynllunio lleol a’i gytuno ganddo’n ysgrifenedig. Bydd y datblygiad yn cael ei gynnal yn unol â'r manylion cymeradwy. Rheswm: Er mwyn cefnogi’r gwaith o gyflwyno seilwaith cyfathrebu digidol ledled Cymru yn unol â Pholisi 13 Cymru’r Dyfodol.", "s78-section-question-25": "A ydych yn ystyried bod amodau eraill, neu fersiynau diwygiedig o'r amodau safonol uchod, yn angenrheidiol?", "s78-section-question-25-hint": "Os Ydych, rhestrwch nhw yma neu mewn dogfen atodedig. Dylech gynnwys rhesymau a pholisïau perthnasol y cynllun datblygu. Os ydych yn bwriadu anfon amodau awgrymedig gyda’ch datganiad 4 wythnos, nodwch hyn yma.", - "s78-section-heading-five": "Cyn llenwi'r ffurflen hon, nodwch a ydych am atodi ffeil(iau) ar gyfer y canlynol, ac os na, darparwch ddolen gwe:", + "s78-section-heading-five": "Cyn cwblhau'r Holiadur, nodwch a ydych am atodi ffeil(iau) ar gyfer y canlynol, ac os na, rhowch ddolen gwe neu resymau. Gellir lanlwytho unrhyw ddogfennau gofynnol ar y dudalen nesaf.", "s78-section-question-26": "Copi o dystysgrif yr ymgeisydd sy'n cadarnhau ei fod wedi hysbysu pobl sydd â buddiant yn y tir?", "s78-section-question-26-hint": "Rhowch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", "s78-section-question-27": "Tystiolaeth o unrhyw gyhoeddusrwydd a roddwyd i'r cais, gan gynnwys hysbysiadau safle a hysbyseb leol?", @@ -206,8 +206,8 @@ "s78-heading-para-one": "Ar gyfer ceisiadau/apeliadau Cynllunio, Ardal Gadwraeth, Adeilad Rhestredig a Hysbysebu", "s78-heading-para-two": "Rhaid i'r ACLl anfon yr holiadur wedi'i gwblhau ac unrhyw atodiadau at PEDW.gwaithachos@llyw.cymru a'r apelydd (neu ei asiant) o fewn 5 niwrnod gwaith o'r dyddiad dechrau a nodwyd yn ein llythyr cychwyn. ", "section-heading-zero": "Manylion yr Achos", - "s78-footnote-one": "* Erthygl 11 Gorchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Rheoliad 7 Rheoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012", - "s78-footnote-two": "** Erthygl 12 Gorchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Adran 67/73 Deddf Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) 1990; Rheoliad 10 Rheoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012", + "s78-footnote-one": "Erthygl 11 Gorchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Rheoliad 7 Rheoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012", + "s78-footnote-two": "Erthygl 12 Gorchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Adran 67/73 Deddf Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) 1990; Rheoliad 10 Rheoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012", "statement-case-type-label": "Math o achos", "statement-representation-capacity-label": "Rhinwedd y sylw", "statement-representation-capacity-details-label": "Manylion rhinwedd y sylw", diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index d90a9a11..1a1286cc 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -90,7 +90,7 @@ "s78-section-question-24d": "d) No development shall take place until a scheme to enable the provision of gigabit capable broadband infrastructure from the site boundary to the dwellings/buildings hereby permitted has been submitted to and agreed in writing by the Local Planning Authority. Development shall be carried out in accordance with the approved details. Reason: To support the roll-out of digital communications infrastructure across Wales in accordance with Policy 13 of Future Wales.", "s78-section-question-25": "Do you consider other conditions, or amended versions of the above standard conditions, to be necessary?", "s78-section-question-25-hint": "If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here.", - "s78-section-heading-five": "Before completing this form, indicate if you are going to attach file(s) for the following, if not, provide a web link:", + "s78-section-heading-five": "Before finalising the Questionnaire, indicate if you are going to attach file(s) for the following, and if not, provide a web link or reasons. Any required documents can be uploaded on the next page.", "s78-section-question-26": "A copy of the applicant’s certificate confirming that they notified persons with an interest in the land?", "s78-section-question-26-hint": "Insert weblink here if available online. If No, give reasons", "s78-section-question-27": "Evidence of any publicity given to the application, including site notices and local advertisement?", From 42940ebaa6e2c351252d525f3f59cad4c496ec2b Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 14:26:11 +0000 Subject: [PATCH 05/16] questionnaire defect 49 --- components/pdftemplates/lpaQuestionnaire_pdf.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js index 026846ba..b0b76f73 100644 --- a/components/pdftemplates/lpaQuestionnaire_pdf.js +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -897,7 +897,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { marginBottom: 10, }} > - a) + {getTrans( docProps.locale, @@ -922,9 +922,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { marginBottom: 10, }} > - - b) - + {getTrans( docProps.locale, @@ -955,7 +953,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { marginBottom: 10, }} > - c) + {getTrans( docProps.locale, @@ -973,7 +971,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { marginBottom: 10, }} > - d) + {getTrans( docProps.locale, From 85f88eb074651b4ff04dd21f45137485048f09b3 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 14:27:28 +0000 Subject: [PATCH 06/16] pdf fixes --- components/pdftemplates/finalComments_pdf.js | 40 +++++++++++--------- components/pdftemplates/statement_pdf.js | 37 ++++++++++-------- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/components/pdftemplates/finalComments_pdf.js b/components/pdftemplates/finalComments_pdf.js index 665c765e..556a4d9f 100644 --- a/components/pdftemplates/finalComments_pdf.js +++ b/components/pdftemplates/finalComments_pdf.js @@ -197,8 +197,7 @@ export const finalComments_pdf = ({ docProps }) => { {getTrans( docProps.locale, "s78-section-question-1" - )}{" "} - : + )} {values.caseRef} @@ -216,8 +215,7 @@ export const finalComments_pdf = ({ docProps }) => { {getTrans( docProps.locale, "statement-representation-capacity-label" - )} - : + )}{" "} {values.representationCapacity} @@ -266,7 +264,6 @@ export const finalComments_pdf = ({ docProps }) => { docProps.locale, "s78-section-question-3" )} - : {values.siteAddress.replace(/false/gm, " ")} @@ -285,7 +282,6 @@ export const finalComments_pdf = ({ docProps }) => { docProps.locale, "statement-case-type-label" )} - : {appealTypeValue.value || ""} @@ -359,20 +355,30 @@ export const finalComments_pdf = ({ docProps }) => { - 7. - - {getTrans( - docProps.locale, - "statement-list-of-attached-files-label" - )} - + + + 7. + + + {getTrans( + docProps.locale, + "statement-list-of-attached-files-label" + )} + + @@ -410,7 +416,6 @@ export const finalComments_pdf = ({ docProps }) => { }} > - {" "} {getTrans( docProps.locale, "statement-declaration-header" @@ -464,7 +469,6 @@ export const finalComments_pdf = ({ docProps }) => { - {values.hasOwnProperty( "representationOnBehalfOf_details" ) ? ( @@ -493,7 +497,7 @@ export const finalComments_pdf = ({ docProps }) => { ) : ( - "" + )} diff --git a/components/pdftemplates/statement_pdf.js b/components/pdftemplates/statement_pdf.js index 13cc8487..6e8bcfbd 100644 --- a/components/pdftemplates/statement_pdf.js +++ b/components/pdftemplates/statement_pdf.js @@ -212,8 +212,7 @@ export const statement_pdf = ({ docProps }) => { {getTrans( docProps.locale, "statement-representation-capacity-label" - )} - :{" "} + )}{" "} {values.representationCapacity} @@ -264,7 +263,7 @@ export const statement_pdf = ({ docProps }) => { )} - {values.siteAddress} + {values.siteAddress.replace(/false/gm, " ")} { docProps.locale, "statement-case-type-label" )} - : {appealTypeValue.value || ""} @@ -328,7 +326,6 @@ export const statement_pdf = ({ docProps }) => { - ( {CleanHTML( values.representationComments )} @@ -355,20 +352,30 @@ export const statement_pdf = ({ docProps }) => { - 7. - - {getTrans( - docProps.locale, - "statement-list-of-attached-files-label" - )} - + + + 7. + + + {getTrans( + docProps.locale, + "statement-list-of-attached-files-label" + )} + + @@ -487,7 +494,7 @@ export const statement_pdf = ({ docProps }) => { ) : ( - "" + )} From 8509450ac0e2f57b33f6276b56d04b0938056a54 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 14:31:30 +0000 Subject: [PATCH 07/16] questionnaire defect 41 --- .../representationLPAQuestionnaire_s78.js | 81 ++++++++++--------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js index 10a44d39..ffdefdcf 100644 --- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js @@ -785,9 +785,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-26" - )} + legend={ + "26. " + + t("myrepresentations:s78-section-question-26") + } hint={t("myrepresentations:s78-footnote-one")} conditionalLabel={t( "myrepresentations:s78-section-question-26-hint" @@ -812,9 +813,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-27" - )} + legend={ + "27. " + + t("myrepresentations:s78-section-question-27") + } hint={t("myrepresentations:s78-footnote-two")} conditionalLabel={t( "myrepresentations:s78-section-question-27-hint" @@ -839,9 +841,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-28" - )} + legend={ + "28. " + + t("myrepresentations:s78-section-question-28") + } conditionalLabel={t( "myrepresentations:s78-section-question-28-hint" )} @@ -865,9 +868,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-29" - )} + legend={ + "29. " + + t("myrepresentations:s78-section-question-29") + } conditionalLabel={t( "myrepresentations:s78-section-question-29-hint" )} @@ -891,9 +895,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-30" - )} + legend={ + "30. " + + t("myrepresentations:s78-section-question-30") + } conditionalLabel={t( "myrepresentations:s78-section-question-30-hint" )} @@ -917,9 +922,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-31" - )} + legend={ + "31. " + + t("myrepresentations:s78-section-question-31") + } conditionalLabel={t( "myrepresentations:s78-section-question-31-hint" )} @@ -943,9 +949,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-32" - )} + legend={ + "32. " + + t("myrepresentations:s78-section-question-32") + } conditionalLabel={t( "myrepresentations:s78-section-question-32-hint" )} @@ -969,9 +976,10 @@ let S78_Questionnaire = (props) => { )} component={RenderLPACondtionalRadioList} validate={[required]} - legend={t( - "myrepresentations:s78-section-question-33" - )} + legend={ + "33. " + + t("myrepresentations:s78-section-question-33") + } conditionalLabel={t( "myrepresentations:s78-section-question-33-hint" )} @@ -996,18 +1004,19 @@ let S78_Questionnaire = (props) => { ticketnumber={props.props.props.caseReference} hint={"sdsd"} fileList={ - props.currentView.caseReference.hasOwnProperty( - "repDetails" - ) - ? props.currentView.caseReference.repDetails.hasOwnProperty( - "filesList" - ) && - props.currentView.caseReference.repDetails - .filesList.length > 0 - ? props.currentView.caseReference - .repDetails.filesList - : [] - : [] + props.currentView.fileList + // props.currentView.caseReference.hasOwnProperty( + // "repDetails" + // ) + // ? props.currentView.caseReference.repDetails.hasOwnProperty( + // "filesList" + // ) && + // props.currentView.caseReference.repDetails + // .filesList.length > 0 + // ? props.currentView.caseReference + // .repDetails.filesList + // : [] + // : [] } setFilesForRepresentations={ setFilesForRepresentations From 8ed6921804979c855da2841ca8284fedd1f155e4 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 16:21:33 +0000 Subject: [PATCH 08/16] uat defect 37 --- components/myportal/topthree_reps.js | 2 +- components/pdftemplates/other_pdf.js | 6 +++++- pages/api/endpoint/getadvancedsearch_api.js | 3 ++- pages/api/endpoint/getadvancedsearchpaged_api.js | 3 ++- pages/api/file/generatepdf.js | 1 + pages/myportal/representation.js | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js index eaf5240d..976b5225 100644 --- a/components/myportal/topthree_reps.js +++ b/components/myportal/topthree_reps.js @@ -219,7 +219,7 @@ const TopThree = (props) => { showTopThreeArr[key].appealType, "repDetails": showTopThreeArr[key], }); - isLPA && setRepresentationCapacity("lpa"); + isLPA && setRepresentationCapacity("LPA"); }} > {showTopThreeArr[key].pinswg_name} diff --git a/components/pdftemplates/other_pdf.js b/components/pdftemplates/other_pdf.js index c85a06cb..c529ddce 100644 --- a/components/pdftemplates/other_pdf.js +++ b/components/pdftemplates/other_pdf.js @@ -113,7 +113,11 @@ export const other_pdf = ({ docProps }) => { let datestr = values.pinswg_name.split("-"); let signedDate = formatDates(new Date()); // datestr[2] + "/" + datestr[1] + "/" + datestr[0]; - const isLPA = values.representationCapacity == "lpa" ? true : false; + const isLPA = + values.representationCapacity == "lpa" || + values.representationCapacity == "LPA" + ? true + : false; let filterFilesList = values.hasOwnProperty("filesList") ? values.filesList.filter(function (el) { return el != null; diff --git a/pages/api/endpoint/getadvancedsearch_api.js b/pages/api/endpoint/getadvancedsearch_api.js index 3ee38d9b..6ca190aa 100644 --- a/pages/api/endpoint/getadvancedsearch_api.js +++ b/pages/api/endpoint/getadvancedsearch_api.js @@ -64,7 +64,8 @@ export default async function ApiProxy(req, res) { : ""; queryString += - _.has(searchString, "lpa") && searchString.lpa != null + (_.has(searchString, "lpa") || _.has(searchString, "LPA")) && + searchString.lpa != null ? " _pinswg_associatedlpa_value eq " + searchString.lpa + " and" : ""; diff --git a/pages/api/endpoint/getadvancedsearchpaged_api.js b/pages/api/endpoint/getadvancedsearchpaged_api.js index 348c2cbf..2c4697c9 100644 --- a/pages/api/endpoint/getadvancedsearchpaged_api.js +++ b/pages/api/endpoint/getadvancedsearchpaged_api.js @@ -99,7 +99,8 @@ export default async function ApiProxy(req, res) { : ""; queryString += - _.has(searchString, "lpa") && searchString.lpa != null + (_.has(searchString, "lpa") || _.has(searchString, "LPA")) && + searchString.lpa != null ? " _pinswg_associatedlpa_value eq " + searchString.lpa + " and" : ""; diff --git a/pages/api/file/generatepdf.js b/pages/api/file/generatepdf.js index 3c19856b..d3f10092 100644 --- a/pages/api/file/generatepdf.js +++ b/pages/api/file/generatepdf.js @@ -219,6 +219,7 @@ export default async function handler(req, res) { repCapacity = "LO"; break; case "lpa": + case "LPA": repCapacity = "LPA"; break; diff --git a/pages/myportal/representation.js b/pages/myportal/representation.js index f395072d..ccfd4c63 100644 --- a/pages/myportal/representation.js +++ b/pages/myportal/representation.js @@ -268,7 +268,7 @@ export const getServerSideProps = wrapper.getServerSideProps( ? true : false; - //isLPA && store.dispatch(setRepresentationCapacity("lpa")); + //isLPA && store.dispatch(setRepresentationCapacity("LPA")); if (query.hasOwnProperty("state")) { console.log("is lpa?:", isLPA); From df7599fca09312b787491b4cf2beea843fb903a9 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 16:22:22 +0000 Subject: [PATCH 09/16] uat defect 38 --- components/utils/index.js | 3 +++ public/assets/images/documenttypes/tif.png | Bin 0 -> 921 bytes 2 files changed, 3 insertions(+) create mode 100644 public/assets/images/documenttypes/tif.png diff --git a/components/utils/index.js b/components/utils/index.js index c5ca7e74..a684a3a7 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -444,6 +444,9 @@ export const getThumbnailIconByExtension = (blobName) => { return "/assets/images/documenttypes/jpg.png"; case "png": return "/assets/images/documenttypes/png.png"; + case "tiff": + case "tif": + return "/assets/images/documenttypes/tif.png"; break; default: return "/assets/images/documenttypes/default.png"; diff --git a/public/assets/images/documenttypes/tif.png b/public/assets/images/documenttypes/tif.png new file mode 100644 index 0000000000000000000000000000000000000000..566317414b187d500646302205fad26a2c23f932 GIT binary patch literal 921 zcmV;K17`e*P)73JlihlZowQ>H^QP_Ee2 z-6nkAiZUThS2%d7c5~_cIyoWtQBt^gImyZkXN9RmN={xu8*)PIBiTPNpwC=8snV6( zset5@6=DEaifyhK*}9mu1!6EuT^Y!!N^Dt9t|Ml9W-v<2K+D-%W>f+#BzFoK{j3DG<}#wctc` zOOeh+qmL3Hwp{!~NS%$Y+%skiR-HPI^|zalvBZPPC*7d4Gj^vHb)EO%DJ_E2>lN?T z@?(w2-L?f2kGlj_-1LXeH=*!A14wGeRL@Hcp1UMm^zO3G7+cb}<(&STBUMvV>(E~F zTsM`ZtC@x^k^bkTaSuN?BY}5+2d%N?@TX6sOlz9IYdZ?|>_jB^8Kcd2k+p6OLhVmc za^w))B}Jm#bdhWw?!m~FW<-PI7`b{&_)ST_JnX>irvRq=-U=X*^2jX6XB7^o6J(FK zwM(BVsYECg{=CvuBoLIJTZY=wsPs8faW84EkxC}}qoLxm;!CReMq;-cexolHb|iw= z%#)Hp{r=iMs~;TR_)l`-uS~*hIr)-3h00=}DJ-U-N}Gz>a*?LGn#7kj6-}E!le$Me z#YJ%C=fre4{9zbBzR$qv%liFWk%#cd5rJ{#<-oJ>FT;zX;}eLC29e>;gtu}vyM>$& z&tm5Nkj|G>ptFH7(BrFKi|Xqa@w~o4N1DC41}jb+#jAaXg}-qBUidat#r(d|q-SL* z{5LP7yKc9R!)PQGsFB2q?W?LlapOS=9c#Id`I)e=U3uBMxlqS5ga?NumXyC1==7U@ v1a7qGHfLilG-W!+n8oXfE0HRhHrLZHy7T3GW4zIY00000NkvXXu0mjf($}ib literal 0 HcmV?d00001 From e7e24fd299a9139d3fb0348620900dee862a5bca Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 16:46:27 +0000 Subject: [PATCH 10/16] questionnaire defect 40 --- .../representationProgress/representationProgress_s78.js | 2 +- locales/cy/myrepresentations.json | 1 + locales/en/myrepresentations.json | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/case/representation/representationProgress/representationProgress_s78.js b/components/case/representation/representationProgress/representationProgress_s78.js index 0257887c..f0ed8e2b 100644 --- a/components/case/representation/representationProgress/representationProgress_s78.js +++ b/components/case/representation/representationProgress/representationProgress_s78.js @@ -332,7 +332,7 @@ const RepresentationProgress_s78 = (props) => { > {t( - "myrepresentations:s78-section-heading-three" + "myrepresentations:s78-section-heading-five-sub" )} diff --git a/locales/cy/myrepresentations.json b/locales/cy/myrepresentations.json index 3e23b506..17ba2360 100644 --- a/locales/cy/myrepresentations.json +++ b/locales/cy/myrepresentations.json @@ -91,6 +91,7 @@ "s78-section-question-25": "A ydych yn ystyried bod amodau eraill, neu fersiynau diwygiedig o'r amodau safonol uchod, yn angenrheidiol?", "s78-section-question-25-hint": "Os Ydych, rhestrwch nhw yma neu mewn dogfen atodedig. Dylech gynnwys rhesymau a pholisïau perthnasol y cynllun datblygu. Os ydych yn bwriadu anfon amodau awgrymedig gyda’ch datganiad 4 wythnos, nodwch hyn yma.", "s78-section-heading-five": "Cyn cwblhau'r Holiadur, nodwch a ydych am atodi ffeil(iau) ar gyfer y canlynol, ac os na, rhowch ddolen gwe neu resymau. Gellir lanlwytho unrhyw ddogfennau gofynnol ar y dudalen nesaf.", + "s78-section-heading-five-sub": "Gorffen yr holiadur", "s78-section-question-26": "Copi o dystysgrif yr ymgeisydd sy'n cadarnhau ei fod wedi hysbysu pobl sydd â buddiant yn y tir?", "s78-section-question-26-hint": "Rhowch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", "s78-section-question-27": "Tystiolaeth o unrhyw gyhoeddusrwydd a roddwyd i'r cais, gan gynnwys hysbysiadau safle a hysbyseb leol?", diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index 1a1286cc..8044032f 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -91,6 +91,7 @@ "s78-section-question-25": "Do you consider other conditions, or amended versions of the above standard conditions, to be necessary?", "s78-section-question-25-hint": "If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here.", "s78-section-heading-five": "Before finalising the Questionnaire, indicate if you are going to attach file(s) for the following, and if not, provide a web link or reasons. Any required documents can be uploaded on the next page.", + "s78-section-heading-five-sub": "Finalising questionnaire", "s78-section-question-26": "A copy of the applicant’s certificate confirming that they notified persons with an interest in the land?", "s78-section-question-26-hint": "Insert weblink here if available online. If No, give reasons", "s78-section-question-27": "Evidence of any publicity given to the application, including site notices and local advertisement?", From 23255d496c8db35bc5ce902bdcbec02346b16db8 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 17:02:02 +0000 Subject: [PATCH 11/16] questionnaire defect 42 --- locales/en/myrepresentations.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index 8044032f..7ef71c67 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -93,13 +93,13 @@ "s78-section-heading-five": "Before finalising the Questionnaire, indicate if you are going to attach file(s) for the following, and if not, provide a web link or reasons. Any required documents can be uploaded on the next page.", "s78-section-heading-five-sub": "Finalising questionnaire", "s78-section-question-26": "A copy of the applicant’s certificate confirming that they notified persons with an interest in the land?", - "s78-section-question-26-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-26-hint": "Insert weblink here if available online. If Not, give reasons", "s78-section-question-27": "Evidence of any publicity given to the application, including site notices and local advertisement?", - "s78-section-question-27-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-27-hint": "Insert weblink here if available online. If Not, give reasons", "s78-section-question-28": "A copy of the letter with which you notified people of the appeal AND a list of the people you notified?", - "s78-section-question-28-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-28-hint": "Insert weblink here if available online. If Not, give reasons", "s78-section-question-29": "The LPA’s Environmental Impact Assessment Screening Opinion, if applicable?", - "s78-section-question-29-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-29-hint": "Insert weblink here if available online. If Not, give reasons", "s78-section-question-30": "Advertisement consent proposals only: A true copy of the Discontinuance Notice (if one has been issued)?", "s78-section-question-30-hint": "If Yes, state how the use of the site or the display of the advertisement(s) enjoys the benefit of deemed consent", "s78-section-question-31": "Details of other appeals or applications relating to the site, or a nearby site, which are still being considered by PEDW or the Welsh Ministers?", @@ -180,15 +180,15 @@ "enf-section-question-32-hint": "If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here.", "enf-section-heading-seven": "Before sending, have you attached or provided a web link to the following:", "enf-section-question-33": "A true copy of the enforcement notice?", - "enf-section-question-33-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-33-hint": "Insert weblink here if available online. If Not, give reasons", "enf-section-question-34": "The enforcement notice plan.", - "enf-section-question-34-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-34-hint": "Insert weblink here if available online. If Not, give reasons", "enf-section-question-35": "A list of those served with the enforcement notice.", - "enf-section-question-35-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-35-hint": "Insert weblink here if available online. If Not, give reasons", "enf-section-question-36": "A copy of the letter with which you notified people of the appeal AND a list of the people you notified?", - "enf-section-question-36-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-36-hint": "Insert weblink here if available online. If Not, give reasons", "enf-section-question-37": "The LPA’s Environmental Impact Assessment Screening Opinion and ‘Regulation 45 Notice’*, if applicable?", - "enf-section-question-37-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-37-hint": "Insert weblink here if available online. If Not, give reasons", "enf-section-question-38": "Details of other appeals or applications relating to the site, or a nearby site, which are still being considered by PEDW or the Welsh Ministers?", "enf-section-question-38-hint": "If Yes, provide reference numbers and, if applicable, attach or insert links to relevant documents", "enf-section-question-39": "Details of any previous appeal decision relating to the site or a nearby site referred to by the LPA or applicant?", From dc8cffad3359623a7975d2cb6c1059cf80d1b7c5 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 17:03:53 +0000 Subject: [PATCH 12/16] questionnaire defect 40 - added heading --- .../representationLPAQuestionnaire_s78.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js index ffdefdcf..e1ff102c 100644 --- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js @@ -767,9 +767,11 @@ let S78_Questionnaire = (props) => { aria-describedby="commentBox-hint" >

- {t("myrepresentations:s78-section-heading-five")} + {t("myrepresentations:s78-section-heading-five-sub")}

- +

+ {t("myrepresentations:s78-section-heading-five")} +

Date: Mon, 13 Jan 2025 17:04:19 +0000 Subject: [PATCH 13/16] questionnaire defect 54 - plus tidying up --- .../pdftemplates/lpaQuestionnaire_pdf.js | 203 ++++++++++++------ 1 file changed, 139 insertions(+), 64 deletions(-) diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js index b0b76f73..6c9de0f5 100644 --- a/components/pdftemplates/lpaQuestionnaire_pdf.js +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -41,7 +41,7 @@ const styles = StyleSheet.create({ logoImage: { width: "200pt" }, questionBullet: { width: "5%", fontSize: 12 }, questionText: { width: "30%", fontSize: 12 }, - questionTextMid: { width: "80%", fontSize: 12 }, + questionTextMid: { width: "75%", fontSize: 12, marginRight: 10 }, questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 }, questionAnswer: { color: "#757575", @@ -277,6 +277,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { + ] - 11. - - {getTrans( - docProps.locale, - "s78-section-question-11" - )} - - + + + 11. + + + {getTrans( + docProps.locale, + "s78-section-question-11" + )} + + + {CleanHTML(values.LPAcaseFileAndReps)} - 12. - - {getTrans( - docProps.locale, - "s78-section-question-12" - )} - - + + + 12. + + + {getTrans( + docProps.locale, + "s78-section-question-12" + )} + + + {CleanHTML(values.LPAldpAndMap)} - 13. - - {getTrans( - docProps.locale, - "s78-section-question-13" - )} - - + + + 13. + + + {getTrans( + docProps.locale, + "s78-section-question-13" + )} + + + {CleanHTML(values.LPAlocalGuidance)} @@ -603,6 +639,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { marginTop: 10, fontFamily: "Helvetica-Bold", }} + wrap={false} > {getTrans( docProps.locale, - "s78-section-heading-five" + "s78-section-heading-five-sub" )} @@ -1040,6 +1086,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { {values.copyOfApplicantsCertificate} - - - {CleanHTML( - values.copyOfApplicantsCertificateEvidence - )} - - + {values.hasOwnProperty( + "copyOfApplicantsCertificateEvidence" + ) && ( + + + {CleanHTML( + values.copyOfApplicantsCertificateEvidence + )} + + + )} { {values.advertismentGiven} - - - - {CleanHTML( - values.advertismentGivenEvidence - )} - - + {values.hasOwnProperty( + "advertismentGivenEvidence" + ) && ( + + + {CleanHTML( + values.advertismentGivenEvidence + )} + + + )} { } - - - {CleanHTML( - values.copyOfLetterOfAppealNotificationEvidence - )} - - + {values.hasOwnProperty( + "copyOfLetterOfAppealNotificationEvidence" + ) && ( + + + {CleanHTML( + values.copyOfLetterOfAppealNotificationEvidence + )} + + + )} { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { flexDirection: "column", marginBottom: 10, }} + wrap={false} > { - - - {getTrans( - docProps.locale, - "lpa-list-supporting-documents-list" - )} - + + + + {getTrans( + docProps.locale, + "lpa-list-supporting-documents-list" + )} + + @@ -1446,7 +1521,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { > {p.name} -{" "} {bytesToSize( - p.size + p.contentLength )}{" "} {"\n"} From c0f59a9645b8cd38d4ebff67fe81a9016e768c3d Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 17:04:47 +0000 Subject: [PATCH 14/16] client side warnings removed --- components/myportal/advancedsearch.js | 5 +---- components/myportal/myrepresentations.js | 1 - components/myportal/myrepresentationsfromblob.js | 1 - components/myportal/searchcases.js | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/components/myportal/advancedsearch.js b/components/myportal/advancedsearch.js index 9f4bb353..a446ca75 100644 --- a/components/myportal/advancedsearch.js +++ b/components/myportal/advancedsearch.js @@ -306,10 +306,7 @@ let AdvancedSearch = (props) => { (router.locale == "cy" ? "/fymhorth/canlyniadauchwiliouwch" : "/myportal/advancedsearchresults") + searchString, - null, - { - shallow: true, - } + null ); }; diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js index f1c0d905..54d2f555 100644 --- a/components/myportal/myrepresentations.js +++ b/components/myportal/myrepresentations.js @@ -40,7 +40,6 @@ const MyRepresentations = (props) => { "/fymhorth/gweldpopeth" : "/myportal/viewall" } - shallow className="govuk-link--no-underline" onClick={() => { setCurrentView({ diff --git a/components/myportal/myrepresentationsfromblob.js b/components/myportal/myrepresentationsfromblob.js index 85ac28ea..4035c5fa 100644 --- a/components/myportal/myrepresentationsfromblob.js +++ b/components/myportal/myrepresentationsfromblob.js @@ -39,7 +39,6 @@ const MyRepresentations = (props) => { "/fymhorth/gweldpopeth" : "/myportal/viewall" } - shallow className="govuk-link--no-underline" onClick={() => { setCurrentView({ diff --git a/components/myportal/searchcases.js b/components/myportal/searchcases.js index f815e59b..f7167d30 100644 --- a/components/myportal/searchcases.js +++ b/components/myportal/searchcases.js @@ -98,7 +98,6 @@ let CaseSearch = (props) => { ? "/fymhorth/canlyniadauchwilio" : "/myportal/searchresults", query: { q: values.basicSearch }, - shallow: true, }); } }; From 59ae2db6c581164f77777539776ad54d74b30542 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 18:18:47 +0000 Subject: [PATCH 15/16] questionnaire defect 47 --- .../pdftemplates/lpaQuestionnaire_pdf.js | 61 ++++++++++++++----- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js index 6c9de0f5..16171483 100644 --- a/components/pdftemplates/lpaQuestionnaire_pdf.js +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -53,6 +53,27 @@ const styles = StyleSheet.create({ paddingLeft: 10, backgroundColor: "white", }, + questionAnswerSmall: { + color: "#757575", + width: "300", + fontSize: 12, + padding: 5, + border: 1, + borderColor: "#eee", + paddingLeft: 10, + backgroundColor: "white", + marginRight: 10, + }, + questionAnswerSmaller: { + color: "#757575", + width: "90", + fontSize: 12, + padding: 5, + border: 1, + borderColor: "#eee", + paddingLeft: 10, + backgroundColor: "white", + }, questionAnswerMid: { color: "#757575", width: "20%", @@ -74,6 +95,15 @@ const styles = StyleSheet.create({ padding: 5, }, + questionAnswerFull: { + color: "#757575", + width: "100%", + fontSize: 10, + padding: 5, + border: 1, + borderColor: "#eee", + backgroundColor: "white", + }, sectionContainer: { backgroundColor: "#F8F8F8", padding: 10, @@ -489,7 +519,6 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { - ] { }} > {getTrans( docProps.locale, "s78-section-question-signed" )} - - {values.caseOfficer} + + w{values.caseOfficer} { alignItems: "center", }} > - + {getTrans( docProps.locale, "s78-section-question-date" )} - + {formatDates(values.signedDate)} @@ -1487,9 +1519,6 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { marginBottom: 10, }} > - {getTrans( docProps.locale, @@ -1499,7 +1528,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { @@ -1516,14 +1545,16 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { > - {p.name} -{" "} + {p.name} + {"\n"}( {bytesToSize( - p.contentLength - )}{" "} - {"\n"} + p.contentLength || + p.size + )} + ){" "} ); From 665c4bbba51c861664d7d24124cb16f6b7f55107 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Jan 2025 18:21:40 +0000 Subject: [PATCH 16/16] uat defect 124, rep defect 11, questionnaire defect 26 --- actions/index.js | 12 +-- components/case/representation/index.js | 93 +++++++++++-------- .../representation/representationAgent.js | 34 +++---- .../representation/representationAppellant.js | 29 +++--- .../representation/representationElements.js | 18 +++- .../representationInterestedPartyPerson.js | 34 +++---- .../case/representation/representationLPA.js | 53 +++++++---- ...resentationLPAQuestionnaire_enforcement.js | 25 ++--- 8 files changed, 173 insertions(+), 125 deletions(-) diff --git a/actions/index.js b/actions/index.js index 4adf8941..335b7064 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1566,12 +1566,12 @@ export const uploadRepFiles = async ( // files.forEach((file) => formData.append("files", file)); - for (let i = 0; i < files.length; i++) { - for (let j = 0; j < files[i].length; j++) { - //console.log("upload rep files:", files[i][j].name); - formData.append(files[i][j].name, files[i][j]); - } - } + // for (let i = 0; i < files.length; i++) { + // for (let j = 0; j < files[i].length; j++) { + // //console.log("upload rep files:", files[i][j].name); + // formData.append(files[i][j].name, files[i][j]); + // } + // } //console.log(formData); diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 3b045eba..0071b180 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -129,6 +129,7 @@ let MakeRepresentation = (props) => { repCap = "LO"; break; case "lpa": + case "LPA": repCap = "LPA"; break; @@ -204,7 +205,7 @@ let MakeRepresentation = (props) => { return values; }; - isLPA && setRepresentationCapacity("lpa"); + isLPA && setRepresentationCapacity("LPA"); currentType == "searchResultsObj" ? (casesObj = jsonpath( @@ -248,8 +249,27 @@ let MakeRepresentation = (props) => { ? props.props.watchedCases.watchedCasesDetails : props.props.searchResultsObj.searchDetailsObj; + let setCaseResultsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchResultsObj + : props.currentType == "watchedCases" + ? props.props.watchedCases.watchedCasesDetails + : props.props.searchResultsObj.searchResultsObj; + var detailsObj = {}; + var resultsObj = {}; + + resultsObj = jsonpath( + '$..[?(@.ticketnumber=="' + + currentView.caseReference.currentReference + + '")]', + setCaseResultsObj + ); + + resultsObj = resultsObj[0]; + detailsObj = jsonpath( '$..[?(@.pinswg_name=="' + currentView.caseReference.currentReference + @@ -396,7 +416,7 @@ let MakeRepresentation = (props) => { ) ) { return ( - //setRepresentationCapacity("lpa"), + //setRepresentationCapacity("LPA"), { ); break; case "lpa": + case "LPA": //setRepresentationCapacity("appellant"); - //setRepresentationCapacity("lpa"); + //setRepresentationCapacity("LPA"); // useEffect(() => { - // setRepresentationCapacity("lpa"); + // setRepresentationCapacity("LPA"); // }, []); // console.log(currentView.caseReference.appealType); @@ -761,6 +782,7 @@ let MakeRepresentation = (props) => { "pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2, "pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown, "pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode, + "pinswg_lpareference": resultsObj.pinswg_lpareference, "_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"], "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue": detailsObj[ @@ -777,7 +799,7 @@ let MakeRepresentation = (props) => { ? props.props.currentView.representationCapacity : values.representationCapacity : isLPA - ? "lpa" + ? "LPA" : values.representationCapacity, "locale": router.locale, }); @@ -840,23 +862,15 @@ let MakeRepresentation = (props) => { : "/myportal" )) : useSaveStatus - ? (values.hasOwnProperty("representationDocuments") && - (values.representationDocuments.map((Blob) => - buildFileArray.push({ - "name": Blob.name, - "size": Blob.size, - }) - ), - (newbuildArr = buildFileArray.concat(values.filesList)), - console.log(buildFileArray, newbuildArr), - Object.assign(values, { - "filesList": newbuildArr, - })), - generateRepPDF( - values, - props.props.accountDetails.containerID, - currentView.caseReference.currentReference - ), + ? (Object.assign(values, { + "filesList": props.currentView.fileList, + }), + // commented out as dont need to create pdf on save + // generateRepPDF( + // values, + // props.props.accountDetails.containerID, + // currentView.caseReference.currentReference + // ), uploadRepresentationFiles(values), router.replace( router.locale != "en" @@ -874,25 +888,26 @@ let MakeRepresentation = (props) => { // Object.assign(values, { // "filesList": buildFileArray, // })), - - uploadRepresentationFiles(values), - generateRepPDF( - values, - props.props.accountDetails.containerID, - currentView.caseReference.currentReference - ); + console.log("updated"); + uploadRepresentationFiles(values); + // generateRepPDF( + // values, + // props.props.accountDetails.containerID, + // currentView.caseReference.currentReference + // ); }; const onHandleSubmit = (values) => { window.scrollTo({ top: 0, behavior: "smooth" }); values = setRepFileName(values); - !values.hasOwnProperty("pinswg_lpareference") && - Object.assign(values, { - "pinswg_lpareference": - searchResultsObj.searchResultsObj.value[0] - .pinswg_lpareference, - }); + // values.representationType == "Questionnaire" && + // !values.hasOwnProperty("pinswg_lpareference") && + // Object.assign(values, { + // "pinswg_lpareference": + // searchResultsObj?.searchResultsObj?.value[0] + // ?.pinswg_lpareference, + // }); //console.log("onHandleSubmit form values - ", JSON.stringify(values)); @@ -973,6 +988,7 @@ let MakeRepresentation = (props) => { "pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown, "pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode, + "pinswg_lpareference": resultsObj.pinswg_lpareference, "_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"], "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue": @@ -990,7 +1006,7 @@ let MakeRepresentation = (props) => { ? props.props.currentView.representationCapacity : values.representationCapacity : isLPA - ? "lpa" + ? "LPA" : values.representationCapacity, "locale": router.locale, })); @@ -998,7 +1014,7 @@ let MakeRepresentation = (props) => { if (currentView.representationSubmit != true) { if (_.isEmpty(currentView.representationCapacity)) { if (isLPA) { - setRepresentationCapacity("lpa"); + setRepresentationCapacity("LPA"); } else { setRepresentationCapacity( values.representationCapacity @@ -1055,6 +1071,7 @@ let MakeRepresentation = (props) => { currentView.caseReference.currentReference ); uploadRepresentationFiles(values); + setRepresentationSubmit(true); setRepresentationSubmitConfirmation(true); } else { console.log("nit updated"); @@ -1064,7 +1081,7 @@ let MakeRepresentation = (props) => { // currentView.representationSubmit != true // ? _.isEmpty(currentView.representationCapacity) // ? isLPA - // ? setRepresentationCapacity("lpa") + // ? setRepresentationCapacity("LPA") // : setRepresentationCapacity( // values.representationCapacity // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "") diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js index a9ed801d..f29115e2 100644 --- a/components/case/representation/representationAgent.js +++ b/components/case/representation/representationAgent.js @@ -199,22 +199,24 @@ const RepAgent = (props) => { } hint={"sdsd"} fileList={ - props.currentView.caseReference.hasOwnProperty( - "repDetails" - ) - ? props.currentView.caseReference.repDetails.hasOwnProperty( - "filesList" - ) && - props.currentView - .caseReference - .repDetails.filesList - .length > 0 - ? props.currentView - .caseReference - .repDetails - .filesList - : [] - : [] + props.currentView.fileList + + // props.currentView.caseReference.hasOwnProperty( + // "repDetails" + // ) + // ? props.currentView.caseReference.repDetails.hasOwnProperty( + // "filesList" + // ) && + // props.currentView + // .caseReference + // .repDetails.filesList + // .length > 0 + // ? props.currentView + // .caseReference + // .repDetails + // .filesList + // : [] + // : [] } setFilesForRepresentations={ setFilesForRepresentations diff --git a/components/case/representation/representationAppellant.js b/components/case/representation/representationAppellant.js index 7abea2e1..64ccd627 100644 --- a/components/case/representation/representationAppellant.js +++ b/components/case/representation/representationAppellant.js @@ -191,20 +191,21 @@ const RepAppellant = (props) => { ticketnumber={props.props.caseReference} hint={"sdsd"} fileList={ - props.currentView.caseReference.hasOwnProperty( - "repDetails" - ) - ? props.currentView.caseReference.repDetails.hasOwnProperty( - "filesList" - ) && - props.currentView - .caseReference.repDetails - .filesList.length > 0 - ? props.currentView - .caseReference - .repDetails.filesList - : [] - : [] + props.currentView.fileList + // props.currentView.caseReference.hasOwnProperty( + // "repDetails" + // ) + // ? props.currentView.caseReference.repDetails.hasOwnProperty( + // "filesList" + // ) && + // props.currentView + // .caseReference.repDetails + // .filesList.length > 0 + // ? props.currentView + // .caseReference + // .repDetails.filesList + // : [] + // : [] } setFilesForRepresentations={ setFilesForRepresentations diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index db6221c8..6f51a3c2 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -7,7 +7,7 @@ import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import Dropzone from "react-dropzone"; import "react-quill-new/dist/quill.snow.css"; -import { Field } from "redux-form"; +import { Field, change } from "redux-form"; import { uploadSingleFile, deleteBlob, @@ -17,6 +17,7 @@ import { } from "../../../actions"; const ReactQuill = dynamic(() => import("react-quill-new"), { ssr: false }); +import { useDispatch } from "react-redux"; // Import the useDispatch hook import { addDays, @@ -867,6 +868,8 @@ const rejectStyle = { export const RenderFileUpload = (field) => { const files = field.input.value; + const dispatch = useDispatch(); // Get dispatch using useDispatch hook + let { t } = useTranslation(); const style = useMemo( @@ -929,9 +932,9 @@ export const RenderFileUpload = (field) => { const filelistObj = field.fileList || {}; - //let blobList = filelistObj; + let blobList = filelistObj; - let blobList = field.props.currentView.fileList; + //let blobList = field.props.currentView.fileList; function removeNullObjects(arr) { if (arr.length === 0) { @@ -1063,6 +1066,7 @@ export const RenderFileUpload = (field) => { [".xlsx"], }} onDrop={(filesToUpload, e) => { + setCompletedUploadFiles(false); const renamedAcceptedFiles = filesToUpload.map( (file) => new File( @@ -1150,9 +1154,13 @@ export const RenderFileUpload = (field) => { )) ).then((data) => { data = data.value || {}; - field.input.value == null; + field.input.value = ""; field.setFilesForRepresentations(data[0]); setCompletedUploadFiles(true); + + dispatch( + change("representationForm", field.name, null) + ); // Set the field value to null }); }); }} @@ -1283,7 +1291,7 @@ export const RenderFileUpload = (field) => { field.ticketnumber + "/" + field.filenamePrefix.representationForm - .values.repfile_name + ?.values?.repfile_name ) + "&blobname=" + blob.name + diff --git a/components/case/representation/representationInterestedPartyPerson.js b/components/case/representation/representationInterestedPartyPerson.js index 2ceee4f9..3649b418 100644 --- a/components/case/representation/representationInterestedPartyPerson.js +++ b/components/case/representation/representationInterestedPartyPerson.js @@ -186,22 +186,24 @@ const RepInterestedPartyPerson = (props) => { } hint={"sdsd"} fileList={ - props.currentView.caseReference.hasOwnProperty( - "repDetails" - ) - ? props.currentView.caseReference.repDetails.hasOwnProperty( - "filesList" - ) && - props.currentView - .caseReference - .repDetails.filesList - .length > 0 - ? props.currentView - .caseReference - .repDetails - .filesList - : [] - : [] + props.currentView.fileList + + // props.currentView.caseReference.hasOwnProperty( + // "repDetails" + // ) + // ? props.currentView.caseReference.repDetails.hasOwnProperty( + // "filesList" + // ) && + // props.currentView + // .caseReference + // .repDetails.filesList + // .length > 0 + // ? props.currentView + // .caseReference + // .repDetails + // .filesList + // : [] + // : [] } setFilesForRepresentations={ setFilesForRepresentations diff --git a/components/case/representation/representationLPA.js b/components/case/representation/representationLPA.js index 9b54a752..ed266276 100644 --- a/components/case/representation/representationLPA.js +++ b/components/case/representation/representationLPA.js @@ -352,23 +352,24 @@ let RepLPA = (props) => { } hint={"sdsd"} fileList={ - (props.formObj.hasOwnProperty( - "representationForm" - ) && - props.formObj[ - "representationForm" - ].hasOwnProperty( - "values" - ) && - props.formObj[ - "representationForm" - ].values.hasOwnProperty( - "filesList" - ) && - props.props.props.form[ - "representationForm" - ].values.filesList) || - [] + props.currentView.fileList + // (props.formObj.hasOwnProperty( + // "representationForm" + // ) && + // props.formObj[ + // "representationForm" + // ].hasOwnProperty( + // "values" + // ) && + // props.formObj[ + // "representationForm" + // ].values.hasOwnProperty( + // "filesList" + // ) && + // props.props.props.form[ + // "representationForm" + // ].values.filesList) || + // [] } setFilesForRepresentations={ setFilesForRepresentations @@ -505,6 +506,22 @@ let RepLPA = (props) => { className="govuk-button" data-module="govuk-button" onClick={() => { + let valuesObj = + props.props.props.form[props.form] + .values || {}; + + console.log("valuesobj:", valuesObj); + + delete valuesObj[ + "_pinswg_appellant_value" + ]; + + console.log("on save:", valuesObj); + updateRepresentation( + valuesObj, + false, + false + ); setRepresentationSubmit(true); }} > @@ -604,7 +621,7 @@ const mapStateToProps = (state, props) => { ? state.currentView.caseReference.repDetails : state.currentView.caseReference, { - "representationCapacity": "lpa", + "representationCapacity": "LPA", "onBehalfOfLPA": props.props.props.accountDetails.accountDetails[ "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js index 39d5d4e2..b8d4d1a1 100644 --- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js @@ -1181,18 +1181,19 @@ let Enforcement_Questionnaire = (props) => { ticketnumber={props.props.props.caseReference} hint={"sdsd"} fileList={ - props.currentView.caseReference.hasOwnProperty( - "repDetails" - ) - ? props.currentView.caseReference.repDetails.hasOwnProperty( - "filesList" - ) && - props.currentView.caseReference.repDetails - .filesList.length > 0 - ? props.currentView.caseReference - .repDetails.filesList - : [] - : [] + props.currentView.fileList + // props.currentView.caseReference.hasOwnProperty( + // "repDetails" + // ) + // ? props.currentView.caseReference.repDetails.hasOwnProperty( + // "filesList" + // ) && + // props.currentView.caseReference.repDetails + // .filesList.length > 0 + // ? props.currentView.caseReference + // .repDetails.filesList + // : [] + // : [] } setFilesForRepresentations={ setFilesForRepresentations