lpa rep pdf tweaks

This commit is contained in:
2024-05-09 18:40:51 +01:00
parent b57d73dec3
commit 815a8ec818
10 changed files with 139 additions and 105 deletions
+56 -2
View File
@@ -393,6 +393,55 @@ let MakeRepresentation = (props) => {
const buildFileArray = [];
setSavingStatus(useSaveStatus);
Object.assign(values, {
"containerID": props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"caseRef": props.props.currentView.caseReference.currentReference,
"pinswg_questionnaireduedate":
detailsObj.pinswg_questionnaireduedate,
"pinswg_statementduedate": detailsObj.pinswg_statementduedate,
"pinswg_finalcommentsduedate":
detailsObj.pinswg_finalcommentsduedate,
"pinswg_name":
props.props.currentView.caseReference.currentReference,
"firstname": props.props.accountDetails.accountDetails.firstname,
"lastname": props.props.accountDetails.accountDetails.lastname,
"emailAddress":
props.props.accountDetails.accountDetails.emailaddress1,
"siteAddress":
detailsObj.pinswg_siteaddressline1 +
" " +
detailsObj.pinswg_siteaddressline2 +
" " +
detailsObj.pinswg_siteaddresstown +
" " +
detailsObj.pinswg_siteaddresspostcode,
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
"pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode,
"_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"],
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
],
"_pinswg_localplanningauthority_value":
detailsObj["_pinswg_localplanningauthority_value"],
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue":
detailsObj[
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
],
"representationCapacity": router.query.hasOwnProperty("state")
? router.query.state == "edit"
? props.props.currentView.representationCapacity
: values.representationCapacity
: isLPA
? "lpa"
: values.representationCapacity,
"locale": router.locale,
});
// "pinswg_name": "2022-11-29-IP-REP_BOND_1",
const repDate = new Date();
@@ -525,7 +574,7 @@ let MakeRepresentation = (props) => {
router.query.hasOwnProperty("state") &&
router.query.state == "edit" &&
setRepresentationSubmit(true);
setRepresentationSubmit(false);
var detailsObj = {};
@@ -609,7 +658,8 @@ let MakeRepresentation = (props) => {
)
: questionnaireCount != 0 &&
showQuestionnaireSection < questionnaireCount
? setShowQuestionnaireSection(showQuestionnaireSection + 1)
? (setShowQuestionnaireSection(showQuestionnaireSection + 1),
updateRepresentation(values, false, false))
: setRepresentationSubmit(true)
: currentView.representationSubmit == true
? (console.log("capacity", currentView.representationCapacity),
@@ -627,6 +677,10 @@ let MakeRepresentation = (props) => {
Object.assign(values, {
"filesList": buildFileArray,
})),
console.log(
"====================== rep lpa payload:\n",
JSON.stringify(values)
),
generateRepPDF(
values,
props.props.accountDetails.containerID,
@@ -228,8 +228,11 @@ let RepLPA = (props) => {
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
.representationType == "undefined" ? (
{!(
"values" in formObj.representationForm &&
"representationType" in
formObj.representationForm.values
) ? (
<>
<h2 className="govuk-heading-m ">
{typeof props.representationType != "undefined"
@@ -356,6 +359,7 @@ let RepLPA = (props) => {
{typeof props.representationType != "undefined" &&
props.representationType == "Questionnaire" && (
<>
{showQuestionnaireSection}
{showQuestionnaireSection <=
questionnaireCount && (
<button
@@ -363,7 +367,9 @@ let RepLPA = (props) => {
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
{t("common:continue-button")} www
{showQuestionnaireSection} -{" "}
{questionnaireCount}
</button>
// <a
// href="#"
@@ -377,13 +383,15 @@ let RepLPA = (props) => {
// Next section
// </a>
)}
{showQuestionnaireSection == 9 && (
{showQuestionnaireSection ==
questionnaireCount && (
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
{t("common:continue-button")} -{" "}
{showQuestionnaireSection}
</button>
)}
{showQuestionnaireSection > 1 && (
@@ -408,7 +416,7 @@ let RepLPA = (props) => {
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
{t("common:continue-button")} ==
</button>
<a
onClick={() => {
@@ -30,6 +30,7 @@ let RepLPACapacitySelection = (props) => {
capacityOptionsArr,
currentType,
casesObj,
detailsObj,
validate,
handleSubmit,
} = props;
@@ -48,6 +49,7 @@ let RepLPACapacitySelection = (props) => {
formObj={formObj}
currentType={currentType}
casesObj={casesObj}
detailsObj={detailsObj}
caseReference={props.props.caseReference}
searchResultsObj={props.props.searchResultsObj}
props={props.props}
@@ -819,10 +819,9 @@ let Enforcement_Questionnaire = (props) => {
errorMsg={t("newappeal:select-an-option-label")}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"a) " +
t("myrepresentations:enf-section-question-31a")
}
legend={t(
"myrepresentations:enf-section-question-31a"
)}
conditionalLabel={t(
"myrepresentations:enf-section-question-31a-hint"
)}
@@ -832,10 +831,7 @@ let Enforcement_Questionnaire = (props) => {
/>
</div>
<Field
label={
"b) " +
t("myrepresentations:enf-section-question-31b")
}
label={t("myrepresentations:enf-section-question-31b")}
name="developmentNotTakePlaceBiodiversity"
id="developmentNotTakePlaceBiodiversity"
component={RenderRadioList}
@@ -849,10 +845,7 @@ let Enforcement_Questionnaire = (props) => {
aria-describedby={props.name + "-hint"}
/>
<Field
label={
"c) " +
t("myrepresentations:enf-section-question-31c")
}
label={t("myrepresentations:enf-section-question-31c")}
name="developmentNotTakePlaceBroadband"
id="developmentNotTakePlaceBroadband"
component={RenderRadioList}
@@ -628,10 +628,7 @@ let S78_Questionnaire = (props) => {
</div>
<Field
label={
"a) " +
t("myrepresentations:s78-section-question-24a")
}
label={t("myrepresentations:s78-section-question-24a")}
name="developmentNotBeginLaterThanFiveYears"
id="developmentNotBeginLaterThanFiveYears"
component={RenderRadioList}
@@ -659,10 +656,9 @@ let S78_Questionnaire = (props) => {
errorMsg={t("newappeal:select-an-option-label")}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"b) " +
t("myrepresentations:s78-section-question-24b")
}
legend={t(
"myrepresentations:s78-section-question-24b"
)}
conditionalLabel={t(
"myrepresentations:s78-section-question-24b-hint"
)}
@@ -672,10 +668,7 @@ let S78_Questionnaire = (props) => {
/>
</div>
<Field
label={
"c) " +
t("myrepresentations:s78-section-question-24c")
}
label={t("myrepresentations:s78-section-question-24c")}
name="developmentNotTakePlaceBiodiversity"
id="developmentNotTakePlaceBiodiversity"
component={RenderRadioList}
@@ -690,10 +683,7 @@ let S78_Questionnaire = (props) => {
validate={[required]}
/>
<Field
label={
"d) " +
t("myrepresentations:s78-section-question-24d")
}
label={t("myrepresentations:s78-section-question-24d")}
name="developmentNotTakePlaceBroadband"
id="developmentNotTakePlaceBroadband"
component={RenderRadioList}
+36 -55
View File
@@ -96,7 +96,6 @@ const styles = StyleSheet.create({
richArea: {
fontSize: 12,
color: "red",
flexDirection: "column",
},
});
@@ -113,7 +112,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
return dd + "/" + mm + "/" + yyyy;
}
let values = docProps;
console.log("//////////////////////\n docprops:".docProps);
console.log("//////////////////////\n docprops:", docProps);
let appealTypeValue = getFormCollectionByID(values.appealType);
console.log("sdffhjdhjdjdgkj: ", values.procedureType);
@@ -156,7 +155,6 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
alt="PEDW Logo"
/>
</View>
<View>
<Text style={{ marginTop: 10, fontSize: 14 }}>
{getTrans(docProps.locale, "s78-heading-para-two")}
@@ -388,9 +386,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.enterNeighbouringLandAccessRequiredEvidence
}
{values.enterNeighbouringLandAccessRequiredEvidence ||
""}
</Html>
</View>
)}
@@ -423,9 +420,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.healthAndSafetyIssues == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.healthAndSafetyIssuesEvidence
}
{values.healthAndSafetyIssuesEvidence ||
""}
</Html>
</View>
)}
@@ -461,6 +457,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
</View>
</View>
<View>
<View
style={{
@@ -617,7 +614,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.ROW == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.ROWEvidence}
{values.ROWEvidence || ""}
</Html>
</View>
)}
@@ -650,7 +647,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.conservationArea == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.conservationAreaEvidence}
{values.conservationAreaEvidence ||
""}
</Html>
</View>
)}
@@ -683,9 +681,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.affectListedBuilding == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.affectListedBuildingEvidence
}
{values.affectListedBuildingEvidence ||
""}
</Html>
</View>
)}
@@ -718,7 +715,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.TPO == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.TPOEvidence}
{values.TPOEvidence || ""}
</Html>
</View>
)}
@@ -751,9 +748,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.natureConservationSite == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.natureConservationSiteEvidence
}
{values.natureConservationSiteEvidence ||
""}
</Html>
</View>
)}
@@ -786,7 +782,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.protectedSpecies == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.protectedSpeciesEvidence}
{values.protectedSpeciesEvidence ||
""}
</Html>
</View>
)}
@@ -838,9 +835,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.governmentDepartmentCommentsEvidence
}
{values.governmentDepartmentCommentsEvidence ||
""}
</Html>
</View>
)}
@@ -928,9 +924,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.developmentCarriedOutInAccordanceEvidence
}
{values.developmentCarriedOutInAccordanceEvidence ||
""}
</Html>
</View>
)}
@@ -1000,9 +995,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.developmentAnyOtherConditionsEvidence
}
{values.developmentAnyOtherConditionsEvidence ||
""}
</Html>
</View>
)}
@@ -1051,13 +1045,11 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.copyOfApplicantsCertificateEvidence
}
{values.copyOfApplicantsCertificateEvidence ||
""}
</Html>
</View>
</View>
<View
style={{
flexDirection: "column",
@@ -1086,11 +1078,10 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.advertismentGivenEvidence}
{values.advertismentGivenEvidence || ""}
</Html>
</View>
</View>
<View
style={{
flexDirection: "column",
@@ -1120,13 +1111,11 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.copyOfLetterOfAppealNotificationEvidence
}
{values.copyOfLetterOfAppealNotificationEvidence ||
""}
</Html>
</View>
</View>
<View
style={{
flexDirection: "column",
@@ -1155,12 +1144,11 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.lpaEIAOS == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.lpaEIAOSEvidence}
{values.lpaEIAOSEvidence || ""}
</Html>
</View>
)}
</View>
<View
style={{
flexDirection: "column",
@@ -1192,14 +1180,12 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.advertismentConsentDiscontinuanceNoticeEvidence
}
{values.advertismentConsentDiscontinuanceNoticeEvidence ||
""}
</Html>
</View>
)}
</View>
<View
style={{
flexDirection: "column",
@@ -1228,14 +1214,12 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.detailsOfOtherAppeals == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.detailsOfOtherAppealsEvidence
}
{values.detailsOfOtherAppealsEvidence ||
""}
</Html>
</View>
)}
</View>
<View
style={{
flexDirection: "column",
@@ -1264,14 +1248,12 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.detailsOfPreviousAppeals == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.detailsOfPreviousAppealsEvidence
}
{values.detailsOfPreviousAppealsEvidence ||
""}
</Html>
</View>
)}
</View>
<View
style={{
flexDirection: "column",
@@ -1300,9 +1282,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.otherRelevantInformation == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{
values.otherRelevantInformationEvidence
}
{values.otherRelevantInformationEvidence ||
""}
</Html>
</View>
)}
@@ -8,7 +8,6 @@ import ReactPDF, {
PDFViewer,
Font,
} from "@react-pdf/renderer";
import { createElement } from "react";
import Html from "react-pdf-html";
import { getFormCollectionByID, bytesToSize } from "../utils";
import fs from "fs";
+1
View File
@@ -97,6 +97,7 @@
"s78-section-question-32-hint": "Os Oes, rhowch y rhif(au) cyfeirnod ar cyfeiriad(au) ac atodwch neu mewnosodwch ddolenni ir penderfyniad(au) ac unrhyw ddogfennau cais perthnasol",
"s78-section-question-33": "Unrhyw wybodaeth berthnasol arall y dylem wybod amdani?",
"s78-section-question-33-hint": "Os Oes, rhowch ddisgrifiad byr ac atodwch neu mewnosodwch ddolenni i'r manylion perthnasol",
"s78-section-heading-six": "Ychwanegu eich ffeiliau",
"s78-section-heading-seven": "Datganiad",
"s78-section-question-signed": "Llofnodwyd",
"s78-section-question-onbehalf": "Ar ran",
+2 -1
View File
@@ -87,7 +87,7 @@
"s78-section-question-27-hint": "Insert weblink here if available online. If No, 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-29": "he LPAs Environmental Impact Assessment Screening Opinion, if applicable?",
"s78-section-question-29": "The LPAs 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-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",
@@ -97,6 +97,7 @@
"s78-section-question-32-hint": "If Yes, provide the reference number(s) and address(es) and attach or insert links to the decision(s) and any relevant application documents",
"s78-section-question-33": "Any other relevant information that we should know about?",
"s78-section-question-33-hint": "If Yes, provide a brief description and attach or insert links to the relevant details",
"s78-section-heading-six": "Add your files",
"s78-section-heading-seven": "Declaration",
"s78-section-question-signed": "Signed",
"s78-section-question-onbehalf": "On behalf of",
+17 -12
View File
@@ -116,7 +116,7 @@ export default async function handler(req, res) {
);
console.log(
"//////////////////////\nreqBodyobj" +
req.body +
JSON.stringify(req.body) +
"\n//////////////////////\n"
);
@@ -227,16 +227,21 @@ export default async function handler(req, res) {
containerID,
caseRef,
reqBodyobj.repfile_name
).then((data) => {
console.log(
"///////////////////////////////////\nrep pdf file created: " +
`${caseRef}/files/${reqBodyobj.repfile_name}.pdf`,
"\n/////////////////////////"
);
return res.status(200).json({
status: "success",
data: data,
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`,
)
.then((data) => {
console.log(
"///////////////////////////////////\nrep pdf file created: " +
`${caseRef}/files/${reqBodyobj.repfile_name}.pdf`,
"\n/////////////////////////"
);
return res.status(200).json({
status: "success",
data: data,
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`,
});
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
});
});
}