Merged PR 1310: appeal pdf fixes and owners

appeal pdf fixes and owners

Related work items: #12809
This commit is contained in:
Robert Bond
2024-11-28 15:49:12 +00:00
5 changed files with 103 additions and 26 deletions
+1 -1
View File
@@ -581,7 +581,7 @@ const RenderDatePicker = ({
> >
{FieldsTranslations(label)} {FieldsTranslations(label)}
</label> </label>
{custom.hint != false && ( {custom.hasOwnProperty("hint") && (
<div className="govuk-hint govuk-!-font-size-14"> <div className="govuk-hint govuk-!-font-size-14">
{t(custom.hint)} {t(custom.hint)}
</div> </div>
+2 -3
View File
@@ -191,9 +191,8 @@ let BuildCheckRow = (props) => {
}} }}
> >
<div className="govuk-!-width-one-half"> <div className="govuk-!-width-one-half">
{ {tenant.pinswg_agriculturaltenantname ||
tenant.pinswg_agriculturaltenantname tenant.pinswg_owners}
}
</div> </div>
<div className="govuk-!-width-one-half"> <div className="govuk-!-width-one-half">
Served:{" "} Served:{" "}
+96 -15
View File
@@ -55,6 +55,8 @@ export const AppealRow_pdf = (props) => {
borderColor: "#eee", borderColor: "#eee",
paddingLeft: 10, paddingLeft: 10,
backgroundColor: "white", backgroundColor: "white",
display: "flex",
flexWrap: "wrap",
}, },
questionAnswerMid: { questionAnswerMid: {
color: "#757575", color: "#757575",
@@ -65,6 +67,8 @@ export const AppealRow_pdf = (props) => {
borderColor: "#eee", borderColor: "#eee",
paddingLeft: 10, paddingLeft: 10,
backgroundColor: "white", backgroundColor: "white",
display: "flex",
flexWrap: "wrap",
}, },
questionAnswerWide: { questionAnswerWide: {
color: "#757575", color: "#757575",
@@ -103,10 +107,11 @@ export const AppealRow_pdf = (props) => {
textAlign: "center", textAlign: "center",
color: "grey", color: "grey",
}, },
documentList: {
fontSize: 10,
},
richArea: { richArea: {
fontSize: 12, fontSize: 12,
color: "red",
flexDirection: "column", flexDirection: "column",
}, },
}); });
@@ -145,6 +150,47 @@ export const AppealRow_pdf = (props) => {
return labelTrans; return labelTrans;
}; };
const getDocumentTypeFromFilename = (filename) => {
var doctypeCode = "000000";
if (filename.indexOf("_-_Statement_of_Case") > 0)
doctypeCode = "000000";
else if (filename.indexOf("_-_Application_Form") > 0)
doctypeCode = "000001";
else if (filename.indexOf("_-_Site_Ownership_Certificate") > 0)
doctypeCode = "000002";
else if (filename.indexOf("_-_Decision_Notice") > 0)
doctypeCode = "000003";
else if (filename.indexOf("_-_Site_Location_Plan") > 0)
doctypeCode = "000004";
else if (filename.indexOf("_-_Plans_Drawing_Documents") > 0)
doctypeCode = "000005";
else if (filename.indexOf("_-_Additional_Plans_Drawings_Documents") > 0)
doctypeCode = "000006";
else if (filename.indexOf("_-_Design_and_Access_Statement") > 0)
doctypeCode = "000007";
else if (filename.indexOf("_-_Green_Infrastructure_Statement") > 0)
doctypeCode = "000008";
else if (filename.indexOf("_-_LPA_Correspondence") > 0)
doctypeCode = "000009";
else if (filename.indexOf("_-_LPA_Original_Permission") > 0)
doctypeCode = "000010";
else if (filename.indexOf("_-_LPA's_Registration_Letter") > 0)
doctypeCode = "000010";
else if (filename.indexOf(+"_-_Environmental_Statement") > 0)
doctypeCode = "000012";
else if (filename.indexOf("_-_Cost_of_Application") > 0)
doctypeCode = "000013";
else if (filename.indexOf("_-_Other_Relevant_Material") > 0)
doctypeCode = "000014";
else if (
filename.indexOf("_-_S106_Agreement_or_Unilateral_Undertaking") > 0
)
doctypeCode = "000015";
return doctypeCode;
};
return ( return (
<> <>
{Object.keys(rowXML).map((key, index) => { {Object.keys(rowXML).map((key, index) => {
@@ -364,12 +410,14 @@ export const AppealRow_pdf = (props) => {
); );
break; break;
case "{16D63FD6-119B-4353-BDCA-18358721C3FE}": case "{16D63FD6-119B-4353-BDCA-18358721C3FE}":
const blobList = jsonpath( // const blobList = jsonpath(
"$..[?(@.documentType=='" + // "$..[?(@.documentType=='" +
documentTypeCode[0].value + // documentTypeCode[0].value +
"')]", // "')]",
props.filesList // props.filesList
); // );
const blobList = props.filesList;
return ( return (
<View <View
style={{ style={{
@@ -399,9 +447,22 @@ export const AppealRow_pdf = (props) => {
> >
{blobList.map((blob, i) => ( {blobList.map((blob, i) => (
<Text key={i}> <Text key={i}>
{blob.name} -{" "} {getDocumentTypeFromFilename(
{bytesToSize( blob.name
blob.contentLength ) ===
documentTypeCode[0]
.value && (
<Text
style={
styles.documentList
}
>
{blob.name} -{" "}
{bytesToSize(
blob.size
)}{" "}
{"\n"}
</Text>
)} )}
</Text> </Text>
))} ))}
@@ -469,9 +530,8 @@ export const AppealRow_pdf = (props) => {
"20", "20",
}} }}
> >
{ {tenant.pinswg_agriculturaltenantname ||
tenant.pinswg_agriculturaltenantname tenant.pinswg_owners}
}
</Text> </Text>
<Text <Text
@@ -493,6 +553,28 @@ export const AppealRow_pdf = (props) => {
</View> </View>
</View> </View>
); );
case "{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
return (
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionText}>
{rows[0].value}
</Text>
<Text style={styles.questionAnswer}>
{props.props[
datafieldname[0].value
] == "true"
? "Yes"
: "No"}
</Text>
</View>
);
break;
default: default:
return ( return (
<View <View
@@ -506,7 +588,6 @@ export const AppealRow_pdf = (props) => {
{rows[0].value} {rows[0].value}
</Text> </Text>
<Text style={styles.questionAnswer}> <Text style={styles.questionAnswer}>
{" "}
{ {
props.props[ props.props[
datafieldname[0].value datafieldname[0].value
@@ -91,7 +91,6 @@ const styles = StyleSheet.create({
richArea: { richArea: {
fontSize: 12, fontSize: 12,
color: "red",
flexDirection: "column", flexDirection: "column",
}, },
}); });
+4 -6
View File
@@ -144,14 +144,12 @@
</labels> </labels>
<control validation="[required]" id="pinswg_ownershipcertificate" classid="{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldcontent="[846040001|newappeal:new-appeal-ownership-option-A,846040002|newappeal:new-appeal-ownership-option-B,846040003|newappeal:new-appeal-ownership-option-CD]" datafieldname="pinswg_ownershipcertificate" requiredDocumentValue="Yes" requiredDocumentLabel="Relevant Ownership certificate" disabled="false" /> <control validation="[required]" id="pinswg_ownershipcertificate" classid="{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldcontent="[846040001|newappeal:new-appeal-ownership-option-A,846040002|newappeal:new-appeal-ownership-option-B,846040003|newappeal:new-appeal-ownership-option-CD]" datafieldname="pinswg_ownershipcertificate" requiredDocumentValue="Yes" requiredDocumentLabel="Relevant Ownership certificate" disabled="false" />
</row> </row>
<!--
<row> <row>
<labels> <labels>
<label description="Owners" /> <label description="Owners" />
</labels> </labels>
<control id="pinswg_owners" parentField="pinswg_ownershipcertificate" parentFieldShowOnValue="846040002" classid="{0273EDBD-AC1D-40d3-9FB2-095C621B552D}" datafieldname="pinswg_owners" disabled="false" /> <control id="pinswg_owners" parentField="pinswg_ownershipcertificate" parentFieldShowOnValue="846040002" classid="{0273EDBD-AC1D-40d3-9FB2-095C621B552D}" datafieldname="pinswg_owners" disabled="false" />
</row> </row>
-->
<row> <row>
<labels> <labels>
<label description="Agricultural holding" hint="newappeal:new-appeal-agricultural-hint" /> <label description="Agricultural holding" hint="newappeal:new-appeal-agricultural-hint" />