Merged PR 1348: Rep defects

Related work items: #12915
This commit is contained in:
Robert Bond
2025-01-03 10:30:44 +00:00
11 changed files with 252 additions and 149 deletions
@@ -172,10 +172,19 @@ const RepAgent = (props) => {
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:publish-policy-label"
)}{" "}
<a
href={t(
"myrepresentations:publish-policy-link"
)}
>
{t(
"myrepresentations:publish-policy-link-label"
)}
</a>{" "}
{t(
"myrepresentations:publish-policy-label-two"
)}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
@@ -146,20 +146,38 @@ const RepAppellant = (props) => {
.appealType == "846040004" ? (
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:questionnaire-publish-policy-label"
"myrepresentations:publish-policy-label"
)}{" "}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
<a
href={t(
"myrepresentations:publish-policy-link"
)}
>
{t(
"myrepresentations:publish-policy-link-label"
)}
</a>{" "}
{t(
"myrepresentations:publish-policy-label-two"
)}
</p>
) : (
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:publish-policy-label"
)}{" "}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
<a
href={t(
"myrepresentations:publish-policy-link"
)}
>
{t(
"myrepresentations:publish-policy-link-label"
)}
</a>{" "}
{t(
"myrepresentations:publish-policy-label-two"
)}
</p>
)}
</div>
@@ -367,6 +367,10 @@ let RepLPA = (props) => {
.containerID
}
filenamePrefix={props.formObj}
props={props.props.props}
setCurrentReference={
props.setCurrentReference
}
/>
{/* // )} */}
</div>
+46 -19
View File
@@ -261,24 +261,11 @@ const ViewAllResults = (props) => {
</Link>
)}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{t("search:searchresults-site-address-label")}:
</span>
{/* {getFormCollectionByID(appealTypeID).PrimaryIdAttribute ==
"pinswg_dnsid"
? detailsObj.pinswg_projectlocation != null
? detailsObj.pinswg_projectlocation.indexOf(";") < 0
? detailsObj.pinswg_projectlocation
: router.locale == "cy"
? detailsObj.pinswg_projectlocation.split(
";"
)[1]
: detailsObj.pinswg_projectlocation.split(
";"
)[0]
: ""
: ""} */}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline1
@@ -329,14 +316,12 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddressline2 !=
null && <br />}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].pinswg_siteaddressline2
) &&
searchDetailsObj[key].pinswg_siteaddressline1 !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddressline2") &&
detailsObj.pinswg_siteaddressline2 != null && (
<br />
@@ -359,7 +344,6 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddresstown !=
null && <br />}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key],
@@ -367,7 +351,6 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddresstown !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown != null && <br />}
{currentView.viewKey == "awaitingSubmissionDetails" &&
@@ -402,7 +385,51 @@ const ViewAllResults = (props) => {
{_.has(detailsObj, "pinswg_siteaddresspostcode")
? detailsObj.pinswg_siteaddresspostcode
: ""}
</dd> */}
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{t("search:searchresults-site-address-label")}:
</span>
{/* Helper function to extract address lines based on current view and data */}
{[
"pinswg_siteaddressline1",
"pinswg_siteaddressline2",
"pinswg_siteaddresstown",
"pinswg_siteaddresscounty",
"pinswg_siteaddresspostcode",
].map((field, idx) => {
const isAwaitingSubmission =
currentView.viewKey ===
"awaitingSubmissionDetails";
const isMyRepresentations =
currentView.viewKey === "myRepresentations";
const searchValue = _.get(
searchDetailsObj,
`${key}.${field}`
);
const detailsValue = _.get(detailsObj, field);
// Determine the display value based on current view
const valueToDisplay =
(isAwaitingSubmission && searchValue) ||
(isMyRepresentations && searchValue) ||
detailsValue ||
"";
// Only render a line break if there is a valid value and it's not the last address part
const renderLineBreak = valueToDisplay && idx < 4; // Only insert <br> if it's not the last element
return (
<>
{valueToDisplay}
{renderLineBreak && <br />}
</>
);
})}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{currentView.viewKey == "awaitingSubmissionDetails"
+32 -19
View File
@@ -257,7 +257,7 @@ export const finalComments_pdf = ({ docProps }) => {
:
</Text>
<Text style={styles.questionAnswer}>
{values.siteAddress}
{values.siteAddress.replace(/false/gm, " ")}
</Text>
</View>
<View
@@ -448,24 +448,37 @@ export const finalComments_pdf = ({ docProps }) => {
</Text>
</View>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
{getTrans(
docProps.locale,
"statement-onbehalf-label"
)}
:
</Text>
<Text style={styles.questionAnswerWide}>
{values.representationCapacity}
</Text>
</View>
{values.hasOwnProperty(
"representationOnBehalfOf_details"
) ? (
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={{ width: "18%", fontSize: 12 }}
>
{getTrans(
docProps.locale,
"statement-onbehalf-label"
)}
:
</Text>
<Text style={styles.questionAnswerWide}>
{values.hasOwnProperty(
"representationOnBehalfOf_details"
)
? values.representationOnBehalfOf_details
: ""}
</Text>
</View>
) : (
""
)}
</View>
</View>
</View>
+30 -18
View File
@@ -441,24 +441,36 @@ export const statement_pdf = ({ docProps }) => {
</Text>
</View>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
{getTrans(
docProps.locale,
"statement-onbehalf-label"
)}
:
</Text>
<Text style={styles.questionAnswerWide}>
{values.representationCapacity}
</Text>
</View>
{values.hasOwnProperty(
"representationOnBehalfOf_details"
) ? (
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={{ width: "18%", fontSize: 12 }}
>
{getTrans(
docProps.locale,
"statement-onbehalf-label"
)}
:
</Text>
<Text style={styles.questionAnswerWide}>
{values.hasOwnProperty(
"representationOnBehalfOf_details"
)
? values.representationOnBehalfOf_details
: ""}
</Text>
</View>
) : (
""
)}
</View>
</View>
</View>
+5 -2
View File
@@ -16,7 +16,10 @@
"kind-of-rep-label": "Pa fath o sylw ydych chi'n ei wneud?",
"enter-comment-label": "Gallwch roi eich cynrychioliad yn y gofod a ddarparwyd neu atodi dogfen ar wahân.",
"comments-set-out-label": "Mae fy sylwadau wedi'u nodi yn",
"publish-policy-label": "Sylwch y gallai'r holl sylwadau gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich sylw yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi. Os yw'n cynnwys deunydd hiliol, enllibus neu sarhaus, caiff ei ddychwelyd atoch a gofynnir i chi ddarparu fersiwn ddiwygiedig.",
"publish-policy-label": "Sylwch y gall pob sylw gael ei gyhoeddi yn unol â'n ",
"publish-policy-link-label": "Polisi Cyhoeddi.",
"publish-policy-link": "https://www.llyw.cymru/polisi-cyhoeddi-penderfyniadau-cynllunio-ac-amgylchedd-cymru",
"publish-policy-label-two": "Pe bai eich sylw yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, mae'n bosibl y caiff ei olygu cyn ei gyhoeddi. Os yw'n cynnwys cynnwys hiliol, enllibus neu sarhaus caiff ei ddychwelyd atoch a gofynnir i chi i ddarparu fersiwn ddiwygiedig.",
"questionnaire-publish-policy-label": "Sylwch y gallai'r holl ddogfennau holiadur gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich holiadur yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi",
"add-files-label": "Ychwanegwch eich ffeiliau",
"fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
@@ -31,7 +34,7 @@
"rep-check-submit-heading": "Gwiriwch eich sylwadau",
"rep-check-your-rep-heading": "Eich sylwadau",
"rep-check-tandc-para-one": "Mae'r data personol a ddarparwyd gennych ar y ffurflen hon yn cael ei chasglu a'i phrosesu yn unol â thelerau ein cofrestriad o dan Ddeddf Diogelu Data 2018.",
"rep-check-tandc-para-two": "Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn cymryd ei chyfrifoldebau diogelu data ar gyfer y wybodaeth a roddwch i ni o ddifrif. I ddarganfod mwy am sut rydym yn defnyddio ac yn rheoli eich data personol, ewch i in hysbysiad preifatrwydd.",
"rep-check-tandc-para-two": "Mae Penderfyniadau Cynllunio a'r Amgylchedd Cymru yn cymryd ei chyfrifoldebau diogelu data am y wybodaeth a roddwch i ni o ddifrif. I ddarganfod mwy am sut rydym yn defnyddio ac yn rheoli eich data personol, ewch i ein",
"rep-check-tandc-para-three": "Cadarnhaf fod pob adran or ffurflen hon wediu llenwin llawn a bod y manylion yn gywir hyd eithaf fy ngwybodaeth.",
"rep-check-tandc-para-four": "Cadarnhaf fy mod wedi darllen yr uchod.",
"rep-complete-heading": "Cyflwyno Sylwadau",
+5 -2
View File
@@ -16,7 +16,10 @@
"kind-of-rep-label": "What kind of representation are you making?",
"enter-comment-label": "You can enter your representation in the space provided or attach a separate document.",
"comments-set-out-label": "My comments are set out in",
"publish-policy-label": "Please note that all representations may be published in line with our Publishing Policy. Should your representation include any sensitive information or potentially defamatory information, it may be redacted before publishing. If it contains racist, libellous or offensive content it will be returned to you and you will be asked to provide an amended version.",
"publish-policy-label": "Please note that all representations may be published in line with our ",
"publish-policy-link-label": "Publishing Policy.",
"publish-policy-link": "https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html",
"publish-policy-label-two": "Should your representation include any sensitive information or potentially defamatory information, it may be redacted before publishing. If it contains racist, libellous or offensive content it will be returned to you and you will be asked to provide an amended version.",
"questionnaire-publish-policy-label": "Please note that all questionnaire documents may be published in line with our Publishing Policy. Should your questionnaire include any sensitive information or potentially defamatory information, it may be redacted before publishing",
"add-files-label": "Add your files",
"fileupload-drop-label": "Drag and drop your files here.",
@@ -31,7 +34,7 @@
"rep-check-submit-heading": "Check your representation",
"rep-check-your-rep-heading": "Your representation",
"rep-check-tandc-para-one": "The gathering and subsequent processing of the personal data supplied by you in this form, is in accordance with the terms of our registration under the Data Protection Act 2018.",
"rep-check-tandc-para-two": "The Planning and Environment Decisions Wales takes its data protection responsibilities for the information you provide us with very seriously. To find out more about how we use and manage your personal data, please go to our",
"rep-check-tandc-para-two": "Planning and Environment Decisions Wales takes its data protection responsibilities for the information you provide us with very seriously. To find out more about how we use and manage your personal data, please go to our",
"rep-check-tandc-para-three": "I confirm that all sections of this form have been fully completed and that the details are correct to the best of my knowledge.",
"rep-check-tandc-para-four": "I confirm I have read the above.",
"rep-complete-heading": "Submission of Representation",
+1
View File
@@ -61,6 +61,7 @@
"notifications-node-client": "^7.0.6",
"openapi-types": "^12.1.3",
"ospoint": "^0.2.1",
"p-limit": "^6.2.0",
"path": "^0.12.7",
"prop-types": "^15.8.1",
"raw-loader": "^4.0.2",
+88 -79
View File
@@ -51,6 +51,7 @@ import {
setWatchedCases,
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import pLimit from "p-limit";
const Home = (props) => {
const {
@@ -374,101 +375,109 @@ export const getServerSideProps = wrapper.getServerSideProps(
const getDetails = async (resultsObj, detailsType) => {
let detailsArr = [];
const limitRequests = pLimit(5); // Limit to 5 concurrent requests
resultsObj =
detailsType == "mySubmittedReps" ? resultsObj : resultsObj.value;
if (detailsType == "myRepresentations") {
const repsObj = resultsObj.map((searchDetail, index) => {
detailsArr.push(
getCase(searchDetail["incidentID"])
.then(async (data) => {
let caseID = "";
limitRequests(async () => {
resultsObj.map((searchDetail, index) => {
detailsArr.push(
getCase(searchDetail["incidentID"])
.then(async (data) => {
let caseID = "";
switch (detailsType) {
case "myCases":
caseID = data.pinswg_title;
break;
case "myWatchedCases":
case "mySubmittedReps":
caseID =
data[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
];
break;
case "awaitingSubmission":
case "myRepresentations":
try {
caseID = data.ticketnumber;
} catch {
console.log("missing:", data);
}
switch (detailsType) {
case "myCases":
caseID = data.pinswg_title;
break;
case "myWatchedCases":
case "mySubmittedReps":
caseID =
data[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
];
break;
case "awaitingSubmission":
case "myRepresentations":
try {
caseID = data.ticketnumber;
} catch {
console.log("missing:", data);
}
break;
default:
caseID = data.pinswg_title;
}
return await getPortalModuleDetails(
getFormCollectionByID(data.pinswg_appealcasetype)
.LogicalCollectionName,
caseID
).catch((error) => {
break;
default:
caseID = data.pinswg_title;
}
return await getPortalModuleDetails(
getFormCollectionByID(
data.pinswg_appealcasetype
).LogicalCollectionName,
caseID
).catch((error) => {
console.log(
"=============================\ngetPortalModuleDetails error",
error
);
});
})
.catch((error) => {
console.log(
"=============================\ngetPortalModuleDetails error",
"=============================\ngetCase error",
error
);
});
})
.catch((error) => {
console.log(
"=============================\ngetCase error",
error
);
})
);
})
);
});
});
}
//debugger;
const detailsObj = resultsObj.map(async (searchDetail, index) => {
let caseID = "";
await Promise.all(
resultsObj.map(async (searchDetail, index) => {
limitRequests(async () => {
try {
let caseID = "";
switch (detailsType) {
case "myCases":
caseID = searchDetail.pinswg_title;
break;
case "myWatchedCases":
case "mySubmittedReps":
caseID =
searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
];
break;
case "awaitingSubmission":
caseID = searchDetail.ticketnumber;
break;
case "myRepresentations":
caseID = searchDetail.casereference;
break;
default:
caseID = searchDetail.pinswg_title;
}
switch (detailsType) {
case "myCases":
caseID = searchDetail.pinswg_title;
break;
case "myWatchedCases":
case "mySubmittedReps":
caseID =
searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
];
break;
case "awaitingSubmission":
caseID = searchDetail.ticketnumber;
break;
case "myRepresentations":
caseID = searchDetail.casereference;
break;
default:
caseID = searchDetail.pinswg_title;
}
console.log(detailsType, " case id : ", caseID);
console.log(detailsType, " case id : ", caseID);
searchDetail.pinswg_appealcasetype != null &&
detailsArr.push(
await getPortalModuleDetails(
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
.LogicalCollectionName,
caseID
// detailsType != "myWatchedCases"
// ? searchDetail.ticketnumber
// : searchDetail[
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
// ]
)
);
});
searchDetail.pinswg_appealcasetype != null &&
detailsArr.push(
getPortalModuleDetails(
getFormCollectionByID(
searchDetail.pinswg_appealcasetype
).LogicalCollectionName,
caseID
)
);
} catch (error) {
console.log("Error processing case:", error);
}
});
})
);
let detArr = Promise.all(detailsArr);
// console.log(detArr);
+4
View File
@@ -270,6 +270,10 @@ div.cardModuleItem:last-of-type {
}
* {
overflow-wrap: anywhere;
}
.cardModuleRemoveCase {
border: 1px solid $red;
padding: 5px;