Merged PR 1062: finalised new appeal pdf to show selected dropdowns
finalised new appeal pdf to show selected dropdowns Related work items: #9494
This commit is contained in:
+3
-1
@@ -52,7 +52,7 @@ NEXTAUTH_URL=$API_ROOT
|
||||
NEXTAUTH_URL_INTERNAL=$API_ROOT
|
||||
NEXTAUTH_SECRET = SuperSecret
|
||||
|
||||
DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
SECRET = SuperSecret
|
||||
|
||||
|
||||
@@ -63,9 +63,11 @@ AZURE_CLIENT_ID = $CLIENT_ID
|
||||
AZURE_TENANT_ID = $TENANT
|
||||
AZURE_CLIENT_SECRET = $CLIENT_SECRET
|
||||
AZURE_STORAGE_ACCOUNT_NAME= "pedwdev"
|
||||
//AZURE_STORAGE_ACCOUNT_NAME= "pedwtest"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = JS3ZIXianhYhB1lZrHB+bXbdzaLlON0alCyKrFAb+jVEwr9iqo2dty92EBxwnufNFM+CSN/fKX2R+AStDn0byg==
|
||||
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net
|
||||
//AZURE_PEDW_STORAGE_ENDPOINT = https://pedwtest.blob.core.windows.net
|
||||
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||
AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net
|
||||
|
||||
|
||||
+3
-2
@@ -1387,7 +1387,8 @@ export const generateRepPDF = async (formValues, containerID, casefolderID) => {
|
||||
export const generateAppealPDF = async (
|
||||
formValues,
|
||||
containerID,
|
||||
casefolderID
|
||||
casefolderID,
|
||||
appealType
|
||||
) => {
|
||||
//let files = filesObj;
|
||||
|
||||
@@ -1397,7 +1398,7 @@ export const generateAppealPDF = async (
|
||||
// formValues.append("containerID", containerID);
|
||||
// formValues.append("casefolderID", casefolderID);
|
||||
|
||||
var queryUrl = "/api/file/generateappealpdf";
|
||||
var queryUrl = "/api/file/generateappealpdf?appealType=" + appealType;
|
||||
|
||||
const config = {
|
||||
method: "post",
|
||||
|
||||
@@ -173,6 +173,7 @@ let BuildSection = (props) => {
|
||||
values,
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
props.appealType,
|
||||
"\n////////////////////////\n"
|
||||
);
|
||||
|
||||
@@ -186,7 +187,8 @@ let BuildSection = (props) => {
|
||||
generateAppealPDF(
|
||||
pdfObj,
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
router.query.appealtypes
|
||||
),
|
||||
props.setNewAppealProgress(
|
||||
getProgressObj(formXML, titleList, mandatoryFieldsData, props)
|
||||
|
||||
@@ -179,6 +179,10 @@ export const AppealRow_pdf = (props) => {
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
|
||||
var datafieldcontent = xpath.select("//@datafieldcontent", doc);
|
||||
|
||||
console.log(datafieldname[0].value);
|
||||
|
||||
return (
|
||||
<>
|
||||
{(() => {
|
||||
@@ -253,6 +257,32 @@ export const AppealRow_pdf = (props) => {
|
||||
);
|
||||
break;
|
||||
case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
||||
var fieldCopy = datafieldcontent[0].value
|
||||
.split(",")
|
||||
.find((a) =>
|
||||
a.includes(
|
||||
props.props[
|
||||
datafieldname[0].value
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
fieldCopy =
|
||||
typeof fieldCopy != "undefined"
|
||||
? fieldCopy.split("|")[1]
|
||||
: fieldCopy;
|
||||
|
||||
const transData = require("../../locales/en/" +
|
||||
(typeof fieldCopy != "undefined"
|
||||
? fieldCopy.split(":")[0]
|
||||
: "common") +
|
||||
".json");
|
||||
|
||||
let transCopy =
|
||||
typeof fieldCopy != "undefined"
|
||||
? transData[fieldCopy.split(":")[1]]
|
||||
: fieldCopy;
|
||||
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
@@ -268,20 +298,19 @@ export const AppealRow_pdf = (props) => {
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
style={styles.questionText}
|
||||
style={
|
||||
styles.questionTextWide
|
||||
}
|
||||
>
|
||||
{rows[0].value}
|
||||
{rows[0].value}{" "}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.questionAnswer}>
|
||||
<Text>
|
||||
{
|
||||
props.props[
|
||||
datafieldname[0]
|
||||
.value
|
||||
]
|
||||
}
|
||||
</Text>
|
||||
<View
|
||||
style={
|
||||
styles.questionAnswerWide
|
||||
}
|
||||
>
|
||||
<Text>{transCopy}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@@ -326,6 +355,31 @@ export const AppealRow_pdf = (props) => {
|
||||
</View>
|
||||
);
|
||||
break;
|
||||
case "{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}":
|
||||
return (
|
||||
<View
|
||||
wrap={false}
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
<Text style={styles.questionText}>
|
||||
{/* {FieldsTranslations(rows[0].value)} */}
|
||||
{rows[0].value}
|
||||
</Text>
|
||||
<Text style={styles.questionAnswer}>
|
||||
{getPickListLabel(
|
||||
props.pickListData,
|
||||
datafieldname[0].value,
|
||||
props.props[
|
||||
datafieldname[0].value
|
||||
]
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -93,7 +93,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
export const planningappeals78_pdf = ({ docProps }) => {
|
||||
export const planningappeals78_pdf = ({ docProps, pickListData }) => {
|
||||
//console.log("----", docProps);
|
||||
function formatDates(dateObj) {
|
||||
var dateObj = new Date(dateObj);
|
||||
@@ -209,6 +209,7 @@ export const planningappeals78_pdf = ({ docProps }) => {
|
||||
props={docProps}
|
||||
key={key}
|
||||
mandatoryFieldsData={null}
|
||||
pickListData={pickListData}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -22,57 +22,59 @@ const ApiResponse = (req, res) => {
|
||||
"846,040,000",
|
||||
"attributevalue": 846040000,
|
||||
},
|
||||
{
|
||||
"value": "Listed Building and Conservation Area Consent",
|
||||
"stringmapid": "d3b500b5-1228-ec11-aaca-00224800be9c",
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"846,040,025",
|
||||
"attributevalue": 846040025,
|
||||
},
|
||||
{
|
||||
"value": "Householder and Minor Commercial Appeals - HAS/CAS",
|
||||
"stringmapid": "585d46a7-9138-ec11-aacb-00224800be9c",
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"846,040,004",
|
||||
"attributevalue": 846040004,
|
||||
},
|
||||
{
|
||||
"value": "Adverts",
|
||||
"stringmapid": "c356f05c-7f90-eb11-aac2-00224800be9c",
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"846,040,018",
|
||||
"attributevalue": 846040018,
|
||||
},
|
||||
{
|
||||
"value": "Non-Validation",
|
||||
"stringmapid": "c956f05c-7f90-eb11-aac2-00224800be9c",
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"846,040,024",
|
||||
"attributevalue": 846040024,
|
||||
},
|
||||
{
|
||||
"value": "Enforcement Notice Appeal - S174",
|
||||
"stringmapid": "b656f05c-7f90-eb11-aac2-00224800be9c",
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"846,040,005",
|
||||
"attributevalue": 846040005,
|
||||
},
|
||||
{
|
||||
"value":
|
||||
"High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice.",
|
||||
"stringmapid": "c256f05c-7f90-eb11-aac2-00224800be9c",
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"846,040,017",
|
||||
"attributevalue": 846040017,
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
export default ApiResponse;
|
||||
|
||||
// list of other appeal types for create new appeals
|
||||
// {
|
||||
// "value": "Listed Building and Conservation Area Consent",
|
||||
// "stringmapid": "d3b500b5-1228-ec11-aaca-00224800be9c",
|
||||
// "organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
// "attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
// "846,040,025",
|
||||
// "attributevalue": 846040025,
|
||||
// },
|
||||
// {
|
||||
// "value": "Householder and Minor Commercial Appeals - HAS/CAS",
|
||||
// "stringmapid": "585d46a7-9138-ec11-aacb-00224800be9c",
|
||||
// "organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
// "attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
// "846,040,004",
|
||||
// "attributevalue": 846040004,
|
||||
// },
|
||||
// {
|
||||
// "value": "Adverts",
|
||||
// "stringmapid": "c356f05c-7f90-eb11-aac2-00224800be9c",
|
||||
// "organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
// "attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
// "846,040,018",
|
||||
// "attributevalue": 846040018,
|
||||
// },
|
||||
// {
|
||||
// "value": "Non-Validation",
|
||||
// "stringmapid": "c956f05c-7f90-eb11-aac2-00224800be9c",
|
||||
// "organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
// "attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
// "846,040,024",
|
||||
// "attributevalue": 846040024,
|
||||
// },
|
||||
// {
|
||||
// "value": "Enforcement Notice Appeal - S174",
|
||||
// "stringmapid": "b656f05c-7f90-eb11-aac2-00224800be9c",
|
||||
// "organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
// "attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
// "846,040,005",
|
||||
// "attributevalue": 846040005,
|
||||
// },
|
||||
// {
|
||||
// "value":
|
||||
// "High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice.",
|
||||
// "stringmapid": "c256f05c-7f90-eb11-aac2-00224800be9c",
|
||||
// "organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
// "attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
// "846,040,017",
|
||||
// "attributevalue": 846040017,
|
||||
// },
|
||||
|
||||
@@ -95,6 +95,7 @@ import ReactPDF, {
|
||||
import middleware from "../middleware/middleware";
|
||||
import nextConnect from "next-connect";
|
||||
import fs from "fs";
|
||||
import { getPickLists } from "../../../actions";
|
||||
import { planningappeals78_pdf } from "../../../components/pdftemplates/planningappeals78_pdf";
|
||||
import { finalComments_pdf } from "../../../components/pdftemplates/finalComments_pdf";
|
||||
import { statement_pdf } from "../../../components/pdftemplates/statement_pdf";
|
||||
@@ -108,6 +109,7 @@ import { other_pdf } from "../../../components/pdftemplates/other_pdf";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
var checkHash = req.query.hash;
|
||||
var appealType = req.query.appealType;
|
||||
|
||||
let appealBodyObj = req.body; //JSON.parse(req.body);
|
||||
|
||||
@@ -144,7 +146,7 @@ export default async function handler(req, res) {
|
||||
return listedbuildingandconservationareaconsen_pdf(values);
|
||||
break;
|
||||
case "846040004":
|
||||
return householderappealhas_pdf(values);
|
||||
return planningappeals78_pdf(values);
|
||||
break;
|
||||
case "846040018":
|
||||
return adverts_pdf(values);
|
||||
@@ -178,8 +180,10 @@ export default async function handler(req, res) {
|
||||
|
||||
// createRepBlob(req.body, containerID, caseRef);
|
||||
|
||||
const pickListData = await getPickLists(appealType);
|
||||
|
||||
ReactPDF.render(
|
||||
<MyDocument docProps={blobProgress} />,
|
||||
<MyDocument docProps={blobProgress} pickListData={pickListData} />,
|
||||
`tmp/${blobProgress.pinswg_name}.pdf`
|
||||
);
|
||||
|
||||
@@ -200,11 +204,11 @@ export default async function handler(req, res) {
|
||||
"\n/////////////////////////"
|
||||
);
|
||||
|
||||
uploadPDFAppealFiles(
|
||||
`tmp/${appealBodyObj.pinswg_name}.pdf`,
|
||||
containerID,
|
||||
appealBodyObj.pinswg_name
|
||||
);
|
||||
// uploadPDFAppealFiles(
|
||||
// `tmp/${appealBodyObj.pinswg_name}.pdf`,
|
||||
// containerID,
|
||||
// appealBodyObj.pinswg_name
|
||||
// );
|
||||
|
||||
// to do upload file to storage account
|
||||
|
||||
|
||||
Reference in New Issue
Block a user