uat defect 130, reps 14

This commit is contained in:
2025-01-11 08:13:18 +00:00
parent adaae7b9b0
commit c627e100e1
8 changed files with 288 additions and 120 deletions
+78 -45
View File
@@ -5,6 +5,7 @@ import {
StyleSheet,
Text,
View,
Font,
} from "@react-pdf/renderer";
import Html from "react-pdf-html";
import { getFormCollectionByID, bytesToSize } from "../../components/utils";
@@ -111,6 +112,18 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
let appealTypeValue = getFormCollectionByID(values.appealType);
//console.log("sdffhjdhjdjdgkj: ", values.procedureType);
Font.registerHyphenationCallback((word) => [word]);
function CleanHTML(htmlStr) {
let cleanStr =
typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "")
: "";
return cleanStr;
}
return (
<Document>
<Page size="A4" style={styles.page} wrap>
@@ -239,7 +252,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value || ""}
{appealTypeValue.value}
</Text>
</View>
</View>
@@ -282,14 +295,16 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.procedureType || ""}
{values.procedureType}
</Text>
</View>
{values.procedureType !=
"Written representations" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.procedureTypeEvidence || ""}
{CleanHTML(
values.procedureTypeEvidence
)}
</Html>
</View>
)}
@@ -309,7 +324,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.enterToView || ""}
{values.enterToView}
</Text>
</View>
@@ -344,8 +359,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={{ fontSize: 12 }}>
{values.enterNeighbouringLandToViewSiteEvidence ||
" "}
{CleanHTML(
values.enterNeighbouringLandToViewSiteEvidence
)}
</Html>
</View>
)}
@@ -380,8 +396,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.enterNeighbouringLandAccessRequiredEvidence ||
""}
{CleanHTML(
values.enterNeighbouringLandAccessRequiredEvidence
)}
</Html>
</View>
)}
@@ -408,14 +425,15 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.healthAndSafetyIssues || ""}
{values.healthAndSafetyIssues}
</Text>
</View>
{values.healthAndSafetyIssues == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.healthAndSafetyIssuesEvidence ||
""}
{CleanHTML(
values.healthAndSafetyIssuesEvidence
)}
</Html>
</View>
)}
@@ -445,7 +463,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.LPAcontactDetails || ""}
{CleanHTML(values.LPAcontactDetails)}
</Html>
</View>
</View>
@@ -482,7 +500,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAcaseFileAndReps || ""}
{CleanHTML(values.LPAcaseFileAndReps)}
</Html>
</View>
</View>
@@ -502,7 +520,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAldpAndMap || ""}
{CleanHTML(values.LPAldpAndMap)}
</Html>
</View>
</View>
@@ -522,7 +540,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAlocalGuidance || ""}
{CleanHTML(values.LPAlocalGuidance)}
</Html>
</View>
</View>
@@ -608,7 +626,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.ROW == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.ROWEvidence || ""}
{CleanHTML(values.ROWEvidence)}
</Html>
</View>
)}
@@ -641,8 +659,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.conservationArea == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.conservationAreaEvidence ||
""}
{CleanHTML(
values.conservationAreaEvidence
)}
</Html>
</View>
)}
@@ -675,8 +694,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.affectListedBuilding == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.affectListedBuildingEvidence ||
""}
{CleanHTML(
values.affectListedBuildingEvidence
)}
</Html>
</View>
)}
@@ -709,7 +729,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.TPO == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.TPOEvidence || ""}
{CleanHTML(values.TPOEvidence)}
</Html>
</View>
)}
@@ -742,8 +762,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.natureConservationSite == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.natureConservationSiteEvidence ||
""}
{CleanHTML(
values.natureConservationSiteEvidence
)}
</Html>
</View>
)}
@@ -776,8 +797,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.protectedSpecies == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.protectedSpeciesEvidence ||
""}
{CleanHTML(
values.protectedSpeciesEvidence
)}
</Html>
</View>
)}
@@ -829,8 +851,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.governmentDepartmentCommentsEvidence ||
""}
{CleanHTML(
values.governmentDepartmentCommentsEvidence
)}
</Html>
</View>
)}
@@ -918,8 +941,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.developmentCarriedOutInAccordanceEvidence ||
""}
{CleanHTML(
values.developmentCarriedOutInAccordanceEvidence
)}
</Html>
</View>
)}
@@ -989,8 +1013,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.developmentAnyOtherConditionsEvidence ||
""}
{CleanHTML(
values.developmentAnyOtherConditionsEvidence
)}
</Html>
</View>
)}
@@ -1039,8 +1064,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.copyOfApplicantsCertificateEvidence ||
""}
{CleanHTML(
values.copyOfApplicantsCertificateEvidence
)}
</Html>
</View>
</View>
@@ -1072,7 +1098,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.advertismentGivenEvidence || ""}
{CleanHTML(
values.advertismentGivenEvidence
)}
</Html>
</View>
</View>
@@ -1105,8 +1133,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.copyOfLetterOfAppealNotificationEvidence ||
""}
{CleanHTML(
values.copyOfLetterOfAppealNotificationEvidence
)}
</Html>
</View>
</View>
@@ -1138,7 +1167,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.lpaEIAOS == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.lpaEIAOSEvidence || ""}
{CleanHTML(values.lpaEIAOSEvidence)}
</Html>
</View>
)}
@@ -1174,8 +1203,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.advertismentConsentDiscontinuanceNoticeEvidence ||
""}
{CleanHTML(
values.advertismentConsentDiscontinuanceNoticeEvidence
)}
</Html>
</View>
)}
@@ -1208,8 +1238,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.detailsOfOtherAppeals == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.detailsOfOtherAppealsEvidence ||
""}
{CleanHTML(
values.detailsOfOtherAppealsEvidence
)}
</Html>
</View>
)}
@@ -1242,8 +1273,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.detailsOfPreviousAppeals == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.detailsOfPreviousAppealsEvidence ||
""}
{CleanHTML(
values.detailsOfPreviousAppealsEvidence
)}
</Html>
</View>
)}
@@ -1276,8 +1308,9 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
{values.otherRelevantInformation == "Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.otherRelevantInformationEvidence ||
""}
{CleanHTML(
values.otherRelevantInformationEvidence
)}
</Html>
</View>
)}