diff --git a/actions/azurestorage.js b/actions/azurestorage.js index e014febb..f407bcd8 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -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; }; diff --git a/actions/index.js b/actions/index.js index a0fe4b06..0fb2eda5 100644 --- a/actions/index.js +++ b/actions/index.js @@ -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", diff --git a/components/case/representation/index.js b/components/case/representation/index.js index adf952b0..217e7b1a 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -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 ( + + ); + } else { + switch (currentView.representationCapacity) { + case false: { setSubmitBack={setSubmitBack} props={props} caseReference={caseReference} - /> - ); - break; - case "appellant": - //setRepresentationCapacity("appellant"); - return ( - - ); - break; - case "agent": - //setRepresentationCapacity("agent"); - return ( - - ); - break; - case "interestedparty/person": - // setRepresentationCapacity("interestedpartyperson"); - return ( - - ); - break; - case "landowner": - //setRepresentationCapacity("landowner"); - return ( - - ); - break; - default: - return ( - - ); + />; + break; + case "appellant": + //setRepresentationCapacity("appellant"); + return ( + + ); + break; + case "lpa": + //setRepresentationCapacity("appellant"); + return ( + + ); + break; + case "agent": + //setRepresentationCapacity("agent"); + return ( + + ); + break; + case "interestedparty/person": + // setRepresentationCapacity("interestedpartyperson"); + return ( + + ); + break; + case "landowner": + //setRepresentationCapacity("landowner"); + return ( + + ); + break; + default: + return ( + + ); + } } }; @@ -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 ( diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js index c7a13195..20c1e9e1 100644 --- a/components/case/representation/representationAgent.js +++ b/components/case/representation/representationAgent.js @@ -7,6 +7,7 @@ import { RenderTextfield, RenderRadioList, RenderMultiline, + RenderRichMultiline, RenderCondtionalRadioList, FileUploadField, } from "./representationElements"; @@ -109,7 +110,7 @@ const RepAgent = (props) => { { { let { t } = useTranslation(); @@ -210,6 +211,11 @@ const RepCompleteSubmit = (props) => { +

