create pdf reps for lpa

This commit is contained in:
2023-09-26 09:12:57 +01:00
parent 34c3e06ee3
commit 41847b3433
55 changed files with 8798 additions and 168 deletions
+156 -28
View File
@@ -55,7 +55,7 @@ export const createContainerSas = async (containerName) => {
);
// Need only list permission to list blobs
const containerPermissions = "rcwltdf";
const containerPermissions = "rcwdltf";
// Best practice: SAS options are time-limited
const sasOptions = {
@@ -260,6 +260,7 @@ export const createBlob = async (formContent, containerName, caseref) => {
const tags = {
containerid: containerName,
caseID: caseID,
blobType: "Appeal",
};
console.log("the tags:", tags);
@@ -283,7 +284,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const content = JSON.stringify(formContent);
console.log(content);
//console.log(content);
const blobName = caseref + "/" + caseID + "_rep.json";
console.log("blobName:", blobName);
@@ -395,6 +396,90 @@ export const uploadFile = async (formContent, containerName, foldername) => {
}
};
export const uploadRepFiles = async (
formContent,
containerName,
foldername
) => {
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl);
const files = formContent;
console.log(...formContent);
console.log("rep files...", files, Object.keys(files).length, foldername);
// console.log(`files[${prop}] = ${files[prop][0].size}`);
const blobName = foldername + formContent.split("tmp/")[1];
console.log(blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
const tags = {
containerid: containerName,
caseID: foldername,
documentType: "rep content",
};
console.log(tags);
// const withTags = await blockBlobClient.setTags(tags);
// const withMeta = await blockBlobClient.setMetadata(tags);
console.log(
`Uploaded block blob ${files} successfully`,
uploadBlobResponse.requestId
);
};
export const uploadPDFRepFiles = async (
formContent,
containerName,
foldername,
repType
) => {
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl);
const files = formContent;
console.log(formContent, containerName, foldername);
console.log(
"rep pdf files...",
files,
Object.keys(files).length,
foldername
);
// console.log(`files[${prop}] = ${files[prop][0].size}`);
console.log(foldername + "/files/" + formContent.split("tmp/")[1]);
const blobName = foldername + "/files/" + formContent.split("tmp/")[1];
console.log(blobName);
console.log(blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
const tags = {
containerid: containerName,
caseID: foldername,
documentType: repType,
blobType: "RepresentationPDF",
};
console.log("the tags:", tags);
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
console.log(
`Uploaded block blob ${files} successfully`,
uploadBlobResponse.requestId
);
};
export const downloadFile = async (containerName, blobName) => {
//console.log.apply(containerName, blobName);
const containerToken = await createContainerSas(containerName);
@@ -486,12 +571,32 @@ export const downloadAllProgressFiles = async (
);
};
export const downloadRepFile = async (
containerName,
blobName,
casefolderID
) => {
console.log(containerName, blobName);
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl);
const blobClient = containerClient.getBlobClient(blobName);
const downloadedBlob = await blobClient.download();
const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody);
console.log("Downloaded blob content:", downloaded.toString());
return JSON.parse(downloaded.toString());
};
export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
// console.log(
// "/////////////////////////\n downloading files: " +
// JSON.stringify(repsBlobObj) +
// "\n/////////////////////////\n"
// );
console.log(
"/////////////////////////\n downloading files: " +
JSON.stringify(repsBlobObj) +
"\n/////////////////////////\n"
);
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
@@ -500,14 +605,18 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
let blobClient = {};
let downloadedBlob = {};
let repArr = [];
let downloaded = "";
let downloaded = [];
let caseBlob = {};
let caseDownloaded = "";
let blobCount = 0;
Array.isArray(repsBlobObj) &&
!repsBlobObj.length &&
console.log("is empt and an array");
for (const prop in repsBlobObj) {
//console.log(`Progress - ${prop}: ${repsBlobObj[prop].name}`);
blobClient = containerClient.getBlobClient(repsBlobObj[prop].name);
console.log(`Progress - ${prop}: ${repsBlobObj[prop].path}`);
blobClient = containerClient.getBlobClient(repsBlobObj[prop].path);
downloadedBlob = await blobClient.download(0);
let repBlobObj = await streamToBuffer(
downloadedBlob.readableStreamBody
@@ -517,17 +626,29 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[0];
repBlobObj = JSON.stringify(repBlobObj);
// repBlobObj = JSON.stringify(repBlobObj);
downloaded = downloaded + repBlobObj + ",";
downloaded.push(repBlobObj);
blobCount++;
}
downloaded = downloaded.substring(0, downloaded.length - 1);
//downloaded = downloaded.substring(0, downloaded.length - 1);
// console.log(
// "/////////////////////////\n downloaded : " +
// JSON.stringify(
// '{ "@odata.count": ' +
// blobCount +
// ',"value": ' +
// downloaded +
// "}"
// ) +
// "\n/////////////////////////\n"
// );
return JSON.parse(
'{ "@odata.count": ' + blobCount + ',"value": [' + downloaded + "]}"
);
return {
"@odata.count": blobCount,
"value": downloaded,
};
};
const streamToBuffer = async (readableStream) => {
@@ -642,7 +763,9 @@ export const getAllProgressBlobs = async (containerName) => {
let blobCount = 0;
let blobObj = [];
for await (const blob of containerClient.listBlobsFlat()) {
for await (const blob of containerClient.findBlobsByTags(
"blobType='Appeal'"
)) {
blob.name.split("/")[1].indexOf("_appeal.json") > 0 &&
blob.name.split("/")[1].indexOf("undefined") < 0 &&
blobObj.push({
@@ -661,12 +784,12 @@ export const getAllProgressBlobs = async (containerName) => {
});
}
//console.log("blobObj:", blobObj);
console.log("blobObj:", blobObj);
return blobObj;
};
export const getRepslobs = async (containerName, caseReference) => {
export const getRepsBlobs = async (containerName) => {
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
@@ -677,25 +800,30 @@ export const getRepslobs = async (containerName, caseReference) => {
for await (const blob of containerClient.findBlobsByTags(
"blobType='Representation'"
)) {
console.log(`-----Blob ${blobCount++}: ${blob.name}`);
blobCount++;
}
// console.log(
// "this is the casefolder and blobcount:",
// caseReference,
// blobCount
// );
console.log(
"this is the casefolder and blobcount:",
//caseReference,
blobCount
);
let blobObj = [];
for await (const blob of containerClient.findBlobsByTags(
"blobType='Representation'"
)) {
// console.log("getRepslobs in here");
// console.log(blob);
blobObj.push(blob);
console.log(blob);
blob.name.split("/")[1].indexOf("_rep.json") > 0 &&
blob.name.split("/")[1].indexOf("undefined") < 0 &&
blobObj.push({
"name": blob.name.split("/")[1],
"path": blob.name,
});
}
//console.log("blobObjwwwww:", blobObj);
console.log("blobObjwwwww:", blobObj);
return blobObj;
};
+48 -8
View File
@@ -782,11 +782,11 @@ export const getAwaitingSubmission = (loggedInUserId) => {
};
export const getAwaitingSubmissionFromBlob = (containerName) => {
// console.log(
// "///////////////////////\ngetAwaitingSubmissionFromBlob: " +
// containerName +
// "\n///////////////////////\n"
// );
console.log(
"///////////////////////\ngetAwaitingSubmissionFromBlob: " +
containerName +
"\n///////////////////////\n"
);
return axios
.get(
BASE_URL +
@@ -807,9 +807,13 @@ export const getAwaitingSubmissionFromBlob = (containerName) => {
export const getRepsFromBlob = (containerName) => {
console.log(
"///////////////////////\ngetRepsFromBlob: " +
"///////////////////////\ngetRepsFromBlob function: " +
containerName +
"\n///////////////////////\n"
"\n///////////////////////\n",
BASE_URL +
"/api/file/getrepsblob?container=" +
containerName +
hashAPIPath("/api/file/getrepsblob?container=" + containerName)
);
return axios
@@ -823,7 +827,12 @@ export const getRepsFromBlob = (containerName) => {
return res.data;
})
.catch((error) => {
//console.log("API call error", error);
console.log(
"///////////////////////\ngetRepsFromBlob error response: " +
error +
"\n///////////////////////\n"
);
console.log("API call error", error);
});
};
@@ -1346,6 +1355,37 @@ export const uploadRepFiles = async (
}
};
export const generateRepPDF = async (formValues, containerID, casefolderID) => {
//let files = filesObj;
console.log("generateRepPDF function: " + formValues);
// var formData = new FormData();
// formValues.append("appealData", JSON.stringify(formValues));
// formValues.append("containerID", containerID);
// formValues.append("casefolderID", casefolderID);
// Object.assign(formValues, {
// "containerID": containerID,
// "casefolderID": casefolderID,
// });
var queryUrl = "/api/file/generatepdf";
const config = {
method: "post",
url: queryUrl,
data: formValues,
headers: { "content-type": "multipart/form-data" },
};
//console.log(config);
try {
const res = await axios(config);
return res.data;
} catch (error) {
console.log("this serror", error);
}
};
export const getFilesFromBlob = (containerName, casefolderID) => {
console.log(
" get files from blob",
+206 -104
View File
@@ -2,7 +2,7 @@ import Link from "next/link";
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import jsonpath from "jsonpath";
import jsonpath, { value } from "jsonpath";
import _, { property } from "lodash";
import {
Field,
@@ -23,11 +23,13 @@ import {
setRepresentationReset,
} from "../../../store/currentView/action";
import RepCapacitySelection from "./representationCapacitySelection";
import RepLPACapacitySelection from "./representationLPACapacitySelection";
import RepDetails from "./representationDetails";
import RepAppellant from "./representationAppellant";
import RepAgent from "./representationAgent";
import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
import RepLandOwner from "./representationLandowner";
import RepLPA from "./representationLPA";
import RepCompleteSubmit from "./representationCompleteSubmit";
import { useSession, signIn, signOut } from "next-auth/react";
import {
@@ -35,6 +37,7 @@ import {
patchCase,
uploadRepFiles,
sendEmail,
generateRepPDF,
} from "../../../actions";
import {
@@ -43,6 +46,16 @@ import {
RenderTextfield,
} from "./representationElements";
import ReactPDF, {
Document,
Page,
Text,
View,
StyleSheet,
PDFViewer,
} from "@react-pdf/renderer";
import { object } from "prop-types";
let MakeRepresentation = (props) => {
let { t } = useTranslation();
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
@@ -87,28 +100,33 @@ let MakeRepresentation = (props) => {
var detailsObj = {};
const capacityOptionsArr = [
"Appellant",
"Agent",
"Interested Party/Person",
"Land Owner",
];
const capacityOptionsArr = ["Appellant", "Agent", "Interested Party"];
const appellantApplicantRepresentationArr = [
"Other",
"Statement",
"Statement of common ground",
"Final comments",
"Written statement of evidence",
"Other",
];
const interestedPersonRepresentationArr = [
"Interested Party/Person correspondence",
"Statement",
"Final comments",
"Other",
];
const lpaRepresentationArr = [
"Questionnaire",
"Final comments",
"Written statement of evidence",
"Other",
];
const landOwnerRepresentationArr = [
"Other",
"Statement",
"Final comments",
"Written statement of evidence",
"Other",
];
const repCapacityType = () => {
@@ -125,10 +143,38 @@ let MakeRepresentation = (props) => {
.toLowerCase();
};
const isLPA =
props.props.accountDetails.accountDetails[
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
] == "LPA"
? true
: false;
const whichControl = () => {
switch (currentView.representationCapacity) {
case false:
return (
console.log(isLPA);
console.log(
currentView.representationCapacity,
_.isEmpty(currentView.representationCapacity)
);
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
return (
<RepLPACapacitySelection
formObj={formObj}
capacityOptionsArr={capacityOptionsArr}
currentType={currentType}
casesObj={casesObj}
setRepresentationCapacity={"LPA"}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
caseReference={caseReference}
/>
);
} else {
switch (currentView.representationCapacity) {
case false:
<RepCapacitySelection
formObj={formObj}
capacityOptionsArr={capacityOptionsArr}
@@ -141,89 +187,120 @@ let MakeRepresentation = (props) => {
setSubmitBack={setSubmitBack}
props={props}
caseReference={caseReference}
/>
);
break;
case "appellant":
//setRepresentationCapacity("appellant");
return (
<RepAppellant
formObj={formObj}
appellantApplicantRepresentationArr={
appellantApplicantRepresentationArr
}
setRepresentationCapacity={setRepresentationCapacity}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "agent":
//setRepresentationCapacity("agent");
return (
<RepAgent
formObj={formObj}
appellantApplicantRepresentationArr={
appellantApplicantRepresentationArr
}
setRepresentationCapacity={setRepresentationCapacity}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "interestedparty/person":
// setRepresentationCapacity("interestedpartyperson");
return (
<RepInterestedPartyPerson
formObj={formObj}
interestedPersonRepresentationArr={
interestedPersonRepresentationArr
}
setRepresentationCapacity={setRepresentationCapacity}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "landowner":
//setRepresentationCapacity("landowner");
return (
<RepLandOwner
formObj={formObj}
landOwnerRepresentationArr={landOwnerRepresentationArr}
setRepresentationCapacity={setRepresentationCapacity}
onHandleSubmit={onHandleSubmit}
setRepresentationSubmit={setRepresentationSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
default:
return (
<RepCapacitySelection
formObj={formObj}
capacityOptionsArr={capacityOptionsArr}
currentType={currentType}
casesObj={casesObj}
setRepresentationCapacity={setRepresentationCapacity}
setRepresentationSubmit={setRepresentationSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
/>;
break;
case "appellant":
//setRepresentationCapacity("appellant");
return (
<RepAppellant
formObj={formObj}
appellantApplicantRepresentationArr={
appellantApplicantRepresentationArr
}
setRepresentationCapacity={
setRepresentationCapacity
}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "lpa":
//setRepresentationCapacity("appellant");
return (
<RepLPA
formObj={formObj}
appellantApplicantRepresentationArr={
lpaRepresentationArr
}
setRepresentationCapacity={
setRepresentationCapacity
}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "agent":
//setRepresentationCapacity("agent");
return (
<RepAgent
formObj={formObj}
appellantApplicantRepresentationArr={
appellantApplicantRepresentationArr
}
setRepresentationCapacity={
setRepresentationCapacity
}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "interestedparty/person":
// setRepresentationCapacity("interestedpartyperson");
return (
<RepInterestedPartyPerson
formObj={formObj}
interestedPersonRepresentationArr={
interestedPersonRepresentationArr
}
setRepresentationCapacity={
setRepresentationCapacity
}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
case "landowner":
//setRepresentationCapacity("landowner");
return (
<RepLandOwner
formObj={formObj}
landOwnerRepresentationArr={
landOwnerRepresentationArr
}
setRepresentationCapacity={
setRepresentationCapacity
}
onHandleSubmit={onHandleSubmit}
setRepresentationSubmit={setRepresentationSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
default:
return (
<RepCapacitySelection
formObj={formObj}
capacityOptionsArr={capacityOptionsArr}
currentType={currentType}
casesObj={casesObj}
setRepresentationCapacity={
setRepresentationCapacity
}
setRepresentationSubmit={setRepresentationSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
}
}
};
@@ -258,6 +335,9 @@ let MakeRepresentation = (props) => {
case "Land Owner":
repType = "LO";
break;
case "LPA":
repType = "LPA";
break;
default:
// code block
@@ -280,6 +360,7 @@ let MakeRepresentation = (props) => {
"containerID": props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"caseRef": props.props.currentView.caseReference.currentReference,
});
updateBody = JSON.stringify(updateBody);
@@ -321,19 +402,40 @@ let MakeRepresentation = (props) => {
};
const onHandleSubmit = (values) => {
console.log("form values - ", JSON.stringify(values));
Object.assign(values, {
"containerID": props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"caseRef": props.props.currentView.caseReference.currentReference,
"pinswg_name":
props.props.currentView.caseReference.currentReference,
"firstname": props.props.accountDetails.accountDetails.firstname,
"lastname": props.props.accountDetails.accountDetails.lastname,
"emailAddress":
props.props.accountDetails.accountDetails.emailaddress1,
});
currentView.representationSubmit != true
? _.isEmpty(currentView.representationCapacity)
? setRepresentationCapacity(
values.representationCapacity
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
)
? isLPA
? setRepresentationCapacity("lpa")
: setRepresentationCapacity(
values.representationCapacity
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
)
: setRepresentationSubmit(true)
: currentView.representationSubmit == true
? (console.log("capacity", currentView.representationCapacity),
console.log("has errors:", props.invalid),
props.invalid == false &&
updateRepresentation(values, false, false),
generateRepPDF(
values,
props.props.accountDetails.containerID,
currentView.caseReference.currentReference
),
uploadRepresentationFiles(values),
setRepresentationSubmitConfirmation(true))
: console.log("nit updated");
@@ -376,8 +478,8 @@ let MakeRepresentation = (props) => {
const repForm = props.props.form;
console.log(
"waht is representationSubmit:",
currentView.representationSubmit
"what is representationSubmit state: " +
currentView.representationSubmit
);
return (
@@ -7,6 +7,7 @@ import {
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderRichMultiline,
RenderCondtionalRadioList,
FileUploadField,
} from "./representationElements";
@@ -109,7 +110,7 @@ const RepAgent = (props) => {
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
@@ -10,6 +10,7 @@ import {
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderRichMultiline,
RenderFileUpload,
FileUploadField,
} from "./representationElements";
@@ -89,7 +90,7 @@ const RepAppellant = (props) => {
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
@@ -3,6 +3,7 @@ import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { useDropzone } from "react-dropzone";
import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck from "./representationLPAQuestionnaireCheck";
const RepCompleteSubmit = (props) => {
let { t } = useTranslation();
@@ -210,6 +211,11 @@ const RepCompleteSubmit = (props) => {
</a>
</dd>
</div>
<RepLPAQuestionnaireCheck
props={props}
formObj={formObj}
setSubmitBack={setSubmitBack}
/>
</dl>
<p>
The gathering and subsequent processing of the
@@ -24,6 +24,8 @@ const RepDetails = (props) => {
detailsObj = detailsObj[0];
console.log("-----detailsObj:", detailsObj);
return (
<>
{" "}
@@ -36,9 +38,9 @@ const RepDetails = (props) => {
</dt>
<dd className="govuk-summary-list__value">
{casesObj.appellantApplicant || ""}
{detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] || "not entered"}
{detailsObj.firstName +
" " +
detailsObj.lastName || "not entered"}
</dd>
</div>
{/* <div className="govuk-summary-list__row">
@@ -8,6 +8,20 @@ import Link from "next/link";
import dynamic from "next/dynamic";
const ReactQuill = dynamic(() => import("react-quill"), { ssr: false });
import "react-quill/dist/quill.snow.css";
import DatePicker, { registerLocale, setDefaultLocale } from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import {
addYears,
addMonths,
addDays,
subYears,
subMonths,
subDays,
parseISO,
} from "date-fns";
import { useRouter } from "next/router";
export const RenderRadioList = ({
datafieldname,
@@ -54,7 +68,13 @@ export const RenderRadioList = ({
{errorMsg}
</span>
)}
<div className="govuk-radios govuk-radios--small">
<div
className={
custom.inline == true
? "govuk-radios govuk-radios--inline govuk-radios--small"
: "govuk-radios govuk-radios--small"
}
>
{Object.keys(options).map((key, index) => (
<div
className="govuk-radios__item"
@@ -204,6 +224,121 @@ export const RenderCondtionalRadioList = ({
);
};
export const RenderLPACondtionalRadioList = ({
datafieldname,
legend,
name,
label,
id,
errorMsg,
options,
input: { onChange, value },
meta: { touched, error },
...custom
}) => {
const required = (value) => (value ? undefined : "Required");
return (
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<fieldset
className="govuk-fieldset"
aria-describedby={id + "-hint"}
>
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
<label
className="govuk-fieldset__heading govuk-body-m"
id={id + "_label"}
>
{label}
</label>
</legend>
{touched && error && (
<span
id={id + "-error"}
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{errorMsg}
</span>
)}
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
<label
className=" govuk-body-m"
id="representationCapacity_label"
>
{legend}
</label>
</legend>
<div id={id + "-hint"} className="govuk-hint"></div>
<div className="govuk-radios govuk-radios--small">
{Object.keys(options).map((key, index) => (
<div key={key} className="govuk-!-margin-bottom-3">
<div
className="govuk-radios__item"
data-children-count={key}
key={key}
>
<Field
id={id + "_" + index}
name={id}
component="input"
type="radio"
className="govuk-radios__input"
value={options[key]}
validate={[required]}
/>
<label
className="govuk-label govuk-radios__label"
htmlFor={id + "_" + index}
>
{options[key]}
</label>
</div>
{value == custom.optionSelect &&
options[key] == custom.optionSelect && (
<div
className="govuk-radios__conditional "
id={id}
>
<div
className="govuk-form-group"
key={"yes_group_" + key}
>
<label
className="govuk-label"
htmlFor={id + "_details"}
>
{custom.conditionalLabel}
</label>
<Field
className="govuk-input govuk-!-width-one-half"
id={id + "Evidence"}
name={id + "Evidence"}
component={RenderMultiline}
/>
</div>
</div>
)}
</div>
))}
</div>
</fieldset>
</div>
</>
);
};
export const RenderPickList = ({
datafieldname,
name,
@@ -294,6 +429,118 @@ export const RenderTextfield = ({
);
};
export const RenderDatePicker = ({
datafieldname,
name,
label,
id,
errorMsg,
input: { onChange, value },
meta: { touched, error },
...custom
}) => {
const router = useRouter();
var startDateArr =
custom.dateStart != "0" ? custom.dateStart.split("") : custom.dateStart;
var endDateArr =
custom.dateEnd != "0" ? custom.dateEnd.split("") : custom.dateEnd;
var minDate =
startDateArr == 0
? new Date()
: startDateArr[0] == "-"
? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
var maxDate =
endDateArr == 0
? new Date()
: startDateArr[0] == "-"
? startDateArr[2] == "y"
? subYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? subMonths(new Date(), startDateArr[1])
: subDays(new Date(), startDateArr[1])
: startDateArr[2] == "y"
? addYears(new Date(), startDateArr[1])
: startDateArr[2] == "m"
? addMonths(new Date(), startDateArr[1])
: addDays(new Date(), startDateArr[1]);
return (
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<fieldset
className="govuk-fieldset"
role="group"
aria-describedby={id + "_label"}
>
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
<label
className="govuk-fieldset__heading"
id={id + "_label"}
htmlFor={id}
>
{label}
</label>
</legend>
{touched && error && (
<span
id={id + "-error"}
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{errorMsg}
</span>
)}
{/* {value}
<br />
{moment(value).format("DD/MM/YY")}
<br /> */}
<DatePicker
{...custom}
locale={router.locale}
autoOk={true}
id={id}
dateFormat="dd/MM/yyyy"
onChange={onChange}
selected={
value
? typeof value != "object"
? parseISO(value)
: value
: null
} //{parseISO(value) || null}
className="govuk-input govuk-input--width-10"
minDate={minDate}
maxDate={maxDate}
//value={!value ? null : moment(value, "DD/MM/yyyy")}
/>
</fieldset>
</div>
</>
);
};
export const RenderMultiline = ({
id,
className,
@@ -314,6 +561,69 @@ export const RenderMultiline = ({
input.onChange(valStr);
};
var modules = {
toolbar: [
[{ "header": [1, 2, false] }],
["bold", "italic", "underline", "blockquote"],
[{ "list": "ordered" }, { "list": "bullet" }, "link"],
["clean"],
],
};
return (
<>
<label className="govuk-label" htmlFor={name}>
{label}
</label>
{"hint" in custom}
{"hint" in custom && (
<div
id={name + "-hint"}
className="govuk-hint govuk-!-font-size-14"
>
{custom.hint}
</div>
)}
<ReactQuill
modules={modules}
theme="snow"
value={editValue}
onChange={changeEdit}
/>
<textarea
{...input}
id={id}
name={name}
rows={rows}
className={className}
value={editValue}
style={{ display: "none" }}
></textarea>
</>
);
};
export const RenderRichMultiline = ({
id,
className,
rows,
datafieldname,
name,
label,
input,
meta: { touched, error },
...custom
}) => {
const [editValue, setEditValue] = useState(
input.value != null ? input.value : ""
);
const changeEdit = (valStr) => {
setEditValue(valStr);
input.onChange(valStr);
};
var modules = {
toolbar: [
[{ "header": [1, 2, false] }],
@@ -325,6 +635,9 @@ export const RenderMultiline = ({
return (
<>
<label className="govuk-label" htmlFor={name}>
{label}
</label>
<ReactQuill
modules={modules}
theme="snow"
@@ -7,6 +7,7 @@ import {
RenderTextfield,
RenderCondtionalRadioList,
RenderMultiline,
RenderRichMultiline,
FileUploadField,
} from "./representationElements";
import { useDropzone } from "react-dropzone";
@@ -92,7 +93,7 @@ const RepInterestedPartyPerson = (props) => {
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
@@ -0,0 +1,954 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { connect } from "react-redux";
import { Field, reduxForm, formValueSelector } from "redux-form";
import {
RenderPickList,
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderCondtionalRadioList,
RenderLPACondtionalRadioList,
FileUploadField,
RenderRichMultiline,
RenderDatePicker,
} from "./representationElements";
import {
setRepresentationCapacity,
setRepresentationSubmit,
} from "../../../store/currentView/action";
import { useDropzone } from "react-dropzone";
import { select } from "xpath";
let RepLPA = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const {
formObj,
appellantApplicantRepresentationArr,
setRepresentationCapacity,
setRepresentationSubmit,
currentView,
procedureTypeValue,
onBehalfOfLPA,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
const required = (value) => (value ? undefined : "Required");
return (
<div id="rep-appellant">
<div className="govuk-grid-column-full">
<div className="govuk-grid-row">
<h2 className="govuk-heading-m ">
Questionnaire from an LPA
</h2>
<div className="govuk-form-group">
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
What kind of representation are you making?
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
optionsArr={appellantApplicantRepresentationArr}
/>
</div>
</div>
{/* <div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
id="representationDescription"
name="representationDescription"
value="email"
data-aria-controls="representationDescription"
type="text"
component={RenderTextfield}
label="Description of representation"
/>
</div>
</div> */}
{props.representationTypeValue}
{props.procedureTypeValue}
<div className="govuk-grid-row">
<div className="govuk-form-group">
{console.log(props)}
typeof props.representationTypeValue == "undefined"
{props.representationTypeValue != "Questionnaire" ? (
<>
<p className="govuk-body">
You can enter your comments in the space
provided or attach a separate document.
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
My comments are set out in:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
</div>
</fieldset>
</>
) : (
<>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Appeal procedure and site visit{" "}
</h3>
<div className="govuk-form-group">
<Field
label="5. Which procedure do you consider the appeal should follow?"
name="procedureType"
optionsArr={[
"Written representations",
"Hearing",
"Inquiry",
]}
id="procedureType"
component={RenderPickList}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
{(procedureTypeValue == "Hearing" ||
procedureTypeValue ==
"Inquiry") && (
<Field
label="If Hearing or Inquiry, provide reasons here for why you consider this to be justified"
name="procedureTypeEvidence"
id="procedureTypeEvidence"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
richText="false"
/>
)}
<Field
label="6. Will the Inspector need to enter the appeal site/property?"
name="enterToView"
id="enterToView"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
<div className="govuk-form-group">
<Field
name="enterNeighbouringLandToViewSite"
datafieldname="enterNeighbouringLandToViewSite"
options={["Yes", "No"]}
id="enterNeighbouringLandToViewSite"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"7. Do you consider that the Inspector needs to enter neighbouring private land/property to view the site?"
}
conditionalLabel={
"If Yes, give reasons and provide the neighbouring site address. If you have them, provide the contact details of the landowner in an attachment."
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="enterNeighbouringLandAccessRequired"
datafieldname="enterNeighbouringLandAccessRequired"
options={["Yes", "No"]}
id="enterNeighbouringLandAccessRequired"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"8. If access to private land/buildings is required, are you content for the Inspector to visit the site on an access required basis, with only the landowner or their representative present?"
}
conditionalLabel={
"If No, give reasons for why you consider an Accompanied Site Visit to be necessary"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="healthAndSafetyIssues"
datafieldname="healthAndSafetyIssues"
options={["Yes", "No"]}
id="healthAndSafetyIssues"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"9. Are you aware of any health and safety issues which would need to be considered when the Inspector visits the site?"
}
conditionalLabel={
"If Yes, describe the health and safety issues to be considered"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
id="LPAcontactDetails"
name="LPAcontactDetails"
value="email"
data-aria-controls="LPAcontactDetails"
type="text"
component={RenderRichMultiline}
label="10. LPA contact for site visit, hearing or inquiry arrangements:"
/>
</div>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Supporting documents{" "}
</h3>
<div className="govuk-form-group">
<Field
label="11. LPA case file and representations"
name="LPAcaseFileAndReps"
id="LPAcaseFileAndReps"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
richText="false"
hint="Insert weblink(s) to case file and representations on the LPAs public portal. This must include all documents which were before the LPA at the time of its decision or when the appeal was made. Ensure that you link directly to the case documents list, not to a generic page on the LPAs portal. If web-based comments were also made, insert a second link to that page. Alternatively, state here if you are sending relevant case file documents under separate cover."
/>
</div>
<div className="govuk-form-group">
<Field
label="12. LPAs adopted local development plan and Proposals Map:"
name="LPAldpAndMap"
id="LPAldpAndMap"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
richText="false"
hint="Insert weblinks to the Written Statement of the adopted LDP/UDP, and the accompanying Proposals Map (including map key). Alternatively, list relevant policies here and attach excerpts."
/>
</div>
<div className="govuk-form-group">
<Field
label="13. Adopted local guidance relevant to the proposal"
name="LPAlocalGuidance"
id="LPAlocalGuidance"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
richText="false"
hint="Insert weblink(s) to any relevant any local guidance (e.g. Supplementary Planning Guidance, Conservation Area appraisals) which the LPA considers relevant, specifying the document name before the web link. Alternatively, list the relevant guidance and attach copies/excerpts."
/>
</div>
<Field
label="14. If applicable, do you intend to submit a full statement at the 4- week stage?"
name="LPAintentionToSubmitFullStatement"
id="LPAintentionToSubmitFullStatement"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Statutory considerations
</h3>
<Field
label="15. Is all or part of the site within an Area of Outstanding Natural Beauty?"
name="AONB"
id="AONB"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="ROW"
datafieldname="ROW"
options={["Yes", "No"]}
id="ROW"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"16. Does the site include any public rights of way?"
}
conditionalLabel={
"If Yes, attach or insert a link to the definitive map and statement for the local area"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="conservationArea"
datafieldname="conservationArea"
options={["Yes", "No"]}
id="conservationArea"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"17. Is all or part of the site within a Conservation Area?"
}
conditionalLabel={
"If Yes, attach or insert links to a plan showing the Conservation Area boundary"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="affectListedBuilding"
datafieldname="affectListedBuilding"
options={["Yes", "No"]}
id="affectListedBuilding"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"18. Would the proposal involve works to, or affect the setting of, a listed building, Scheduled Monument or other designated historic asset?"
}
conditionalLabel={
"If Yes, attach or insert links to the listing description(s) and location plan"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="TPO"
datafieldname="TPO"
options={["Yes", "No"]}
id="TPO"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"19. Is any part of the site subject to a Tree Preservation Order?"
}
conditionalLabel={
"If Yes, attach or insert links to the relevant plan and details"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="natureConservationSite"
datafieldname="natureConservationSite"
options={["Yes", "No"]}
id="natureConservationSite"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"20. Is the site within or likely to affect an International or National Designated Site for nature conservation (as defined in Planning Policy Wales)?"
}
conditionalLabel={
"If Yes, specify the name and attach any relevant details"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="protectedSpecies"
datafieldname="protectedSpecies"
options={["Yes", "No"]}
id="protectedSpecies"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"21. Are any protected species likely to be affected by the proposal?"
}
conditionalLabel={
"If Yes, specify which and attach any relevant details"
}
optionSelect={"Yes"}
/>
</div>
<Field
label="22. Does the case involve persons claiming Gypsy/Traveller status, whether or not this is accepted by the LPA?"
name="gypsyTravellerInvolvment"
id="gypsyTravellerInvolvment"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="governmentDepartmentComments"
datafieldname="governmentDepartmentComments"
options={["Yes", "No"]}
id="governmentDepartmentComments"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"23. Have you received comments or directions from any government department/agency or statutory undertaker, including in response to a statutory notification or consultation?"
}
conditionalLabel={
"If Yes, specify which and attach any relevant details"
}
optionSelect={"Yes"}
/>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Suggested conditions
</h3>
<div className="govuk-form-group govuk-body-m">
24. Review the following standard
conditions and advise whether they would
be necessary if permission/consent is
granted (not applicable to Advertisement
consent proposals):
</div>
<Field
label="a) The development shall begin not later than five years from the date of this decision.
Reason: To comply with Section 91 of the Town and Country Planning Act 1990 / Section 18 of the Town and Country Planning (Listed Building and Conservation Areas) Act 1990."
name="developmentNotBeginLaterThanFiveYears"
id="developmentNotBeginLaterThanFiveYears"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="developmentCarriedOutInAccordance"
datafieldname="developmentCarriedOutInAccordance"
options={["Yes", "No"]}
id="developmentCarriedOutInAccordance"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"b) The development shall be carried out in accordance with the following approved plans and documents: ............................ Reason: To ensure the development is carried out in accordance with the approved documents, plans and drawings submitted with the application."
}
conditionalLabel={
"If Yes, list the approved plans, documents and drawings here or list them in an attached document"
}
optionSelect={"Yes"}
/>
</div>
<Field
label="c) No development shall take place until a scheme for biodiversity enhancement has been submitted to and agreed in writing by the local planning authority. Development shall be carried out in accordance with the approved details.
Reason: In the interests of maintaining and enhancing biodiversity, in accordance with Future Wales Policy 9."
name="developmentNotTakePlaceBiodiversity"
id="developmentNotTakePlaceBiodiversity"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<Field
label="d) No development shall take place until a scheme to enable the provision of gigabit capable broadband infrastructure from the site boundary to the dwellings/buildings hereby permitted has been submitted to and agreed in writing by the local planning authority. Development shall be carried out in accordance with the approved details.
Reason: To support the roll-out of digital communications infrastructure across Wales in accordance with Policy 13 of Future Wales."
name="developmentNotTakePlaceBroadband"
id="developmentNotTakePlaceBroadband"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="developmentAnyOtherConditions"
datafieldname="developmentAnyOtherConditions"
options={["Yes", "No"]}
id="developmentAnyOtherConditions"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"25. Do you consider other conditions, or amended versions of the above standard conditions, to be necessary?"
}
conditionalLabel={
"If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here."
}
optionSelect={"Yes"}
/>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Before sending, have you attached or
provided a web link to:
</h3>
<div className="govuk-form-group">
<Field
name="copyOfApplicantsCertificate"
datafieldname="copyOfApplicantsCertificate"
options={["Yes", "No"]}
id="copyOfApplicantsCertificate"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"26. A copy of the applicants certificate confirming that they notified persons with an interest in the land?"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="advertismentGiven"
datafieldname="advertismentGiven"
options={["Yes", "No"]}
id="advertismentGiven"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"27. Evidence of any publicity given to the application, including site notices and local advertisement?**"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="copyOfLetterOfAppealNotification"
datafieldname="copyOfLetterOfAppealNotification"
options={["Yes", "No"]}
id="copyOfLetterOfAppealNotification"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"28. A copy of the letter with which you notified people of the appeal AND a list of the people you notified?"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="lpaEIAOS"
datafieldname="lpaEIAOS"
options={["Yes", "No"]}
id="lpaEIAOS"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"29. If Yes, insert weblink or attach a copy of the Screening Opinion and any related correspondence"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="advertismentConsentDiscontinuanceNotice"
datafieldname="advertismentConsentDiscontinuanceNotice"
options={["Yes", "No"]}
id="advertismentConsentDiscontinuanceNotice"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"30. Advertisement consent proposals only: A true copy of the Discontinuance Notice (if one has been issued)?"
}
conditionalLabel={
"If Yes, state how the use of the site or the display of the advertisement(s) enjoys the benefit of deemed consent"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="detailsOfOtherAppeals"
datafieldname="detailsOfOtherAppeals"
options={["Yes", "No"]}
id="detailsOfOtherAppeals"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"31. Details of other appeals or applications relating to the site, or a nearby site, which are still being considered by PEDW or the Welsh Ministers?"
}
conditionalLabel={
"If Yes, provide reference numbers and, if applicable, attach or insert links to relevant documents"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="detailsOfPreviousAppeals"
datafieldname="detailsOfPreviousAppeals"
options={["Yes", "No"]}
id="detailsOfPreviousAppeals"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"32. Details of any previous appeal decision relating to the site or a nearby site referred to by the LPA or applicant?"
}
conditionalLabel={
"If Yes, provide the reference number(s) and address(es) and attach or insert links to the decision(s) and any relevant application documents"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="otherRelevantInformation"
datafieldname="otherRelevantInformation"
options={["Yes", "No"]}
id="otherRelevantInformation"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={
RenderLPACondtionalRadioList
}
validate={[required]}
legend={
"33. Any other relevant information that we should know about?"
}
conditionalLabel={
"If Yes, provide a brief description and attach or insert links to the relevant details"
}
optionSelect={"Yes"}
/>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Declaration
</h3>
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-one-half"
id="caseOfficer"
name="caseOfficer"
data-aria-controls="caseOfficer"
type="text"
component={RenderTextfield}
label="Signed"
validate={[required]}
/>
</div>
<div className="govuk-form-group">
{onBehalfOfLPA} seww
<Field
className="govuk-input govuk-!-width-one-half"
id="onBehalfOfLPA"
name="onBehalfOfLPA"
data-aria-controls="caseOfficer"
type="text"
component={RenderTextfield}
label="On behalf of"
validate={[required]}
/>
</div>
<Field
name="signedDate"
id="signedDate"
label="Date"
component={RenderDatePicker}
validate={[required]}
errorMsg="Select a date"
dateStart="0"
dateEnd="1-y"
/>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
{" "}
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
label={"Add your files"}
ticketnumber={
props.props.caseReference
}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
/>
</div>
</fieldset>
</>
)}
</div>{" "}
</div>
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
Continue
</button>
{/* <a
onClick={() => {
setRepresentationSubmit(false);
}}
className="govuk-button"
>
Continue
</a> */}
<a
onClick={() => {
//setRepresentationCapacity();
}}
className="govuk-link"
>
Back
</a>
</div>
</div>
</div>
</div>
);
};
const selector = formValueSelector("representationForm"); // <-- same as form name
RepLPA = connect((state) => {
const representationTypeValue = selector(state, "representationType");
const procedureTypeValue = selector(state, "procedureType");
return {
procedureTypeValue,
representationTypeValue,
};
})(RepLPA);
const mapStateToProps = (state, props) => {
console.log();
return {
initialValues: {
onBehalfOfLPA:
props.props.props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
],
},
};
};
export default connect(mapStateToProps)(
reduxForm({
form: "representationForm",
enableReinitialize: true,
destroyOnUnmount: false,
})(RepLPA)
);
@@ -0,0 +1,102 @@
import Link from "next/link";
import { connect } from "react-redux";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import {
Field,
reduxForm,
formValueSelector,
handleSubmit,
reset,
} from "redux-form";
import {
RenderPickList,
RenderTextfield,
RenderRadioList,
RenderMultiline,
} from "./representationElements";
import { useDropzone } from "react-dropzone";
import RepDetails from "./representationDetails";
import RepLPADetails from "./representationLPADetails";
import { setRepresentationCapacity } from "../../../store/currentView/action";
let RepLPACapacitySelection = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const {
formObj,
capacityOptionsArr,
currentType,
casesObj,
validate,
handleSubmit,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
const required = (value) => (value ? undefined : "Required");
return (
<>
<RepLPADetails
formObj={formObj}
currentType={currentType}
casesObj={casesObj}
caseReference={props.props.caseReference}
searchResultsObj={props.props.searchResultsObj}
/>{" "}
<div id="rep-details" className="vo_hiddens">
<div className="govuk-grid-column-full">
<div className="govuk-grid-row">
{/* <h2 className="govuk-heading-m ">
Your details - {props.firstValue}
</h2> */}
{/* <div className="">
<label className="govuk-visually-hidden2">
<Field
name="representationCapacity"
datafieldname="representationCapacity"
label="In what capacity do you wish to make representations on this case?"
options={["LPA"]}
id="representationCapacity"
//className="govuk-radios__input "
errorMsg={t(
"newappeal:select-an-option-label"
)}
component="input"
validate={[required]}
value="LPA"
checked={"true"}
type="radio"
/>
LPA
</label>
</div> */}
</div>
</div>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
</div>
</div>
</div>
</div>
</>
);
};
export default RepLPACapacitySelection;
@@ -0,0 +1,78 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { connect } from "react-redux";
import { Field, reduxForm, formValueSelector } from "redux-form";
import {
RenderPickList,
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderCondtionalRadioList,
RenderLPACondtionalRadioList,
FileUploadField,
RenderRichMultiline,
RenderDatePicker,
} from "./representationElements";
let RepLPAQuestionnaire = (props) => {
return (
<>
<p className="govuk-body">
You can enter your comments in the space provided or attach a
separate document.
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div id="commentBox-hint" className="govuk-hint">
My comments are set out in: vcc
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
</div>
</fieldset>
</>
);
};
const selector = formValueSelector("representationForm"); // <-- same as form name
RepLPAQuestionnaire = connect((state) => {
const representationTypeValue = selector(state, "representationType");
const procedureTypeValue = selector(state, "procedureType");
return {
procedureTypeValue,
representationTypeValue,
};
})(RepLPAQuestionnaire);
const mapStateToProps = (state, props) => {
console.log();
return {
initialValues: {
onBehalfOfLPA:
props.props.props.props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
],
},
};
};
export default connect(mapStateToProps)(
reduxForm({
form: "representationForm",
enableReinitialize: true,
destroyOnUnmount: false,
})(RepLPAQuestionnaire)
);
@@ -0,0 +1,103 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { Field, reduxForm } from "redux-form";
import { RenderPickList, RenderTextfield } from "./representationElements";
import jsonpath from "jsonpath";
const RepLPADetails = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const { currentType, casesObj, caseReference } = props;
let setCaseDetailsObj = props.searchResultsObj.searchDetailsObj;
var detailsObj = {};
detailsObj = jsonpath.query(
setCaseDetailsObj,
'$..[?(@.pinswg_name=="' + caseReference + '")]'
);
detailsObj = detailsObj[0];
return (
<>
{" "}
<div className="govuk-grid-column-full">
<div id="rep-sumamry" className="govuk-grid-row">
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-applicant-label")}
</dt>
<dd className="govuk-summary-list__value">
{casesObj.appellantApplicant || ""}
{detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] || "not entered"}
</dd>
</div>
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-agent-label")}
</dt>
<dd className="govuk-summary-list__value">
Mr A Agent
</dd>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-site-address-label")}
</dt>
<dd className="govuk-summary-list__value">
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1") &&
detailsObj.pinswg_siteaddressline1 !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddressline2")
? detailsObj.pinswg_siteaddressline2
: ""}
{_.has(detailsObj, "pinswg_siteaddressline2") &&
detailsObj.pinswg_siteaddressline2 !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown")
? detailsObj.pinswg_siteaddresstown
: ""}
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresscounty")
? detailsObj.pinswg_siteaddresscounty
: ""}
{_.has(
detailsObj,
"pinswg_siteaddresscounty"
) &&
detailsObj.pinswg_siteaddresscounty !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresspostcode")
? detailsObj.pinswg_siteaddresspostcode
: ""}
</dd>
</div>
</dl>
</div>
<div className="govuk-grid-row">
<p className="govuk-body">
This form enables you to submit statements, comments and
questionaires on a case to Planning and Environment
Decisions Wales.{" "}
</p>
</div>
</div>
</>
);
};
export default RepLPADetails;
@@ -0,0 +1,795 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { connect } from "react-redux";
import { Field, reduxForm, formValueSelector } from "redux-form";
import {
RenderPickList,
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderCondtionalRadioList,
RenderLPACondtionalRadioList,
FileUploadField,
RenderRichMultiline,
RenderDatePicker,
} from "./representationElements";
import {
setRepresentationCapacity,
setRepresentationSubmit,
} from "../../../store/currentView/action";
import { useDropzone } from "react-dropzone";
import { select } from "xpath";
let RepLPAQuestionnaire = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const {
formObj,
appellantApplicantRepresentationArr,
setRepresentationCapacity,
setRepresentationSubmit,
currentView,
procedureTypeValue,
onBehalfOfLPA,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
const required = (value) => (value ? undefined : "Required");
return (
<>
{props.representationTypeValue}
{props.procedureTypeValue}
<div className="govuk-grid-row">
<div className="govuk-form-group">
<>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Appeal procedure and site visit{" "}
</h3>
<div className="govuk-form-group">
<Field
label="5. Which procedure do you consider the appeal should follow?"
name="procedureType"
optionsArr={[
"Written representations",
"Hearing",
"Inquiry",
]}
id="procedureType"
component={RenderPickList}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
{(procedureTypeValue == "Hearing" ||
procedureTypeValue == "Inquiry") && (
<Field
label="If Hearing or Inquiry, provide reasons here for why you consider this to be justified"
name="procedureTypeEvidence"
id="procedureTypeEvidence"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
richText="false"
/>
)}
<Field
label="6. Will the Inspector need to enter the appeal site/property?"
name="enterToView"
id="enterToView"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="enterNeighbouringLandToViewSite"
datafieldname="enterNeighbouringLandToViewSite"
options={["Yes", "No"]}
id="enterNeighbouringLandToViewSite"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"7. Do you consider that the Inspector needs to enter neighbouring private land/property to view the site?"
}
conditionalLabel={
"If Yes, give reasons and provide the neighbouring site address. If you have them, provide the contact details of the landowner in an attachment."
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="enterNeighbouringLandAccessRequired"
datafieldname="enterNeighbouringLandAccessRequired"
options={["Yes", "No"]}
id="enterNeighbouringLandAccessRequired"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"8. If access to private land/buildings is required, are you content for the Inspector to visit the site on an access required basis, with only the landowner or their representative present?"
}
conditionalLabel={
"If No, give reasons for why you consider an Accompanied Site Visit to be necessary"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="healthAndSafetyIssues"
datafieldname="healthAndSafetyIssues"
options={["Yes", "No"]}
id="healthAndSafetyIssues"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"9. Are you aware of any health and safety issues which would need to be considered when the Inspector visits the site?"
}
conditionalLabel={
"If Yes, describe the health and safety issues to be considered"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
id="LPAcontactDetails"
name="LPAcontactDetails"
value="email"
data-aria-controls="LPAcontactDetails"
type="text"
component={RenderRichMultiline}
label="10. LPA contact for site visit, hearing or inquiry arrangements:"
/>
</div>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Supporting documents{" "}
</h3>
<div className="govuk-form-group">
<Field
label="11. LPA case file and representations"
name="LPAcaseFileAndReps"
id="LPAcaseFileAndReps"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
richText="false"
hint="Insert weblink(s) to case file and representations on the LPAs public portal. This must include all documents which were before the LPA at the time of its decision or when the appeal was made. Ensure that you link directly to the case documents list, not to a generic page on the LPAs portal. If web-based comments were also made, insert a second link to that page. Alternatively, state here if you are sending relevant case file documents under separate cover."
/>
</div>
<div className="govuk-form-group">
<Field
label="12. LPAs adopted local development plan and Proposals Map:"
name="LPAldpAndMap"
id="LPAldpAndMap"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
richText="false"
hint="Insert weblinks to the Written Statement of the adopted LDP/UDP, and the accompanying Proposals Map (including map key). Alternatively, list relevant policies here and attach excerpts."
/>
</div>
<div className="govuk-form-group">
<Field
label="13. Adopted local guidance relevant to the proposal"
name="LPAlocalGuidance"
id="LPAlocalGuidance"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
richText="false"
hint="Insert weblink(s) to any relevant any local guidance (e.g. Supplementary Planning Guidance, Conservation Area appraisals) which the LPA considers relevant, specifying the document name before the web link. Alternatively, list the relevant guidance and attach copies/excerpts."
/>
</div>
<Field
label="14. If applicable, do you intend to submit a full statement at the 4- week stage?"
name="LPAintentionToSubmitFullStatement"
id="LPAintentionToSubmitFullStatement"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Statutory considerations
</h3>
<Field
label="15. Is all or part of the site within an Area of Outstanding Natural Beauty?"
name="AONB"
id="AONB"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="ROW"
datafieldname="ROW"
options={["Yes", "No"]}
id="ROW"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"16. Does the site include any public rights of way?"
}
conditionalLabel={
"If Yes, attach or insert a link to the definitive map and statement for the local area"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="conservationArea"
datafieldname="conservationArea"
options={["Yes", "No"]}
id="conservationArea"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"17. Is all or part of the site within a Conservation Area?"
}
conditionalLabel={
"If Yes, attach or insert links to a plan showing the Conservation Area boundary"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="affectListedBuilding"
datafieldname="affectListedBuilding"
options={["Yes", "No"]}
id="affectListedBuilding"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"18. Would the proposal involve works to, or affect the setting of, a listed building, Scheduled Monument or other designated historic asset?"
}
conditionalLabel={
"If Yes, attach or insert links to the listing description(s) and location plan"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="TPO"
datafieldname="TPO"
options={["Yes", "No"]}
id="TPO"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"19. Is any part of the site subject to a Tree Preservation Order?"
}
conditionalLabel={
"If Yes, attach or insert links to the relevant plan and details"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="natureConservationSite"
datafieldname="natureConservationSite"
options={["Yes", "No"]}
id="natureConservationSite"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"20. Is the site within or likely to affect an International or National Designated Site for nature conservation (as defined in Planning Policy Wales)?"
}
conditionalLabel={
"If Yes, specify the name and attach any relevant details"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="protectedSpecies"
datafieldname="protectedSpecies"
options={["Yes", "No"]}
id="protectedSpecies"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"21. Are any protected species likely to be affected by the proposal?"
}
conditionalLabel={
"If Yes, specify which and attach any relevant details"
}
optionSelect={"Yes"}
/>
</div>
<Field
label="22. Does the case involve persons claiming Gypsy/Traveller status, whether or not this is accepted by the LPA?"
name="gypsyTravellerInvolvment"
id="gypsyTravellerInvolvment"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="governmentDepartmentComments"
datafieldname="governmentDepartmentComments"
options={["Yes", "No"]}
id="governmentDepartmentComments"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"23. Have you received comments or directions from any government department/agency or statutory undertaker, including in response to a statutory notification or consultation?"
}
conditionalLabel={
"If Yes, specify which and attach any relevant details"
}
optionSelect={"Yes"}
/>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Suggested conditions
</h3>
<div className="govuk-form-group govuk-body-m">
24. Review the following standard conditions and
advise whether they would be necessary if
permission/consent is granted (not applicable to
Advertisement consent proposals):
</div>
<Field
label="a) The development shall begin not later than five years from the date of this decision.
Reason: To comply with Section 91 of the Town and Country Planning Act 1990 / Section 18 of the Town and Country Planning (Listed Building and Conservation Areas) Act 1990."
name="developmentNotBeginLaterThanFiveYears"
id="developmentNotBeginLaterThanFiveYears"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="developmentCarriedOutInAccordance"
datafieldname="developmentCarriedOutInAccordance"
options={["Yes", "No"]}
id="developmentCarriedOutInAccordance"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"b) The development shall be carried out in accordance with the following approved plans and documents: ............................ Reason: To ensure the development is carried out in accordance with the approved documents, plans and drawings submitted with the application."
}
conditionalLabel={
"If Yes, list the approved plans, documents and drawings here or list them in an attached document"
}
optionSelect={"Yes"}
/>
</div>
<Field
label="c) No development shall take place until a scheme for biodiversity enhancement has been submitted to and agreed in writing by the local planning authority. Development shall be carried out in accordance with the approved details.
Reason: In the interests of maintaining and enhancing biodiversity, in accordance with Future Wales Policy 9."
name="developmentNotTakePlaceBiodiversity"
id="developmentNotTakePlaceBiodiversity"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<Field
label="d) No development shall take place until a scheme to enable the provision of gigabit capable broadband infrastructure from the site boundary to the dwellings/buildings hereby permitted has been submitted to and agreed in writing by the local planning authority. Development shall be carried out in accordance with the approved details.
Reason: To support the roll-out of digital communications infrastructure across Wales in accordance with Policy 13 of Future Wales."
name="developmentNotTakePlaceBroadband"
id="developmentNotTakePlaceBroadband"
component={RenderRadioList}
options={["Yes", "No"]}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<div className="govuk-form-group">
<Field
name="developmentAnyOtherConditions"
datafieldname="developmentAnyOtherConditions"
options={["Yes", "No"]}
id="developmentAnyOtherConditions"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"25. Do you consider other conditions, or amended versions of the above standard conditions, to be necessary?"
}
conditionalLabel={
"If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here."
}
optionSelect={"Yes"}
/>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">
Before sending, have you attached or provided a
web link to:
</h3>
<div className="govuk-form-group">
<Field
name="copyOfApplicantsCertificate"
datafieldname="copyOfApplicantsCertificate"
options={["Yes", "No"]}
id="copyOfApplicantsCertificate"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"26. A copy of the applicants certificate confirming that they notified persons with an interest in the land?"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="advertismentGiven"
datafieldname="advertismentGiven"
options={["Yes", "No"]}
id="advertismentGiven"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"27. Evidence of any publicity given to the application, including site notices and local advertisement?**"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="copyOfLetterOfAppealNotification"
datafieldname="copyOfLetterOfAppealNotification"
options={["Yes", "No"]}
id="copyOfLetterOfAppealNotification"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"28. A copy of the letter with which you notified people of the appeal AND a list of the people you notified?"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"No"}
/>
</div>
<div className="govuk-form-group">
<Field
name="lpaEIAOS"
datafieldname="lpaEIAOS"
options={["Yes", "No"]}
id="lpaEIAOS"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"29. If Yes, insert weblink or attach a copy of the Screening Opinion and any related correspondence"
}
conditionalLabel={
"Insert weblink here if available online. If No, give reasons"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="advertismentConsentDiscontinuanceNotice"
datafieldname="advertismentConsentDiscontinuanceNotice"
options={["Yes", "No"]}
id="advertismentConsentDiscontinuanceNotice"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"30. Advertisement consent proposals only: A true copy of the Discontinuance Notice (if one has been issued)?"
}
conditionalLabel={
"If Yes, state how the use of the site or the display of the advertisement(s) enjoys the benefit of deemed consent"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="detailsOfOtherAppeals"
datafieldname="detailsOfOtherAppeals"
options={["Yes", "No"]}
id="detailsOfOtherAppeals"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"31. Details of other appeals or applications relating to the site, or a nearby site, which are still being considered by PEDW or the Welsh Ministers?"
}
conditionalLabel={
"If Yes, provide reference numbers and, if applicable, attach or insert links to relevant documents"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="detailsOfPreviousAppeals"
datafieldname="detailsOfPreviousAppeals"
options={["Yes", "No"]}
id="detailsOfPreviousAppeals"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"32. Details of any previous appeal decision relating to the site or a nearby site referred to by the LPA or applicant?"
}
conditionalLabel={
"If Yes, provide the reference number(s) and address(es) and attach or insert links to the decision(s) and any relevant application documents"
}
optionSelect={"Yes"}
/>
</div>
<div className="govuk-form-group">
<Field
name="otherRelevantInformation"
datafieldname="otherRelevantInformation"
options={["Yes", "No"]}
id="otherRelevantInformation"
className="govuk-radios__input"
errorMsg={t(
"newappeal:select-an-option-label"
)}
component={RenderLPACondtionalRadioList}
validate={[required]}
legend={
"33. Any other relevant information that we should know about?"
}
conditionalLabel={
"If Yes, provide a brief description and attach or insert links to the relevant details"
}
optionSelect={"Yes"}
/>
</div>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
<h3 className="govuk-heading-s ">Declaration</h3>
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-one-half"
id="caseOfficer"
name="caseOfficer"
data-aria-controls="caseOfficer"
type="text"
component={RenderTextfield}
label="Signed"
validate={[required]}
/>
</div>
<div className="govuk-form-group">
{onBehalfOfLPA} seww
<Field
className="govuk-input govuk-!-width-one-half"
id="onBehalfOfLPA"
name="onBehalfOfLPA"
data-aria-controls="caseOfficer"
type="text"
component={RenderTextfield}
label="On behalf of"
validate={[required]}
/>
</div>
<Field
name="signedDate"
id="signedDate"
label="Date"
component={RenderDatePicker}
validate={[required]}
errorMsg="Select a date"
dateStart="0"
dateEnd="1-y"
/>
</fieldset>
<fieldset
className="govuk-fieldset govuk-!-margin-top-9"
aria-describedby="commentBox-hint"
>
{" "}
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
label={"Add your files"}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.props.accountDetails
.containerID
}
/>
</div>
</fieldset>
</>
</div>{" "}
</div>
</>
);
};
const selector = formValueSelector("representationForm"); // <-- same as form name
RepLPAQuestionnaire = connect((state) => {
const representationTypeValue = selector(state, "representationType");
const procedureTypeValue = selector(state, "procedureType");
return {
procedureTypeValue,
representationTypeValue,
};
})(RepLPAQuestionnaire);
const mapStateToProps = (state, props) => {
console.log();
return {
initialValues: {
onBehalfOfLPA:
props.props.props.props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
],
},
};
};
export default connect(mapStateToProps)(
reduxForm({
form: "representationForm",
enableReinitialize: true,
destroyOnUnmount: false,
})(RepLPAQuestionnaire)
);
File diff suppressed because it is too large Load Diff
@@ -7,6 +7,7 @@ import {
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderRichMultiline,
FileUploadField,
} from "./representationElements";
import { useDropzone } from "react-dropzone";
@@ -88,7 +89,7 @@ const RepLandOwner = (props) => {
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
+27 -1
View File
@@ -385,7 +385,32 @@ const CaseSummary = (props) => {
</dl>
</div>
</div>
{/* <div className="govuk-grid-row">
<div className="govuk-grid-column-full">
todays date - {formatDates(new Date())}
<br />
pinswg_startdate -{" "}
{formatDates(detailsObj.pinswg_startdate)}
<br />
days between pinswg_startdate & todays date -
{Math.floor(
(new Date(detailsObj.pinswg_startdate) -
new Date()) /
(24 * 3600 * 1000)
)}
<br />
pinswg_statementduedate -{" "}
{formatDates(detailsObj.pinswg_statementduedate)}
<br />
pinswg_finalcommentsduedate -{" "}
{formatDates(detailsObj.pinswg_finalcommentsduedate)}
<br />
pinswg_startdatetimeiftheevent -{" "}
{formatDates(detailsObj.pinswg_startdatetimeiftheevent)}
<br /> <br />
</div>
</div>
*/}
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-button-group">
@@ -415,6 +440,7 @@ const CaseSummary = (props) => {
)}
</a>
</Link>
<a
onClick={() => {
//spinnerState();
+6 -1
View File
@@ -182,7 +182,12 @@ const TopThree = (props) => {
<div className="cardModuleReference">
<b>{t("myportal:case-reference")}:</b>
{" "}
{showTopThreeArr[key].casereference}
{showTopThreeArr[key].caseRef}
</div>
<div className="cardModuleReference">
<b>Representation type:</b>
{" "}
{showTopThreeArr[key].representationType}
</div>
</div>
</div>
@@ -0,0 +1,392 @@
import ReactPDF, {
Document,
Page,
Text,
View,
Image,
StyleSheet,
PDFViewer,
Font,
} from "@react-pdf/renderer";
import { createElement } from "react";
import Html from "react-pdf-html";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
const styles = StyleSheet.create({
page: {
backgroundColor: "white",
padding: 20,
fontSize: 16,
paddingBottom: 50,
},
header: {
fontSize: 25,
fontFamily: "Helvetica",
flexDirection: "row",
justifyContent: "space-between",
},
subHeader: {
fontSize: 20,
},
logoImage: { width: "200pt" },
questionBullet: { width: "5%", fontSize: 12 },
questionText: { width: "30%", fontSize: 12 },
questionTextMid: { width: "80%", fontSize: 12 },
questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 },
questionAnswer: {
color: "#757575",
width: "65%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerMid: {
color: "#757575",
width: "20%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerWide: {
color: "#757575",
width: "95%",
fontSize: 12,
marginLeft: "5%",
border: 1,
borderColor: "#eee",
backgroundColor: "white",
padding: 5,
},
sectionContainer: {
backgroundColor: "#F8F8F8",
padding: 10,
marginTop: 20,
fontSize: 15,
},
pageNumber: {
position: "absolute",
fontSize: 12,
bottom: 20,
left: 0,
right: 0,
textAlign: "center",
color: "grey",
},
richArea: {
fontSize: 12,
color: "red",
flexDirection: "column",
},
});
// const renderer_1 = require("@react-pdf/renderer");
// const renderPara = {
// "p": ({ style, element, children }) =>
// createElement(renderer_1.View, { style: style }, children),
// };
export const finalComments_pdf = ({ docProps }) => {
//console.log("----", docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = dateObj.getFullYear();
return dd + "/" + mm + "/" + yyyy;
}
let values = docProps;
return (
<Document>
<Page size="A4" style={styles.page} wrap>
<View style={{ padding: 20 }}>
<View style={styles.header}>
<View>
<Text
style={{
width: "60%",
fontFamily: "Helvetica-Bold",
}}
>
Final Comments
</Text>
<View>
<Text
style={{
width: "60%",
fontSize: 15,
marginTop: 20,
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
</Text>
</View>
</View>
<Image
style={styles.logoImage}
src="public/assets/images/pedw_logo.png"
/>
</View>
<View style={styles.section}>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case details</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1.</Text>
<Text style={styles.questionText}>
PEDW reference:
</Text>
<Text style={styles.questionAnswer}>
{values.caseRef}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>2.</Text>
<Text style={styles.questionText}>
LPA reference:
</Text>
<Text style={styles.questionAnswer}>
{values.lpaRef}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionText}>
Site address/grid ref:
</Text>
<Text style={styles.questionAnswer}>
123 Big Street, Small Town, Little County,
XD23 54X
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionText}>
Case Type:
</Text>
<Text style={styles.questionAnswer}>
Planning applicaiton (s78)
</Text>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Comments</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "column",
marginBottom: 10,
}}
>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>
5.
</Text>
<Text style={styles.questionTextMid}>
Final Comments
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.representationComments}
</Html>
</View>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>
Supporting documents
</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionText}>
List of attachec files
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAcaseFileAndReps}
</Html>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text>Declaration</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text
style={{ width: "40%", fontSize: 12 }}
>
Signed:
</Text>
<Text style={styles.questionAnswer}>
{values.caseOfficer}
</Text>
</View>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text style={styles.questionText}>
Date:
</Text>
<Text style={styles.questionAnswer}>
{formatDates(values.signedDate)}
</Text>
</View>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
On behalf of:
</Text>
<Text style={styles.questionAnswerWide}>
{values.onBehalfOfLPA}
</Text>
</View>
</View>
<View style={{ marginTop: 50, fontSize: 12 }}>
<Text>
* Article 11 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Regulation 7 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) (Wales) Regulations 2012
</Text>
<Text style={{ marginTop: 20 }}>
** Article 12 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Section 67/73 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) Act 1990; Regulation 10 of The Town and
Country Planning (Listed Buildings and
Conservation Areas) (Wales) Regulations 2012
</Text>
</View>
</View>
</View>
<Text
style={styles.pageNumber}
render={({ pageNumber, totalPages }) =>
`${pageNumber} / ${totalPages}`
}
fixed
/>
<View
fixed
style={{
position: "absolute",
top: 20,
left: 20,
bottom: 20,
right: 20,
border: 1,
borderColor: "#eee",
padding: 20,
paddingTop: 30,
height: "100%",
}}
></View>
</Page>
</Document>
);
};
File diff suppressed because it is too large Load Diff
+348
View File
@@ -0,0 +1,348 @@
import ReactPDF, {
Document,
Page,
Text,
View,
Image,
StyleSheet,
PDFViewer,
Font,
} from "@react-pdf/renderer";
import { createElement } from "react";
import Html from "react-pdf-html";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
const styles = StyleSheet.create({
page: {
backgroundColor: "white",
padding: 20,
fontSize: 16,
paddingBottom: 50,
},
header: {
fontSize: 25,
fontFamily: "Helvetica",
flexDirection: "row",
justifyContent: "space-between",
},
subHeader: {
fontSize: 20,
},
logoImage: { width: "200pt" },
questionBullet: { width: "5%", fontSize: 12 },
questionText: { width: "30%", fontSize: 12 },
questionTextMid: { width: "80%", fontSize: 12 },
questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 },
questionAnswer: {
color: "#757575",
width: "65%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerMid: {
color: "#757575",
width: "20%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerWide: {
color: "#757575",
width: "95%",
fontSize: 12,
marginLeft: "5%",
border: 1,
borderColor: "#eee",
backgroundColor: "white",
padding: 5,
},
sectionContainer: {
backgroundColor: "#F8F8F8",
padding: 10,
marginTop: 20,
fontSize: 15,
},
pageNumber: {
position: "absolute",
fontSize: 12,
bottom: 20,
left: 0,
right: 0,
textAlign: "center",
color: "grey",
},
richArea: {
fontSize: 12,
color: "red",
flexDirection: "column",
},
});
// const renderer_1 = require("@react-pdf/renderer");
// const renderPara = {
// "p": ({ style, element, children }) =>
// createElement(renderer_1.View, { style: style }, children),
// };
export const other_pdf = ({ docProps }) => {
//console.log("----", docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = dateObj.getFullYear();
return dd + "/" + mm + "/" + yyyy;
}
let values = docProps;
return (
<Document>
<Page size="A4" style={styles.page} wrap>
<View style={{ padding: 20 }}>
<View style={styles.header}>
<View>
<Text
style={{
width: "60%",
fontFamily: "Helvetica-Bold",
}}
>
Other
</Text>
<View>
<Text
style={{
width: "60%",
fontSize: 15,
marginTop: 20,
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
</Text>
</View>
</View>
<Image
style={styles.logoImage}
src="public/assets/images/pedw_logo.png"
/>
</View>
<View style={styles.section}>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case details</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1.</Text>
<Text style={styles.questionText}>
PEDW reference:
</Text>
<Text style={styles.questionAnswer}>
{values.caseRef}
</Text>
</View>
{/* <View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionText}>
Case Type:
</Text>
<Text style={styles.questionAnswer}>
Planning applicaiton (s78)
</Text>
</View> */}
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Comments</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "column",
marginBottom: 10,
}}
>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.representationComments}
</Html>
</View>
</View>
</View>
</View>
{/* <View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>
Supporting documents
</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionText}>
List of attached files
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAcaseFileAndReps}
</Html>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text>Declaration</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text
style={{ width: "40%", fontSize: 12 }}
>
Signed:
</Text>
<Text style={styles.questionAnswer}>
{values.caseOfficer}
</Text>
</View>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text style={styles.questionText}>
Date:
</Text>
<Text style={styles.questionAnswer}>
{formatDates(values.signedDate)}
</Text>
</View>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
On behalf of:
</Text>
<Text style={styles.questionAnswerWide}>
{values.onBehalfOfLPA}
</Text>
</View>
</View>
<View style={{ marginTop: 50, fontSize: 12 }}>
<Text>
* Article 11 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Regulation 7 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) (Wales) Regulations 2012
</Text>
<Text style={{ marginTop: 20 }}>
** Article 12 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Section 67/73 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) Act 1990; Regulation 10 of The Town and
Country Planning (Listed Buildings and
Conservation Areas) (Wales) Regulations 2012
</Text>
</View>
</View> */}
</View>
<Text
style={styles.pageNumber}
render={({ pageNumber, totalPages }) =>
`${pageNumber} / ${totalPages}`
}
fixed
/>
<View
fixed
style={{
position: "absolute",
top: 20,
left: 20,
bottom: 20,
right: 20,
border: 1,
borderColor: "#eee",
padding: 20,
paddingTop: 30,
height: "100%",
}}
></View>
</Page>
</Document>
);
};
+390
View File
@@ -0,0 +1,390 @@
import ReactPDF, {
Document,
Page,
Text,
View,
Image,
StyleSheet,
PDFViewer,
Font,
} from "@react-pdf/renderer";
import { createElement } from "react";
import Html from "react-pdf-html";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
const styles = StyleSheet.create({
page: {
backgroundColor: "white",
padding: 20,
fontSize: 16,
paddingBottom: 50,
},
header: {
fontSize: 25,
fontFamily: "Helvetica",
flexDirection: "row",
justifyContent: "space-between",
},
subHeader: {
fontSize: 20,
},
logoImage: { width: "200pt" },
questionBullet: { width: "5%", fontSize: 12 },
questionText: { width: "30%", fontSize: 12 },
questionTextMid: { width: "80%", fontSize: 12 },
questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 },
questionAnswer: {
color: "#757575",
width: "65%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerMid: {
color: "#757575",
width: "20%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerWide: {
color: "#757575",
width: "95%",
fontSize: 12,
marginLeft: "5%",
border: 1,
borderColor: "#eee",
backgroundColor: "white",
padding: 5,
},
sectionContainer: {
backgroundColor: "#F8F8F8",
padding: 10,
marginTop: 20,
fontSize: 15,
},
pageNumber: {
position: "absolute",
fontSize: 12,
bottom: 20,
left: 0,
right: 0,
textAlign: "center",
color: "grey",
},
richArea: {
fontSize: 12,
color: "red",
flexDirection: "column",
},
});
// const renderer_1 = require("@react-pdf/renderer");
// const renderPara = {
// "p": ({ style, element, children }) =>
// createElement(renderer_1.View, { style: style }, children),
// };
export const statement_pdf = ({ docProps }) => {
//console.log("----", docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = dateObj.getFullYear();
return dd + "/" + mm + "/" + yyyy;
}
let values = docProps;
return (
<Document>
<Page size="A4" style={styles.page} wrap>
<View style={{ padding: 20 }}>
<View style={styles.header}>
<View>
<Text
style={{
width: "60%",
fontFamily: "Helvetica-Bold",
}}
>
Statement
</Text>
<View>
<Text
style={{
width: "60%",
fontSize: 15,
marginTop: 20,
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
</Text>
</View>
</View>
<Image
style={styles.logoImage}
src="public/assets/images/pedw_logo.png"
/>
</View>
<View style={styles.section}>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case details</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1.</Text>
<Text style={styles.questionText}>
PEDW reference:
</Text>
<Text style={styles.questionAnswer}>
{values.caseRef}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>2.</Text>
<Text style={styles.questionText}>
LPA reference:
</Text>
<Text style={styles.questionAnswer}>
{values.lpaRef}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionText}>
Site address/grid ref:
</Text>
<Text style={styles.questionAnswer}>
123 Big Street, Small Town, Little County,
XD23 54X
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionText}>
Case Type:
</Text>
<Text style={styles.questionAnswer}>
Planning applicaiton (s78)
</Text>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Comments</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "column",
marginBottom: 10,
}}
>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>
5.
</Text>
<Text style={styles.questionTextMid}>
Stament
</Text>
<Text style={styles.questionAnswerMid}>
{values.representationComment}
</Text>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>
Supporting documents
</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionText}>
List of attached files
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAcaseFileAndReps}
</Html>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text>Declaration</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text
style={{ width: "40%", fontSize: 12 }}
>
Signed:
</Text>
<Text style={styles.questionAnswer}>
{values.caseOfficer}
</Text>
</View>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text style={styles.questionText}>
Date:
</Text>
<Text style={styles.questionAnswer}>
{formatDates(values.signedDate)}
</Text>
</View>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
On behalf of:
</Text>
<Text style={styles.questionAnswerWide}>
{values.onBehalfOfLPA}
</Text>
</View>
</View>
<View style={{ marginTop: 50, fontSize: 12 }}>
<Text>
* Article 11 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Regulation 7 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) (Wales) Regulations 2012
</Text>
<Text style={{ marginTop: 20 }}>
** Article 12 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Section 67/73 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) Act 1990; Regulation 10 of The Town and
Country Planning (Listed Buildings and
Conservation Areas) (Wales) Regulations 2012
</Text>
</View>
</View>
</View>
<Text
style={styles.pageNumber}
render={({ pageNumber, totalPages }) =>
`${pageNumber} / ${totalPages}`
}
fixed
/>
<View
fixed
style={{
position: "absolute",
top: 20,
left: 20,
bottom: 20,
right: 20,
border: 1,
borderColor: "#eee",
padding: 20,
paddingTop: 30,
height: "100%",
}}
></View>
</Page>
</Document>
);
};
@@ -0,0 +1,390 @@
import ReactPDF, {
Document,
Page,
Text,
View,
Image,
StyleSheet,
PDFViewer,
Font,
} from "@react-pdf/renderer";
import { createElement } from "react";
import Html from "react-pdf-html";
import renderers, { renderBlock } from "react-pdf-html/dist/renderers";
const styles = StyleSheet.create({
page: {
backgroundColor: "white",
padding: 20,
fontSize: 16,
paddingBottom: 50,
},
header: {
fontSize: 25,
fontFamily: "Helvetica",
flexDirection: "row",
justifyContent: "space-between",
},
subHeader: {
fontSize: 20,
},
logoImage: { width: "200pt" },
questionBullet: { width: "5%", fontSize: 12 },
questionText: { width: "30%", fontSize: 12 },
questionTextMid: { width: "80%", fontSize: 12 },
questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 },
questionAnswer: {
color: "#757575",
width: "65%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerMid: {
color: "#757575",
width: "20%",
fontSize: 12,
padding: 5,
border: 1,
borderColor: "#eee",
paddingLeft: 10,
backgroundColor: "white",
},
questionAnswerWide: {
color: "#757575",
width: "95%",
fontSize: 12,
marginLeft: "5%",
border: 1,
borderColor: "#eee",
backgroundColor: "white",
padding: 5,
},
sectionContainer: {
backgroundColor: "#F8F8F8",
padding: 10,
marginTop: 20,
fontSize: 15,
},
pageNumber: {
position: "absolute",
fontSize: 12,
bottom: 20,
left: 0,
right: 0,
textAlign: "center",
color: "grey",
},
richArea: {
fontSize: 12,
color: "red",
flexDirection: "column",
},
});
// const renderer_1 = require("@react-pdf/renderer");
// const renderPara = {
// "p": ({ style, element, children }) =>
// createElement(renderer_1.View, { style: style }, children),
// };
export const writtenStatement_pdf = ({ docProps }) => {
//console.log("----", docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = dateObj.getFullYear();
return dd + "/" + mm + "/" + yyyy;
}
let values = docProps;
return (
<Document>
<Page size="A4" style={styles.page} wrap>
<View style={{ padding: 20 }}>
<View style={styles.header}>
<View>
<Text
style={{
width: "60%",
fontFamily: "Helvetica-Bold",
}}
>
Written Statement
</Text>
<View>
<Text
style={{
width: "60%",
fontSize: 15,
marginTop: 20,
fontFamily: "Helvetica-Bold",
}}
>
For Planning, Conservation area, Listed
Building and Advertisement
applications/appeals
</Text>
</View>
</View>
<Image
style={styles.logoImage}
src="public/assets/images/pedw_logo.png"
/>
</View>
<View style={styles.section}>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Case details</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1.</Text>
<Text style={styles.questionText}>
PEDW reference:
</Text>
<Text style={styles.questionAnswer}>
{values.caseRef}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>2.</Text>
<Text style={styles.questionText}>
LPA reference:
</Text>
<Text style={styles.questionAnswer}>
{values.lpaRef}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>3.</Text>
<Text style={styles.questionText}>
Site address/grid ref:
</Text>
<Text style={styles.questionAnswer}>
123 Big Street, Small Town, Little County,
XD23 54X
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>4.</Text>
<Text style={styles.questionText}>
Case Type:
</Text>
<Text style={styles.questionAnswer}>
Planning applicaiton (s78)
</Text>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>Comments</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "column",
marginBottom: 10,
}}
>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>
5.
</Text>
<Text style={styles.questionTextMid}>
Stament
</Text>
<Text style={styles.questionAnswerMid}>
{values.representationComment}
</Text>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text style={{ fontSize: 14 }}>
Supporting documents
</Text>
</View>
<View style={styles.sectionContainer}>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>11.</Text>
<Text style={styles.questionText}>
List of attached files
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAcaseFileAndReps}
</Html>
</View>
</View>
</View>
</View>
<View>
<View
style={{
marginTop: 10,
fontFamily: "Helvetica-Bold",
}}
>
<Text>Declaration</Text>
</View>
<View style={styles.sectionContainer}>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text
style={{ width: "40%", fontSize: 12 }}
>
Signed:
</Text>
<Text style={styles.questionAnswer}>
{values.caseOfficer}
</Text>
</View>
<View
style={{
flexDirection: "row",
marginBottom: 10,
alignItems: "center",
}}
>
<Text style={styles.questionText}>
Date:
</Text>
<Text style={styles.questionAnswer}>
{formatDates(values.signedDate)}
</Text>
</View>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={{ width: "18%", fontSize: 12 }}>
On behalf of:
</Text>
<Text style={styles.questionAnswerWide}>
{values.onBehalfOfLPA}
</Text>
</View>
</View>
<View style={{ marginTop: 50, fontSize: 12 }}>
<Text>
* Article 11 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Regulation 7 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) (Wales) Regulations 2012
</Text>
<Text style={{ marginTop: 20 }}>
** Article 12 of The Town and Country Planning
(Development Management Procedure) (Wales) Order
2012; Section 67/73 of The Town and Country
Planning (Listed Buildings and Conservation
Areas) Act 1990; Regulation 10 of The Town and
Country Planning (Listed Buildings and
Conservation Areas) (Wales) Regulations 2012
</Text>
</View>
</View>
</View>
<Text
style={styles.pageNumber}
render={({ pageNumber, totalPages }) =>
`${pageNumber} / ${totalPages}`
}
fixed
/>
<View
fixed
style={{
position: "absolute",
top: 20,
left: 20,
bottom: 20,
right: 20,
border: 1,
borderColor: "#eee",
padding: 20,
paddingTop: 30,
height: "100%",
}}
></View>
</Page>
</Document>
);
};
+1 -1
View File
@@ -238,7 +238,7 @@ export const getProgressObj = (
};
const BuildRowObj = (rowXML, titleList) => {
const rowObj = Object.keys(rowXML).map((key, index) => {
let rowObj = Object.keys(rowXML).map((key, index) => {
var doc = parser.parseFromString(rowXML[key].outerHTML, "text/xml");
if (_.isEmpty(rowXML[key].innerHTML)) {
("");
+6 -1
View File
@@ -4,6 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"debugdev": "NODE_OPTIONS='--inspect' next dev",
"dev:app": "node ./server/server.js",
"build": "NODE_ENV=production node_modules/next/dist/bin/next build",
"start": "node_modules/next/dist/bin/next start",
@@ -19,6 +20,7 @@
"@azure/storage-queue": "^12.11.0",
"@next-auth/prisma-adapter": "^1.0.4",
"@prisma/client": "^5.0.0",
"@react-pdf/renderer": "^3.1.12",
"@redux-devtools/extension": "^3.2.5",
"applicationinsights": "^2.2.0",
"axios": "^0.24.0",
@@ -51,6 +53,7 @@
"ospoint": "^0.2.1",
"path": "^0.12.7",
"prop-types": "^15.8.1",
"raw-loader": "^4.0.2",
"react": "17.0.2",
"react-accessible-accordion": "^4.0.0",
"react-autosuggest": "^10.1.0",
@@ -60,6 +63,8 @@
"react-dropzone": "^11.5.1",
"react-idle-timer": "4.6.4",
"react-leaflet": "^3.2.5",
"react-pdf": "^7.3.3",
"react-pdf-html": "^1.1.18",
"react-quill": "^2.0.0",
"react-redux": "^7.2.6",
"redux": "^4.2.1",
@@ -81,4 +86,4 @@
"eslint-plugin-jsdoc": "^40.0.1",
"prisma": "^5.0.0"
}
}
}
+262
View File
@@ -0,0 +1,262 @@
/**
* @swagger
* /api/file/generatepdf:
* post:
* tags: [Azure Storage]
* summary: Phase 2
* description: Create reps pdf from text field
* consumes:
* - application/json
* requestBody:
* name: PDF
* description: PDF content body
* required: true
* content:
* 'application/json':
* schema:
* type: object
* properties:
* representationType:
* type: string
* example: "Questionnaire"
* representationQuestion1:
* type: string
* example: "question 111111"
* representationQuestion2:
* type: string
* example: "question 232222"
* representationCapacity:
* type: string
* example: "yes"
* representationDocuments:
* type: array
* example: [{}]
* pinswg_name:
* type: string
* example: "2023-8-24-1692882853853--REP_Bond"
* containerID:
* type: string
* example: "cljzkgyev0006f9tl4pk6u171"
* appealType:
* type: integer
* example: 846040000
* incidentID:
* type: string
* example: "50b533aa-43f1-ec11-aade-00224800be9c"
* caseRef:
* type: string
* example: "CAS-00764-L0Q9W2"
* parameters:
* - name: container
* in: query
* required: true
* example: cljzkgyev0006f9tl4pk6u171
* schema:
* type: string
* - name: casefolderID
* in: query
* required: true
* example: CAS-00764-L0Q9W2
* schema:
* type: string
* - name: hash
* in: query
* required: true
* example: 530b67db992ea277a236790be05b2e49bdd9dd02e6d790cc1c25f96cf39687cb
* schema:
* type: string
*
* responses:
* 200:
* description: Success
*/
import {
createContainer,
getContainers,
getBlobs,
createRepBlob,
uploadFile,
uploadPDFRepFiles,
} from "../../../actions/azurestorage";
import { hashAPIPath } from "../../../actions";
import ReactPDF, {
Document,
Page,
Text,
View,
StyleSheet,
PDFViewer,
} from "@react-pdf/renderer";
import middleware from "../middleware/middleware";
import nextConnect from "next-connect";
import fs from "fs";
import { lpaQuestionnaire_pdf } from "../../../components/pdftemplates/lpaQuestionnaire_pdf";
import { finalComments_pdf } from "../../../components/pdftemplates/finalComments_pdf";
import { statement_pdf } from "../../../components/pdftemplates/statement_pdf";
import { writtenStatement_pdf } from "../../../components/pdftemplates/writtenStatement_pdf";
import { other_pdf } from "../../../components/pdftemplates/other_pdf";
// const ApiProxy = nextConnect();
// ApiProxy.use(middleware);
// ApiProxy.post(async (req, res) => {
export default function handler(req, res) {
var checkHash = req.query.hash;
let reqBodyobj = JSON.parse(req.body);
console.log(
"//////////////////////\nreqBodyobj" +
req +
"\n//////////////////////\n"
);
console.log(
"//////////////////////\nreqBodyobj" +
req.body +
"\n//////////////////////\n"
);
var containerID = reqBodyobj.containerID;
var casefolderID = reqBodyobj.casefolderID;
var caseRef = reqBodyobj.caseRef;
var representationType = reqBodyobj.representationType;
var repRaiser = reqBodyobj.lastname;
//console.log("there are files:", Object.keys(req.files).length);
var checkquerypath = "/api/file/generatepdf";
//console.log("-------", checkHash);
// console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash);
//console.log(casefolderID, caseRef);
// Create Document Component
const MyDocument = (values) => {
switch (values.docProps.representationType) {
case "Questionnaire":
return lpaQuestionnaire_pdf(values);
break;
case "Final comments":
return finalComments_pdf(values);
break;
case "Statement":
return statement_pdf(values);
break;
case "Written statement":
return writtenStatement_pdf(values);
break;
case "Other":
return other_pdf(values);
break;
default:
return other_pdf(values);
}
};
let repCapacity = "";
switch (reqBodyobj.representationCapacity) {
case "Appellant":
repCapacity = "APPELLANT";
break;
case "Agent":
repCapacity = "AGENT";
break;
case "Interested Party/Person":
repCapacity = "IP";
break;
case "Land Owner":
repCapacity = "LO";
break;
case "LPA":
repCapacity = "LPA";
break;
default:
// code block
}
let repType = "";
switch (reqBodyobj.representationType) {
case "Statement":
repType = "STATE";
break;
case "Statement of common ground":
repType = "SCG";
break;
case "Written statement":
repType = "WS";
break;
case "Written statement of evidence":
repType = "WSE";
break;
case "Questionnaire":
repType = "QUEST";
break;
case "Final comments":
repType = "FC";
break;
case "Other":
repType = "OTHER";
break;
default:
// code block
}
const repDate = new Date();
let day = ("0" + repDate.getDate()).slice(-2);
let month = ("0" + (repDate.getMonth() + 1)).slice(-2);
let year = repDate.getFullYear();
let time =
("0" + repDate.getHours()).slice(-2) +
"" +
("0" + repDate.getMinutes()).slice(-2);
let repDateStamp = "";
repDateStamp = year + "" + month + day + "-" + time;
console.log(repDateStamp);
//if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
// //createContainer(containerID).then((containerName) => {
// console.log("does this get folder name:", containerID, casefolderID);
console.log(
"///////////////////////////////////\n file created: \n" +
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf` +
"\n/////////////////////////"
);
createRepBlob(req.body, containerID, caseRef);
ReactPDF.render(
<MyDocument docProps={reqBodyobj} />,
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`
);
uploadPDFRepFiles(
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,
containerID,
caseRef,
repType
);
// to do upload file to storage account
// then remove from local folder
// fs.unlinkSync( `tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,);
return res.status(200).json({
data: "success",
path: `tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,
});
// } else {
// return res.status(400).json();
// }
}
+2 -2
View File
@@ -54,10 +54,10 @@ ApiProxy.get(async (req, res) => {
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await getBlobs(containerName, casefolderID).then((data) => {
return res.status(200).json({ files: data });
return res.status(200).json({ "value": [data] });
});
} else {
return res.status(400).json();
return res.status(400).json({ "error": "ooops" });
}
});
+53 -13
View File
@@ -1,6 +1,37 @@
/**
* @swagger
* /api/file/getrepsblob:
* get:
* tags: [Azure Storage]
* summary: Phase 2
* description: get reps blobs
* parameters:
* - name: container
* in: query
* required: true
* example: cl761h97h0008h11ycmu2qyfo
* schema:
* type: string
* - name: casefolderID
* in: query
* required: true
* example: TMP-AYJHX-SNW1H5
* schema:
* type: string
* - name: hash
* in: query
* required: true
* example: 372c59f86d62b57cc2a7981eeee7737c944d407c6a7f2ea9d85797bbfe9852c5
* schema:
* type: string
* responses:
* 200:
* description: Success
*/
import {
downloadAllRepsFiles,
getRepslobs,
getRepsBlobs,
} from "../../../actions/azurestorage";
import _ from "lodash";
import nextConnect from "next-connect";
@@ -17,23 +48,32 @@ ApiProxy.get(async (req, res) => {
var checkHash = req.query.hash;
var checkquerypath = "/api/file/getrepsblob?container=" + containerName;
// console.log("-----", casefolderID);
// console.log("-----", req.query);
// console.log("-----", checkquerypath);
// console.log("-----", hashAPIPath(checkquerypath));
// console.log("-----", checkHash);
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getRepslobs(containerName, casefolderID)
.then((data) => {
return downloadAllRepsFiles(containerName, data);
const blobObj = await getRepsBlobs(containerName, casefolderID)
.then(async (data) => {
console.log("----------xxxxxx------", data);
let result = await downloadAllRepsFiles(containerName, data);
return res.status(200).json(result);
})
.then((data) => {
return res.status(200).json(data);
.catch((error) => {
console.log(
"///////////////////////\ngetRepsFromBlob api in api route response: " +
error +
"\n///////////////////////\n"
);
console.log("API call error", error);
});
} else {
return res.status(400).json();
return res.status(400).json({ msg: "error" });
}
});
export const config = {
api: {
bodyParser: false,
},
};
export default ApiProxy;
-1
View File
@@ -2,7 +2,6 @@ import {
createContainer,
getContainers,
getBlobs,
createBlob,
uploadFile,
} from "../../../actions/azurestorage";
import { hashAPIPath } from "../../../actions";
+16
View File
@@ -297,7 +297,23 @@ export const getServerSideProps = wrapper.getServerSideProps(
const getDetails = (resultsObj, detailsType) => {
let detailsArr = [];
// console.log(
// "//////////////////////////////////\n",
// resultsObj,
// //"\n",
// detailsType,
// "\n//////////////////////////////////\n"
// );
resultsObj = resultsObj.value;
// console.log(
// "////////////////////////////////// resultsobj\n",
// detailsType,
// "\n",
// resultsObj.length + "\n//////////////////////////////////\n"
// );
if (detailsType == "myRepresentations") {
const repsObj = resultsObj.map((searchDetail, index) => {
//console.log(".......... ", searchDetail);
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.