Merged PR 1081: updated rep pdfs for multilingual

updated rep pdfs for multilingual

Related work items: #10403
This commit is contained in:
Robert Bond
2024-02-13 08:05:39 +00:00
6 changed files with 223 additions and 55 deletions
+2 -2
View File
@@ -115,10 +115,10 @@ let MakeRepresentation = (props) => {
var detailsObj = {};
detailsObj = jsonpath(
setCaseDetailsObj,
'$..[?(@.pinswg_name=="' +
currentView.caseReference.currentReference +
'")]'
'")]',
setCaseDetailsObj
);
detailsObj = detailsObj[0];
+98 -24
View File
@@ -14,6 +14,19 @@ import { getFormCollectionByID } from "../../components/utils";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
import transLookupCY from "../../locales/cy/myrepresentations.json";
import transLookupEN from "../../locales/en/myrepresentations.json";
import { JSONPath as jsonpath } from "jsonpath-plus";
const getTrans = (locale, key) => {
let jsonQuery = `$.${key}`;
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]);
return jsonObj[key];
};
const styles = StyleSheet.create({
page: {
backgroundColor: "white",
@@ -117,7 +130,11 @@ export const finalComments_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
Final Comments
F
{getTrans(
docProps.locale,
"final-comments-label"
)}
</Text>
<View>
<Text
@@ -128,9 +145,9 @@ export const finalComments_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
{/* For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
applications/appeals */}
</Text>
</View>
</View>
@@ -148,7 +165,12 @@ export const finalComments_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case details</Text>
<Text style={{ fontSize: 14 }}>
{getTrans(
docProps.locale,
"statement-case-details-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
<View
@@ -158,9 +180,13 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1a.</Text>
<Text style={styles.questionBullet}>1.</Text>
<Text style={styles.questionText}>
Case reference :
{getTrans(
docProps.locale,
"s78-section-question-1"
)}{" "}
:
</Text>
<Text style={styles.questionAnswer}>
{values.caseRef}
@@ -173,9 +199,13 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}></Text>
<Text style={styles.questionBullet}>2.</Text>
<Text style={styles.questionText}>
Representation capacity:
{getTrans(
docProps.locale,
"statement-representation-capacity-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{values.representationCapacity}
@@ -188,9 +218,13 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}></Text>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionText}>
Representation capacity{"\n"} details:
{getTrans(
docProps.locale,
"statement-representation-capacity-details-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
<Html style={styles.richArea}>
@@ -214,9 +248,13 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionText}>
Site address/grid ref:
{getTrans(
docProps.locale,
"s78-section-question-3"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{values.siteAddress}
@@ -229,9 +267,13 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionBullet}>5.</Text>
<Text style={styles.questionText}>
Case Type:
{getTrans(
docProps.locale,
"statement-case-type-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value}
@@ -246,7 +288,12 @@ export const finalComments_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Comments</Text>
<Text style={{ fontSize: 14 }}>
{getTrans(
docProps.locale,
"statement-comments-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
<View
@@ -263,10 +310,13 @@ export const finalComments_pdf = ({ docProps }) => {
}}
>
<Text style={styles.questionBullet}>
5.
6.
</Text>
<Text style={styles.questionTextMid}>
Final Comments
{getTrans(
docProps.locale,
"final-comments-label"
)}
</Text>
</View>
<View style={styles.questionAnswerWide}>
@@ -285,7 +335,10 @@ export const finalComments_pdf = ({ docProps }) => {
}}
>
<Text style={{ fontSize: 14 }}>
Supporting documents
{getTrans(
docProps.locale,
"statement-supporting-documents-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
@@ -296,9 +349,12 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionBullet}>7.</Text>
<Text style={styles.questionText}>
List of attached files
{getTrans(
docProps.locale,
"statement-list-of-attached-files-label"
)}
</Text>
<View
style={[
@@ -337,7 +393,13 @@ export const finalComments_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
<Text>Declaration</Text>
<Text>
{" "}
{getTrans(
docProps.locale,
"statement-declaration-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
<View
@@ -357,7 +419,11 @@ export const finalComments_pdf = ({ docProps }) => {
<Text
style={{ width: "40%", fontSize: 12 }}
>
Signed:
{getTrans(
docProps.locale,
"statement-signed-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{values.firstname} {values.lastname}
@@ -371,7 +437,11 @@ export const finalComments_pdf = ({ docProps }) => {
}}
>
<Text style={styles.questionText}>
Date:
{getTrans(
docProps.locale,
"statement-date-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{signedDate}
@@ -386,7 +456,11 @@ export const finalComments_pdf = ({ docProps }) => {
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
On behalf of:
{getTrans(
docProps.locale,
"statement-onbehalf-label"
)}
:
</Text>
<Text style={styles.questionAnswerWide}>
{values.representationCapacity}
+93 -25
View File
@@ -11,9 +11,23 @@ import ReactPDF, {
import { createElement } from "react";
import Html from "react-pdf-html";
import { getFormCollectionByID } from "../../components/utils";
import useTranslation from "next-translate/useTranslation";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
import transLookupCY from "../../locales/cy/myrepresentations.json";
import transLookupEN from "../../locales/en/myrepresentations.json";
import { JSONPath as jsonpath } from "jsonpath-plus";
const getTrans = (locale, key) => {
let jsonQuery = `$.${key}`;
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]);
return jsonObj[key];
};
const styles = StyleSheet.create({
page: {
backgroundColor: "white",
@@ -90,7 +104,7 @@ const styles = StyleSheet.create({
});
export const statement_pdf = ({ docProps }) => {
//console.log("----", docProps);
console.log("----", docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
@@ -104,7 +118,7 @@ export const statement_pdf = ({ docProps }) => {
let datestr = values.pinswg_name.split("-");
let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
let appealTypeValue = getFormCollectionByID(values.appealType);
let { t } = useTranslation();
return (
<Document>
<Page size="A4" style={styles.page} wrap>
@@ -117,7 +131,10 @@ export const statement_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
Statement
{getTrans(
docProps.locale,
"statement-statement-label"
)}
</Text>
<View>
<Text
@@ -128,9 +145,9 @@ export const statement_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
{/* For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
applications/appeals */}
</Text>
</View>
</View>
@@ -148,7 +165,12 @@ export const statement_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case details</Text>
<Text style={{ fontSize: 14 }}>
{getTrans(
docProps.locale,
"statement-case-details-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
<View
@@ -160,10 +182,10 @@ export const statement_pdf = ({ docProps }) => {
>
<Text style={styles.questionBullet}>1.</Text>
<Text style={styles.questionText}>
{t(
"myrepresentations:s78-section-question-1"
{getTrans(
docProps.locale,
"s78-section-question-1"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{values.caseRef}
@@ -178,7 +200,11 @@ export const statement_pdf = ({ docProps }) => {
>
<Text style={styles.questionBullet}>1a.</Text>
<Text style={styles.questionText}>
Representation capacity:
{getTrans(
docProps.locale,
"statement-representation-capacity-label"
)}
:{" "}
</Text>
<Text style={styles.questionAnswer}>
{values.representationCapacity}
@@ -193,7 +219,11 @@ export const statement_pdf = ({ docProps }) => {
>
<Text style={styles.questionBullet}>1c.</Text>
<Text style={styles.questionText}>
Representation capacity details:
{getTrans(
docProps.locale,
"statement-representation-capacity-details-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
<Html style={styles.richArea}>
@@ -217,9 +247,12 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionBullet}>2.</Text>
<Text style={styles.questionText}>
Site address/grid ref:
{getTrans(
docProps.locale,
"s78-section-question-3"
)}
</Text>
<Text style={styles.questionAnswer}>
{values.siteAddress}
@@ -232,9 +265,13 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionText}>
Case Type:
{getTrans(
docProps.locale,
"statement-case-type-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value}
@@ -249,7 +286,12 @@ export const statement_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Comments</Text>
<Text style={{ fontSize: 14 }}>
{getTrans(
docProps.locale,
"statement-comments-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
<View
@@ -266,10 +308,13 @@ export const statement_pdf = ({ docProps }) => {
}}
>
<Text style={styles.questionBullet}>
5.
4.
</Text>
<Text style={styles.questionTextMid}>
Statement
{getTrans(
docProps.locale,
"statement-statement-label"
)}
</Text>
</View>
<View style={styles.questionAnswerWide}>
@@ -288,7 +333,10 @@ export const statement_pdf = ({ docProps }) => {
}}
>
<Text style={{ fontSize: 14 }}>
Supporting documents
{getTrans(
docProps.locale,
"statement-supporting-documents-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
@@ -299,9 +347,12 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionBullet}>5.</Text>
<Text style={styles.questionText}>
List of attached files
{getTrans(
docProps.locale,
"statement-list-of-attached-files-label"
)}
</Text>
<View
style={[
@@ -340,7 +391,12 @@ export const statement_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
<Text>Declaration</Text>
<Text>
{getTrans(
docProps.locale,
"statement-declaration-header"
)}
</Text>
</View>
<View style={styles.sectionContainer}>
<View
@@ -360,7 +416,11 @@ export const statement_pdf = ({ docProps }) => {
<Text
style={{ width: "40%", fontSize: 12 }}
>
Signed:
{getTrans(
docProps.locale,
"statement-signed-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{values.firstname} {values.lastname}
@@ -374,7 +434,11 @@ export const statement_pdf = ({ docProps }) => {
}}
>
<Text style={styles.questionText}>
Date:
{getTrans(
docProps.locale,
"statement-date-label"
)}
:
</Text>
<Text style={styles.questionAnswer}>
{signedDate}
@@ -389,7 +453,11 @@ export const statement_pdf = ({ docProps }) => {
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
On behalf of:
{getTrans(
docProps.locale,
"statement-onbehalf-label"
)}
:
</Text>
<Text style={styles.questionAnswerWide}>
{values.representationCapacity}
@@ -128,9 +128,9 @@ export const writtenStatement_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
{/* For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
applications/appeals */}
</Text>
</View>
</View>
+14 -1
View File
@@ -195,5 +195,18 @@
"s78-heading-para-two": "Rhaid i'r ACLl anfon yr holiadur wedi'i gwblhau ac unrhyw atodiadau i PEDW.gwaithachos@llyw.cymru a'r apelydd (neu ei asiant) o fewn 5 diwrnod gwaith i'r dyddiad dechrau a nodir yn ein llythyr cychwyn. ",
"section-heading-zero": "Manylion yr Achos",
"s78-footnote-one": "* Erthygl 11 o Orchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Rheoliad 7 o Reoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012",
"s78-footnote-two": "** Erthygl 12 o Orchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Adran 67/73 o Ddeddf Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) 1990; Rheoliad 10 o Reoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012"
"s78-footnote-two": "** Erthygl 12 o Orchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Adran 67/73 o Ddeddf Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) 1990; Rheoliad 10 o Reoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012",
"statement-case-type-label": "Math o achos",
"statement-representation-capacity-label": "Capasiti cynrychiolaeth",
"statement-representation-capacity-details-label": "Manylion capasiti cynrychiolaeth",
"statement-statement-label": "Datganiad",
"statement-list-of-attached-files-label": "Rhestr o ffeiliau atodedig",
"statement-supporting-documents-header": "Dogfennau ategol",
"statement-comments-header": "Sylwadau",
"statement-case-details-header": "Manylion yr achos",
"statement-declaration-header": "Datganiad",
"statement-signed-label": "Llofnodwyd",
"statement-date-label": "Dyddiad",
"statement-onbehalf-label": "Ar ran",
"final-comments-label": "Sylwadau terfynol"
}
+14 -1
View File
@@ -196,5 +196,18 @@
"s78-heading-para-two": "The LPA must send the completed questionnaire and any attachments to PEDW.casework@gov.wales and the appellant (or their agent) within 5 working days of the start date specified in our start letter",
"section-heading-zero": "Case Details",
"s78-footnote-one": "* Article 11 of The Town and Country Planning (Development Management Procedure) (Wales) Order 2012; Regulation 7 of The Town and Country Planning (Listed Buildings and Conservation Areas) (Wales) Regulations 2012",
"s78-footnote-two": "** Article 12 of The Town and Country Planning (Development Management Procedure) (Wales) Order 2012; Section 67/73 of The Town and Country Planning (Listed Buildings and Conservation Areas) Act 1990; Regulation 10 of The Town and Country Planning (Listed Buildings and Conservation Areas) (Wales) Regulations 2012"
"s78-footnote-two": "** Article 12 of The Town and Country Planning (Development Management Procedure) (Wales) Order 2012; Section 67/73 of The Town and Country Planning (Listed Buildings and Conservation Areas) Act 1990; Regulation 10 of The Town and Country Planning (Listed Buildings and Conservation Areas) (Wales) Regulations 2012",
"statement-case-type-label": "Case type",
"statement-representation-capacity-label": "Representation capacity",
"statement-representation-capacity-details-label": "Representation capacity details",
"statement-statement-label": "Statement",
"statement-list-of-attached-files-label": "List of attached files",
"statement-supporting-documents-header": "Supporting documents",
"statement-comments-header": "Comments",
"statement-case-details-header": "Case details",
"statement-declaration-header": "Declaration",
"statement-signed-label": "Signed",
"statement-date-label": "Date",
"statement-onbehalf-label": "On behalf of",
"final-comments-label": "Final comments"
}