The gathering and subsequent processing of the diff --git a/components/case/representation/representationDetails.js b/components/case/representation/representationDetails.js index cd621e7e..1c1282b1 100644 --- a/components/case/representation/representationDetails.js +++ b/components/case/representation/representationDetails.js @@ -24,6 +24,8 @@ const RepDetails = (props) => { detailsObj = detailsObj[0]; + console.log("-----detailsObj:", detailsObj); + return ( <> {" "} @@ -36,9 +38,9 @@ const RepDetails = (props) => {

{casesObj.appellantApplicant || ""} - {detailsObj[ - "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" - ] || "not entered"} + {detailsObj.firstName + + " " + + detailsObj.lastName || "not entered"}
{/*
diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 4d25d5e9..9aa404da 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -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} )} -
+
{Object.keys(options).map((key, index) => (
{ + const required = (value) => (value ? undefined : "Required"); + + return ( + <> +
+
+ + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} + + + + + +
+
+ {Object.keys(options).map((key, index) => ( +
+
+ + +
+ {value == custom.optionSelect && + options[key] == custom.optionSelect && ( +
+
+ + +
+
+ )} +
+ ))} +
+
+
+ + ); +}; + 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 ( + <> +
+
+ + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} + + {/* {value} +
+ {moment(value).format("DD/MM/YY")} +
*/} + + +
+
+ + ); +}; + 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 ( + <> + + {"hint" in custom} + + {"hint" in custom && ( +
+ {custom.hint} +
+ )} + + + + ); +}; + +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 ( <> + { { + 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) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + const required = (value) => (value ? undefined : "Required"); + + return ( +
    +
    +
    +

    + Questionnaire from an LPA +

    + +
    + + +
    +
    + {/*
    +
    + +
    +
    */} + + {props.representationTypeValue} + {props.procedureTypeValue} + +
    +
    + {console.log(props)} + typeof props.representationTypeValue == "undefined" + {props.representationTypeValue != "Questionnaire" ? ( + <> +

    + You can enter your comments in the space + provided or attach a separate document. +

    +
    +
    + My comments are set out in: +
    +
    + +
    +
    + + ) : ( + <> +
    +

    + Appeal procedure and site visit{" "} +

    +
    + + {(procedureTypeValue == "Hearing" || + procedureTypeValue == + "Inquiry") && ( + + )} + + + +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    +
    +
    +

    + Supporting documents{" "} +

    +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +

    + Statutory considerations +

    + + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    +
    +

    + Suggested conditions +

    +
    + 24. Review the following standard + conditions and advise whether they would + be necessary if permission/consent is + granted (not applicable to Advertisement + consent proposals): +
    + + + +
    + +
    + + + +
    + +
    +
    +
    +

    + Before sending, have you attached or + provided a web link to: +

    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +

    + Declaration +

    +
    + +
    + +
    + {onBehalfOfLPA} seww + +
    + +
    + +
    + {" "} +
    + +
    +
    + + )} +
    {" "} +
    + +
    +
    + ); +}; + +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) +); diff --git a/components/case/representation/representationLPACapacitySelection.js b/components/case/representation/representationLPACapacitySelection.js new file mode 100644 index 00000000..d1ef7b9d --- /dev/null +++ b/components/case/representation/representationLPACapacitySelection.js @@ -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) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + + const required = (value) => (value ? undefined : "Required"); + + return ( + <> + {" "} +
    +
    +
    + {/*

    + Your details - {props.firstValue} +

    */} + + {/*
    + +
    */} +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + ); +}; + +export default RepLPACapacitySelection; diff --git a/components/case/representation/representationLPAComments.js b/components/case/representation/representationLPAComments.js new file mode 100644 index 00000000..861dea57 --- /dev/null +++ b/components/case/representation/representationLPAComments.js @@ -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 ( + <> +

    + You can enter your comments in the space provided or attach a + separate document. +

    +
    +
    + My comments are set out in: vcc +
    +
    + +
    +
    + + ); +}; + +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) +); diff --git a/components/case/representation/representationLPADetails.js b/components/case/representation/representationLPADetails.js new file mode 100644 index 00000000..a01dfb20 --- /dev/null +++ b/components/case/representation/representationLPADetails.js @@ -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 ( + <> + {" "} +
    +
    +
    +
    +
    + {t("case:summary-applicant-label")} +
    +
    + {casesObj.appellantApplicant || ""} + {detailsObj[ + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ] || "not entered"} +
    +
    + {/*
    +
    + {t("case:summary-agent-label")} +
    +
    + Mr A Agent +
    +
    */} +
    +
    + {t("case:summary-site-address-label")} +
    +
    + {_.has(detailsObj, "pinswg_siteaddressline1") + ? detailsObj.pinswg_siteaddressline1 + : ""} + {_.has(detailsObj, "pinswg_siteaddressline1") && + detailsObj.pinswg_siteaddressline1 != + null &&
    } + {_.has(detailsObj, "pinswg_siteaddressline2") + ? detailsObj.pinswg_siteaddressline2 + : ""} + {_.has(detailsObj, "pinswg_siteaddressline2") && + detailsObj.pinswg_siteaddressline2 != + null &&
    } + {_.has(detailsObj, "pinswg_siteaddresstown") + ? detailsObj.pinswg_siteaddresstown + : ""} + {_.has(detailsObj, "pinswg_siteaddresstown") && + detailsObj.pinswg_siteaddresstown != + null &&
    } + {_.has(detailsObj, "pinswg_siteaddresscounty") + ? detailsObj.pinswg_siteaddresscounty + : ""} + {_.has( + detailsObj, + "pinswg_siteaddresscounty" + ) && + detailsObj.pinswg_siteaddresscounty != + null &&
    } + {_.has(detailsObj, "pinswg_siteaddresspostcode") + ? detailsObj.pinswg_siteaddresspostcode + : ""} +
    +
    +
    +
    +
    +

    + This form enables you to submit statements, comments and + questionaires on a case to Planning and Environment + Decisions Wales.{" "} +

    +
    +
    + + ); +}; + +export default RepLPADetails; diff --git a/components/case/representation/representationLPAQuestionnaire.js b/components/case/representation/representationLPAQuestionnaire.js new file mode 100644 index 00000000..0c02762e --- /dev/null +++ b/components/case/representation/representationLPAQuestionnaire.js @@ -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) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + const required = (value) => (value ? undefined : "Required"); + + return ( + <> + {props.representationTypeValue} + {props.procedureTypeValue} + +
    +
    + <> +
    +

    + Appeal procedure and site visit{" "} +

    +
    + + {(procedureTypeValue == "Hearing" || + procedureTypeValue == "Inquiry") && ( + + )} + + + +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    +
    +
    +

    + Supporting documents{" "} +

    +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +

    + Statutory considerations +

    + + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    +
    +

    + Suggested conditions +

    +
    + 24. Review the following standard conditions and + advise whether they would be necessary if + permission/consent is granted (not applicable to + Advertisement consent proposals): +
    + + + +
    + +
    + + + +
    + +
    +
    +
    +

    + Before sending, have you attached or provided a + web link to: +

    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +

    Declaration

    +
    + +
    + +
    + {onBehalfOfLPA} seww + +
    + +
    + +
    + {" "} +
    + +
    +
    + +
    {" "} +
    + + ); +}; + +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) +); diff --git a/components/case/representation/representationLPAQuestionnaireCheck.js b/components/case/representation/representationLPAQuestionnaireCheck.js new file mode 100644 index 00000000..9c69c270 --- /dev/null +++ b/components/case/representation/representationLPAQuestionnaireCheck.js @@ -0,0 +1,2580 @@ +// 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 RepLPAQuestionnaireCheck = (props) => { +// let { t } = useTranslation(); + +// const router = useRouter(); +// const { locale } = router; +// const { +// formObj, +// appellantApplicantRepresentationArr, +// setRepresentationCapacity, +// setRepresentationSubmit, +// currentView, +// procedureTypeValue, +// onBehalfOfLPA, +// } = props; + +// return ( +// <> + +//
    +//
    +// <> +//
    +//

    +// Appeal procedure and site visit{" "} +//

    +//
    +// +// {(procedureTypeValue == "Hearing" || +// procedureTypeValue == "Inquiry") && ( +// +// )} + +// + +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    + +//
    +// +//
    +//
    +//
    +//
    +//

    +// Supporting documents{" "} +//

    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +// +//
    + +//
    +//

    +// Statutory considerations +//

    +// + +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +// +//
    +// +//
    +//
    +//
    +//

    +// Suggested conditions +//

    +//
    +// 24. Review the following standard conditions and +// advise whether they would be necessary if +// permission/consent is granted (not applicable to +// Advertisement consent proposals): +//
    + +// + +//
    +// +//
    +// +// + +//
    +// +//
    +//
    +//
    +//

    +// Before sending, have you attached or provided a +// web link to: +//

    + +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +// +//
    +//
    +//
    +//

    Declaration

    +//
    +// +//
    + +//
    +// {onBehalfOfLPA} seww +// +//
    +// +//
    + +//
    +// {" "} +//
    +// +//
    +//
    +// +//
    {" "} +//
    +// +// ); +// }; + +// 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) +// ); + +import _ from "lodash"; +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; + +let RepLPAQuestionnaireCheck = (props) => { + let { t } = useTranslation(); + const { formObj, currentView, setSubmitBack } = props; + const repFormData = formObj.representationForm.values; + 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; + } + + return ( + <> + {_.has(repFormData, "procedureType") && ( + <> +
    +
    + 5. Which procedure do you consider the appeal should + follow? +
    + +
    + {repFormData.procedureType} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.representationOnBehalfOf == "Yes" && ( +
    +
    + {t("case:representation-onbehalfof-details")} +
    + +
    + {repFormData.representationOnBehalfOf_details} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "enterToView") && ( + <> +
    +
    + 6. Will the Inspector need to enter the appeal + site/property?{" "} +
    + +
    + {repFormData.enterToView} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "enterNeighbouringLandToViewSite") && ( + <> +
    +
    + 7. Do you consider that the Inspector needs to enter + neighbouring private land/property to view the site? +
    + +
    + {repFormData.enterNeighbouringLandToViewSite} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.enterNeighbouringLandToViewSite == "Yes" && ( +
    +
    + {t("case:representation-onbehalfof-details")} +
    + +
    + { + repFormData.enterNeighbouringLandToViewSiteEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "enterNeighbouringLandAccessRequired") && ( + <> +
    +
    + 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? +
    + +
    + {repFormData.enterNeighbouringLandAccessRequired} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.enterNeighbouringLandAccessRequired == + "Yes" && ( + + )} + + )} + {_.has(repFormData, "healthAndSafetyIssues") && ( + <> +
    +
    + 9. Are you aware of any health and safety issues + which would need to be considered when the Inspector + visits the site? +
    + +
    + {repFormData.healthAndSafetyIssues} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.healthAndSafetyIssues == "Yes" && ( + + )} + + )} + {_.has(repFormData, "LPAcontactDetails") && ( + <> +
    +
    + 10. LPA contact for site visit, hearing or inquiry + arrangements: +
    + +
    + {repFormData.healthAndSafetyIssues} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "LPAcaseFileAndReps") && ( + <> +
    +
    + 11. LPA case file and represen- tations +
    + +
    + {repFormData.LPAcaseFileAndReps} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "LPAldpAndMap") && ( + <> +
    +
    + 12. LPA’s adopted local development plan and + Proposals Map +
    + +
    + {repFormData.LPAldpAndMap} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "LPAintentionToSubmitFullStatement") && ( + <> +
    +
    + 14. If applicable, do you intend to submit a full + statement at the 4- week stage? +
    + +
    + {repFormData.LPAintentionToSubmitFullStatement} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "AONB") && ( + <> +
    +
    + 15. Is all or part of the site within an Area of + Outstanding Natural Beauty? +
    + +
    + {repFormData.AONB} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "ROW") && ( + <> +
    +
    + 16. Does the site include any public rights of way? +
    + +
    + {repFormData.ROW} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.ROW == "Yes" && ( + + )} + + )} + {_.has(repFormData, "conservationArea") && ( + <> +
    +
    + 17. Is all or part of the site within a Conservation + Area? +
    + +
    + {repFormData.conservationArea} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.conservationArea == "Yes" && ( + + )} + + )} + {_.has(repFormData, "affectListedBuilding") && ( + <> +
    +
    + 18. Would the proposal involve works to, or affect + the setting of, a listed building, Scheduled + Monument or other designated historic asset? +
    + +
    + {repFormData.affectListedBuilding} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.affectListedBuilding == "Yes" && ( + + )} + + )} + {_.has(repFormData, "TPO") && ( + <> +
    +
    + 19. Is any part of the site subject to a Tree + Preservation Order? +
    + +
    + {repFormData.affectListedBuilding} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.TPO == "Yes" && ( + + )} + + )} + {_.has(repFormData, "natureConservationSite") && ( + <> +
    +
    + 20. Is the site within or likely to affect an + International or National Designated Site for nature + conservation (as defined in Planning Policy Wales)? +
    + +
    + {repFormData.natureConservationSite} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.natureConservationSite == "Yes" && ( + + )} + + )} + {_.has(repFormData, "protectedSpecies") && ( + <> +
    +
    + 21. Are any protected species likely to be affected + by the proposal? +
    + +
    + {repFormData.protectedSpecies} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.protectedSpecies == "Yes" && ( + + )} + + )} + {_.has(repFormData, "gypsyTravellerInvolvment") && ( + <> +
    +
    + 22. Does the case involve persons claiming + Gypsy/Traveller status, whether or not this is + accepted by the LPA? +
    + +
    + {repFormData.gypsyTravellerInvolvment} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "governmentDepartmentComments") && ( + <> +
    +
    + 23. Have you received comments or directions from + any government department/agency or statutory + undertaker, including in response to a statutory + notification or consultation? +
    + +
    + {repFormData.governmentDepartmentComments} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.governmentDepartmentComments == "Yes" && ( +
    +
    + Evidence +
    + +
    + { + repFormData.governmentDepartmentCommentsEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "developmentNotBeginLaterThanFiveYears") && ( + <> +
    +
    + 24a. The development shall begin not later than five + years from the date of this decision. +
    + +
    + {repFormData.developmentNotBeginLaterThanFiveYears} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "developmentCarriedOutInAccordance") && ( + <> +
    +
    + 24b. 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. +
    + +
    + {repFormData.developmentCarriedOutInAccordance} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.developmentCarriedOutInAccordance == "Yes" && ( +
    +
    + Evidence +
    + +
    + { + repFormData.developmentCarriedOutInAccordanceEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "developmentNotTakePlaceBiodiversity") && ( + <> +
    +
    + 24c. 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. +
    + +
    + {repFormData.developmentNotTakePlaceBiodiversity} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + + )} + {_.has(repFormData, "developmentNotTakePlaceBroadband") && ( + <> +
    +
    + 24d. 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. +
    + +
    + {repFormData.developmentNotTakePlaceBroadband} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.developmentNotTakePlaceBroadband == "Yes" && ( +
    +
    + Evidence +
    + +
    + { + repFormData.developmentNotTakePlaceBroadbandEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "developmentAnyOtherConditions") && ( + <> +
    +
    + 25. Do you consider other conditions, or amended + versions of the above standard conditions, to be + necessary? +
    + +
    + {repFormData.developmentAnyOtherConditions} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.developmentAnyOtherConditions == "Yes" && ( +
    +
    + Evidence +
    + +
    + { + repFormData.developmentAnyOtherConditionsEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "copyOfApplicantsCertificate") && ( + <> +
    +
    + 26. A copy of the applicant’s certificate confirming + that they notified persons with an interest in the + land?* +
    + +
    + {repFormData.copyOfApplicantsCertificate} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.copyOfApplicantsCertificate == "Yes" && ( + + )} + + )} + {_.has(repFormData, "advertismentGiven") && ( + <> +
    +
    + 27. Evidence of any publicity given to the + application, including site notices and local + advertisement?** +
    + +
    + {repFormData.advertismentGiven} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.advertismentGiven == "Yes" && ( + + )} + + )} + {_.has(repFormData, "copyOfLetterOfAppealNotification") && ( + <> +
    +
    + 28. A copy of the letter with which you notified + people of the appeal AND a list of the people you + notified? +
    + +
    + {repFormData.copyOfLetterOfAppealNotification} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.copyOfLetterOfAppealNotification == "Yes" && ( +
    +
    + Evidence +
    + +
    + { + repFormData.copyOfLetterOfAppealNotificationEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "lpaEIAOS") && ( + <> +
    +
    + 29. The LPA’s Environmental Impact Assessment + Screening Opinion, if applicable? +
    + +
    + {repFormData.lpaEIAOS} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.lpaEIAOS == "Yes" && ( + + )} + + )} + {_.has(repFormData, "advertismentConsentDiscontinuanceNotice") && ( + <> +
    +
    + 30. Advertisement consent proposals only: A true + copy of the Discontinuance Notice (if one has been + issued)? +
    + +
    + { + repFormData.advertismentConsentDiscontinuanceNotice + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.lpaEIAOS == "Yes" && ( +
    +
    + Evidence +
    + +
    + { + repFormData.advertismentConsentDiscontinuanceNoticeEvidence + } +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + )} + + )} + {_.has(repFormData, "detailsOfOtherAppeals") && ( + <> +
    +
    + 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? +
    + +
    + {repFormData.detailsOfOtherAppeals} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.detailsOfOtherAppeals == "Yes" && ( + + )} + + )} + {_.has(repFormData, "detailsOfPreviousAppeals") && ( + <> +
    +
    + 32. Details of any previous appeal decision relating + to the site or a nearby site referred to by the LPA + or applicant? +
    + +
    + {repFormData.detailsOfPreviousAppeals} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.detailsOfPreviousAppeals == "Yes" && ( + + )} + + )} + {_.has(repFormData, "otherRelevantInformation") && ( + <> +
    +
    + 33. Any other relevant information that we should + know about? +
    + +
    + {repFormData.otherRelevantInformation} +
    + +
    + { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
    +
    + {repFormData.otherRelevantInformation == "Yes" && ( + + )} + + )} + {_.has(repFormData, "signedDate") && ( + <> + + + )} + {_.has(repFormData, "caseOfficer") && ( + <> + + + )} + {_.has(repFormData, "onBehalfOfLPA") && ( + <> + + + )} + + ); +}; +export default RepLPAQuestionnaireCheck; diff --git a/components/case/representation/representationLandowner.js b/components/case/representation/representationLandowner.js index 8e9e6b01..0919bb16 100644 --- a/components/case/representation/representationLandowner.js +++ b/components/case/representation/representationLandowner.js @@ -7,6 +7,7 @@ import { RenderTextfield, RenderRadioList, RenderMultiline, + RenderRichMultiline, FileUploadField, } from "./representationElements"; import { useDropzone } from "react-dropzone"; @@ -88,7 +89,7 @@ const RepLandOwner = (props) => { {
    - + {/*
    +
    + todays date - {formatDates(new Date())} +
    + pinswg_startdate -{" "} + {formatDates(detailsObj.pinswg_startdate)} +
    + days between pinswg_startdate & todays date - + {Math.floor( + (new Date(detailsObj.pinswg_startdate) - + new Date()) / + (24 * 3600 * 1000) + )} +
    + pinswg_statementduedate -{" "} + {formatDates(detailsObj.pinswg_statementduedate)} +
    + pinswg_finalcommentsduedate -{" "} + {formatDates(detailsObj.pinswg_finalcommentsduedate)} +
    + pinswg_startdatetimeiftheevent -{" "} + {formatDates(detailsObj.pinswg_startdatetimeiftheevent)} +

    +
    +
    + */}
    diff --git a/components/pdftemplates/finalComments_pdf.js b/components/pdftemplates/finalComments_pdf.js new file mode 100644 index 00000000..32a0b61b --- /dev/null +++ b/components/pdftemplates/finalComments_pdf.js @@ -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 ( + + + + + + + Final Comments + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + + + + + + Case details + + + + 1. + + PEDW reference: + + + {values.caseRef} + + + + 2. + + LPA reference: + + + {values.lpaRef} + + + + 3. + + Site address/grid ref: + + + 123 Big Street, Small Town, Little County, + XD23 54X + + + + 4. + + Case Type: + + + Planning applicaiton (s78) + + + + + + + Comments + + + + + + 5. + + + Final Comments + + + + {values.representationComments} + + + + + + + + + + Supporting documents + + + + + 11. + + List of attachec files + + + + {values.LPAcaseFileAndReps} + + + + + + + + Declaration + + + + + + Signed: + + + {values.caseOfficer} + + + + + Date: + + + {formatDates(values.signedDate)} + + + + + + On behalf of: + + + {values.onBehalfOfLPA} + + + + + + * 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 + + + ** 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 + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js new file mode 100644 index 00000000..0939036b --- /dev/null +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -0,0 +1,1348 @@ +import ReactPDF, { + Document, + Page, + Text, + View, + Image, + StyleSheet, + PDFViewer, + Font, +} from "@react-pdf/renderer"; +import Html from "react-pdf-html"; + +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", + }, +}); + +export const lpaQuestionnaire_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; + + console.log("sdffhjdhjdjdgkj: ", values.procedureType); + return ( + + + + + + + Local Planning Authority Questionnaire + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + + + + + + The LPA must send the completed questionnaire and + any attachments to PEDW.casework@gov.wales and the + appellant (or their agent) within 5 working days of + the start date specified in our start letter. + + + + + Case details + + + + 1. + + PEDW reference: + + + {values.caseRef} + + + + 2. + + LPA reference: + + + {values.lpaRef} + + + + 3. + + Site address/grid ref: + + + 123 Big Street, Small Town, Little County, + XD23 54X + + + + 4. + + Case Type: + + + Planning applicaiton (s78) + + + + + + + + Appeal procedure and site visit + + + + + + + 5. + + + Which procedure do you consider the + appeal should follow? + + + {values.procedureType} + + + {values.procedureType != + "Written representations" && ( + + + {values.procedureTypeEvidence} + + + )} + + + 6. + + Will the Inspector need to enter the appeal + site/property? + + + {values.enterToView} + + + + + + + 7. + + + Do you consider that the Inspector needs + to enter neighbouring private + land/property to view the site? + + + {values.enterNeighbouringLandToViewSite} + + + + {values.enterNeighbouringLandToViewSite == + "Yes" && ( + + + { + values.enterNeighbouringLandToViewSiteEvidence + } + + + )} + + + + + 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? + + + { + values.enterNeighbouringLandAccessRequired + } + + + {values.enterNeighbouringLandAccessRequired != + "Yes" && ( + + + { + values.enterNeighbouringLandAccessRequiredEvidence + } + + + )} + + + + + 9. + + + Are you aware of any health and safety + issues which would need to be considered + when the Inspector visits the site? + + + {values.healthAndSafetyIssues} + + + {values.healthAndSafetyIssues == "Yes" && ( + + + { + values.healthAndSafetyIssuesEvidence + } + + + )} + + + + + 10. + + + + LPA contact for site visit, hearing or + inquiry arrangements: + + + + + {values.LPAcontactDetails} + + + + + + + + + Supporting documents + + + + + 11. + + LPA case file and representations + + + + {values.LPAcaseFileAndReps} + + + + + 12. + + LPA’s adopted local development plan and + Proposals Map + + + + {values.LPAldpAndMap} + + + + + 13. + + Adopted local guidance relevant to the + proposal: + + + + {values.LPAlocalGuidance} + + + + + 14. + + If applicable, do you intend to submit a + full statement at the 4- week stage? + + + {values.LPAintentionToSubmitFullStatement} + + + + + + + + Statutory considerations + + + + + 15. + + Is all or part of the site within an Area of + Outstanding Natural Beauty? + + + {values.AONB} + + + + + + 16. + + + Does the site include any public rights + of way? + + + {values.ROW} + + + {values.ROW == "Yes" && ( + + + {values.ROWEvidence} + + + )} + + + + + 17. + + + Is all or part of the site within a + Conservation Area? + + + {values.conservationArea}{" "} + + + {values.conservationArea == "Yes" && ( + + + {values.conservationAreaEvidence} + + + )} + + + + + 18. + + + Would the proposal involve works to, or + affect the setting of, a listed + building, Scheduled Monument or other + designated historic asset? + + + {values.affectListedBuilding} + + + {values.affectListedBuilding == "Yes" && ( + + + { + values.affectListedBuildingEvidence + } + + + )} + + + + + 19. + + + Is any part of the site subject to a + Tree Preservation Order? + + + {values.TPO} + + + {values.TPO == "Yes" && ( + + + {values.TPOEvidence} + + + )} + + + + + 20. + + + Is the site within or likely to affect + an International or National Designated + Site for nature conservation (as defined + in Planning Policy Wales)? + + + {values.natureConservationSite} + + + {values.natureConservationSite == "Yes" && ( + + + { + values.natureConservationSiteEvidence + } + + + )} + + + + + 21. + + + Are any protected species likely to be + affected by the proposal? + + + {values.protectedSpecies} + + + {values.protectedSpecies == "Yes" && ( + + + {values.protectedSpeciesEvidence} + + + )} + + + 22. + + Does the case involve persons claiming + Gypsy/Traveller status, whether or not this + is accepted by the LPA? + + + {values.gypsyTravellerInvolvment} + + + + + + 23. + + + Have you received comments or directions + from any government department/agency or + statutory undertaker, including in + response to a statutory notification or + consultation? + + + {values.governmentDepartmentComments} + + + {values.governmentDepartmentComments == + "Yes" && ( + + + { + values.governmentDepartmentCommentsEvidence + } + + + )} + + + + + + + Suggested considerations + + + + + 24. + + Review the following standard conditions and + advise whether they would be necessary if + permission/consent is granted (not + applicable to Advertisement consent + proposals): + + + + a) + + The development shall begin not later than + five years from the date of this decision. + + + { + values.developmentNotBeginLaterThanFiveYears + } + + + + + + 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. + + + { + values.developmentCarriedOutInAccordance + } + + + {values.developmentCarriedOutInAccordance == + "Yes" && ( + + + { + values.developmentCarriedOutInAccordanceEvidence + } + + + )} + + + 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. + + + {values.developmentNotTakePlaceBiodiversity} + + + + 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. + + + {values.developmentNotTakePlaceBroadband} + + + + + + 25. + + + Do you consider other conditions, or + amended versions of the above standard + conditions, to be necessary? + + + {values.developmentAnyOtherConditions} + + + {values.developmentAnyOtherConditions == + "Yes" && ( + + + { + values.developmentAnyOtherConditionsEvidence + } + + + )} + + + + + + + Before sending, have you attached or provided a + web link to: + + + + + + + 26. + + + A copy of the applicant’s certificate + confirming that they notified persons + with an interest in the land?* + + + {values.copyOfApplicantsCertificate} + + + + + { + values.copyOfApplicantsCertificateEvidence + } + + + + + + + + 27. + + + Evidence of any publicity given to the + application, including site notices and + local advertisement?** + + + {values.advertismentGiven} + + + + + + {values.advertismentGivenEvidence} + + + + + + + + 28. + + + A copy of the letter with which you + notified people of the appeal AND a list + of the people you notified? + + + { + values.copyOfLetterOfAppealNotification + } + + + + + { + values.copyOfLetterOfAppealNotificationEvidence + } + + + + + + + + 29. + + + The LPA’s Environmental Impact + Assessment Screening Opinion, if + applicable? + + + {values.lpaEIAOS} + + + {values.lpaEIAOS == "Yes" && ( + + + {values.lpaEIAOSEvidence} + + + )} + + + + + + 30. + + + Advertisement consent proposals only: A + true copy of the Discontinuance Notice + (if one has been issued)? + + + { + values.advertismentConsentDiscontinuanceNotice + } + + + {values.advertismentConsentDiscontinuanceNotice == + "Yes" && ( + + + { + values.advertismentConsentDiscontinuanceNoticeEvidence + } + + + )} + + + + + + 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? + + + {values.detailsOfOtherAppeals} + + + {values.detailsOfOtherAppeals == "Yes" && ( + + + { + values.detailsOfOtherAppealsEvidence + } + + + )} + + + + + + 32. + + + Details of any previous appeal decision + relating to the site or a nearby site + referred to by the LPA or applicant? + + + {values.detailsOfPreviousAppeals} + + + {values.detailsOfPreviousAppeals == "Yes" && ( + + + { + values.detailsOfPreviousAppealsEvidence + } + + + )} + + + + + + 33. + + + Any other relevant information that we + should know about? + + + {values.otherRelevantInformation} + + + {values.otherRelevantInformation == "Yes" && ( + + + { + values.otherRelevantInformationEvidence + } + + + )} + + + + + + Declaration + + + + + + Signed: + + + {values.caseOfficer} + + + + + Date: + + + {formatDates(values.signedDate)} + + + + + + On behalf of: + + + {values.onBehalfOfLPA} + + + + + + * 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 + + + ** 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 + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/other_pdf.js b/components/pdftemplates/other_pdf.js new file mode 100644 index 00000000..8640a721 --- /dev/null +++ b/components/pdftemplates/other_pdf.js @@ -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 ( + + + + + + + Other + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + + + + + + Case details + + + + 1. + + PEDW reference: + + + {values.caseRef} + + + + {/* + 4. + + Case Type: + + + Planning applicaiton (s78) + + */} + + + + + Comments + + + + + + {values.representationComments} + + + + + + {/* + + + Supporting documents + + + + + 11. + + List of attached files + + + + {values.LPAcaseFileAndReps} + + + + + + + + Declaration + + + + + + Signed: + + + {values.caseOfficer} + + + + + Date: + + + {formatDates(values.signedDate)} + + + + + + On behalf of: + + + {values.onBehalfOfLPA} + + + + + + * 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 + + + ** 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 + + + */} + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/statement_pdf.js b/components/pdftemplates/statement_pdf.js new file mode 100644 index 00000000..fdef0c9d --- /dev/null +++ b/components/pdftemplates/statement_pdf.js @@ -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 ( + + + + + + + Statement + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + + + + + + Case details + + + + 1. + + PEDW reference: + + + {values.caseRef} + + + + 2. + + LPA reference: + + + {values.lpaRef} + + + + 3. + + Site address/grid ref: + + + 123 Big Street, Small Town, Little County, + XD23 54X + + + + 4. + + Case Type: + + + Planning applicaiton (s78) + + + + + + + Comments + + + + + + 5. + + + Stament + + + {values.representationComment} + + + + + + + + + Supporting documents + + + + + 11. + + List of attached files + + + + {values.LPAcaseFileAndReps} + + + + + + + + Declaration + + + + + + Signed: + + + {values.caseOfficer} + + + + + Date: + + + {formatDates(values.signedDate)} + + + + + + On behalf of: + + + {values.onBehalfOfLPA} + + + + + + * 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 + + + ** 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 + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/writtenStatement_pdf.js b/components/pdftemplates/writtenStatement_pdf.js new file mode 100644 index 00000000..1bb9c864 --- /dev/null +++ b/components/pdftemplates/writtenStatement_pdf.js @@ -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 ( + + + + + + + Written Statement + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + + + + + + Case details + + + + 1. + + PEDW reference: + + + {values.caseRef} + + + + 2. + + LPA reference: + + + {values.lpaRef} + + + + 3. + + Site address/grid ref: + + + 123 Big Street, Small Town, Little County, + XD23 54X + + + + 4. + + Case Type: + + + Planning applicaiton (s78) + + + + + + + Comments + + + + + + 5. + + + Stament + + + {values.representationComment} + + + + + + + + + Supporting documents + + + + + 11. + + List of attached files + + + + {values.LPAcaseFileAndReps} + + + + + + + + Declaration + + + + + + Signed: + + + {values.caseOfficer} + + + + + Date: + + + {formatDates(values.signedDate)} + + + + + + On behalf of: + + + {values.onBehalfOfLPA} + + + + + + * 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 + + + ** 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 + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/utils/index.js b/components/utils/index.js index bd4e5447..bafc989e 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -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)) { (""); diff --git a/package.json b/package.json index 2952c2f6..4257786f 100644 --- a/package.json +++ b/package.json @@ -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" } -} +} \ No newline at end of file diff --git a/pages/api/file/generatepdf.js b/pages/api/file/generatepdf.js new file mode 100644 index 00000000..71a8e158 --- /dev/null +++ b/pages/api/file/generatepdf.js @@ -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( + , + `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(); + // } +} diff --git a/pages/api/file/getbloblist.js b/pages/api/file/getbloblist.js index 392d3a14..17f05b56 100644 --- a/pages/api/file/getbloblist.js +++ b/pages/api/file/getbloblist.js @@ -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" }); } }); diff --git a/pages/api/file/getrepsblob.js b/pages/api/file/getrepsblob.js index 3c2823fb..730220ac 100644 --- a/pages/api/file/getrepsblob.js +++ b/pages/api/file/getrepsblob.js @@ -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; diff --git a/pages/api/file/setupcontainer.js b/pages/api/file/setupcontainer.js index 0781cebf..cff853cb 100644 --- a/pages/api/file/setupcontainer.js +++ b/pages/api/file/setupcontainer.js @@ -2,7 +2,6 @@ import { createContainer, getContainers, getBlobs, - createBlob, uploadFile, } from "../../../actions/azurestorage"; import { hashAPIPath } from "../../../actions"; diff --git a/pages/myportal/index.js b/pages/myportal/index.js index a5133b72..628dec9c 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -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); diff --git a/public/fonts/Roboto/LICENSE.txt b/public/fonts/Roboto/LICENSE.txt new file mode 100644 index 00000000..75b52484 --- /dev/null +++ b/public/fonts/Roboto/LICENSE.txt @@ -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. diff --git a/public/fonts/Roboto/Roboto-Black.ttf b/public/fonts/Roboto/Roboto-Black.ttf new file mode 100644 index 00000000..0112e7da Binary files /dev/null and b/public/fonts/Roboto/Roboto-Black.ttf differ diff --git a/public/fonts/Roboto/Roboto-BlackItalic.ttf b/public/fonts/Roboto/Roboto-BlackItalic.ttf new file mode 100644 index 00000000..b2c6aca5 Binary files /dev/null and b/public/fonts/Roboto/Roboto-BlackItalic.ttf differ diff --git a/public/fonts/Roboto/Roboto-Bold.ttf b/public/fonts/Roboto/Roboto-Bold.ttf new file mode 100644 index 00000000..43da14d8 Binary files /dev/null and b/public/fonts/Roboto/Roboto-Bold.ttf differ diff --git a/public/fonts/Roboto/Roboto-BoldItalic.ttf b/public/fonts/Roboto/Roboto-BoldItalic.ttf new file mode 100644 index 00000000..bcfdab43 Binary files /dev/null and b/public/fonts/Roboto/Roboto-BoldItalic.ttf differ diff --git a/public/fonts/Roboto/Roboto-Italic.ttf b/public/fonts/Roboto/Roboto-Italic.ttf new file mode 100644 index 00000000..1b5eaa36 Binary files /dev/null and b/public/fonts/Roboto/Roboto-Italic.ttf differ diff --git a/public/fonts/Roboto/Roboto-Light.ttf b/public/fonts/Roboto/Roboto-Light.ttf new file mode 100644 index 00000000..e7307e72 Binary files /dev/null and b/public/fonts/Roboto/Roboto-Light.ttf differ diff --git a/public/fonts/Roboto/Roboto-LightItalic.ttf b/public/fonts/Roboto/Roboto-LightItalic.ttf new file mode 100644 index 00000000..2d277afb Binary files /dev/null and b/public/fonts/Roboto/Roboto-LightItalic.ttf differ diff --git a/public/fonts/Roboto/Roboto-Medium.ttf b/public/fonts/Roboto/Roboto-Medium.ttf new file mode 100644 index 00000000..ac0f908b Binary files /dev/null and b/public/fonts/Roboto/Roboto-Medium.ttf differ diff --git a/public/fonts/Roboto/Roboto-MediumItalic.ttf b/public/fonts/Roboto/Roboto-MediumItalic.ttf new file mode 100644 index 00000000..fc36a478 Binary files /dev/null and b/public/fonts/Roboto/Roboto-MediumItalic.ttf differ diff --git a/public/fonts/Roboto/Roboto-Regular.ttf b/public/fonts/Roboto/Roboto-Regular.ttf new file mode 100644 index 00000000..ddf4bfac Binary files /dev/null and b/public/fonts/Roboto/Roboto-Regular.ttf differ diff --git a/public/fonts/Roboto/Roboto-Thin.ttf b/public/fonts/Roboto/Roboto-Thin.ttf new file mode 100644 index 00000000..2e0dee6a Binary files /dev/null and b/public/fonts/Roboto/Roboto-Thin.ttf differ diff --git a/public/fonts/Roboto/Roboto-ThinItalic.ttf b/public/fonts/Roboto/Roboto-ThinItalic.ttf new file mode 100644 index 00000000..084f9c0f Binary files /dev/null and b/public/fonts/Roboto/Roboto-ThinItalic.ttf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230921-1157_APPELLANT_RDBTech_STATE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230921-1157_APPELLANT_RDBTech_STATE.pdf new file mode 100644 index 00000000..2b0cb9fb Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230921-1157_APPELLANT_RDBTech_STATE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230921-1202_APPELLANT_RDBTech_STATE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230921-1202_APPELLANT_RDBTech_STATE.pdf new file mode 100644 index 00000000..8a750c96 Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230921-1202_APPELLANT_RDBTech_STATE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230921-1204_APPELLANT_RDBTech_STATE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230921-1204_APPELLANT_RDBTech_STATE.pdf new file mode 100644 index 00000000..b9fb8dff Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230921-1204_APPELLANT_RDBTech_STATE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230921-1248_APPELLANT_RDBTech_STATE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230921-1248_APPELLANT_RDBTech_STATE.pdf new file mode 100644 index 00000000..4c3df6d7 Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230921-1248_APPELLANT_RDBTech_STATE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230921-1250_APPELLANT_RDBTech_STATE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230921-1250_APPELLANT_RDBTech_STATE.pdf new file mode 100644 index 00000000..823edcd7 Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230921-1250_APPELLANT_RDBTech_STATE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230921-1307_AGENT_RDBTech_WSE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230921-1307_AGENT_RDBTech_WSE.pdf new file mode 100644 index 00000000..fbaeed88 Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230921-1307_AGENT_RDBTech_WSE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230925-1418_APPELLANT_RDBTech_STATE.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230925-1418_APPELLANT_RDBTech_STATE.pdf new file mode 100644 index 00000000..ee07c178 Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230925-1418_APPELLANT_RDBTech_STATE.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230925-1422_APPELLANT_RDBTech_FC.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230925-1422_APPELLANT_RDBTech_FC.pdf new file mode 100644 index 00000000..db55ee7f Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230925-1422_APPELLANT_RDBTech_FC.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230925-1423_APPELLANT_RDBTech_FC.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230925-1423_APPELLANT_RDBTech_FC.pdf new file mode 100644 index 00000000..a766aca7 Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230925-1423_APPELLANT_RDBTech_FC.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230925-1640_APPELLANT_RDBTech_FC.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230925-1640_APPELLANT_RDBTech_FC.pdf new file mode 100644 index 00000000..df8e6afa Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230925-1640_APPELLANT_RDBTech_FC.pdf differ diff --git a/tmp/CAS-00764-L0Q9W2_rep_20230925-1646_APPELLANT_RDBTech_FC.pdf b/tmp/CAS-00764-L0Q9W2_rep_20230925-1646_APPELLANT_RDBTech_FC.pdf new file mode 100644 index 00000000..b135c0ca Binary files /dev/null and b/tmp/CAS-00764-L0Q9W2_rep_20230925-1646_APPELLANT_RDBTech_FC.pdf differ diff --git a/tmp/~$23-03-16 - Main LPA Questionnaire template v2.docx b/tmp/~$23-03-16 - Main LPA Questionnaire template v2.docx new file mode 100644 index 00000000..1215360c Binary files /dev/null and b/tmp/~$23-03-16 - Main LPA Questionnaire template v2.docx differ