added agent details to new appeal pdf

This commit is contained in:
2024-01-23 13:14:52 +00:00
parent 9e3454e7bf
commit 89c38fe4c9
7 changed files with 758 additions and 354 deletions
+56 -2
View File
@@ -9,6 +9,7 @@ import {
getFormCollectionByID,
getPickListLabel,
getRadioLabel,
bytesToSize,
} from "../../components/utils";
import ReactPDF, {
@@ -178,9 +179,17 @@ export const AppealRow_pdf = (props) => {
var rows = xpath.select("//label/@description", doc);
var fieldtype = xpath.select("//@classid", doc);
var datafieldname = xpath.select("//@datafieldname", doc);
var datafieldcontent = xpath.select("//@datafieldcontent", doc);
var parentField = xpath.select("//@parentField", doc);
var parentFieldShowOnValue = xpath.select(
"//@parentFieldShowOnValue",
doc
);
var documentTypeCode = xpath.select(
"//@ishareDocumentCode",
doc
);
console.log(datafieldname[0].value);
return (
@@ -380,6 +389,52 @@ export const AppealRow_pdf = (props) => {
</View>
);
break;
case "{16D63FD6-119B-4353-BDCA-18358721C3FE}":
const blobList = jsonpath.query(
props.filesList,
"$..[?(@.documentType=='" +
documentTypeCode[0].value +
"')]"
);
return (
<View
style={{
flexDirection: "column",
marginBottom: 10,
}}
>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={
styles.questionTextWide
}
>
{rows[0].value}
</Text>
</View>
<View
style={
styles.questionAnswerWide
}
>
{blobList.map((blob, i) => (
<Text>
{blob.name} -{" "}
{bytesToSize(
blob.contentLength
)}
</Text>
))}
</View>
</View>
);
break;
default:
return (
<View
@@ -390,7 +445,6 @@ export const AppealRow_pdf = (props) => {
}}
>
<Text style={styles.questionText}>
{/* {FieldsTranslations(rows[0].value)} */}
{rows[0].value}
</Text>
<Text style={styles.questionAnswer}>
+359 -34
View File
@@ -10,7 +10,7 @@ import ReactPDF, {
} from "@react-pdf/renderer";
import { createElement } from "react";
import Html from "react-pdf-html";
import { getFormCollectionByID } from "../utils";
import { getFormCollectionByID, bytesToSize } from "../utils";
import fs from "fs";
import xpath from "xpath";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
@@ -36,7 +36,11 @@ const styles = StyleSheet.create({
},
logoImage: { width: "200pt" },
questionBullet: { width: "5%", fontSize: 12 },
questionText: { width: "30%", fontSize: 12 },
questionText: {
width: "35%",
fontSize: 12,
fontFamily: "Helvetica-Bold",
},
questionTextMid: { width: "80%", fontSize: 12 },
questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 },
questionAnswer: {
@@ -139,7 +143,7 @@ export const planningappeals78_pdf = ({ docProps, pickListData }) => {
doc
);
//console.log(titles);
console.log("\n//////////\n The Case:\n", docProps.caseObj);
return (
<Document>
@@ -177,6 +181,326 @@ export const planningappeals78_pdf = ({ docProps, pickListData }) => {
/>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case Details</Text>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<View
style={{
flexDirection: "column",
marginBottom: 10,
}}
>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Appeal submitted on behalf of:
</Text>
<Text style={styles.questionAnswer}>
{" "}
{
values.caseObj
.pinswg_onbehalfof
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Appellant or Agent
</Text>
<Text style={styles.questionAnswer}>
{" "}
{values.caseObj
.pinswg_appellantagent ==
"846040000"
? "Appellant"
: "Agent"}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Appellant name
</Text>
<Text style={styles.questionAnswer}>
{values.caseObj
.pinswg_appellantfirstname +
" " +
values.caseObj
.pinswg_appellantlastname}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Appellant email address
</Text>
<Text style={styles.questionAnswer}>
{
values.caseObj
.pinswg_appellantemailaddress
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Appellant address
</Text>
<Text style={styles.questionAnswer}>
{
values.caseObj
.pinswg_appellantaddress
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Appellant phone number
</Text>
<Text style={styles.questionAnswer}>
{" "}
{
values.caseObj
.pinswg_appellantphonenumber
}
</Text>
</View>
{values.caseObj.pinswg_appellantagent !=
"846040000" && (
<>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={
styles.questionText
}
>
Company name
</Text>
<Text
style={
styles.questionAnswer
}
>
{
values.caseObj
.pinswg_agentcompanyname
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={
styles.questionText
}
>
Agent name
</Text>
<Text
style={
styles.questionAnswer
}
>
{
values.caseObj
.pinswg_agentfirstname
}{" "}
{
values.caseObj
.pinswg_agentlastname
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={
styles.questionText
}
>
Agent email address
</Text>
<Text
style={
styles.questionAnswer
}
>
{
values.caseObj
.pinswg_agentemailaddress
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={
styles.questionText
}
>
Agent address
</Text>
<Text
style={
styles.questionAnswer
}
>
{
values.caseObj
.pinswg_agentaddress
}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text
style={
styles.questionText
}
>
Agent phone number
</Text>
<Text
style={
styles.questionAnswer
}
>
{" "}
{
values.caseObj
.pinswg_agentphonenumber
}
</Text>
</View>
</>
)}
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
LPA
</Text>
<Text style={styles.questionAnswer}>
{values.caseObj.pinswg_lpaname}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Contact Preference
</Text>
<Text style={styles.questionAnswer}>
{values.caseObj
.pinswg_contactprefs ==
"846040000"
? "Email"
: "Post"}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
Language Preference
</Text>
<Text style={styles.questionAnswer}>
{values.caseObj
.pinswg_contactprefs ==
"846040000"
? "English"
: "Welsh"}
</Text>
</View>
</View>
</View>
</View>
</View>
</View>
{Object.keys(titles).map((key) => (
<View key={key}>
<View
@@ -210,6 +534,7 @@ export const planningappeals78_pdf = ({ docProps, pickListData }) => {
key={key}
mandatoryFieldsData={null}
pickListData={pickListData}
filesList={values.filesList}
/>
</View>
</View>
@@ -218,7 +543,7 @@ export const planningappeals78_pdf = ({ docProps, pickListData }) => {
</View>
))}
<View>
{/* <View>
<View
style={{
marginTop: 10,
@@ -231,46 +556,46 @@ export const planningappeals78_pdf = ({ docProps, pickListData }) => {
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
flexDirection: "column",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionTextWide}>
List of attached files
</Text>
<View
style={[
styles.questionAnswerWide,
{ flexDirection: "column" },
]}
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
List of attached files
</Text>
</View>
<View
style={{
color: "#757575",
width: "100%",
fontSize: 12,
border: 1,
borderColor: "#eee",
backgroundColor: "white",
padding: 5,
marginBottom: 10,
lineHeight: 1.2,
}}
>
{values.hasOwnProperty("filesList") &&
values.filesList.map(function (p) {
return (
<View
key={p.name}
style={{
flexDirection: "row",
marginBottom: 4,
}}
>
<Text
styles={
styles.questionTextMid
}
>
{p.name} - {p.size}
</Text>
</View>
);
})}
values.filesList.map((key) => (
<Text style={{ marginBottom: 10 }}>
{key.name} -{" "}
{bytesToSize(key.contentLength)}
</Text>
))}
</View>
</View>
</View>
</View>
</View> */}
</View>
<Text
style={styles.pageNumber}