Merged PR 1365: enforcement pdf fixes
enforcement pdf fixes Related work items: #13012
This commit is contained in:
+3
-1
@@ -138,7 +138,9 @@ APPLICATIONINSIGHTS_CONNECTIONSTRING = InstrumentationKey=7a06e24a-793c-47bc-898
|
|||||||
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=cc60e8e7-5b30-4c2b-a176-8b96b21b12df;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=2a4094be-6fd1-46ab-a67d-5f241692b129
|
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=cc60e8e7-5b30-4c2b-a176-8b96b21b12df;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=2a4094be-6fd1-46ab-a67d-5f241692b129
|
||||||
|
|
||||||
// Preprod Connection string
|
// Preprod Connection string
|
||||||
NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=7370f0f9-834d-4c7a-b3c4-9951fcad5ad2;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=04362cb7-6dfc-469e-8274-12243e8be851
|
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=7370f0f9-834d-4c7a-b3c4-9951fcad5ad2;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=04362cb7-6dfc-469e-8274-12243e8be851
|
||||||
|
|
||||||
|
NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=a41b91bf-f7dc-4f44-bb66-a67df4eee435;IngestionEndpoint=https://uksouth-1.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/;ApplicationId=473d0632-16f1-4065-8984-d6bac62402c0
|
||||||
|
|
||||||
// Prod Connection string
|
// Prod Connection string
|
||||||
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
|
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
|
||||||
|
|||||||
@@ -874,7 +874,7 @@ let MakeRepresentation = (props) => {
|
|||||||
: Object.assign(values, {
|
: Object.assign(values, {
|
||||||
"filesList": props.currentView.fileList,
|
"filesList": props.currentView.fileList,
|
||||||
}),
|
}),
|
||||||
console.log("Rep Updated - props.caseReference"),
|
console.log("Rep Updated - ", props.caseReference),
|
||||||
uploadRepresentationFiles(values);
|
uploadRepresentationFiles(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,18 @@ import {
|
|||||||
import Html from "react-pdf-html";
|
import Html from "react-pdf-html";
|
||||||
import { getFormCollectionByID, bytesToSize } from "../../components/utils";
|
import { getFormCollectionByID, bytesToSize } from "../../components/utils";
|
||||||
|
|
||||||
|
import transLookupCY from "../../locales/cy/myrepresentations.json";
|
||||||
|
import transLookupEN from "../../locales/en/myrepresentations.json";
|
||||||
|
|
||||||
|
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({
|
const styles = StyleSheet.create({
|
||||||
page: {
|
page: {
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
@@ -29,7 +41,7 @@ const styles = StyleSheet.create({
|
|||||||
logoImage: { width: "200pt" },
|
logoImage: { width: "200pt" },
|
||||||
questionBullet: { width: "5%", fontSize: 12 },
|
questionBullet: { width: "5%", fontSize: 12 },
|
||||||
questionText: { width: "30%", 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 },
|
questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 },
|
||||||
questionAnswer: {
|
questionAnswer: {
|
||||||
color: "#757575",
|
color: "#757575",
|
||||||
@@ -41,6 +53,28 @@ const styles = StyleSheet.create({
|
|||||||
paddingLeft: 10,
|
paddingLeft: 10,
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
},
|
},
|
||||||
|
questionAnswerSmall: {
|
||||||
|
color: "#757575",
|
||||||
|
width: "300",
|
||||||
|
fontSize: 12,
|
||||||
|
padding: 5,
|
||||||
|
border: 1,
|
||||||
|
borderColor: "#eee",
|
||||||
|
paddingLeft: 10,
|
||||||
|
paddingRight: 10,
|
||||||
|
backgroundColor: "white",
|
||||||
|
marginRight: 10,
|
||||||
|
},
|
||||||
|
questionAnswerSmaller: {
|
||||||
|
color: "#757575",
|
||||||
|
width: "90",
|
||||||
|
fontSize: 12,
|
||||||
|
padding: 5,
|
||||||
|
border: 1,
|
||||||
|
borderColor: "#eee",
|
||||||
|
paddingLeft: 10,
|
||||||
|
backgroundColor: "white",
|
||||||
|
},
|
||||||
questionAnswerMid: {
|
questionAnswerMid: {
|
||||||
color: "#757575",
|
color: "#757575",
|
||||||
width: "20%",
|
width: "20%",
|
||||||
@@ -53,15 +87,23 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
questionAnswerWide: {
|
questionAnswerWide: {
|
||||||
color: "#757575",
|
color: "#757575",
|
||||||
width: "95%",
|
width: "100%",
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
marginLeft: "5%",
|
|
||||||
border: 1,
|
border: 1,
|
||||||
borderColor: "#eee",
|
borderColor: "#eee",
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
padding: 5,
|
padding: 5,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
questionAnswerFull: {
|
||||||
|
color: "#757575",
|
||||||
|
width: "100%",
|
||||||
|
fontSize: 10,
|
||||||
|
padding: 5,
|
||||||
|
border: 1,
|
||||||
|
borderColor: "#eee",
|
||||||
|
backgroundColor: "white",
|
||||||
|
},
|
||||||
sectionContainer: {
|
sectionContainer: {
|
||||||
backgroundColor: "#F8F8F8",
|
backgroundColor: "#F8F8F8",
|
||||||
padding: 10,
|
padding: 10,
|
||||||
@@ -174,8 +216,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
>
|
>
|
||||||
<Text style={styles.questionBullet}>1.</Text>
|
<Text style={styles.questionBullet}>1.</Text>
|
||||||
<Text style={styles.questionText}>
|
<Text style={styles.questionText}>
|
||||||
{t(
|
{getTrans(
|
||||||
"myrepresentations:s78-section-question-1"
|
docProps.locale,
|
||||||
|
"s78-section-question-1"
|
||||||
)}
|
)}
|
||||||
:
|
:
|
||||||
</Text>
|
</Text>
|
||||||
@@ -192,13 +235,14 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
>
|
>
|
||||||
<Text style={styles.questionBullet}>2.</Text>
|
<Text style={styles.questionBullet}>2.</Text>
|
||||||
<Text style={styles.questionText}>
|
<Text style={styles.questionText}>
|
||||||
{t(
|
{getTrans(
|
||||||
"myrepresentations:s78-section-question-2"
|
docProps.locale,
|
||||||
|
"s78-section-question-2"
|
||||||
)}
|
)}
|
||||||
:
|
:
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.questionAnswer}>
|
<Text style={styles.questionAnswer}>
|
||||||
{values.lpaRef}
|
{values.lpaReference}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
@@ -226,7 +270,10 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={{ fontSize: 14 }}>
|
<Text style={{ fontSize: 14 }}>
|
||||||
{t("myrepresentations:s78-section-heading-one")}
|
{getTrans(
|
||||||
|
docProps.locale,
|
||||||
|
"s78-section-heading-one"
|
||||||
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.sectionContainer}>
|
<View style={styles.sectionContainer}>
|
||||||
@@ -681,16 +728,26 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
<View
|
<View
|
||||||
wrap={false}
|
wrap={false}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "column",
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.questionBullet}>18.</Text>
|
<View
|
||||||
<Text style={styles.questionText}>
|
wrap={false}
|
||||||
LPA’s adopted Local Development Plan and
|
style={{
|
||||||
Proposals Map
|
flexDirection: "row",
|
||||||
</Text>
|
marginBottom: 10,
|
||||||
<View style={styles.questionAnswer}>
|
}}
|
||||||
|
>
|
||||||
|
<Text style={styles.questionBullet}>
|
||||||
|
18.
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.questionTextWide}>
|
||||||
|
LPA’s adopted Local Development Plan and
|
||||||
|
Proposals Map
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.questionAnswerWide}>
|
||||||
<Html style={styles.richArea}>
|
<Html style={styles.richArea}>
|
||||||
{CleanHTML(values.LPAldpAndMap)}
|
{CleanHTML(values.LPAldpAndMap)}
|
||||||
</Html>
|
</Html>
|
||||||
@@ -699,16 +756,26 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
<View
|
<View
|
||||||
wrap={false}
|
wrap={false}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "column",
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.questionBullet}>19.</Text>
|
<View
|
||||||
<Text style={styles.questionText}>
|
wrap={false}
|
||||||
Adopted local guidance relevant to the
|
style={{
|
||||||
proposal:
|
flexDirection: "row",
|
||||||
</Text>
|
marginBottom: 10,
|
||||||
<View style={styles.questionAnswer}>
|
}}
|
||||||
|
>
|
||||||
|
<Text style={styles.questionBullet}>
|
||||||
|
19.
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.questionTextWide}>
|
||||||
|
Adopted local guidance relevant to the
|
||||||
|
proposal:
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.questionAnswerWide}>
|
||||||
<Html style={styles.richArea}>
|
<Html style={styles.richArea}>
|
||||||
{CleanHTML(values.LPAlocalGuidance)}
|
{CleanHTML(values.LPAlocalGuidance)}
|
||||||
</Html>
|
</Html>
|
||||||
@@ -1271,7 +1338,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
<View style={styles.questionAnswerWide}>
|
<View style={styles.questionAnswerWide}>
|
||||||
<Html style={styles.richArea}>
|
<Html style={styles.richArea}>
|
||||||
{CleanHTML(
|
{CleanHTML(
|
||||||
values.enforcementNoticePlan
|
values.enforcementNoticePlanEvidence
|
||||||
)}
|
)}
|
||||||
</Html>
|
</Html>
|
||||||
</View>
|
</View>
|
||||||
@@ -1506,11 +1573,23 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
style={{ width: "40%", fontSize: 12 }}
|
style={{ width: "15%", fontSize: 12 }}
|
||||||
>
|
>
|
||||||
Signed:
|
Signed:
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.questionAnswer}>
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "#757575",
|
||||||
|
width: "310",
|
||||||
|
fontSize: 12,
|
||||||
|
padding: 5,
|
||||||
|
border: 1,
|
||||||
|
borderColor: "#eee",
|
||||||
|
backgroundColor: "white",
|
||||||
|
paddingRight: 10,
|
||||||
|
}}
|
||||||
|
wrap={true}
|
||||||
|
>
|
||||||
{values.caseOfficer}
|
{values.caseOfficer}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -1521,10 +1600,16 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.questionText}>
|
<Text
|
||||||
|
style={{
|
||||||
|
width: "40",
|
||||||
|
fontSize: 12,
|
||||||
|
marginLeft: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
Date:
|
Date:
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.questionAnswer}>
|
<Text style={styles.questionAnswerSmaller}>
|
||||||
{formatDates(values.signedDate)}
|
{formatDates(values.signedDate)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -1534,6 +1619,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={{ width: "18%", fontSize: 12 }}>
|
<Text style={{ width: "18%", fontSize: 12 }}>
|
||||||
@@ -1559,17 +1645,24 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
<View
|
<View
|
||||||
wrap={false}
|
wrap={false}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "column",
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.questionBullet}></Text>
|
<View
|
||||||
<Text style={styles.questionText}>
|
wrap={false}
|
||||||
List of attached files
|
style={{
|
||||||
</Text>
|
flexDirection: "row",
|
||||||
|
marginBottom: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={styles.questionTextWide}>
|
||||||
|
List of attached files
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
styles.questionAnswer,
|
styles.questionAnswerFull,
|
||||||
{ flexDirection: "column" },
|
{ flexDirection: "column" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -1586,12 +1679,13 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
styles={
|
styles={
|
||||||
styles.questionTextMid
|
styles.questionAnswer
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{p.name} -{" "}
|
{p.name} -{" "}
|
||||||
{bytesToSize(
|
{bytesToSize(
|
||||||
p.size
|
p.size ||
|
||||||
|
p.contentLength
|
||||||
)}{" "}
|
)}{" "}
|
||||||
{"\n"}
|
{"\n"}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -1602,13 +1696,6 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ marginTop: 50, fontSize: 12 }}>
|
|
||||||
<Text>
|
|
||||||
* Regulation 45 of the Town and Country Planning
|
|
||||||
(Environmental Impact Assessment) (Wales)
|
|
||||||
Regulations 2017 (as amended).
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Text
|
<Text
|
||||||
|
|||||||
@@ -1492,6 +1492,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={{ width: "18%", fontSize: 12 }}>
|
<Text style={{ width: "18%", fontSize: 12 }}>
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ import ReactPDF, {
|
|||||||
import middleware from "../middleware/middleware";
|
import middleware from "../middleware/middleware";
|
||||||
import nextConnect from "next-connect";
|
import nextConnect from "next-connect";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import { EnforcementQuestionnaire_pdf } from "../../../components/pdftemplates/enforcement_pdf";
|
||||||
import { lpaQuestionnaire_pdf } from "../../../components/pdftemplates/lpaQuestionnaire_pdf";
|
import { lpaQuestionnaire_pdf } from "../../../components/pdftemplates/lpaQuestionnaire_pdf";
|
||||||
import { finalComments_pdf } from "../../../components/pdftemplates/finalComments_pdf";
|
import { finalComments_pdf } from "../../../components/pdftemplates/finalComments_pdf";
|
||||||
import { statement_pdf } from "../../../components/pdftemplates/statement_pdf";
|
import { statement_pdf } from "../../../components/pdftemplates/statement_pdf";
|
||||||
@@ -182,6 +183,21 @@ export default async function handler(req, res) {
|
|||||||
console.log(values.docProps.locale);
|
console.log(values.docProps.locale);
|
||||||
switch (values.docProps.representationType) {
|
switch (values.docProps.representationType) {
|
||||||
case "Questionnaire":
|
case "Questionnaire":
|
||||||
|
switch (values.docProps.appealType) {
|
||||||
|
case 846040005:
|
||||||
|
case 846040006:
|
||||||
|
case 846040007:
|
||||||
|
return EnforcementQuestionnaire_pdf(
|
||||||
|
values,
|
||||||
|
values.docProps.locale
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return lpaQuestionnaire_pdf(
|
||||||
|
values,
|
||||||
|
values.docProps.locale
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return lpaQuestionnaire_pdf(values, values.docProps.locale);
|
return lpaQuestionnaire_pdf(values, values.docProps.locale);
|
||||||
break;
|
break;
|
||||||
case "Final comments":
|
case "Final comments":
|
||||||
@@ -268,6 +284,12 @@ export default async function handler(req, res) {
|
|||||||
// "\n/////////////////////////"
|
// "\n/////////////////////////"
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
// umcomment to render pdf locally
|
||||||
|
// ReactPDF.render(
|
||||||
|
// <MyDocument docProps={reqBodyobj} />,
|
||||||
|
// process.cwd() + `/tmp/${reqBodyobj.repfile_name}.pdf`
|
||||||
|
// );
|
||||||
|
|
||||||
const renderedPDF = await ReactPDF.renderToStream(
|
const renderedPDF = await ReactPDF.renderToStream(
|
||||||
<MyDocument docProps={reqBodyobj} />
|
<MyDocument docProps={reqBodyobj} />
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user