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
|
||||
|
||||
// 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
|
||||
//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, {
|
||||
"filesList": props.currentView.fileList,
|
||||
}),
|
||||
console.log("Rep Updated - props.caseReference"),
|
||||
console.log("Rep Updated - ", props.caseReference),
|
||||
uploadRepresentationFiles(values);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,18 @@ import {
|
||||
import Html from "react-pdf-html";
|
||||
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({
|
||||
page: {
|
||||
backgroundColor: "white",
|
||||
@@ -29,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",
|
||||
@@ -41,6 +53,28 @@ const styles = StyleSheet.create({
|
||||
paddingLeft: 10,
|
||||
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: {
|
||||
color: "#757575",
|
||||
width: "20%",
|
||||
@@ -53,15 +87,23 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
questionAnswerWide: {
|
||||
color: "#757575",
|
||||
width: "95%",
|
||||
width: "100%",
|
||||
fontSize: 12,
|
||||
marginLeft: "5%",
|
||||
border: 1,
|
||||
borderColor: "#eee",
|
||||
backgroundColor: "white",
|
||||
padding: 5,
|
||||
},
|
||||
|
||||
questionAnswerFull: {
|
||||
color: "#757575",
|
||||
width: "100%",
|
||||
fontSize: 10,
|
||||
padding: 5,
|
||||
border: 1,
|
||||
borderColor: "#eee",
|
||||
backgroundColor: "white",
|
||||
},
|
||||
sectionContainer: {
|
||||
backgroundColor: "#F8F8F8",
|
||||
padding: 10,
|
||||
@@ -174,8 +216,9 @@ export const EnforcementQuestionnaire_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>
|
||||
@@ -192,13 +235,14 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
>
|
||||
<Text style={styles.questionBullet}>2.</Text>
|
||||
<Text style={styles.questionText}>
|
||||
{t(
|
||||
"myrepresentations:s78-section-question-2"
|
||||
{getTrans(
|
||||
docProps.locale,
|
||||
"s78-section-question-2"
|
||||
)}
|
||||
:
|
||||
</Text>
|
||||
<Text style={styles.questionAnswer}>
|
||||
{values.lpaRef}
|
||||
{values.lpaReference}
|
||||
</Text>
|
||||
</View>
|
||||
<View
|
||||
@@ -226,7 +270,10 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
}}
|
||||
>
|
||||
<Text style={{ fontSize: 14 }}>
|
||||
{t("myrepresentations:s78-section-heading-one")}
|
||||
{getTrans(
|
||||
docProps.locale,
|
||||
"s78-section-heading-one"
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
@@ -681,16 +728,26 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
flexDirection: "column",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<Text style={styles.questionBullet}>18.</Text>
|
||||
<Text style={styles.questionText}>
|
||||
LPA’s adopted Local Development Plan and
|
||||
Proposals Map
|
||||
</Text>
|
||||
<View style={styles.questionAnswer}>
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<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}>
|
||||
{CleanHTML(values.LPAldpAndMap)}
|
||||
</Html>
|
||||
@@ -699,16 +756,26 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
flexDirection: "column",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<Text style={styles.questionBullet}>19.</Text>
|
||||
<Text style={styles.questionText}>
|
||||
Adopted local guidance relevant to the
|
||||
proposal:
|
||||
</Text>
|
||||
<View style={styles.questionAnswer}>
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<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}>
|
||||
{CleanHTML(values.LPAlocalGuidance)}
|
||||
</Html>
|
||||
@@ -1271,7 +1338,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
<View style={styles.questionAnswerWide}>
|
||||
<Html style={styles.richArea}>
|
||||
{CleanHTML(
|
||||
values.enforcementNoticePlan
|
||||
values.enforcementNoticePlanEvidence
|
||||
)}
|
||||
</Html>
|
||||
</View>
|
||||
@@ -1506,11 +1573,23 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
style={{ width: "40%", fontSize: 12 }}
|
||||
style={{ width: "15%", fontSize: 12 }}
|
||||
>
|
||||
Signed:
|
||||
</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}
|
||||
</Text>
|
||||
</View>
|
||||
@@ -1521,10 +1600,16 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Text style={styles.questionText}>
|
||||
<Text
|
||||
style={{
|
||||
width: "40",
|
||||
fontSize: 12,
|
||||
marginLeft: 10,
|
||||
}}
|
||||
>
|
||||
Date:
|
||||
</Text>
|
||||
<Text style={styles.questionAnswer}>
|
||||
<Text style={styles.questionAnswerSmaller}>
|
||||
{formatDates(values.signedDate)}
|
||||
</Text>
|
||||
</View>
|
||||
@@ -1534,6 +1619,7 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 10,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Text style={{ width: "18%", fontSize: 12 }}>
|
||||
@@ -1559,17 +1645,24 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
flexDirection: "column",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<Text style={styles.questionBullet}></Text>
|
||||
<Text style={styles.questionText}>
|
||||
List of attached files
|
||||
</Text>
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<Text style={styles.questionTextWide}>
|
||||
List of attached files
|
||||
</Text>
|
||||
</View>
|
||||
<View
|
||||
style={[
|
||||
styles.questionAnswer,
|
||||
styles.questionAnswerFull,
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
@@ -1586,12 +1679,13 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
styles.questionAnswer
|
||||
}
|
||||
>
|
||||
{p.name} -{" "}
|
||||
{bytesToSize(
|
||||
p.size
|
||||
p.size ||
|
||||
p.contentLength
|
||||
)}{" "}
|
||||
{"\n"}
|
||||
</Text>
|
||||
@@ -1602,13 +1696,6 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
|
||||
</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>
|
||||
<Text
|
||||
|
||||
@@ -1492,6 +1492,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 10,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Text style={{ width: "18%", fontSize: 12 }}>
|
||||
|
||||
@@ -94,6 +94,7 @@ import ReactPDF, {
|
||||
import middleware from "../middleware/middleware";
|
||||
import nextConnect from "next-connect";
|
||||
import fs from "fs";
|
||||
import { EnforcementQuestionnaire_pdf } from "../../../components/pdftemplates/enforcement_pdf";
|
||||
import { lpaQuestionnaire_pdf } from "../../../components/pdftemplates/lpaQuestionnaire_pdf";
|
||||
import { finalComments_pdf } from "../../../components/pdftemplates/finalComments_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);
|
||||
switch (values.docProps.representationType) {
|
||||
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);
|
||||
break;
|
||||
case "Final comments":
|
||||
@@ -268,6 +284,12 @@ export default async function handler(req, res) {
|
||||
// "\n/////////////////////////"
|
||||
// );
|
||||
|
||||
// umcomment to render pdf locally
|
||||
// ReactPDF.render(
|
||||
// <MyDocument docProps={reqBodyobj} />,
|
||||
// process.cwd() + `/tmp/${reqBodyobj.repfile_name}.pdf`
|
||||
// );
|
||||
|
||||
const renderedPDF = await ReactPDF.renderToStream(
|
||||
<MyDocument docProps={reqBodyobj} />
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user