diff --git a/.env old.local b/.env old.local new file mode 100644 index 00000000..ad6df2a5 --- /dev/null +++ b/.env old.local @@ -0,0 +1,119 @@ +ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/ +//ESNR Tenant +//TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502 +//WGO Tenant +TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5 +GRANT_TYPE = "client_credentials" + +HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c +NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c + + +//Dev oauth ESNR +CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a +//CLIENT_SECRET = 4Vt8Q~olL1hx7n01B0~tXf-N2YL5DyC_Fk6waagX +CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE +RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ +RELAYURI = "dev-pedw-ns.servicebus.windows.net" +RELAYPATH = "dev-pedw-hc" + + +//Test Oauth ESNR +//CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1 +//CLIENT_SECRET = IXI8Q~D5oqsC-nrtayHHc~tUAfjQFzNiKVQ~fc2S +//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ +//RELAYURI = "test-pedw-ns.servicebus.windows.net" +//RELAYPATH = "test-pedw-hc" + + +//Preprod Oauth WGO +//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a +//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF +//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/ +//RELAYURI = "pp-pedw-ns.servicebus.windows.net" +//RELAYPATH = "pp-pedw-hc" + + + +//Prod Oauth WGO +//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc +//CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~ +//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/ +//RELAYURI = "prod-pedw-ns.servicebus.windows.net" +//RELAYPATH = "prod-pedw-hc" + + +GOOGLE_TAG_MANAGER = GTM-T78CBC3 +SHOWLOGIN = "true" +SHOWREPRESENTATIONS = true +SHOWFILEUPLOAD = "false" +SHOWMAPS = "false" +//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 + + +PORT= "3000" +DEFAULT_DOMAIN = "localhost" +I18N_DOMAIN = "cymru.local" +//I18N_DOMAIN ="dev-gwaithcynllunio.gwasanaeth.llyw.cymru" +//I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru" +//I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s +//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" + + +//gov gateway +GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration" +GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ +GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS +//GG_REDIRECT_URI = "http://localhost:3000" +GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales" + +NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ +NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000" + +API_ROOT = "http://localhost:3000" + + +GOOGLE_MAP_API_KEY = AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo + + + +//Next Auth vars +//EMAIL_SERVER_HOST=smtp.sendgrid.net +//EMAIL_SERVER_PORT=465 +//EMAIL_SERVER_USER=apikey +//EMAIL_SERVER_PASSWORD=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 +//EMAIL_FROM=rob@rdbsolutions.co.uk + + +EMAIL_SERVER_HOST=rdbdigital.com +EMAIL_SERVER_PORT=465 +EMAIL_SERVER_USER=rob@rdbdigital.com +EMAIL_SERVER_PASSWORD=!Sky9fish2020 +EMAIL_FROM=no-reply@rdbdigital.com + +NEXTAUTH_URL=http://localhost:3000 +NEXTAUTH_URL_INTERNAL=http://localhost:3000 +//DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true +DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword + +SECRET = SuperSecret + + +//Azure Storage Account + +AZURE_CLIENT_ID = $CLIENT_ID +AZURE_TENANT_ID = $TENANT +AZURE_CLIENT_SECRET = $CLIENT_SECRET +AZURE_STORAGE_ACCOUNT_NAME= "pedwdev" +AZURE_STORAGE_ACCOUNT_KEY = JS3ZIXianhYhB1lZrHB+bXbdzaLlON0alCyKrFAb+jVEwr9iqo2dty92EBxwnufNFM+CSN/fKX2R+AStDn0byg== + + +AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net +AZURE_PEDW_CONTAINER = "pedwapplications" +AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net + + + +//gov.notify + +NOTIFY_API_KEY = pedwnextauthkey-90f93710-9dae-423e-aea1-11eccd0dc132-0c9469d9-d671-444d-9e9d-3e5a62001043 \ No newline at end of file diff --git a/.env.local b/.env.local index 566dba97..5c9218c6 100644 --- a/.env.local +++ b/.env.local @@ -1,17 +1,11 @@ ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/ -//ESNR Tenant -//TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502 -//WGO Tenant TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5 GRANT_TYPE = "client_credentials" HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c -NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c - //Dev oauth ESNR CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a -//CLIENT_SECRET = 4Vt8Q~olL1hx7n01B0~tXf-N2YL5DyC_Fk6waagX CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ RELAYURI = "dev-pedw-ns.servicebus.windows.net" @@ -44,59 +38,23 @@ RELAYPATH = "dev-pedw-hc" GOOGLE_TAG_MANAGER = GTM-T78CBC3 -SHOWLOGIN = "true" -SHOWREPRESENTATIONS = false +SHOWLOGIN = true +SHOWREPRESENTATIONS = true SHOWFILEUPLOAD = "false" -SHOWMAPS = "true" -//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 - - -PORT= "3000" -DEFAULT_DOMAIN = "localhost" -I18N_DOMAIN = "cymru.local" -//I18N_DOMAIN ="dev-gwaithcynllunio.gwasanaeth.llyw.cymru" -//I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru" -//I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s -//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" - - -//gov gateway -GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration" -GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ -GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS -//GG_REDIRECT_URI = "http://localhost:3000" -GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales" - -NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ -NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000" - +SHOWMAPS = "false" API_ROOT = "http://localhost:3000" - - -GOOGLE_MAP_API_KEY = AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo - +CY_API_ROOT ="http://cymru.local:3000" +I18N_DOMAIN = "cymru.local" //Next Auth vars -//EMAIL_SERVER_HOST=smtp.sendgrid.net -//EMAIL_SERVER_PORT=465 -//EMAIL_SERVER_USER=apikey -//EMAIL_SERVER_PASSWORD=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 -//EMAIL_FROM=rob@rdbsolutions.co.uk +NEXTAUTH_URL=$API_ROOT +NEXTAUTH_URL_INTERNAL=$API_ROOT +NEXTAUTH_SECRET = SuperSecret - -EMAIL_SERVER_HOST=rdbdigital.com -EMAIL_SERVER_PORT=465 -EMAIL_SERVER_USER=rob@rdbdigital.com -EMAIL_SERVER_PASSWORD=!Sky9fish2020 -EMAIL_FROM=no-reply@rdbdigital.com - -NEXTAUTH_URL=http://localhost:3000 -NEXTAUTH_URL_INTERNAL=http://localhost:3000 -//DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword +SECRET = SuperSecret -SECRET=SuperSecret //Azure Storage Account @@ -104,15 +62,12 @@ SECRET=SuperSecret AZURE_CLIENT_ID = $CLIENT_ID AZURE_TENANT_ID = $TENANT AZURE_CLIENT_SECRET = $CLIENT_SECRET +AZURE_STORAGE_ACCOUNT_NAME= "pedwdev" AZURE_STORAGE_ACCOUNT_KEY = JS3ZIXianhYhB1lZrHB+bXbdzaLlON0alCyKrFAb+jVEwr9iqo2dty92EBxwnufNFM+CSN/fKX2R+AStDn0byg== - AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net AZURE_PEDW_CONTAINER = "pedwapplications" AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net - - //gov.notify - NOTIFY_API_KEY = pedwnextauthkey-90f93710-9dae-423e-aea1-11eccd0dc132-0c9469d9-d671-444d-9e9d-3e5a62001043 \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index ee1d2c9f..3d3f9308 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,32 @@ "rules": { "@next/next/no-img-element": "off", "react/no-unknown-property": "error" - } + + }//, + //...your configuration + // "overrides": [ + // //...your overrides + // { + // // Force the setting of a swagger description on each api endpoint + // "files": ["pages/api/**/*.js"], + // "plugins": ["jsdoc"], + // "rules": { + // "jsdoc/no-missing-syntax": [ + // "error", + // { + // "contexts": [ + // { + // "comment": "JsdocBlock:has(JsdocTag[tag=swagger])", + // "context": "any", + // "message": "@swagger documentation is required on each API. Check this out for syntax info: https://github.com/jellydn/next-swagger-doc" + // } + // ] + // } + // ] + // } + // } + // ] + } diff --git a/.gitignore b/.gitignore index f67b7a05..47b6046b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,6 @@ yarn-error.log* #lock files yarn.lock -package-lock.json \ No newline at end of file +package-lock.json + +tmp/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 562cc640..39c6d864 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,12 +4,18 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { + { + "name": "Next.js: debug server-side", + "type": "node-terminal", + "request": "launch", + "command": "yarn run dev" + }, + {"name": "Launch Chrome against localhost", "type": "pwa-chrome", "request": "launch", - "name": "Launch Chrome against localhost", "url": "http://localhost:3000", "webRoot": "${workspaceFolder}" } + ] } \ No newline at end of file diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 095a4836..c4855bb6 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -1,4 +1,6 @@ -import { v4 as uuidv4 } from "uuid"; +import { DefaultAzureCredential } from "@azure/identity"; +import _ from "lodash"; +import { hashAPIPath } from "."; const { ContainerClient, BlockBlobClient, @@ -6,13 +8,25 @@ const { BlobSASPermissions, ContainerSASPermissions, generateBlobSASQueryParameters, + SASProtocol, } = require("@azure/storage-blob"); -import { DefaultAzureCredential } from "@azure/identity"; -import { consoleLogger, conLog, hashAPIPath } from "."; -import _ from "lodash"; +const { + QueueServiceClient, + AccountSASResourceTypes, + AccountSASServices, + AccountSASPermissions, + QueueSASPermissions, + QueueSASSignatureValues, + generateAccountSASQueryParameters, + generateQueueSASQueryParameters, + StorageSharedKeyCredential, + QueueClient, +} = require("@azure/storage-queue"); const STORAGE_PATH = process.env.AZURE_PEDW_STORAGE_ENDPOINT; const STORAGE_CONTAINER = process.env.AZURE_PEDW_CONTAINER; +const QUEUE_PATH = process.env.AZURE_PEDW_QUEUE_ENDPOINT; + const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME; export const createContainerSas = async (containerName) => { @@ -41,7 +55,7 @@ export const createContainerSas = async (containerName) => { ); // Need only list permission to list blobs - const containerPermissions = "rcwltd"; + const containerPermissions = "rcwdltf"; // Best practice: SAS options are time-limited const sasOptions = { @@ -246,6 +260,40 @@ export const createBlob = async (formContent, containerName, caseref) => { const tags = { containerid: containerName, caseID: caseID, + blobType: "Appeal", + }; + + console.log("the tags:", tags); + const withTags = await blockBlobClient.setTags(tags); + const withMeta = await blockBlobClient.setMetadata(tags); + + return formContent.pinswg_name; +}; + +export const createRepBlob = async (formContent, containerName, caseref) => { + const containerToken = await createContainerSas(containerName); + const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; + const containerClient = new ContainerClient(sasUrl); + + formContent = JSON.parse(formContent); + + const content = JSON.stringify(formContent); + + //console.log(content); + const blobName = caseref + "/" + formContent.repfile_name + "_rep.json"; + + console.log("blobName:", blobName); + const blockBlobClient = containerClient.getBlockBlobClient(blobName); + + const uploadBlobResponse = await blockBlobClient.upload( + content, + Buffer.byteLength(content) + ); + + const tags = { + containerid: containerName, + caseID: formContent.caseRef, + blobType: "Representation", }; console.log("the tags:", tags); @@ -325,13 +373,18 @@ export const uploadFile = async (formContent, containerName, foldername) => { files[prop][0].path, files[prop].size ); + + console.log( + "////////////////////////\nfile name:", + files[prop][0].fieldName, + "\n////////////////////////////" + ); + const tags = { containerid: containerName, - caseID: foldername, - documentType: files[prop][0].fieldName.slice( - 0, - files[prop][0].fieldName.indexOf("_") - ), + caseID: foldername.split("/")[0], + documentType: files[prop][0].fieldName.split(".")[1], + blobType: "RepresentationFile", }; const withTags = await blockBlobClient.setTags(tags); const withMeta = await blockBlobClient.setMetadata(tags); @@ -343,8 +396,125 @@ 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); + + const blobName = foldername + "/" + formContent.split("tmp/")[1]; + const blockBlobClient = containerClient.getBlockBlobClient(blobName); + const uploadBlobResponse = await blockBlobClient.uploadFile(formContent); + const tags = { + containerid: containerName, + caseID: formContent.split("tmp/")[0], + documentType: "Rep docs", + }; + 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 + "/" + formContent.split("tmp/")[1]; + console.log(blobName); + + const blockBlobClient = containerClient.getBlockBlobClient(blobName); + const uploadBlobResponse = await blockBlobClient.uploadFile(formContent); + + const tags = { + containerid: containerName, + caseID: foldername.split("/")[0], + 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 uploadPDFCaseFiles = 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, containerName, foldername); + console.log( + "case pdf files...", + files, + Object.keys(files).length, + foldername + ); + + const blobName = foldername + "/" + formContent.split("tmp/")[1]; + const blockBlobClient = containerClient.getBlockBlobClient(blobName); + const uploadBlobResponse = await blockBlobClient.uploadFile(formContent); + + const tags = { + containerid: containerName, + caseID: foldername.split("/")[0], + blobType: "AppealPDF", + }; + + 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); + //console.log(containerName, blobName); const containerToken = await createContainerSas(containerName); const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; const containerClient = new ContainerClient(sasUrl); @@ -360,7 +530,7 @@ export const downloadProgressFile = async ( blobName, casefolderID ) => { - //console.log.apply(containerName, blobName); + console.log(containerName, blobName); const containerToken = await createContainerSas(containerName); const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; @@ -370,7 +540,7 @@ export const downloadProgressFile = async ( const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody); - console.log("Downloaded blob content:", downloaded.toString()); + //console.log("Downloaded blob content:", downloaded.toString()); return JSON.parse(downloaded.toString()); }; @@ -379,11 +549,11 @@ export const downloadAllProgressFiles = async ( containerName, progressBlobObj ) => { - console.log( - "/////////////////////////\n downloading files: " + - JSON.stringify(progressBlobObj) + - "\n/////////////////////////\n" - ); + // console.log( + // "/////////////////////////\n downloading files: " + + // JSON.stringify(progressBlobObj) + + // "\n/////////////////////////\n" + // ); const containerToken = await createContainerSas(containerName); const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; @@ -397,7 +567,7 @@ export const downloadAllProgressFiles = async ( let blobCount = 0; for (const prop in progressBlobObj) { - console.log(`Progress - ${prop}: ${progressBlobObj[prop].path}`); + //console.log(`Progress - ${prop}: ${progressBlobObj[prop].path}`); blobClient = containerClient.getBlobClient(progressBlobObj[prop].path); downloadedBlob = await blobClient.download(0); downloaded = @@ -410,7 +580,7 @@ export const downloadAllProgressFiles = async ( downloaded = downloaded.substring(0, downloaded.length - 1); for (const prop in progressBlobObj) { - console.log(`Cases - ${prop}: ${progressBlobObj[prop].caseObj}`); + //console.log(`Cases - ${prop}: ${progressBlobObj[prop].caseObj}`); blobClient = containerClient.getBlobClient( progressBlobObj[prop].caseObj ); @@ -434,6 +604,86 @@ 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" + ); + + const containerToken = await createContainerSas(containerName); + const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; + const containerClient = new ContainerClient(sasUrl); + + let blobClient = {}; + let downloadedBlob = {}; + let repArr = []; + 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].path}`); + blobClient = containerClient.getBlobClient(repsBlobObj[prop].path); + downloadedBlob = await blobClient.download(0); + let repBlobObj = await streamToBuffer( + downloadedBlob.readableStreamBody + ); + + repBlobObj = JSON.parse(repBlobObj); + + repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[1]; + + // repBlobObj = JSON.stringify(repBlobObj); + + downloaded.push(repBlobObj); + blobCount++; + } + + //downloaded = downloaded.substring(0, downloaded.length - 1); + // console.log( + // "/////////////////////////\n downloaded : " + + // JSON.stringify( + // '{ "@odata.count": ' + + // blobCount + + // ',"value": ' + + // downloaded + + // "}" + // ) + + // "\n/////////////////////////\n" + // ); + + return { + "@odata.count": blobCount, + "value": downloaded, + }; +}; + const streamToBuffer = async (readableStream) => { return new Promise((resolve, reject) => { const chunks = []; @@ -465,6 +715,17 @@ export const getCaseBlob = async ( content, Buffer.byteLength(content) ); + + const tags = { + containerid: containerName, + caseID: caseReference, + blobType: "Case", + }; + + console.log("the tags:", tags); + const withTags = await blockBlobClient.setTags(tags); + const withMeta = await blockBlobClient.setMetadata(tags); + return blobName; }; @@ -482,18 +743,22 @@ export const getProgressBlobs = async (containerName, caseReference) => { blobCount++; } - console.log("this is the caasefolder:", caseReference, blobCount); + console.log( + "this is the casefolder and blobcount:", + caseReference, + blobCount + ); let blobObj = []; for await (const blob of containerClient.listBlobsFlat({ prefix: caseReference + "/" + caseReference + "_appeal.json", })) { - console.log("in here"); + console.log("getProgressBlobs in here", blob.name.split("/")); blobObj.push({ "name": blob.name.split("/")[1], "path": blob.name, "versionId": blob.versionId, - "caseObj": caseReference + "/" + caseReference + "_case.json", + "caseObj": caseReference + "/case/" + caseReference + "_case.json", "isCurrentVersion": blob.isCurrentVersion, "contentLength": blob.properties.contentLength, "contentType": blob.contentType, @@ -529,8 +794,6 @@ export const getProgressBlobs = async (containerName, caseReference) => { }, ]).reverse()[0]; - //console.log("blobObjwwwww:", blobObj); - return blobObj; }; @@ -544,26 +807,194 @@ export const getAllProgressBlobs = async (containerName) => { let blobCount = 0; let blobObj = []; - for await (const blob of containerClient.listBlobsFlat()) { - blob.name.split("/")[1].indexOf(".json") > 0 && + 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({ "name": blob.name.split("/")[1], "path": blob.name, - "versionId": blob.versionId, + //"versionId": blob.versionId, "caseObj": blob.name.split("/")[0] + "/case/" + blob.name.split("/")[0] + "_case.json", - "isCurrentVersion": blob.isCurrentVersion, - "contentLength": blob.properties.contentLength, - "contentType": blob.contentType, - "lastModified": blob.properties.lastModified, + // "isCurrentVersion": blob.isCurrentVersion, + // "contentLength": blob.properties.contentLength, + // "contentType": blob.contentType, + // "lastModified": blob.properties.lastModified, }); } - //console.log("blobObj:", blobObj); + console.log("blobObj:", blobObj); return blobObj; }; + +export const getRepsBlobs = async (containerName) => { + const containerToken = await createContainerSas(containerName); + + const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; + + const containerClient = new ContainerClient(sasUrl); + + let blobCount = 0; + 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 + ); + + const listOptions = { + includeMetadata: true, + includeSnapshots: false, + includeTags: true, + includeVersions: true, + }; + + let blobObj = []; + for await (const blob of containerClient.findBlobsByTags( + "blobType='Representation'", + listOptions + )) { + const blobClient = await containerClient.getBlobClient(blob.name); + console.log("getreps blob blob", blob); + blob.name.split("/")[2].indexOf("_rep.json") > 0 && + blob.name.split("/")[2].indexOf("undefined") < 0 && + blobObj.push({ + "name": blob.name.split("/")[2], + "path": blob.name, + "size": blobClient.getProperties().contentLength, + }); + } + + //console.log("blobObjwwwww:", blobObj); + + return blobObj; +}; + +export const createQueueSas = async (queueName) => { + // Get environment variables + const account = process.env.AZURE_STORAGE_ACCOUNT_NAME; + const accountKey = process.env.AZURE_STORAGE_ACCOUNT_KEY; + + const sharedKeyCredential = new StorageSharedKeyCredential( + account, + accountKey + ); + + // Best practice: create time limits + const TEN_MINUTES = 10 * 60 * 1000; + const NOW = new Date(); + + // Best practice: set start time a little before current time to + // make sure any clock issues are avoided + const TEN_MINUTES_AFTER_NOW = new Date(NOW.valueOf() + TEN_MINUTES); + + var resource_types = new AccountSASResourceTypes(); + resource_types.container = true; + resource_types.object = true; + resource_types.service = true; + + var permission = new QueueSASPermissions(); + permission.read = true; + permission.write = true; + permission.delete = true; + permission.list = true; + permission.add = true; + permission.update = true; + permission.process = true; + + var sas_signature_val = { + expiresOn: TEN_MINUTES_AFTER_NOW, + permissions: permission, + queueName: queueName, + }; + + const sasToken = generateQueueSASQueryParameters( + sas_signature_val, + sharedKeyCredential + ); + //console.log("sass token:", sasToken); + + return sasToken.toString(); +}; + +export const createCaseCompleteMessage = async ( + containerName, + caseReference +) => { + const whichQueue = "pedw-submitted-applications"; + const queueToken = await createQueueSas(whichQueue); + + const sasUrl = `${QUEUE_PATH}?${queueToken}`; + const queueServiceClient = new QueueServiceClient(sasUrl); + + const message = { + containerName: containerName, + casepath: + containerName + + "/" + + caseReference + + "/" + + caseReference + + "_appeal.json", + casecontentpath: containerName + "/" + caseReference + "/case", + filespath: containerName + "/" + caseReference + "/files", + + // uploadUrl: fileRecord.uploadUrl, + // filename: fileRecord.file.name, + // fileSize: fileRecord.file.size, + }; + + const sendMessageResponse = await queueServiceClient + .getQueueClient(whichQueue) + .sendMessage( + JSON.stringify( + `${JSON.stringify( + message + )}` + ) + ); + + return sendMessageResponse; +}; + +export const createRepCompleteMessage = async ( + containerName, + caseReference +) => { + const whichQueue = "pedw-submitted-representations"; + const queueToken = await createQueueSas(whichQueue); + + const sasUrl = `${QUEUE_PATH}?${queueToken}`; + const queueServiceClient = new QueueServiceClient(sasUrl); + + const message = { + containerName: containerName, + caseref: caseReference, + reppath: containerName + "/" + caseReference + "/", + filespath: containerName + "/" + caseReference + "/files", + }; + + const sendMessageResponse = await queueServiceClient + .getQueueClient(whichQueue) + .sendMessage( + JSON.stringify( + `${JSON.stringify( + message + )}` + ) + ); + + return sendMessageResponse; +}; diff --git a/actions/index.js b/actions/index.js index 3d35652b..c5507837 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1,9 +1,5 @@ import axios from "axios"; -import https from "https"; import CryptoJS from "crypto-js"; -import HmacSHA256 from "crypto-js/hmac-sha256"; -import { getFormCollection } from "../components/utils"; -import { downloadFile, getCaseBlob } from "./azurestorage"; let BASE_URL; const port = parseInt(process.env.PORT, 10) || 3000; @@ -13,6 +9,8 @@ if (process.browser) { } else { BASE_URL = process.env.API_ROOT || `http://localhost:${port}`; } +BASE_URL = process.env.API_ROOT; + const WORDKEY = process.env.HASHKEY; const cache = {}; @@ -29,13 +27,15 @@ export const consoleLogger = (err) => { var errStr = "\n\n/////////////////////////////////////////////////\nServer Error " + "\n" + - err.response.status + - " : " + - err.response.statusText + - "\nRequest URL: " + - err.response.config.url + - "\nRequest Time: " + - err.response.headers.date + + (err.hasOwnProperty("response") + ? err.response.status + + " : " + + err.response.statusText + + "\nRequest URL: " + + err.response.config.url + + "\nRequest Time: " + + err.response.headers.date + : err) + "\n/////////////////////////////////////////////////\n\n"; return errStr; }; @@ -582,7 +582,7 @@ export const getPickLists = (whichForm) => { }; export const getPersonalAccount = (contactid) => { - //console.log(contactid); + console.log(contactid); return axios .get( BASE_URL + @@ -667,6 +667,17 @@ export const getMyCases = (loggedInUserId) => { }); }; +export const getMyLPACases = (lpaid) => { + return axios + .get(BASE_URL + "/api/endpoint/getmylpacases_api?lpaid=" + lpaid) + .then((res) => { + return res.data; + }) + .catch((error) => { + //console.log("API call error", error); + }); +}; + export const getMyRepresentations = (loggedInUserId) => { return axios .get( @@ -793,12 +804,47 @@ export const getAwaitingSubmissionFromBlob = (containerName) => { }); }; +export const getRepsFromBlob = (containerName) => { + console.log( + "///////////////////////\ngetRepsFromBlob function: " + + containerName + + "\n///////////////////////\n", + BASE_URL + + "/api/file/getrepsblob?container=" + + containerName + + hashAPIPath("/api/file/getrepsblob?container=" + containerName) + ); + + return axios + .get( + BASE_URL + + "/api/file/getrepsblob?container=" + + containerName + + hashAPIPath("/api/file/getrepsblob?container=" + containerName) + ) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log( + "///////////////////////\ngetRepsFromBlob error response: " + + error + + "\n///////////////////////\n" + ); + console.log("API call error", error); + }); +}; + export const getAwaitingSubmissionFromBlobProxy = (containerName) => { return axios .get( BASE_URL + "/api/file/getawaitingsubmissionfromblob?container=" + - containerName + containerName + + hashAPIPath( + "/api/file/getawaitingsubmissionfromblob?container=" + + containerName + ) ) .then((res) => { return res.data; @@ -974,6 +1020,17 @@ export const createNewCaseBlob = ( contactid + "&containername=" + containerName; + //+ + // hashAPIPath( + // "/api/file/createcase_api?appealTypeId=" + + // appealTypeId + + // "&lpaID=" + + // lpaID + + // "&contactid=" + + // contactid + + // "&containername=" + + // containerName + // ); var config = { method: "post", @@ -1228,7 +1285,7 @@ export const uploadFiles = async ( for (let i = 0; i < files.length; i++) { for (let j = 0; j < files[i].length; j++) { - console.log(files[i][j].name); + console.log("upload files:", files[i][j].name); formData.append(files[i][j].name, files[i][j]); } } @@ -1253,7 +1310,96 @@ export const uploadFiles = async ( } }; +export const uploadRepFiles = async ( + formValues, + filesObj, + containerID, + casefolderID +) => { + let files = filesObj; + + //console.log(formValues); + var formData = new FormData(); + formData.append("appealData", JSON.stringify(formValues)); + formData.append("containerID", containerID); + formData.append("casefolderID", casefolderID); + formData.append("repOrAppeal", true); + + // files.forEach((file) => formData.append("files", file)); + + for (let i = 0; i < files.length; i++) { + for (let j = 0; j < files[i].length; j++) { + console.log("upload rep files:", files[i][j].name); + formData.append(files[i][j].name, files[i][j]); + } + } + + //console.log(formData); + + var queryUrl = "/api/file/upload"; + + const config = { + method: "post", + url: queryUrl, + data: formData, + 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 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", + BASE_URL + + "/api/file/getbloblist?container=" + + containerName + + "&casefolderID=" + + casefolderID + + hashAPIPath( + "/api/file/getbloblist?container=" + + containerName + + "&casefolderID=" + + casefolderID + ) + ); return axios .get( BASE_URL + @@ -1350,6 +1496,20 @@ export const downloadBlob = (containerName, blobName) => { }; export const getProgressFromBlob = async (containerName, casereference) => { + console.log( + /////////////////\ngetProgressFromBlob", + BASE_URL + + "/api/file/getprogressobjblob?container=" + + containerName + + "&casefolderID=" + + casereference + + hashAPIPath( + "/api/file/getprogressobjblob?container=" + + containerName + + "&casefolderID=" + + casereference + ) + ); try { const res = await axios.get( BASE_URL + @@ -1383,6 +1543,13 @@ export const sendEmail = async ( "personalisation": personalisation, }; + console.log( + "hwewwew: ", + templateId, + emailAddress, + personalisation, + reference + ); var queryUrl = "/api/email/notify"; var config = { @@ -1426,3 +1593,91 @@ export const getPortalLogin = (emailAddress) => { return JSON.stringify(error); }); }; + +export const createContainerProxy = (containerName) => { + var queryUrl = + "/api/file/setupcontainer?ident=" + + containerName + + hashAPIPath("/api/file/setupcontainer?ident=" + containerName); + + return axios + .get(BASE_URL + queryUrl) + .then((res) => res.data) + .catch((error) => { + //console.log(consoleLogger(error)); + console.log("thiserror", error); + return JSON.stringify(error); + }); +}; + +export const sendCaseCompleteMessage = async (containerID, caseReference) => { + var queryUrl = + "/api/file/createappealcompletemessage_api?container=" + + containerID + + "&tempcaseref=" + + caseReference; + + var config = { + method: "get", + url: queryUrl, + }; + + //console.log(data); + + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + //console.log("API call error", error); + }); +}; + +export const sendCaseCompleteMessageProxy = async ( + containerID, + caseReference +) => { + var queryUrl = + "/api/file/createappealcompletemessageproxy_api?container=" + + containerID + + "&tempcaseref=" + + caseReference; + + var config = { + method: "get", + url: queryUrl, + }; + + //console.log(data); + + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + //console.log("API call error", error); + }); +}; + +export const sendRepCompleteMessage = async (containerID, caseReference) => { + var queryUrl = + "/api/file/createrepcompletemessage_api?container=" + + containerID + + "&tempcaseref=" + + caseReference; + + var config = { + method: "get", + url: queryUrl, + }; + + //console.log(data); + + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + //console.log("API call error", error); + }); +}; diff --git a/actions/selectQueryTypes.js b/actions/selectQueryTypes.js index 2ff061a5..abcfd86b 100644 --- a/actions/selectQueryTypes.js +++ b/actions/selectQueryTypes.js @@ -48,7 +48,13 @@ export const getSelectQuery = (appealTypeName) => { return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_starttimeofevent,pinswg_typeofevent"; break; case "pinswg_planningappeals78s": - return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_typeofevent"; + // console.log( + // "///////////////\n path:", + // process.env.RELAYPATH == "test-pedw-hc" + // ); + return process.env.RELAYPATH == "dev-pedw-hc" + ? "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_representation_period_end_date,pinswg_extend_representation_date,pinswg_typeofevent" + : "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_typeofevent"; break; case "pinswg_planningconditionss73s79s": return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateofevent,pinswg_typeofevent"; diff --git a/components/account/changepassword.js b/components/account/changepassword.js index 5e32af17..638c1836 100644 --- a/components/account/changepassword.js +++ b/components/account/changepassword.js @@ -95,65 +95,63 @@ const ChangePassword = (props) => { const [hasErrors, setHasErrors] = useState(""); - return ( - <> - {passwordUpdated != true ? ( -
-
- - -
+ return <> + {passwordUpdated != true ? ( + +
+ + +
-
- - Cancel - -
-
- ) : ( - <> -

- Go to My Portal - -

- - )} - - ); +
+ + + Cancel + +
+ + ) : ( + <> +

+ + Go to My Portal + +

+ + )} + ; }; const mapStateToProps = (state) => { diff --git a/components/account/personaldetails.js b/components/account/personaldetails.js index e776ac70..58043e5f 100644 --- a/components/account/personaldetails.js +++ b/components/account/personaldetails.js @@ -63,6 +63,142 @@ const RenderTextfield = ({ ); }; +const RenderRadioList = ({ + datafieldname, + name, + label, + id, + errorMsg, + options, + input: { onChange, value }, + meta: { touched, error }, + ...custom +}) => { + const required = (value) => (value ? undefined : "Required"); + + return ( + <> +
+
+ + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} +
+ {Object.keys(options).map((key, index) => ( +
+ + +
+ ))} +
+
+
+ + ); +}; + +const RenderPickList = ({ + datafieldname, + name, + label, + input, + optionsArr, + meta: { touched, error }, + errorMsg, +}) => { + let { t, lang } = useTranslation(); + optionsArr = [ + t("account:account-preferred-language-english") + ":846040001", + t("account:account-preferred-language-welsh") + ":846040000", + ]; + return ( + <> +
+ + {touched && error && ( + + Error:{" "} + {errorMsg} + + )} + +
+ +
+
+ + ); +}; + let PersonalDetails = (props) => { const { handleSubmit, @@ -101,171 +237,189 @@ let PersonalDetails = (props) => { setPersonalDetailsComplete(true); }; - return ( - <> - {props.accountUpdatedComplete == false ? ( - props.personalDetailsComplete == false ? ( -
-
- -

- About you -

-
-
- - Role:{" "} - { - props.props.accountDetails - .accountDetails[ - "pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" - ] - } - -
- - - - - - -
-
- -

- What is your address? -

-
- - - - - - -
-
- - + +

+ {t("account:account-about-you-label")} +

+
+
+ + {t("account:account-role-label")}:{" "} + { + props.props.accountDetails + .accountDetails[ + "pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" + ] } - > - Cancel - +
- - ) : ( - <> - - - ) + + + + + + + + +
+ +

+ {t("account:account-your-address-label")} +

+
+ + + + + + +
+
+ + + + {t("common:cancel-link")} + + +
+ ) : ( - - )} - - ); + <> + + + ) + ) : ( + + )} + ; }; const mapStateToProps = (state) => { diff --git a/components/account/personaldetailsCheck.js b/components/account/personaldetailsCheck.js index dddeea69..aad11ee0 100644 --- a/components/account/personaldetailsCheck.js +++ b/components/account/personaldetailsCheck.js @@ -25,272 +25,331 @@ const BuildCheckPersonalDetails = (props) => { const router = useRouter(); const { locale } = router; - return ( - <> -

About you

-
-
-
First name
-
- { - props.props.props.form.personalDetailsForm.values - .firstname - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - first name - - -
-
-
-
Last name
-
- { - props.props.props.form.personalDetailsForm.values - .lastname - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - last name - - -
-
-
-
Email address
-
- { - props.props.props.form.personalDetailsForm.values - .emailaddress1 - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - email address - - -
-
-
-
Telephone
-
- { - props.props.props.form.personalDetailsForm.values - .telephone1 - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - telephone - - -
-
-
-
Company/Group
-
- { - props.props.props.form.personalDetailsForm.values - .company - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - company/group - - -
-
-
-
-

Your address

+ const getPreferredLanguageLabel = (id) => { + return id == 846040001 + ? t("account:account-preferred-language-english") + : t("account:account-preferred-language-welsh"); + }; -
-
Address Line 1
-
- { - props.props.props.form.personalDetailsForm.values - .address1_line1 - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - address line 1 - - -
-
-
-
Address line 2
-
- { - props.props.props.form.personalDetailsForm.values - .address1_line2 - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - address line 2 - - -
-
-
-
Town/City
-
- { - props.props.props.form.personalDetailsForm.values - .address1_city - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - town/city - - -
-
-
-
County
-
- { - props.props.props.form.personalDetailsForm.values - .address1_county - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - county - - -
-
-
-
Postcode
-
- { - props.props.props.form.personalDetailsForm.values - .address1_postalcode - } -
-
- { - setPersonalDetailsComplete(false); - }} - > - Change - - {" "} - postcode - - -
-
-
-
- - - Cancel - + return <> +

+ {t("account:account-about-you-label")} +

+
+
+
+ {t("account:account-first-name-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .firstname + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {t("account:account-first-name-label")}{" "} + + +
- - ); +
+
+ {" "} + {t("account:account-last-name-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .lastname + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-last-name-label")} + + +
+
+
+
+ {" "} + {t("account:account-email-address-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .emailaddress1 + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-email-address-label")} + + +
+
+
+
+ {t("account:account-telephone-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .telephone1 + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {t("account:account-telephone-label")} + + +
+
+
+
+ {" "} + {t("account:account-company-group-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .company + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-company-group-label")} + + +
+
+
+
+ {t("account:account-preferred-language-label")} +
+
+ {getPreferredLanguageLabel( + props.props.props.form.personalDetailsForm.values + .pinswg_preferredlanguage + )} +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-preferred-language-label")} + + +
+
+
+

+ {" "} + {t("account:account-your-address-label")} +

+
+
+
+ {t("account:account-address-line-1-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .address1_line1 + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-address-line-1-label")} + + +
+
+
+
+ {t("account:account-address-line-2-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .address1_line2 + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-address-line-2-label")} + + +
+
+
+
+ {t("account:account-town-city-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .address1_city + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-town-city-label")} + + +
+
+
+
+ {" "} + {t("account:account-county-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .address1_county + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-county-label")} + + +
+
+
+
+ {" "} + {t("account:account-postcode-label")} +
+
+ { + props.props.props.form.personalDetailsForm.values + .address1_postalcode + } +
+
+ { + setPersonalDetailsComplete(false); + }} + > + {t("common:change-link-label")} + + {" "} + {t("account:account-postcode-label")} + + +
+
+
+
+ + + {t("common:back-link")} + +
+ ; }; const mapStateToProps = (state) => { diff --git a/components/account/personaldetailsComplete.js b/components/account/personaldetailsComplete.js index 2740f5a8..1e202af3 100644 --- a/components/account/personaldetailsComplete.js +++ b/components/account/personaldetailsComplete.js @@ -40,25 +40,22 @@ const PersonalDetailsComplete = (props) => { props.props.props.form.personalDetailsForm.values, ]); - return ( - <> -

Your details have been updated

+ return <> +

{t("account:account-complete-para-1")}

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a - metus non quam mollis egestas. Integer ac leo cursus, laoreet - nulla sed, tempus tellus. Mauris condimentum erat arcu. -

+

{t("account:account-complete-para-2")}

-

- - Return to My Portal - -

- - ); +

+ + + {" "} + {t("account:account-complete-return-to-portal-link")} + + +

+ ; }; const mapStateToProps = (state) => { diff --git a/components/account/registerComplete.js b/components/account/registerComplete.js index 66607e12..fb82290e 100644 --- a/components/account/registerComplete.js +++ b/components/account/registerComplete.js @@ -78,7 +78,7 @@ const RegisterComplete = (props) => { var registerBody = ""; switch (props.accountDetails.accCr) { case "created": - return (registerBody = ( + return registerBody = ( <>

{t("account:register-new-account-confirmation-email")} @@ -95,24 +95,33 @@ const RegisterComplete = (props) => {

- - { - setLogout(), - window.localStorage.clear(), - destroyCookie({}, "pinsUser"), - signOut({ callbackUrl: "/logout" }); - }} - > - {t( - "account:register-new-account-my-portal-link" - )} - + { + setLogout(), + window.localStorage.clear(), + destroyCookie( + null, + "next-auth.csrf-token" + ), + destroyCookie( + null, + "next-auth.callback-url" + ), + destroyCookie(null, "pedw_locale"), + destroyCookie(null, "pinsUser"), + signOut({ callbackUrl: "/logout" }); + }}> + + {t( + "account:register-new-account-my-portal-link" + )} +

- )); + ); break; diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 65d50d1d..b09a0db4 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -4,7 +4,7 @@ import _ from "lodash"; import { useState } from "react"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import LoadingOverlay from "react-loading-overlay"; + import { getSession, useSession } from "next-auth/react"; const Breadcrumbs = (props) => { @@ -61,17 +61,18 @@ const Breadcrumbs = (props) => {
    {/*
  1. - - - {t("common:gov-wales-label")} - - -
  2. */} + + + {t("common:gov-wales-label")} + + + */}
  3. - - - {t("common:service-name-breadcrumb")} - + + {t("common:service-name-breadcrumb")}
  4. {router.pathname == "/myportal" ? ( @@ -84,17 +85,18 @@ const Breadcrumbs = (props) => { {router.pathname == "/myportal/searchresults" ? ( <>
  5. - - - {t("common:breadcrumb-my-portal")} - - + {t("common:breadcrumb-my-portal")} +
  6. {t("common:breadcrumb-search-results")} @@ -127,13 +129,14 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  7. @@ -154,12 +157,9 @@ const Breadcrumbs = (props) => { "/advancedsearch" : "/advancedsearch" } + className="govuk-breadcrumbs__link" > - - {t( - "common:breadcrumb-advanced-search" - )} - + {t("common:breadcrumb-advanced-search")}
  8. @@ -178,13 +178,14 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  9. @@ -195,12 +196,9 @@ const Breadcrumbs = (props) => { "/myportal/advancedsearch" : "/myportal/advancedsearch" } + className="govuk-breadcrumbs__link" > - - {t( - "common:breadcrumb-advanced-search" - )} - + {t("common:breadcrumb-advanced-search")}
  10. @@ -218,13 +216,14 @@ const Breadcrumbs = (props) => { - - {t("newappeal:parent-page-title")} - + {t("newappeal:parent-page-title")}
  11. @@ -240,13 +239,14 @@ const Breadcrumbs = (props) => { - - {t("newappeal:parent-page-title")} - + {t("newappeal:parent-page-title")}
  12. @@ -262,13 +262,14 @@ const Breadcrumbs = (props) => { - - {t("newappeal:parent-page-title")} - + {t("newappeal:parent-page-title")}
  13. @@ -287,26 +288,28 @@ const Breadcrumbs = (props) => { - - {t("newappeal:parent-page-title")} - + {t("newappeal:parent-page-title")}
  14. - - {t("newappeal:page-title")} - + {t("newappeal:page-title")}
  15. @@ -322,17 +325,18 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  16. - Your cases + {t("common:breadcrumb-your-cases")}
  17. ) : ( @@ -346,13 +350,12 @@ const Breadcrumbs = (props) => { router.locale != "en" ? "/" + router.locale + - "/myportal" + "/fymhorth" : "/myportal" } + className="govuk-breadcrumbs__link" > - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  18. @@ -381,26 +384,28 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  19. - - Your cases{" "} - + {t("common:breadcrumb-your-cases")}
  20. @@ -422,13 +427,14 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  21. @@ -444,20 +450,22 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  22. - - - {t("dnsCommon:service-name")} - + + {t("dnsCommon:service-name")}
  23. @@ -486,18 +494,13 @@ const Breadcrumbs = (props) => { props.props.search .searchString } + onClick={() => { + // spinnerState(); + router.back(); + }} + className="govuk-breadcrumbs__link" > - { - // spinnerState(); - router.back(); - }} - className="govuk-breadcrumbs__link" - > - {t( - "common:breadcrumb-search-results" - )} - + {t("common:breadcrumb-search-results")}
  24. @@ -518,21 +521,36 @@ const Breadcrumbs = (props) => { - - {t( - "common:breadcrumb-my-portal" - )} - + {t("common:breadcrumb-my-portal")}
  25. )}
  26. - Make representation for:{" "} + + { + props.props.currentView + .caseReference.currentReference + } + +
  27. +
  28. + {t( + "myrepresentations:make-a-representation-for-label" + )}{" "} { props.props.currentView.caseReference .currentReference @@ -548,17 +566,18 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  29. - Your account + {t("account:account-title")}
  30. ) : ( @@ -579,13 +598,14 @@ const Breadcrumbs = (props) => { - - {t("common:breadcrumb-my-portal")} - + {t("common:breadcrumb-my-portal")}
  31. @@ -613,10 +633,9 @@ const Breadcrumbs = (props) => { ? router.locale + "/../../dns" : "/../../dns" } + className="govuk-breadcrumbs__link" > - - {t("dnsCommon:service-name")} - + {t("dnsCommon:service-name")}
  32. @@ -649,10 +668,9 @@ const Breadcrumbs = (props) => { "/dnsapplications" : "/dnsapplications" } + className="govuk-breadcrumbs__link" > - - {t("dnsCommon:service-name")} - + {t("dnsCommon:service-name")}
  33. @@ -712,12 +730,11 @@ const Breadcrumbs = (props) => { "/dns/applications" : "/dns/applications" } + className="govuk-breadcrumbs__link" > - - {t( - "dnsApplicationView:page-parent-title" - )} - + {t( + "dnsApplicationView:page-parent-title" + )}
  34. @@ -793,50 +810,45 @@ const Breadcrumbs = (props) => { "" )} {/* {!_.isEmpty(slug) ? ( - <> -
  35. - - - {t("common:breadcrumb-my-portal")} - - -
  36. -
  37. - - - {t("common:breadcrumb-new-appeal")} - - -
  38. -
  39. - {props.formTitle} -
  40. - - ) : ( - "" - )} */} + <> +
  41. + + + {t("common:breadcrumb-my-portal")} + + +
  42. +
  43. + + + {t("common:breadcrumb-new-appeal")} + + +
  44. +
  45. + {props.formTitle} +
  46. + + ) : ( + "" + )} */}
- {/* */} ); }; diff --git a/components/case.js b/components/case.js index ab83efee..6dde13cb 100644 --- a/components/case.js +++ b/components/case.js @@ -45,7 +45,7 @@ const Case = (props) => { searchDetailsObj={props.searchDetailsObj} documentDetailsObj={props.documentDetailsObj} /> - {showRepresentations == "true" && ( + {showRepresentations == true && ( { let { t } = useTranslation(); @@ -204,8 +196,8 @@ const DocumentDetails = (props) => { {/*
- {t("case:documents-size-label")} -
*/} + {t("case:documents-size-label")} + */}
{showSpinnerState == true ? (
@@ -240,41 +232,33 @@ const DocumentDetails = (props) => { {showDownloadingState === key && (
{/* { */} + className="data-loading-icon" + src="/assets/images/loading.gif" + alt={ + router.locale == + "cy" + ? "Nôl data" + : "Fetching data" + } + /> */}
)} { + toggleDownLoadLink(key); + }} > - { - toggleDownLoadLink(key); - }} - > - - {t( - "case:documents-name-label" - )} - : - - {_.has( - detailsObj, - "pinswg_name" - ) - ? detailsObj.pinswg_name - : ""} - + + {t("case:documents-name-label")} + : + + {_.has(detailsObj, "pinswg_name") + ? detailsObj.pinswg_name + : ""}
@@ -317,11 +301,11 @@ const DocumentDetails = (props) => { : ""}
{/*
- - {t("case:documents-size-label")}: - - 92 -
*/} + + {t("case:documents-size-label")}: + + 92 + */}
); }) @@ -340,49 +324,6 @@ const DocumentDetails = (props) => { ); }; - useEffect(() => { - getDocumentTypes(); - if (selectedOption) { - setShowSpinnerState(true); - getDocumentResults(1, orderByState, fieldSortState); - } - - if (selectedDocumentType) { - setShowSpinnerState(true); - getDocumentResults( - 1, - orderByState, - fieldSortState, - selectedDocumentType - ); - } - - const docDetailsObj = async () => { - let docObj = await getSearchDocumentDetails(incidentid).then( - (data) => { - //console.log(data); - setDocumentDetails(data); - setDocumentSearchState(true); - - return data; - } - ); - - return docObj; - }; - - const searchDocumentResultsObj = docDetailsObj(); - }, [ - incidentid, - setDocumentDetails, - selectedOption, - selectedDocumentType, - fieldSortState, - orderByState, - getDocumentTypes, - getDocumentResults, - ]); - const getDocumentTypes = useCallback(() => { getSearchDocumentTypes(props.incidentid).then((data) => { setDocumentTypes(data); @@ -429,15 +370,6 @@ const DocumentDetails = (props) => { return docObj; }; - 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; - } - const pagesCount = Math.ceil(documentDetailsObj["@odata.count"] / 10); let currentPage = 0; @@ -504,6 +436,48 @@ const DocumentDetails = (props) => { setShowSpinnerState(true); }; + useEffect(() => { + getDocumentTypes(); + if (selectedOption) { + setShowSpinnerState(true); + getDocumentResults(1, orderByState, fieldSortState); + } + + if (selectedDocumentType) { + setShowSpinnerState(true); + getDocumentResults( + 1, + orderByState, + fieldSortState, + selectedDocumentType + ); + } + + const docDetailsObj = async () => { + let docObj = await getSearchDocumentDetails(incidentid).then( + (data) => { + //console.log(data); + setDocumentDetails(data); + setDocumentSearchState(true); + + return data; + } + ); + + return docObj; + }; + + const searchDocumentResultsObj = docDetailsObj(); + }, [ + incidentid, + setDocumentDetails, + selectedOption, + selectedDocumentType, + fieldSortState, + orderByState, + getDocumentTypes, + getDocumentResults, + ]); return ( <>
@@ -528,11 +502,6 @@ const DocumentDetails = (props) => {
- {/* */} ); }; diff --git a/components/case/representation/index copy.js b/components/case/representation/index copy.js deleted file mode 100644 index 5eaff2cd..00000000 --- a/components/case/representation/index copy.js +++ /dev/null @@ -1,212 +0,0 @@ -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 _ from "lodash"; -import { Field, FieldArray, reduxForm, formValueSelector } from "redux-form"; -import { connect } from "react-redux"; -import { useDropzone } from "react-dropzone"; - -import { setRepresentationCapacity } from "../../../store/currentView/action"; -import RepCapacitySelection from "./representationCapacitySelection"; -import RepDetails from "./representationDetails"; -import RepAppellant from "./representationAppellant"; -import RepAgent from "./representationAgent"; -import RepInterestedPartyPerson from "./representationInterestedPartyPerson"; -import RepLandOwner from "./representationLandowner"; -import { - RenderPickList, - RenderRadioList, - RenderTextfield, -} from "./representationElements"; - -let MakeRepresentation = (props) => { - let { t } = useTranslation(); - const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); - - const [clearRepForm, setClearRepForm] = useState(false); - - const router = useRouter(); - const { locale } = router; - const { - caseReference, - myCases, - myRepresentations, - watchedCases, - awaitingSubmission, - searchResultsObj, - currentType, - currentView, - setRepresentationCapacity, - } = props; - const formObj = props.props.form; - let setCaseQueryObj = props[currentType]; - var casesObj = {}; - - currentType == "searchResultsObj" - ? (casesObj = jsonpath.query( - setCaseQueryObj, - '$..[?(@.title=="' + caseReference + '")]' - )) - : (casesObj = jsonpath.query( - setCaseQueryObj, - '$..[?(@.reference=="' + caseReference + '")]' - )); - - casesObj = Object.assign({}, ...casesObj); - - const capacityOptionsArr = [ - "Appellant", - "Agent", - "Interested Party/Person", - "Land Owner", - ]; - - const appellantApplicantRepresentationArr = [ - "Other", - "Statement", - "Statement of common ground", - "Written statement of evidence", - ]; - - const interestedPersonRepresentationArr = [ - "Interested Party/Person correspondence", - ]; - - const landOwnerRepresentationArr = [ - "Other", - "Statement", - "Written statement of evidence", - ]; - - const repCapacityType = () => { - currentView.representationCapacity == false - ? false - : _.isEmpty(formObj["representationForm"]) - ? false - : _.isEmpty(formObj["representationForm"].values) - ? false - : _.isEmpty( - formObj["representationForm"].values.representationCapacity - ) - ? setRepresentationCapacity(false) - : setRepresentationCapacity( - formObj["representationForm"].values.representationCapacity - .replace(/(\band|[\s\-\+\(\)\,\&])/g, "") - .toLowerCase() - ); - - return currentView.representationCapacity; - }; - - const whichControl = () => { - repCapacityType(); - switch (currentView.representationCapacity) { - case false: - return ( - - ); - break; - case "appellant": - setRepresentationCapacity("appellant"); - return ( - - ); - break; - case "agent": - setRepresentationCapacity("agent"); - return ( - - ); - break; - case "interestedpartyperson": - setRepresentationCapacity("interestedpartyperson"); - return ( - - ); - break; - case "landowner": - setRepresentationCapacity("landowner"); - return ( - - ); - break; - default: - return ( - - ); - } - }; - - return ( -
- {whichControl()} - {props.firstValue} -
- ); -}; - -const mapStateToProps = (state) => { - return { - search: state.search, - searchResultsObj: state.searchResultsObj, - formData: state.formData, - appealType: state.appealType, - currentView: state.currentView, - //form: state.form, - }; -}; - -const mapDispatchToProps = (dispatch) => { - return { - setRepresentationCapacity: (representationCapacity) => { - dispatch(setRepresentationCapacity(representationCapacity)); - }, - }; -}; - -const selector = formValueSelector("representationForm"); - -export default connect( - mapStateToProps, - mapDispatchToProps -)( - reduxForm({ - form: "representationForm", - destroyOnUnmount: false, - })(MakeRepresentation) -); diff --git a/components/case/representation/index.js b/components/case/representation/index.js index fc36477b..eaf568da 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -2,8 +2,8 @@ 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 _ from "lodash"; +import jsonpath, { value } from "jsonpath"; +import _, { property } from "lodash"; import { Field, FieldArray, @@ -19,21 +19,29 @@ import { setRepresentationSubmit, setSubmitBack, setRepresentationSubmitConfirmation, + setRepresentationMessageSent, + 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 { - RenderPickList, - RenderRadioList, - RenderTextfield, -} from "./representationElements"; + updateCase, + patchCase, + uploadRepFiles, + sendEmail, + generateRepPDF, +} from "../../../actions"; +import { formatDates } from "../../../components/utils"; +import RepresentationProgress_s78 from "./representationProgress/representationProgress_s78"; +import RepresentationProgress_enforcement from "./representationProgress/representationProgress_enforcement"; let MakeRepresentation = (props) => { let { t } = useTranslation(); @@ -59,11 +67,22 @@ let MakeRepresentation = (props) => { setSubmitBack, handleSubmit, setRepresentationSubmitConfirmation, + setRepresentationMessageSent, + initialValues, } = props; const formObj = props.props.form; - let setCaseQueryObj = props[currentType]; + let setCaseQueryObj = props[currentType] || {}; var casesObj = {}; + const [showQuestionnaireSection, setShowQuestionnaireSection] = useState(1); + + const isLPA = + props.props.accountDetails.accountDetails[ + "pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" + ] == "LPA" + ? true + : false; + currentType == "searchResultsObj" ? (casesObj = jsonpath.query( setCaseQueryObj, @@ -76,29 +95,60 @@ let MakeRepresentation = (props) => { casesObj = Object.assign({}, ...casesObj); + var detailsObj = {}; + const capacityOptionsArr = [ - "Appellant", - "Agent", - "Interested Party/Person", - "Land Owner", + t("myrepresentations:capacity-options-arr-appellant"), + t("myrepresentations:capacity-options-arr-agent"), + t("myrepresentations:capacity-options-arr-interested"), ]; - const appellantApplicantRepresentationArr = [ - "Other", - "Statement", - "Statement of common ground", - "Written statement of evidence", - ]; + let setCaseDetailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchDetailsObj + : props.props.searchResultsObj.searchDetailsObj; - const interestedPersonRepresentationArr = [ - "Interested Party/Person correspondence", - ]; + var detailsObj = {}; - const landOwnerRepresentationArr = [ - "Other", - "Statement", - "Written statement of evidence", - ]; + detailsObj = jsonpath.query( + setCaseDetailsObj, + '$..[?(@.pinswg_name=="' + + currentView.caseReference.currentReference + + '")]' + ); + + detailsObj = detailsObj[0]; + + const buildRepsArr = (detailsObj) => { + let buildArr = []; + + let todaysDate = new Date(); + + let startDate = new Date(detailsObj.pinswg_startdate); + let questionnaireDate = new Date( + detailsObj.pinswg_questionnaireduedate + ); + let finalCommentsDate = new Date( + detailsObj.pinswg_finalcommentsduedate + ); + let statementDueDate = new Date(detailsObj.pinswg_statementduedate); + + isLPA && + todaysDate >= startDate && + todaysDate <= questionnaireDate && + buildArr.push("Questionnaire"); + + todaysDate >= startDate && + todaysDate <= statementDueDate && + buildArr.push("Statement"); + + todaysDate >= statementDueDate && + todaysDate <= finalCommentsDate && + buildArr.push("Final comments"); + + return buildArr; + }; const repCapacityType = () => { return _.isEmpty(formObj["representationForm"]) @@ -115,9 +165,31 @@ let MakeRepresentation = (props) => { }; 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: { currentView={currentView} setSubmitBack={setSubmitBack} props={props} - /> - ); - 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 ( - - ); + caseReference={caseReference} + />; + break; + case "appellant": + case t( + "myrepresentations:capacity-options-arr-appellant" + ).toLocaleLowerCase(): + //setRepresentationCapacity("appellant"); + return ( + + ); + break; + case "lpa": + //setRepresentationCapacity("appellant"); + return ( + + ); + break; + case "agent": + case t( + "myrepresentations:capacity-options-arr-agent" + ).toLowerCase(): + //setRepresentationCapacity("agent"); + return ( + + ); + break; + case t( + "myrepresentations:capacity-options-arr-interested" + ).toLowerCase(): + // setRepresentationCapacity("interestedpartyperson"); + return ( + + ); + break; + case "landowner": + //setRepresentationCapacity("landowner"); + return ( + + ); + break; + default: + return ( + + ); + } } }; + const whichProgress = () => { + { + console.log("curr"); + switch (currentView.caseReference.appealType) { + case 846040000: + case 846040001: + case 846040006: + case 846040025: + case 846040004: + case 846040018: + case 846040003: + case 846040009: + case 846040008: + return ( + + ); + break; + + case 846040005: + case 846040006: + case 846040007: + return ( + + ); + break; + default: + return <>hello; + break; + } + } + }; + + const updateRepresentation = async ( + values, + sendSavedEmail, + useSaveStatus + ) => { + let incidentId = props.appealType.caseReference.incidentid; + let updateBody = values || {}; + + // "pinswg_name": "2022-11-29-IP-REP_BOND_1", + + const repDate = new Date(); + + let day = repDate.getDate(); + let month = repDate.getMonth() + 1; + let year = repDate.getFullYear(); + let time = repDate.getTime(); + + let repType = ""; + switch (values.representationCapacity) { + case t("myrepresentations:capacity-options-arr-appellant"): + repType = "APPELLANT"; + break; + case t("myrepresentations:capacity-options-arr-agent"): + repType = "AGENT"; + break; + case t("myrepresentations:capacity-options-arr-interested"): + repType = "IP"; + break; + case "Land Owner": + repType = "LO"; + break; + case "lpa": + repType = "LPA"; + break; + + default: + // code block + } + + Object.assign(updateBody, { + "repfile_name": updateBody.hasOwnProperty("repfile_name") + ? updateBody.repfile_name + : year + + "-" + + month + + "-" + + day + + "-" + + time + + "-" + + repType + + "-REP" + + "_" + + props.props.accountDetails.accountDetails.lastname, + "pinswg_name": + props.props.currentView.caseReference.currentReference, + "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); + updateBody = updateBody.replace(/:"Yes"/gm, `:true`); + updateBody = updateBody.replace(/:"No"/gm, `:false`); + updateBody = JSON.parse(updateBody); + + Object.keys(updateBody).forEach((key) => { + if (updateBody[key] === null) { + delete updateBody[key]; + } + if (key.indexOf("_") == 0) { + delete updateBody[key]; + } + }); + + //console.log(updateBody); + + //window.alert(`form is :\n\n${JSON.stringify(updateBody, null, 2)}`); + + const reference = "PEDW-PARTIAL-REP"; + const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75"; + const emailAddress = props.props.accountDetails.loggedinUserEmail; + const personalisation = { + "caseReference": props.caseReference, + "emailAddress": props.props.accountDetails.loggedinUserEmail, + "returnLink": "", + "linkExpiry": 10 * 60, + }; + props.currentView.representationSubmit == "true" && + (sendSavedEmail == true && + sendEmail(templateId, emailAddress, personalisation, reference), + useSaveStatus && + router.replace( + router.locale != "en" + ? router.locale + "/myportal" + : "/myportal" + )); + }; + const onHandleSubmit = (values) => { - // console.log( - // values, - // values.representationCapacity, - // currentView.representationCapacity - // ); + console.log("form values - ", JSON.stringify(values)); - // console.log(_.isEmpty(currentView.representationCapacity)); - // console.log( - // values.representationCapacity - // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "") - // .toLowerCase() == currentView.representationCapacity - // ); + const buildFileArray = []; - _.isEmpty(currentView.representationCapacity) - ? setRepresentationCapacity( - values.representationCapacity - .replace(/(\band|[\s\-\+\(\)\,\&])/g, "") - .toLowerCase() - ) - : setRepresentationSubmit("true"); + console.log("attached docs: - ", buildFileArray); - window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`); + let setCaseDetailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchDetailsObj + : props.props.searchResultsObj.searchDetailsObj; + + router.query.hasOwnProperty("state") && + router.query.state == "edit" && + setRepresentationSubmit(true); + + var detailsObj = {}; + + detailsObj = jsonpath.query( + setCaseDetailsObj, + '$..[?(@.pinswg_name=="' + caseReference + '")]' + ); + + detailsObj = detailsObj[0]; + + console.log( + "Has data from form:", + formObj.hasOwnProperty("representationForm") && + formObj.representationForm.hasOwnProperty("values") + ); + + formObj.hasOwnProperty("representationForm") && + !router.query.hasOwnProperty("state") && + formObj.representationForm.hasOwnProperty("values") && + (Object.assign(values, formObj.representationForm.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_questionnaireduedate": + detailsObj.pinswg_questionnaireduedate, + "pinswg_statementduedate": detailsObj.pinswg_statementduedate, + "pinswg_finalcommentsduedate": + detailsObj.pinswg_finalcommentsduedate, + "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, + "siteAddress": + detailsObj.pinswg_siteaddressline1 + + " " + + detailsObj.pinswg_siteaddressline2 + + " " + + detailsObj.pinswg_siteaddresstown + + " " + + detailsObj.pinswg_siteaddresspostcode, + "pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1, + "pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2, + "pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown, + "pinswg_siteaddresspostcode": + detailsObj.pinswg_siteaddresspostcode, + "_pinswg_appellant_value": + detailsObj["_pinswg_appellant_value"], + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue": + detailsObj[ + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ], + "_pinswg_localplanningauthority_value": + detailsObj["_pinswg_localplanningauthority_value"], + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue": + detailsObj[ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ], + "representationCapacity": router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.currentView.representationCapacity + : values.representationCapacity + : isLPA + ? "lpa" + : values.representationCapacity, + "locale": locale, + })); + console.log(values); + currentView.representationSubmit != true + ? _.isEmpty(currentView.representationCapacity) + ? 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), + values.hasOwnProperty("representationDocuments") && + (values.representationDocuments.map((Blob) => + buildFileArray.push({ + "name": Blob.name, + "size": Blob.size, + }) + ), + Object.assign(values, { "filesList": buildFileArray })), + generateRepPDF( + values, + props.props.accountDetails.containerID, + currentView.caseReference.currentReference + ), + uploadRepresentationFiles(values), + setRepresentationSubmitConfirmation(true)) + : console.log("nit updated"); + + //window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`); + }; + + const uploadRepresentationFiles = (values) => { + // get filelists from values object + let fileListObj = _.filter(values, function (v, key) { + return _.includes(key, "representationDocuments"); + }); + + console.log(fileListObj); + + console.log( + "\n////////////////////////\n upload files:", + values.containerID + ); + + var dataObj = values; + + for (let key in dataObj) { + _.includes(key, "representationDocuments") == true && + delete dataObj[key]; + } + + uploadRepFiles( + dataObj, + fileListObj, + values.containerID, + props.caseReference + "/" + dataObj.repfile_name + ).then((data) => { + //console.log("hello", data); + + return data; + }); }; const repForm = props.props.form; - // console.log( - // "waht is representationSubmit:", - // currentView.representationSubmit - // ); + try { + let value = props.initialValues; + //console.log("has props"), value; + setRepresentationCapacity( + props.initialValues.representationCapacity.toLowerCase() + ); + //setRepresentationSubmit(false); + } catch { + console.log("not has props"); + } return (
- {currentView.representationSubmit == "true" ? ( + {currentView.representationSubmit == true ? ( { setRepresentationSubmit={setRepresentationSubmit} currentView={currentView} setSubmitBack={setSubmitBack} + setRepresentationMessageSent={ + setRepresentationMessageSent + } setRepresentationSubmitConfirmation={ setRepresentationSubmitConfirmation } + props={props} /> ) : ( <> @@ -277,7 +683,7 @@ let MakeRepresentation = (props) => { @@ -285,10 +691,496 @@ let MakeRepresentation = (props) => { ) : ( <>

- Make a representation on:{" "} + {t( + "myrepresentations:make-a-representation-on-label" + )}{" "} {currentView.caseReference.currentReference}

- {whichControl()} +
+
+ {whichControl()} +
+
+ {" "} +
+
+

+ {t( + "myrepresentations:timetable-title" + )} +

+
+
+ {t( + "myrepresentations:questionnaire-due-label" + )} + : + + {" "} + {formatDates( + detailsObj.pinswg_questionnaireduedate + )} + +
+
+ {t( + "myrepresentations:statements-due-label" + )} + : + + {" "} + {formatDates( + detailsObj.pinswg_statementduedate + )} + +
+
+ {t( + "myrepresentations:final-comments-due-label" + )} + : + + {" "} + {formatDates( + detailsObj.pinswg_finalcommentsduedate + )} + +
+
+
+
+ { + formObj.hasOwnProperty( + "representationForm" + ) && + formObj[ + "representationForm" + ].hasOwnProperty("values") && + formObj[ + "representationForm" + ].values.hasOwnProperty( + "representationType" + ) && + formObj["representationForm"] + .values + .representationType == + "Questionnaire" && + whichProgress() + // + } +
+
)} @@ -299,12 +1191,16 @@ let MakeRepresentation = (props) => { }; const mapStateToProps = (state) => { + //console.log("\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \n in map state", state); + return { search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, currentView: state.currentView, + myRepresentations: state.myRepresentations, + initialValues: state.currentView.caseReference.repDetails, //form: state.form, }; }; @@ -312,7 +1208,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { setRepresentationCapacity: (representationCapacity) => { - dispatch(reset("representationForm")); + //dispatch(reset("representationForm")); dispatch(setRepresentationCapacity(representationCapacity)); }, setRepresentationSubmit: (representationSubmit) => { @@ -324,6 +1220,12 @@ const mapDispatchToProps = (dispatch) => { setRepresentationSubmitConfirmation: () => { dispatch(setRepresentationSubmitConfirmation(true)); }, + setRepresentationMessageSent: (messageSent) => { + dispatch(setRepresentationMessageSent(messageSent)); + }, + setRepresentationReset: () => { + dispatch(setRepresentationReset()); + }, }; }; @@ -336,5 +1238,6 @@ export default connect( reduxForm({ form: "representationForm", destroyOnUnmount: false, + enableReinitialize: true, })(MakeRepresentation) ); diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js index 692ed496..a1cc8e24 100644 --- a/components/case/representation/representationAgent.js +++ b/components/case/representation/representationAgent.js @@ -1,4 +1,5 @@ import Link from "next/link"; +import { connect } from "react-redux"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import { Field, reduxForm } from "redux-form"; @@ -7,11 +8,16 @@ import { RenderTextfield, RenderRadioList, RenderMultiline, + RenderRichMultiline, + RenderCondtionalRadioList, + FileUploadField, } from "./representationElements"; import { - setRepresentationCapacity, - setRepresentationSubmit, -} from "../../../store/currentView/action"; + getFormCollectionByID, + getThumbnailIconByExtension, + bytesToSize, +} from "../../utils"; + import { useDropzone } from "react-dropzone"; const RepAgent = (props) => { @@ -32,29 +38,33 @@ const RepAgent = (props) => { {file.path} - {file.size} bytes )); + const required = (value) => (value ? undefined : "Required"); return ( -
-
-
-

Representation - agent

+ <> +
+

+ {t( + "myrepresentations:representation-from-an-agent-heading" + )} +

-
- - -
+
+ +
-
+
+ {/*
{ label="Description of representation" />
-
-
-
-

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

-
-
- My comments are set out in:* -
-
-
- - -
-
-
- -
-
-
- - -
-
-
-
-
- -

- Drag and drop files here or - click to select files -

-
- -
-
-
-
-
-
{" "} -
- */} +
+
+
-
+ +
+
+

+ {t("myrepresentations:enter-comment-label")} +

+
+
+ {t("myrepresentations:comments-set-out-label")}: +
+
+ +

+ {t("myrepresentations:publish-policy-label")} + + https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html + +

+
+
+ +
+ {props.currentView.caseReference.hasOwnProperty( + "repDetails" + ) && + props.currentView.caseReference.repDetails.filesList + .length > 0 ? ( +
+ {props.currentView.caseReference.repDetails.filesList.map( + (blob, i) => ( +
+ {blob.name} + + + {blob.name} ( + {bytesToSize(blob.size)}) + +
+ ) + )} +
+ ) : ( + "" + )} +
+
{" "} +
+ + ); }; diff --git a/components/case/representation/representationAppellant.js b/components/case/representation/representationAppellant.js index 8a4f4807..4253243a 100644 --- a/components/case/representation/representationAppellant.js +++ b/components/case/representation/representationAppellant.js @@ -10,8 +10,17 @@ import { RenderTextfield, RenderRadioList, RenderMultiline, + RenderRichMultiline, RenderFileUpload, + FileUploadField, + RepresentationGuidanceText, } from "./representationElements"; +import { + getFormCollectionByID, + getThumbnailIconByExtension, + bytesToSize, +} from "../../utils"; + import { useDropzone } from "react-dropzone"; // import { // setRepresentationCapacity, @@ -35,25 +44,38 @@ const RepAppellant = (props) => { // console.log(props); return ( -
-
-
-
- + <> +
+
+

+ {t( + "myrepresentations:representation-from-an-appellant-heading" + )} +

+ + + {typeof props.representationType == "undefined" ? ( -
+ ) : ( +

{props.representationType}

+ )}
-
+
+ + {/*
{ label="Description of representation" />
-
-
-
-

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

-
-
- My comments are set out in:* +
*/} + +
+
+

+ {t("myrepresentations:enter-comment-label")} +

+
+
+ {t("myrepresentations:comments-set-out-label")}: +
+
+ + {RepresentationGuidanceText( + formObj.representationForm.values.appealType + )} +
+
+ +
+ {props.currentView.caseReference.hasOwnProperty( + "repDetails" + ) && + props.currentView.caseReference.repDetails.filesList + .length > 0 ? ( +
+ {props.currentView.caseReference.repDetails.filesList.map( + (blob, i) => ( +
+ {blob.name} + + + {blob.name} ( + {bytesToSize(blob.size)}) + +
+ ) + )}
-
-
- - -
-
-
- -
-
-
- - -
-
-

- {props.label}{" "} -

- -
-
-
-
{" "} -
-
-
- - {/* +
{" "} +
+
-
+ ); }; diff --git a/components/case/representation/representationCapacitySelection.js b/components/case/representation/representationCapacitySelection.js index e75265c4..64a57017 100644 --- a/components/case/representation/representationCapacitySelection.js +++ b/components/case/representation/representationCapacitySelection.js @@ -13,6 +13,7 @@ import { RenderPickList, RenderTextfield, RenderRadioList, + RenderRadioListWithText, RenderMultiline, } from "./representationElements"; import { useDropzone } from "react-dropzone"; @@ -47,22 +48,31 @@ let RepCapacitySelection = (props) => { formObj={formObj} currentType={currentType} casesObj={casesObj} + caseReference={props.props.caseReference} + searchResultsObj={props.props.searchResultsObj} + myRepresentations={props.props.myRepresentations} + props={props} />{" "} -
+

- Your details - {props.firstValue} + {t( + "myrepresentations:capacity-select-your-details" + )}{" "} + - {props.firstValue}

@@ -75,7 +85,7 @@ let RepCapacitySelection = (props) => { className="govuk-button" data-module="govuk-button" > - Continue + {t("common:continue-button")}
diff --git a/components/case/representation/representationComplete.js b/components/case/representation/representationComplete.js index 6900d915..d2265706 100644 --- a/components/case/representation/representationComplete.js +++ b/components/case/representation/representationComplete.js @@ -1,19 +1,11 @@ +import useTranslation from "next-translate/useTranslation"; 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, - RenderRadioList, - RenderMultiline, -} from "./representationElements"; -import { - setRepresentationCapacity, - setRepresentationSubmit, - setSubmitBack, -} from "../../../store/currentView/action"; +import { useEffect } from "react"; + import { useDropzone } from "react-dropzone"; +import { sendEmail, sendRepCompleteMessage } from "../../../actions"; +import { setRepresentationReset } from "../../../store/currentView/action"; const RepComplete = (props) => { let { t } = useTranslation(); @@ -28,6 +20,7 @@ const RepComplete = (props) => { currentView, setSubmitBack, setRepresentationSubmitConfirmation, + setRepresentationMessageSent, } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => ( @@ -36,35 +29,50 @@ const RepComplete = (props) => { )); + useEffect(() => { + const reference = "PEDW-REPRESENTATION-COMPLETE"; + const templateId = "c49785e7-3217-40b6-b33f-dffc4e58d5c1"; + const emailAddress = + props.props.props.props.accountDetails.accountDetails.emailaddress1; + const personalisation = { + "caseReference": + props.props.currentView.caseReference.currentReference, + "emailAddress": + props.props.props.props.accountDetails.accountDetails + .emailaddress1, + "linkExpiry": 10 * 60, + }; + + props.props.currentView.representationMessageSent != true && + (sendRepCompleteMessage( + props.props.props.props.accountDetails.containerID, + props.props.currentView.caseReference.currentReference + ), + sendEmail(templateId, emailAddress, personalisation, reference), + setRepresentationMessageSent(true)); + }); return (

- Submission of Representation + {t("myrepresentations:rep-complete-heading")}

-

- Thank you for submitting your representation(s) using - the Appeals Casework Portal. -

+

{t("myrepresentations:rep-complete-para-one")}

-

- Please remember that any supporting documentation needs - to be received by us within the appropriate deadline for - the case. Anything you send to us must be clearly marked - with the case reference number and the site address - (including the postcode, where known). -

+

{t("myrepresentations:rep-complete-para-two")}

-

- You will shortly receive confirmation to the email - address you have provided. -

+

{t("myrepresentations:rep-complete-para-three")}

- - Continue + setRepresentationReset()} + className="govuk-button"> + + {t("common:continue-button")} +
diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index 6a501fa9..e0e06560 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -1,21 +1,16 @@ -import Link from "next/link"; -import { useRouter } from "next/router"; +import _ from "lodash"; import useTranslation from "next-translate/useTranslation"; -import { Field, reduxForm } from "redux-form"; -import { - RenderPickList, - RenderTextfield, - RenderRadioList, - RenderMultiline, -} from "./representationElements"; -import { - setRepresentationCapacity, - setRepresentationSubmit, - setSubmitBack, - setRepresentationSubmitConfirmation, -} from "../../../store/currentView/action"; +import { useRouter } from "next/router"; import { useDropzone } from "react-dropzone"; import RepComplete from "./representationComplete"; +import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78"; +import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; + +import { + getFormCollectionByID, + getThumbnailIconByExtension, + bytesToSize, +} from "../../utils"; const RepCompleteSubmit = (props) => { let { t } = useTranslation(); @@ -30,6 +25,8 @@ const RepCompleteSubmit = (props) => { currentView, setSubmitBack, setRepresentationSubmitConfirmation, + setRepresentationMessageSent, + setRepresentationReset, } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => ( @@ -38,34 +35,279 @@ const RepCompleteSubmit = (props) => { )); + const repFormData = formObj.representationForm.values; + + console.log("///////// formObj:", formObj); + + const whichQuestionnaireCheck = () => { + { + console.log("curr"); + switch (currentView.caseReference.appealType) { + case 846040000: + return ( + + ); + break; + + case 846040005: + return ( + + ); + break; + default: + return <>hello; + break; + } + } + }; + return ( <> {currentView.representationSubmitConfirmation == true ? ( - + ) : (
-

Submit

+

+ {" "} + {t( + "myrepresentations:rep-check-submit-heading" + )} +

+
+

+ {t( + "myrepresentations:rep-check-your-rep-heading" + )} +

+
+
+ {t( + "case:representation-representation-type" + )} +
+ +
+ {repFormData.representationType} +
+ +
+ { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
+
+ {_.has( + repFormData, + "representationOnBehalfOf" + ) && ( + <> +
+
+ {t( + "case:representation-onbehalfof" + )} +
+ +
+ { + repFormData.representationOnBehalfOf + } +
+ +
+ { + 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 + )} */} + + +
+
+ )} + + )} + +
+
+ {t("case:representation-files")} +
+ +
+ {formObj.representationForm.values.hasOwnProperty( + "representationDocuments" + ) && + formObj.representationForm.values + .representationDocuments.length > 0 + ? formObj.representationForm.values.representationDocuments.map( + (blob, i) => ( +
+ {blob.name} + + + {blob.name} ( + {bytesToSize( + blob.size + )} + ) + +
+ ) + ) + : ""}{" "} +
+ +
+ { + setSubmitBack(); + }} + > + {t("newappeal:change-link-label")} + + {" "} + {/* {FieldsTranslations( + rows[0].value + )} */} + + +
+
+ {whichQuestionnaireCheck()} +

- The gathering and subsequent processing of the - personal data supplied by you in this form, is - in accordance with the terms of our registration - under the Data Protection Act 2018. + {t( + "myrepresentations:rep-check-tandc-para-one" + )}

- The Planning Inspectorate takes its data - protection responsibilities for the information - you provide us with very seriously. To find out - more about how we use and manage your personal - data, please go to our privacy notice. + {t( + "myrepresentations:rep-check-tandc-para-two" + )}

- I confirm that all sections of this form have - been fully completed and that the details are - correct to the best of my knowledge. + {t( + "myrepresentations:rep-check-tandc-para-three" + )}

@@ -73,7 +315,10 @@ const RepCompleteSubmit = (props) => { className="govuk-label govuk-body-m" htmlFor="representationType" > - I confirm I have read the above. + {" "} + {t( + "myrepresentations:rep-check-tandc-para-four" + )} {/* { type="submit" className="govuk-button" data-module="govuk-button" - onClick={() => - setRepresentationSubmitConfirmation() - } + // onClick={() => { + // setRepresentationSubmitConfirmation(); + // setRepresentationSubmit(true); + // }} > - Continue + {t("common:continue-button")} {/* { @@ -101,14 +347,14 @@ const RepCompleteSubmit = (props) => { }} className="govuk-button" > - Continue + {t("common:continue-button")} */} setSubmitBack()} className="govuk-link" > - Back + {t("case:summary-back-button-label")}
diff --git a/components/case/representation/representationDetails.js b/components/case/representation/representationDetails.js index 0964ce68..26b42572 100644 --- a/components/case/representation/representationDetails.js +++ b/components/case/representation/representationDetails.js @@ -3,6 +3,7 @@ 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 RepDetails = (props) => { let { t } = useTranslation(); @@ -12,6 +13,31 @@ const RepDetails = (props) => { const { currentType, casesObj } = props; + let { caseReference } = props; + + let setCaseDetailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.myRepresentations.myRepresentations + : props.searchResultsObj.searchDetailsObj + : props.searchResultsObj.searchDetailsObj; + + var detailsObj = {}; + + caseReference = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? router.query.case + : caseReference + : caseReference; + + detailsObj = jsonpath.query( + setCaseDetailsObj, + '$..[?(@.pinswg_name=="' + caseReference + '")]' + ); + + detailsObj = detailsObj[0]; + + console.log("-----detailsObj:", detailsObj); + return ( <> {" "} @@ -24,6 +50,14 @@ const RepDetails = (props) => {
{casesObj.appellantApplicant || ""} + { + detailsObj[ + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ] + } + {/* {detailsObj.firstName + + " " + + detailsObj.lastName || "not entered"} */}
{/*
@@ -39,26 +73,46 @@ const RepDetails = (props) => { {t("case:summary-site-address-label")}
- {casesObj.address1 || ""} -
- {casesObj.town || ""} - -
- {casesObj.postcode || ""} + {_.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 comments on a case to - Planning and Environment Decisions Wales.{" "} + {t("myrepresentations:capacity-para-one")}

- Please note that comments from interested parties need - to be made within the timetable. This can be found on - the previous ‘Case Summary‘ page. Comments - submitted after this date may be considered invalid. + {t("myrepresentations:capacity-para-two")}

diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 129d27b8..ae40409b 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -8,6 +8,26 @@ 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 { + getFormCollectionByID, + getThumbnailIconByExtension, + bytesToSize, +} from "../../utils"; + +import { useRouter } from "next/router"; export const RenderRadioList = ({ datafieldname, @@ -54,7 +74,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 === options[key] && ( +
+
+ + +
+
+ )} +
+ ))} +
+
+
+ + ); +}; + +export const RenderCondtionalRadioList = ({ + datafieldname, + legend, + name, + label, + id, + errorMsg, + options, + input: { onChange, value }, + meta: { touched, error }, + ...custom +}) => { + const required = (value) => (value ? undefined : "Required"); + let { t } = useTranslation(); + return ( + <> +
+
+ + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} + + + + + +
+ e.g. ‘Owners of Numbers 1-5 High Street‘, or + ‘Mr and Mrs Smith‘ or ‘The executors + of Mr Evans‘ estate‘ +
+
+ {Object.keys(options).map((key, index) => ( +
+
+ + +
+ {value == + t("myrepresentations:questionnaire-yes") && + options[key] == + t( + "myrepresentations:questionnaire-yes" + ) && ( +
+
+ + +
+
+ )} +
+ ))} +
+
+
+ + ); +}; + +export const RenderLPACondtionalRadioList = ({ + datafieldname, + legend, + name, + label, + id, + errorMsg, + options, + input: { onChange, value }, + meta: { touched, error }, + ...custom +}) => { + const required = (value) => (value ? undefined : "Required"); + + console.log(error); + + return ( + <> +
+
+ + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} + + + + + +
+
+ {Object.keys(options).map((key, index) => ( +
+
+ + +
+ {value == custom.optionSelect && + options[key] == custom.optionSelect && ( +
+
+ + +
+
+ )} +
+ ))} +
+
+
+ + ); +}; + export const RenderPickList = ({ datafieldname, name, label, input, optionsArr, - meta: { touched, errorStr }, + meta: { touched, error }, + errorMsg, }) => { return ( -
- + <> +
+ + {touched && error && ( + + Error:{" "} + {errorMsg} + + )} - {touched && errorStr && {errorStr}} -
+
+ +
+
+ ); }; @@ -123,6 +539,8 @@ export const RenderTextfield = ({ meta: { touched, error }, ...custom }) => { + const required = (value) => (value ? undefined : "Required"); + return ( <>
)); - function bytesToSize(bytes) { - var sizes = ["Bytes", "KB", "MB", "GB", "TB"]; - if (bytes == 0) return "0 Byte"; - var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); - return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i]; - } - const getThumbnailIcon = (fileObj, fileType) => { switch (fileType) { case "text/html": @@ -321,47 +913,6 @@ export const RenderFileUpload = (field) => { } }; - const getThumbnailIconByExtension = (blobName) => { - let fileType = blobName.slice(blobName.lastIndexOf(".") + 1); - - switch (fileType) { - case "html": - return "/assets/images/documenttypes/html.png"; - break; - case "txt": - return "/assets/images/documenttypes/txt.png"; - break; - case "doc": - return "/assets/images/documenttypes/doc.png"; - break; - case "pdf": - return "/assets/images/documenttypes/pdf.png"; - break; - case "docx": - return "/assets/images/documenttypes/docx.png"; - break; - case "csv": - return "/assets/images/documenttypes/csv.png"; - break; - case "xlsx": - return "/assets/images/documenttypes/xlsx.png"; - break; - - case "zip": - return "/assets/images/documenttypes/zip.png"; - break; - case "jpeg": - case "jpg": - return "/assets/images/documenttypes/jpg.png"; - case "png": - return "/assets/images/documenttypes/png.png"; - break; - default: - return "/assets/images/documenttypes/txt.png"; - break; - } - }; - const getDocumentType = (docCode) => { switch (docCode) { case "000001": @@ -448,15 +999,9 @@ export const RenderFileUpload = (field) => { onDrop={(filesToUpload, e) => { const renamedAcceptedFiles = filesToUpload.map( (file) => - new File( - [file], - `${getDocumentType(field.documentTypeCode)}_${ - file.name - }`, - { - type: file.type, - } - ) + new File([file], `${file.name}`, { + type: file.type, + }) ); field.input.onChange(renamedAcceptedFiles); }} @@ -464,9 +1009,9 @@ export const RenderFileUpload = (field) => { {({ getRootProps, getInputProps }) => ( <> {/* {field.hint != false && ( -
ss{t(field.hint)}
- )} -
*/} +
ss{t(field.hint)}
+ )} +
*/}
{" "} @@ -551,13 +1096,64 @@ export const RenderFileUpload = (field) => { blob.name + blob.hashedfilepath } + className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link" > - - {blob.name} ({bytesToSize(blob.contentLength)}) - + {blob.name}({bytesToSize(blob.contentLength)})
))}{" "} ); }; + +export function FileUploadField(props) { + return ( + <> +

{props.label}

+ + + ); +} + +export const RepresentationGuidanceText = (appealType) => { + let { t } = useTranslation(); + + console.log(appealType); + switch (appealType) { + case "846040004": //has/cas + return ( +

+ {t("myrepresentations:questionnaire-publish-policy-label")}{" "} + + https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html + +

+ ); + break; + default: + return ( +

+ {t("myrepresentations:publish-policy-label")}{" "} + + https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html + +

+ ); + break; + } + + return guidanceString; +}; diff --git a/components/case/representation/representationInterestedPartyPerson.js b/components/case/representation/representationInterestedPartyPerson.js index fb4b6088..d07e6e6d 100644 --- a/components/case/representation/representationInterestedPartyPerson.js +++ b/components/case/representation/representationInterestedPartyPerson.js @@ -5,8 +5,10 @@ import { Field, reduxForm } from "redux-form"; import { RenderPickList, RenderTextfield, - RenderRadioList, + RenderCondtionalRadioList, RenderMultiline, + RenderRichMultiline, + FileUploadField, } from "./representationElements"; import { useDropzone } from "react-dropzone"; @@ -21,6 +23,8 @@ const RepInterestedPartyPerson = (props) => { setRepresentationCapacity, setRepresentationSubmit, } = props; + const required = (value) => (value ? undefined : "Required"); + const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => (
  • @@ -28,302 +32,125 @@ const RepInterestedPartyPerson = (props) => {
  • )); return ( -
    -
    -
    -

    - Representation - interested -

    - -
    - - -
    -
    -
    -
    - -
    -
    -
    -
    - - - -
    - e.g. ‘Owners of Numbers 1-5 High - Street‘, or ‘Mr and Mrs - Smith‘ or ‘The executors of Mr - Evans‘ estate‘ -
    -
    -
    - - -
    -
    -
    - - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -

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

    -
    -
    - My comments are set out in:* -
    -
    -
    - - -
    -
    -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    - -

    - Drag and drop files here - or click to select files -

    -
    - -
    -
    -
    -
    -
    -
    {" "} -
    - + <> +
    +

    + {t( + "myrepresentations:representation-from-an-interested-party-heading" + )} +

    +
    + +
    -
    + +
    +
    + +
    +
    + +
    +
    +

    + {t("myrepresentations:enter-comment-label")} +

    +
    +
    + {t("myrepresentations:comments-set-out-label")}: +
    +
    + +
    + +
    + +
    +
    +
    {" "} +
    + + + ); }; diff --git a/components/case/representation/representationLPA.js b/components/case/representation/representationLPA.js new file mode 100644 index 00000000..05346adb --- /dev/null +++ b/components/case/representation/representationLPA.js @@ -0,0 +1,425 @@ +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 { getFormCollectionByID, formatDates } from "../../utils"; +import { + setRepresentationCapacity, + setRepresentationSubmit, +} from "../../../store/currentView/action"; +import { useDropzone } from "react-dropzone"; +import { select } from "xpath"; +import jsonpath from "jsonpath"; +import { useState } from "react"; +import Enforcement_Questionnaire from "./representationQuestionnaires/representationLPAQuestionnaire_enforcement"; +import S78_Qquestionnaire from "./representationQuestionnaires/representationLPAQuestionnaire_s78"; +import RepresentationProgress_s78 from "./representationProgress/representationProgress_s78"; +import RepresentationProgress_enforcement from "./representationProgress/representationProgress_enforcement"; +import transLookup from "../../../data/lookuptranslations.json"; + +let RepLPA = (props) => { + let { t } = useTranslation(); + + const router = useRouter(); + const { locale } = router; + const { + formObj, + appellantApplicantRepresentationArr, + setRepresentationCapacity, + setRepresentationSubmit, + currentView, + procedureTypeValue, + onBehalfOfLPA, + setShowQuestionnaireSection, + showQuestionnaireSection, + } = props; + const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); + const files = acceptedFiles.map((file) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + const required = (value) => (value ? undefined : "Required"); + + const whichQuestionnaire = () => { + { + console.log("curr"); + switch (currentView.caseReference.appealType) { + case 846040000: + case 846040001: + case 846040006: + case 846040025: + case 846040004: + case 846040018: + case 846040003: + case 846040009: + case 846040008: + return ( + + ); + break; + + case 846040005: + case 846040006: + case 846040007: + return ( + + ); + break; + default: + return <>hello; + break; + } + } + }; + + const whichProgress = () => { + { + console.log("curr"); + switch (currentView.caseReference.appealType) { + case 846040000: + case 846040001: + case 846040006: + case 846040025: + case 846040004: + case 846040018: + case 846040003: + case 846040009: + case 846040008: + return ( + + ); + break; + + case 846040005: + case 846040006: + case 846040007: + return ( + + ); + break; + default: + return <>hello; + break; + } + } + }; + + let setCaseDetailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchDetailsObj + : props.props.searchResultsObj.searchDetailsObj; + + var detailsObj = {}; + + detailsObj = jsonpath.query( + setCaseDetailsObj, + '$..[?(@.pinswg_name=="' + + currentView.caseReference.currentReference + + '")]' + ); + + let setCaseResultssObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchResultsObj + : props.props.searchResultsObj.searchResultsObj; + + detailsObj = detailsObj[0]; + + var resultsObj = {}; + + resultsObj = jsonpath.query( + setCaseResultssObj, + '$..[?(@.pinswg_name=="' + + currentView.caseReference.currentReference + + '")]' + ); + resultsObj = resultsObj[0]; + + //console.log(resultsObj, detailsObj); + + return ( + <> +
    +

    + {typeof props.representationType != "undefined" + ? props.representationType == "Questionnaire" + ? locale == "cy" + ? "Holiadur" + : props.representationType + : props.representationType + : locale == "cy" + ? "Cynrychioliadau" + : "Representation"}{" "} + {locale == "cy" ? "o ACLI am a" : "from an LPA for a"}{" "} + {locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.attributevalue=="' + + currentView.caseReference.appealType + + '")].value_cy' + ) + : getFormCollectionByID( + currentView.caseReference.appealType + ).value} +

    + + {typeof props.representationType == "undefined" && ( +
    + + +
    + )} +
    + +
    +
    + {typeof props.representationType != "undefined" && + (props.representationType != "Questionnaire" ? ( + <> +

    + {t("myrepresentations:enter-comment-label")} +

    +
    +
    + {t( + "myrepresentations:comments-set-out-label" + )} + : +
    +
    + +
    +
    +
    + {" "} +
    + +
    +
    + + ) : ( + whichQuestionnaire() + ))} +
    {" "} +
    +
    +
    + {typeof props.representationType != "undefined" && + props.representationType == "Questionnaire" && ( + <> + {showQuestionnaireSection < 7 && ( + { + setShowQuestionnaireSection( + showQuestionnaireSection + 1 + ); + }} + className="govuk-button" + > + Next section + + )} + {showQuestionnaireSection == 9 && ( + + )} + {showQuestionnaireSection > 1 && ( + { + setShowQuestionnaireSection( + showQuestionnaireSection - 1 + ); + }} + className="govuk-link" + > + Back + + )} + + )}{" "} + {typeof props.representationType != "undefined" && + props.representationType != "Questionnaire" && ( + <> + + {/* { + + setRepresentationSubmit(false); + }} + className="govuk-button" + > + {t("common:continue-button")} + */} + { + //setRepresentationCapacity(); + }} + className="govuk-link" + > + {t("common:back-link")} + + + )} +
    +
    + + ); +}; + +const selector = formValueSelector("representationForm"); // <-- same as form name + +RepLPA = connect((state) => { + const representationType = selector(state, "representationType"); + const procedureType = selector(state, "procedureType"); + + return { + procedureType, + representationType, + }; +})(RepLPA); + +const mapStateToProps = (state, props) => { + let initialValuesTemp = Object.assign( + state.currentView.caseReference.hasOwnProperty("repDetails") + ? state.currentView.caseReference.repDetails + : state.currentView.caseReference, + { + "onBehalfOfLPA": + props.props.props.accountDetails.accountDetails[ + "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" + ], + } + ); + return { + search: state.search, + searchResultsObj: state.searchResultsObj, + formData: state.formData, + appealType: state.appealType, + currentView: state.currentView, + myRepresentations: state.myRepresentations, + initialValues: initialValuesTemp, + }; +}; + +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..342f58fd --- /dev/null +++ b/components/case/representation/representationLPACapacitySelection.js @@ -0,0 +1,103 @@ +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..8c0c7170 --- /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 ( + <> +

    + {t("myrepresentations:enter-comment-label")} +

    +
    +
    + {t("myrepresentations:comments-set-out-label")}: +
    +
    + +
    +
    + + ); +}; + +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 { + search: state.search, + searchResultsObj: state.searchResultsObj, + formData: state.formData, + appealType: state.appealType, + currentView: state.currentView, + myRepresentations: state.myRepresentations, + initialValues: state.currentView.caseReference.repDetails, + }; +}; + +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..84038a4a --- /dev/null +++ b/components/case/representation/representationLPADetails.js @@ -0,0 +1,105 @@ +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 = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchDetailsObj + : props.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 + : ""} +
    +
    +
    +
    +
    +

    + {t("myrepresentations:lpa-capacity-para-one")} +

    +
    +
    + + ); +}; + +export default RepLPADetails; diff --git a/components/case/representation/representationLandowner.js b/components/case/representation/representationLandowner.js index 393472d2..b72d924d 100644 --- a/components/case/representation/representationLandowner.js +++ b/components/case/representation/representationLandowner.js @@ -7,6 +7,8 @@ import { RenderTextfield, RenderRadioList, RenderMultiline, + RenderRichMultiline, + FileUploadField, } from "./representationElements"; import { useDropzone } from "react-dropzone"; import { @@ -37,7 +39,7 @@ const RepLandOwner = (props) => {

    - Representation - landowner + Representation for a Land owner

    @@ -45,7 +47,10 @@ const RepLandOwner = (props) => { className="govuk-label govuk-body-m" htmlFor="representationType" > - What kind of representation are you making? + {t( + "myrepresentations:representation-from-an-agent-heading" + )} + ? { />
    -
    + {/*
    { label="Description of representation" />
    -
    +
    */} +

    - You can enter your comments in the space provided or - attach a separate document. + {t("myrepresentations:enter-comment-label")}

    - My comments are set out in:* + {t("myrepresentations:comments-set-out-label")}:
    -
    -
    - - -
    -
    + +
    + +
    + -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    - -

    - Drag and drop files here or - click to select files -

    -
    - -
    -
    -
    + />
    -
    +
    {" "}
    +
    {/* { }} className="govuk-button" > - Continue + {t("common:continue-button")} */} { }} className="govuk-link" > - Back + {t("common:back-link")}
    diff --git a/components/case/representation/representationProgress/representationProgress_enforcement.js b/components/case/representation/representationProgress/representationProgress_enforcement.js new file mode 100644 index 00000000..bc9d7f8f --- /dev/null +++ b/components/case/representation/representationProgress/representationProgress_enforcement.js @@ -0,0 +1,540 @@ +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"; +import jsonpath from "jsonpath"; + +const RepresentationProgress_enforcement = (props) => { + let { t } = useTranslation(); + const router = useRouter(); + const { + formObj, + appellantApplicantRepresentationArr, + setRepresentationCapacity, + setRepresentationSubmit, + currentView, + procedureTypeValue, + onBehalfOfLPA, + setShowQuestionnaireSection, + showQuestionnaireSection, + } = props; + + return ( + + ); +}; + +export default RepresentationProgress_enforcement; diff --git a/components/case/representation/representationProgress/representationProgress_s78.js b/components/case/representation/representationProgress/representationProgress_s78.js new file mode 100644 index 00000000..9ecd4fbb --- /dev/null +++ b/components/case/representation/representationProgress/representationProgress_s78.js @@ -0,0 +1,435 @@ +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"; +import jsonpath from "jsonpath"; + +const RepresentationProgress_s78 = (props) => { + let { t } = useTranslation(); + const router = useRouter(); + + const { + formObj, + appellantApplicantRepresentationArr, + setRepresentationCapacity, + setRepresentationSubmit, + currentView, + procedureTypeValue, + onBehalfOfLPA, + setShowQuestionnaireSection, + showQuestionnaireSection, + } = props; + + return ( + + ); +}; + +export default RepresentationProgress_s78; diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js new file mode 100644 index 00000000..b750d1b0 --- /dev/null +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js @@ -0,0 +1,1213 @@ +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"; +import jsonpath from "jsonpath"; + +let Enforcement_Questionnaire = (props) => { + let { t } = useTranslation(); + + const router = useRouter(); + const { locale } = router; + const { + formObj, + appellantApplicantRepresentationArr, + setRepresentationCapacity, + setRepresentationSubmit, + currentView, + procedureTypeValue, + onBehalfOfLPA, + showQuestionnaireSection, + } = props; + const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); + const files = acceptedFiles.map((file) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + const required = (value) => (value ? undefined : "Required"); + + let setCaseDetailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchDetailsObj + : props.props.searchResultsObj.searchDetailsObj; + + var detailsObj = {}; + + detailsObj = jsonpath.query( + setCaseDetailsObj, + '$..[?(@.pinswg_name=="' + + currentView.caseReference.currentReference + + '")]' + ); + + let setCaseResultssObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchResultsObj + : props.props.searchResultsObj.searchResultsObj; + + detailsObj = detailsObj[0]; + + var resultsObj = {}; + + resultsObj = jsonpath.query( + setCaseResultssObj, + '$..[?(@.ticketnumber=="' + + currentView.caseReference.currentReference + + '")]' + ); + resultsObj = resultsObj[0]; + + return ( + <> + {showQuestionnaireSection == 1 && ( +
    +

    + Enforcement_Questionnaire{" "} + {t("myrepresentations:enf-section-heading-one")}{" "} +

    +
    +
    + 1. {t("myrepresentations:enf-section-question-1")}:{" "} + {currentView.caseReference.currentReference} +
    +
    +
    +
    + 2. {t("myrepresentations:enf-section-question-2")}:{" "} + {resultsObj.pinswg_lpareference} +
    +
    +
    +
    + 3. {t("myrepresentations:enf-section-question-3")}:{" "} + {detailsObj.pinswg_siteaddressline1 + + " " + + detailsObj.pinswg_siteaddressline2 + + " " + + detailsObj.pinswg_siteaddresstown + + " " + + detailsObj.pinswg_siteaddresspostcode} +
    +
    +
    + + + {(procedureTypeValue == "Hearing" || + procedureTypeValue == "Inquiry") && ( + + )} + + + +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    +
    + )}{" "} + {showQuestionnaireSection == 2 && ( +
    +

    + {t("myrepresentations:enf-section-heading-two")} +

    +
    + +
    +
    + +
    +
    + )}{" "} + {showQuestionnaireSection == 3 && ( +
    +

    + {t("myrepresentations:enf-section-heading-three")} +

    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + )}{" "} + {showQuestionnaireSection == 4 && ( +
    +

    + {" "} + {t("myrepresentations:enf-section-heading-four")}{" "} +

    +
    + +
    +
    + +
    + +
    + )}{" "} + {showQuestionnaireSection == 5 && ( +
    +

    + {t("myrepresentations:enf-section-heading-five")} +

    + + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + )}{" "} + {showQuestionnaireSection == 6 && ( +
    +

    + {t("myrepresentations:enf-section-heading-six")} +

    +
    + {t("myrepresentations:enf-section-question-31")} +
    + +
    + +
    + + + +
    + +
    +
    + )}{" "} + {showQuestionnaireSection == 7 && ( +
    +

    + {t("myrepresentations:enf-section-heading-seven")} +

    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + )}{" "} + {showQuestionnaireSection == 8 && ( +
    + {" "} +
    + +
    +
    + )} + {showQuestionnaireSection == 9 && ( +
    +

    + {t("myrepresentations:enf-section-heading-eight")} +

    +
    + +
    + +
    + {onBehalfOfLPA} + +
    + +
    + )} + + ); +}; + +//export default Enforcement_Questionnaire; + +const selector = formValueSelector("representationForm"); // <-- same as form name + +Enforcement_Questionnaire = connect((state) => { + const representationTypeValue = selector(state, "representationType"); + const procedureTypeValue = selector(state, "procedureType"); + + return { + procedureTypeValue, + representationTypeValue, + }; +})(Enforcement_Questionnaire); + +const mapStateToProps = (state, props) => { + console.log(); + return { + search: state.search, + searchResultsObj: state.searchResultsObj, + formData: state.formData, + appealType: state.appealType, + currentView: state.currentView, + myRepresentations: state.myRepresentations, + initialValues: state.currentView.caseReference.repDetails, + }; +}; + +export default connect(mapStateToProps)( + reduxForm({ + form: "representationForm", + enableReinitialize: true, + destroyOnUnmount: false, + })(Enforcement_Questionnaire) +); diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js new file mode 100644 index 00000000..e57a8c00 --- /dev/null +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js @@ -0,0 +1,1024 @@ +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"; +import jsonpath from "jsonpath"; +import { getFormCollectionByID } from "../../../../components/utils"; + +let S78_Questionnaire = async (props) => { + //let { t } = useTranslation(); + + let t = await getT(props.reqQuery.__nextLocale, "common"); + + const router = useRouter(); + const { locale } = router; + const { + formObj, + appellantApplicantRepresentationArr, + setRepresentationCapacity, + setRepresentationSubmit, + currentView, + procedureTypeValue, + onBehalfOfLPA, + showQuestionnaireSection, + } = props; + const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); + const files = acceptedFiles.map((file) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + const required = (value) => (value ? undefined : "Required"); + + let setCaseDetailsObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchDetailsObj + : props.props.searchResultsObj.searchDetailsObj; + + var detailsObj = {}; + + detailsObj = jsonpath.query( + setCaseDetailsObj, + '$..[?(@.pinswg_name=="' + + currentView.caseReference.currentReference + + '")]' + ); + + let setCaseResultssObj = router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? props.props.myRepresentations.myRepresentations + : props.props.searchResultsObj.searchResultsObj + : props.props.searchResultsObj.searchResultsObj; + + detailsObj = detailsObj[0]; + + var resultsObj = {}; + + resultsObj = jsonpath.query( + setCaseResultssObj, + "$..[?(@." + + (router.query.hasOwnProperty("state") + ? router.query.state == "edit" + ? "caseRef" + : "ticketnumber" + : "ticketnumber") + + '=="' + + currentView.caseReference.currentReference + + '")]' + ); + resultsObj = resultsObj[0]; + + console.log(resultsObj); + + return ( + <> + {props.representationTypeValue} + {props.procedureTypeValue} + {showQuestionnaireSection == 1 && ( +
    +

    + {t("myrepresentations:s78-section-heading-one")}{" "} +

    +
    +
    + 1. {t("myrepresentations:s78-section-question-1")}{" "} + {currentView.caseReference.currentReference} +
    +
    +
    +
    + 2. {t("myrepresentations:s78-section-question-2")}{" "} + {resultsObj.pinswg_lpareference} +
    +
    +
    +
    + 3. {t("myrepresentations:s78-section-question-3")}{" "} + {detailsObj.pinswg_siteaddressline1 + + " " + + detailsObj.pinswg_siteaddressline2 + + " " + + detailsObj.pinswg_siteaddresstown + + " " + + detailsObj.pinswg_siteaddresspostcode} +
    +
    +
    +
    + 4. {t("myrepresentations:s78-section-question-4")}{" "} + { + getFormCollectionByID( + currentView.caseReference.appealType + ).value + } +
    +
    + +
    + + {(procedureTypeValue == "Hearing" || + procedureTypeValue == "Inquiry") && ( + + )} + + + +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    +
    + )} + {showQuestionnaireSection == 2 && ( +
    +

    + {" "} + {t("myrepresentations:s78-section-heading-two")}{" "} +

    +
    + +
    +
    + +
    +
    + +
    + +
    + )} + {showQuestionnaireSection == 3 && ( +
    +

    + {t("myrepresentations:s78-section-heading-three")} +

    + + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    + )} + {showQuestionnaireSection == 4 && ( +
    +

    + {t("myrepresentations:s78-section-heading-four")} +

    +
    + {"24. " + + t("myrepresentations:s78-section-question-24")} +
    + + + +
    + +
    + + + +
    + +
    +
    + )} + {showQuestionnaireSection == 5 && ( +
    +

    + {t("myrepresentations:s78-section-heading-five")} +

    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + )} + {showQuestionnaireSection == 6 && ( +
    + {" "} +
    + +
    +
    + )} + {showQuestionnaireSection == 7 && ( +
    +

    Declaration

    +
    + +
    +
    + {onBehalfOfLPA} + +
    + + ss +
    + )} + + ); +}; + +export default S78_Questionnaire; + +// const selector = formValueSelector("representationForm"); //<-- same as form name + +// S78_Questionnaire = connect((state) => { +// const representationTypeValue = selector(state, "representationType"); +// const procedureTypeValue = selector(state, "procedureType"); + +// return { +// procedureTypeValue, +// representationTypeValue, +// }; +// })(S78_Questionnaire); + +// const mapStateToProps = (state, props) => { +// console.log(); +// return { +// search: state.search, +// searchResultsObj: state.searchResultsObj, +// formData: state.formData, +// appealType: state.appealType, +// currentView: state.currentView, +// myRepresentations: state.myRepresentations, +// initialValues: state.currentView.caseReference.repDetails, +// }; +// }; + +// export default connect(mapStateToProps)( +// reduxForm({ +// form: "representationForm", +// enableReinitialize: true, +// destroyOnUnmount: false, +// })(S78_Questionnaire) +// ); diff --git a/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement.js b/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement.js new file mode 100644 index 00000000..44ce4199 --- /dev/null +++ b/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement.js @@ -0,0 +1,1786 @@ +import _ from "lodash"; +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; +import { formatDates } from "../../../utils"; + +let RepLPAQuestionnaireCheck_enforcement = (props) => { + let { t } = useTranslation(); + const { formObj, currentView, setSubmitBack } = props; + const repFormData = formObj.representationForm.values; + + 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. {t("myrepresentations:s78-section-question-15")} +
    + +
    + {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_enforcement; diff --git a/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js b/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js new file mode 100644 index 00000000..c888c288 --- /dev/null +++ b/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js @@ -0,0 +1,1786 @@ +import _ from "lodash"; +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; +import { formatDates } from "../../../utils"; + +let RepLPAQuestionnaireCheck_s78 = (props) => { + let { t } = useTranslation(); + const { formObj, currentView, setSubmitBack } = props; + const repFormData = formObj.representationForm.values; + + 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. {t("myrepresentations:s78-section-question-15")} +
    + +
    + {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_s78; diff --git a/components/case/representationList.js b/components/case/representationList.js index da22ec6e..2059054e 100644 --- a/components/case/representationList.js +++ b/components/case/representationList.js @@ -6,10 +6,11 @@ import useTranslation from "next-translate/useTranslation"; import jsonpath from "jsonpath"; import _ from "lodash"; import transLookup from "../../data/lookuptranslations.json"; -import LoadingOverlay from "react-loading-overlay"; + import { getRepresentations } from "../../actions"; import { setRepresentations } from "../../store/searchOutput/action"; import PaginationControl from "./pagination"; +import { formatDates } from "../utils"; const RepresentationList = (props) => { const { incidentid, representationsObj, setRepresentations } = props; @@ -153,15 +154,6 @@ const RepresentationList = (props) => { const representationResultsObj = representationDetailsObj(); }, [incidentid, setRepresentations]); - 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; - } - const pagesCount = Math.ceil(representationsObj["@odata.count"] / 10); let currentPage = 0; @@ -224,11 +216,6 @@ const RepresentationList = (props) => {
    - {/* */} ); }; diff --git a/components/case/summary.js b/components/case/summary.js index a8a8f37f..263bf2f8 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -6,16 +6,27 @@ import useTranslation from "next-translate/useTranslation"; import jsonpath from "jsonpath"; import _ from "lodash"; import transLookup from "../../data/lookuptranslations.json"; -import LoadingOverlay from "react-loading-overlay"; -import { getLinkedCases } from "../../actions"; +import { + getLinkedCases, + createWatchedCases, + getWatchedCasesProxy, + getPortalModuleDetailsProxy, + deleteWatchedCases, +} from "../../actions"; import { setCurrentLinkedCases, setCurrentReference, } from "../../store/currentView/action"; +import { + setWatchedCases, + setWatchedCasesDetails, +} from "../../store/watchedCases/action"; + import { getFormCollectionByID } from "../utils"; -import { getSession, useSession } from "next-auth/react"; +import { getSession, useSession, signIn } from "next-auth/react"; +import { parseCookies, setCookie, destroyCookie } from "nookies"; import Pinswg_advertsid from "./summaryTypes/pinswg_advertsid"; import Pinswg_callinss77id from "./summaryTypes/pinswg_callinss77id"; @@ -62,12 +73,92 @@ const CaseSummary = (props) => { setCurrentLinkedCases, linkedCasesReference, setCurrentReference, + setWatchedCases, + setWatchedCasesDetails, showMap, + showLoginCheck, } = props; const { data: session, status } = useSession(); //console.log("session status:", status, session); + const cookies = parseCookies(); + + const selectWatchedCase = (loggedInUser, incidentID, appealType) => { + let updateBody = { + "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", + "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", + "pinswg_appealcasetype": +appealType, + }; + + createWatchedCases(updateBody) + .then((data) => data) + .then(() => { + getWatchedCasesProxy(loggedInUser).then((data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + }); + }); + }; + + const getDetails = (resultsObj, detailsType) => { + console.log(resultsObj); + let detailsArr = []; + resultsObj = resultsObj.value; + const detailsObj = resultsObj.map((searchDetail, index) => { + if (searchDetail.pinswg_appealcasetype == null) { + console.log( + detailsType != "myWatchedCases" + ? searchDetail.ticketnumber + : searchDetail[ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ] + ); + } else { + detailsArr.push( + getPortalModuleDetailsProxy( + getFormCollectionByID( + searchDetail.pinswg_appealcasetype + ).LogicalCollectionName, + detailsType != "myWatchedCases" + ? searchDetail.ticketnumber + : searchDetail[ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ] + ) + ); + } + }); + //console.log(detailsArr); + return Promise.all(detailsArr); + }; + + const isWatchedCase = (whichIncident) => { + let isWatched = jsonpath.query( + watchedCases, + "$..value[?(@._pinswg_watchedcase_value=='" + whichIncident + "')]" + ); + + return isWatched; + }; + + const deleteItem = (caseID, topThreeType) => { + let cookies = parseCookies(); + topThreeType == "watchedCases" && + deleteWatchedCases(caseID) + .then((data) => data) + .then(() => { + getWatchedCasesProxy(cookies.pinsUser).then((data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + }); + }); + }; + const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"]; let setCaseQueryObj = props[currentType]; @@ -113,6 +204,18 @@ const CaseSummary = (props) => { let showDetails = typeof detailsObj != "undefined" ? true : false; + var timestamp = showDetails + ? detailsObj.hasOwnProperty("pinswg_representation_period_end_date") + ? Date.parse(detailsObj.pinswg_representation_period_end_date) + : "n/a" + : "n/a"; + + if (isNaN(timestamp) == false) { + var d = new Date(timestamp); + } + + let hasEndDate = typeof d != "undefined"; + let showDetailsBlock = showDetails == true ? (
    @@ -143,7 +246,6 @@ const CaseSummary = (props) => { ] || "not entered"}
    - {detailsObj.pinswg_agentcontactname != null && (_.has( detailsObj, @@ -283,6 +385,182 @@ const CaseSummary = (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)} +

    +
    +
    + */} +
    +
    +
    + {_.has(detailsObj, "pinswg_startdate") && + showReps( + detailsObj.pinswg_startdate, + detailsObj.pinswg_finalcommentsduedate + ) && ( + <> + + {t( + "case:summary-make-representation-label" + )} + + + { + //spinnerState(); + router.back(); + }} + className="govuk-button govuk-button--secondary" + > + {t( + "case:summary-back-button-label" + )} + + + )} +
    + {session && + (isWatchedCase( + props.currentView.caseReference + .incidentid + ).length > + 0 == + true ? ( + { + deleteItem( + isWatchedCase( + props.currentView + .caseReference + .incidentid + )[0].pinswg_watchlistid, + + "watchedCases" + ); + alert( + t( + "case:you-have-stopped-watching-label" + ) + + props.currentView + .caseReference + .currentReference + ); + }} + title={t( + "case:stop-watching-case-link" + )} + > + {t("case:stop-watching-case-link")}{" "} + + ) : ( + { + selectWatchedCase( + props.accountDetails + .loggedinUserId, + props.currentView + .caseReference + .incidentid, + props.currentView + .caseReference + .appealType + ); + alert( + t( + "case:you-are-watching-label" + ) + + " " + + props.currentView + .caseReference + .currentReference + ); + }} + > + {t("case:watch-this-case-link")} + + ))} + + {!session && ( + { + // signIn("email"); + signIn(); + // selectWatchedCase( + // cookies.pinsUser, + // item.incidentid, + // item.pinswg_appealcasetype + // ); + // alert( + // "Trying to watch case " + + // item.title + // ); + }} + title={t("case:watch-this-case-link")} + > + {t("case:watch-this-case-link")} + + )} +
    +
    +
    +
    + +
    +
    + {_.has(detailsObj, "pinswg_startdate") && + showRepsEnded( + detailsObj.pinswg_startdate, + detailsObj.pinswg_finalcommentsduedate + ) && ( +
    + {t( + "case:representation-period-ended-on-label" + )} + + {formatDates( + detailsObj.pinswg_finalcommentsduedate + )} +
    + )} +
    +
    {/* 1{" "} {_.has(detailsObj, "pinswg_startdatetimeiftheevent") && detailsObj.pinswg_startdatetimeiftheevent} @@ -345,12 +623,13 @@ const CaseSummary = (props) => { true ? ( "" ) : ( - - - {t( - "case:summary-make-representation-label" - )} - + + {t( + "case:summary-make-representation-label" + )} )} @@ -717,8 +996,9 @@ const CaseSummary = (props) => { item.title + "&lk=1" } + className="" > - {item.title} + {item.title} ); @@ -729,16 +1009,24 @@ const CaseSummary = (props) => { ); } - return ( - <> - {showDetailsBlock} - {/* */} - - ); + function showReps(startDate, endDate) { + let date = new Date(); + date = new Date(date.toDateString()); + const start = new Date(startDate); + const end = new Date(endDate); + + return date >= start && date <= end ? true : false; + } + + function showRepsEnded(startDate, endDate) { + let date = new Date(); + date = new Date(date.toDateString()); + const start = new Date(startDate); + const end = new Date(endDate); + return date > start && date > end ? true : false; + } + + return <>{showDetailsBlock}; }; const mapStateToProps = (state) => { @@ -755,6 +1043,12 @@ const mapDispatchToProps = (dispatch) => { setCurrentReference: (currentReference) => { dispatch(setCurrentReference(currentReference)); }, + setWatchedCases: (watchedCases) => { + dispatch(setWatchedCases(watchedCases)); + }, + setWatchedCasesDetails: (watchedCasesDetails) => { + dispatch(setWatchedCasesDetails(watchedCasesDetails)); + }, }; }; diff --git a/components/case/summaryTypes/pinswg_dnsid.js b/components/case/summaryTypes/pinswg_dnsid.js index e3ec3f27..1e7a5d38 100644 --- a/components/case/summaryTypes/pinswg_dnsid.js +++ b/components/case/summaryTypes/pinswg_dnsid.js @@ -18,8 +18,8 @@ const Pinswg_dnsid = (props) => { const router = useRouter(); const { locale } = router; - const point = {}; - const siteCoords = {}; + let point = {}; + let siteCoords = {}; let center = {}; point = new OSPoint( diff --git a/components/caseresults.js b/components/caseresults.js index b7c0223e..da23c9e1 100644 --- a/components/caseresults.js +++ b/components/caseresults.js @@ -25,17 +25,17 @@ export default function Search({ children, pages }) {
    - - - {t("search:searchresults-search-button-label")} - + + + {t("search:searchresults-search-button-label")} + - - - {t( - "search:searchresults-new-search-button-label" - )} - + + + {t( + "search:searchresults-new-search-button-label" + )} +
    diff --git a/components/checkanswers.js b/components/checkanswers.js index 3ce9038f..77ca5ecc 100644 --- a/components/checkanswers.js +++ b/components/checkanswers.js @@ -19,7 +19,6 @@ const CheckAnswers = (props) => { id="main-content" role="main" > - sss { setBannerVisible(false); }; - return ( - <> - {bannerVisible ? ( - -
    - ); diff --git a/components/main.js b/components/main.js index deefa314..c51e8e35 100644 --- a/components/main.js +++ b/components/main.js @@ -12,7 +12,7 @@ import Dns from "./homepage/dns"; const MainHome = (props) => { let { t } = useTranslation(); - const { showLogin, session } = props; + const { showLogin, session, siteurl } = props; const router = useRouter(); const { locale } = router; @@ -34,7 +34,7 @@ const MainHome = (props) => { {showLogin == "true" && ( <> - + )}{" "} diff --git a/components/myportal.js b/components/myportal.js index fee936ef..7692deaa 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -25,126 +25,152 @@ const MyPortal = (props) => { const handleLogout = () => { console.info("////////////\n" + "logout" + "\n////////////"); window.localStorage.clear(), - destroyCookie({}, "pinsUser"), + destroyCookie(null, "next-auth.csrf-token"), + destroyCookie(null, "next-auth.callback-url"), + destroyCookie(null, "pedw_locale"), + destroyCookie(null, "pinsUser"), signOut({ callbackUrl: "/logout" }); }; - return ( - <> -
    -
    -

    - { -

    + const isLPA = + props.accountDetails.accountDetails[ + "pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" + ] == "LPA" + ? true + : false; -
    - {router.locale{" "} - -
    - +
    +
    +

    + { +

    + +
    + {router.locale{" "} +
    + + + { + props.accountDetails.accountDetails + .firstname + }{" "} + { + props.accountDetails.accountDetails + .lastname + } + {" - "} + { + props.accountDetails.accountDetails[ + "pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" + ] + } + + +
    +
    + { + handleLogout(); + }} + className="govuk-header__link govuk-!-margin-right-3"> + + {t("common:signout-label")} + + +
    +
    +
    + {isLPA && ( +
    +

    + { + props.accountDetails.accountDetails[ + "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" + ] + }{" "} + LPA Portal +

    +
    + )} +
    +
    +
    + {!isLPA && } + + {/* {props.awaitingSubmission.awaitingSubmission[ + "@odata.count" + ] > 0 && ( + - { - handleLogout(); - }} - className="govuk-header__link govuk-!-margin-right-3" - > - {t("common:signout-label")} - - -
    + /> + )} */} + {isLPA + ? "" + : props.awaitingSubmission + .awaitingSubmissionFromBlob[ + "@odata.count" + ] > 0 && ( + + )} + {props.myCases.myCases["@odata.count"] > 0 && ( + + )} + {props.watchedCases.watchedCases["@odata.count"] > + 0 && ( + + )} + {props.myRepresentations.myRepresentations[ + "@odata.count" + ] > 0 && ( + + )} + {!isLPA && } + + {/* */}
    -
    -
    -
    - - - {/* {props.awaitingSubmission.awaitingSubmission[ - "@odata.count" - ] > 0 && ( - - )} */} - {props.awaitingSubmission - .awaitingSubmissionFromBlob["@odata.count"] > - 0 && ( - - )} - {props.myCases.myCases["@odata.count"] > 0 && ( - - )} - {props.watchedCases.watchedCases["@odata.count"] > - 0 && ( - - )} - {props.myRepresentations.myRepresentations[ - "@odata.count" - ] > 0 && ( - - )} - - {/* */} - {showFileUpload == "true" && } -
    -
    -
    -
    - - - ); +
    +
    + + ; }; export default MyPortal; diff --git a/components/myportal/advancedsearch.js b/components/myportal/advancedsearch.js index efa1c89e..49c57496 100644 --- a/components/myportal/advancedsearch.js +++ b/components/myportal/advancedsearch.js @@ -6,7 +6,7 @@ import { reduxForm, formValueSelector, Field } from "redux-form"; import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; import jsonpath from "jsonpath"; import data from "../../data/collections.json"; -import LoadingOverlay from "react-loading-overlay"; + import transLookup from "../../data/lookuptranslations.json"; const required = (errorMsg) => (value) => @@ -179,98 +179,96 @@ let AdvancedSearch = (props) => { label, errormsg, }) => { - return ( - <> -
    - - {touched && error && ( - - - Error: - {" "} - {errormsg} - - )} -
    - props.onChangeSelectAppealType(e)} + > + + {_.isEmpty(optionsObj) + ? "" + : Object.keys(optionsObj).map((key, index) => { + return ( +
    + ? "" + : optionsObj[key] + .attributevalue + + "," + + optionsObj[key].value + .replace( + /(\band|[\s\-\+\(\)\,\&])/g, + "" + ) + .toLowerCase() + } + > + {_.isEmpty(optionsObj[key]) + ? "" + : _.isEmpty(optionsObj[key]) + ? "" + : _.isEmpty( + optionsObj[key].value + ) + ? "" + : router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + optionsObj[key] + .value + + '")].value_cy' + ) + : optionsObj[key].value || + t( + "case:summary-no-date-entered-label" + )} + + ); + })} +
    - - ); +
    + ; }; // const [showSpinnerState, setShowSpinnerState] = useState(false); @@ -471,11 +469,6 @@ let AdvancedSearch = (props) => {
    - {/* */} ); }; diff --git a/components/myportal/awaitingsubmission.js b/components/myportal/awaitingsubmission.js index 42c215b7..cd296a53 100644 --- a/components/myportal/awaitingsubmission.js +++ b/components/myportal/awaitingsubmission.js @@ -32,18 +32,24 @@ const AwaitingSubmission = (props) => { {props.awaitingSubmission.awaitingSubmission["@odata.count"] > 3 && (
    - - { - setCurrentView({ - "viewName": "Awaiting Submission", - "viewKey": "awaitingSubmission", - }); - }} - > - {t("myportal:viewall-link")} - + { + setCurrentView({ + "viewName": "Awaiting Submission", + "viewKey": "awaitingSubmission", + }); + }}> + + {t("myportal:viewall-link")} +
    )} diff --git a/components/myportal/awaitingsubmissionfromblob.js b/components/myportal/awaitingsubmissionfromblob.js index 13fab0f4..aa28e440 100644 --- a/components/myportal/awaitingsubmissionfromblob.js +++ b/components/myportal/awaitingsubmissionfromblob.js @@ -60,45 +60,42 @@ const AwaitingSubmissionFromBlob = (props) => { { - props.setCurrentReference({ - "currentReference": - showTopThreeArr[key].ticketnumber, + className="govuk-link--no-underline" + data-id={index} + onClick={() => { + props.setCurrentReference({ + "currentReference": + showTopThreeArr[key].ticketnumber, - "currentType": "awaitingSubmission", + "currentType": "awaitingSubmission", - "incidentid": - showTopThreeArr[key].incidentid, + "incidentid": + showTopThreeArr[key].incidentid, + + "appealType": + showTopThreeArr[key] + .pinswg_appealcasetype, + }); + }}> + + {showTopThreeArr[index].pinswg_name} - "appealType": - showTopThreeArr[key] - .pinswg_appealcasetype, - }); - }} - > - {showTopThreeArr[index].pinswg_name} -
    @@ -215,18 +212,24 @@ const AwaitingSubmissionFromBlob = (props) => {
    {props.awaitingSubmissionFromBlob["@odata.count"] > 3 && (
    - - { - setCurrentView({ - "viewName": "Awaiting Submission", - "viewKey": "awaitingSubmissionDetails", - }); - }} - > - {t("myportal:viewall-link")} - + { + setCurrentView({ + "viewName": "Awaiting Submission", + "viewKey": "awaitingSubmissionDetails", + }); + }}> + + {t("myportal:viewall-link")} +
    )} diff --git a/components/myportal/dns.js b/components/myportal/dns.js index 238490bf..6d4b00ac 100644 --- a/components/myportal/dns.js +++ b/components/myportal/dns.js @@ -2,7 +2,6 @@ import Link from "next/link"; import { useState } from "react"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import LoadingOverlay from "react-loading-overlay"; export default function Dns() { let { t } = useTranslation(); @@ -34,23 +33,16 @@ export default function Dns() { ? "/fymhorth/ceisiadaudns" : "/myportal/dnsapplications" } - > - { - // spinnerState(); - // }} - > - {t("home:dns-card-button")} - + // onClick={() => { + // spinnerState(); + // }} + className="govuk-button withChevron govuk-button-cta"> + + {t("home:dns-card-button")} +
    - {/* */}
    ); } diff --git a/components/myportal/makenewappeal.js b/components/myportal/makenewappeal.js index ad42d108..b300ccf3 100644 --- a/components/myportal/makenewappeal.js +++ b/components/myportal/makenewappeal.js @@ -20,10 +20,10 @@ export default function MakeNewAppeal() { {t("myportal:makenewappeal-card-paragraph-two")}

    - - - {t("myportal:makenewappeal-card-button-label")} - + + + {t("myportal:makenewappeal-card-button-label")} +
    diff --git a/components/myportal/mycases.js b/components/myportal/mycases.js index 73321722..f080c25e 100644 --- a/components/myportal/mycases.js +++ b/components/myportal/mycases.js @@ -26,18 +26,27 @@ const MyCases = (props) => {
    {props.myCases.myCases["@odata.count"] > 3 && (
    - - { - setCurrentView({ - "viewName": "My Cases", - "viewKey": "myCases", - }); - }} - > - {t("myportal:viewall-link")} - + { + setCurrentView({ + "viewName": "My Cases", + "viewKey": "myCases", + }); + }}> + + {t("myportal:viewall-link")}{" "} + {props.isLPA && + props.myCases.myCases["@odata.count"] + + " appeals"} +
    )} diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js index 139c7dd4..dcd1b6cb 100644 --- a/components/myportal/myrepresentations.js +++ b/components/myportal/myrepresentations.js @@ -1,7 +1,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import TopThree from "./topthree"; +import TopThree from "./topthree_reps"; import { connect } from "react-redux"; import { setCurrentView } from "../../store/currentView/action"; @@ -31,18 +31,25 @@ const MyRepresentations = (props) => { {props.myRepresentations.myRepresentations["@odata.count"] > 3 && (
    - - { - setCurrentView({ - "viewName": "My Representations", - "viewKey": "myRepresentations", - }); - }} - > - {t("myportal:viewall-link")} - + { + setCurrentView({ + "viewName": "My Representations", + "viewKey": "myRepresentations", + }); + }}> + + {t("myportal:viewall-link")} +
    )} diff --git a/components/myportal/myrepresentationsfromblob.js b/components/myportal/myrepresentationsfromblob.js new file mode 100644 index 00000000..4c9492e5 --- /dev/null +++ b/components/myportal/myrepresentationsfromblob.js @@ -0,0 +1,69 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; +import TopThree from "./topthree_reps"; +import { connect } from "react-redux"; +import { setCurrentView } from "../../store/currentView/action"; + +const MyRepresentations = (props) => { + let { t } = useTranslation(); + + const router = useRouter(); + const { locale } = router; + const { setCurrentView } = props; + + return ( +
    +
    +

    + {t("myportal:myrepresentations-card-title")}dd +

    +
    + +
    + + {props.myRepresentations.myRepresentations["@odata.count"] > + 3 && ( +
    + { + setCurrentView({ + "viewName": "My Representations", + "viewKey": "myRepresentations", + }); + }}> + + {t("myportal:viewall-link")} + + +
    + )} +
    +
    + ); +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentView: (currentView) => { + dispatch(setCurrentView(currentView)); + }, + }; +}; + +export default connect(null, mapDispatchToProps)(MyRepresentations); diff --git a/components/myportal/searchcases.js b/components/myportal/searchcases.js index 552d756a..cd556f0b 100644 --- a/components/myportal/searchcases.js +++ b/components/myportal/searchcases.js @@ -4,7 +4,6 @@ import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import { connect } from "react-redux"; import { Field, reduxForm } from "redux-form"; -import LoadingOverlay from "react-loading-overlay"; const required = (errorMsg) => (value) => value || typeof value === "number" ? undefined : errorMsg; @@ -96,69 +95,62 @@ let CaseSearch = (props) => { }); }; - return ( - <> -
    -
    -
    -

    - {t("myportal:searchcases-card-title")} -

    + return <> +
    + +
    +

    + {t("myportal:searchcases-card-title")} +

    - + -
    - -
    - - - {t("myportal:searchcases-card-advanced-link")} - - +
    +
    - - {/* */} -
    - - ); + + + {t("myportal:searchcases-card-advanced-link")} + + +
    + +
    + ; }; const mapStateToProps = (state) => { diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 7a103719..d677ac60 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -167,47 +167,45 @@ const TopThree = (props) => { ? "/fymhorth/achos" : "/myportal/case" } - > - { - setCurrentReference({ - "currentReference": - topThreeType != "watchedCases" - ? topThreeType != - "myRepresentations" - ? showTopThreeArr[key] - .ticketnumber - : showTopThreeArr[key][ - "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" - ] + className="govuk-link--no-underline" + data-id={index} + onClick={() => { + setCurrentReference({ + "currentReference": + topThreeType != "watchedCases" + ? topThreeType != + "myRepresentations" + ? showTopThreeArr[key] + .ticketnumber : showTopThreeArr[key][ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ], - "currentType": topThreeType, + "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" + ] + : showTopThreeArr[key][ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ], + "currentType": topThreeType, - "incidentid": getIncidentId( - topThreeType, - showTopThreeArr[key] - ), + "incidentid": getIncidentId( + topThreeType, + showTopThreeArr[key] + ), - "appealType": - showTopThreeArr[key] - .pinswg_appealcasetype, - }); - }} - > - {topThreeType != "watchedCases" - ? topThreeType != "myRepresentations" - ? showTopThreeArr[key].ticketnumber - : showTopThreeArr[key][ - "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" - ] + "appealType": + showTopThreeArr[key] + .pinswg_appealcasetype, + }); + }}> + + {topThreeType != "watchedCases" + ? topThreeType != "myRepresentations" + ? showTopThreeArr[key].ticketnumber : showTopThreeArr[key][ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ]}{" "} - + "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" + ] + : showTopThreeArr[key][ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ]}{" "} +
    {/* {(topThreeType == "awaitingSubmission" || diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js new file mode 100644 index 00000000..70ed771f --- /dev/null +++ b/components/myportal/topthree_reps.js @@ -0,0 +1,270 @@ +import useTranslation from "next-translate/useTranslation"; +import Link from "next/link"; +import { useRouter } from "next/router"; +import { parseCookies } from "nookies"; +import { connect } from "react-redux"; +import { + deleteAwaitingSubmissions, + deleteWatchedCases, + getAwaitingSubmissionProxy, + getPortalModuleDetailsProxy, + getWatchedCasesProxy, +} from "../../actions"; +import { + setAwaitingSubmission, + setAwaitingSubmissionDetails, +} from "../../store/awaitingSubmission/action"; +import { setCurrentReference } from "../../store/currentView/action"; +import { + setWatchedCases, + setWatchedCasesDetails, +} from "../../store/watchedCases/action"; +import { getFormCollectionByID } from "../utils"; +import jsonpath from "jsonpath"; +import transLookup from "../../data/lookuptranslations.json"; + +const TopThree = (props) => { + let { t } = useTranslation(); + const { + showTopThree, + showDetails, + setCurrentReference, + topThreeType, + setWatchedCases, + setWatchedCasesDetails, + setAwaitingSubmission, + setAwaitingSubmissionDetails, + } = props; + + const router = useRouter(); + const { locale } = router; + + let topthreeRow = []; + let showTopThreeArr = showTopThree.value; + + Object.keys(showTopThreeArr).map((key, index) => { + let createdDate = parseInt( + showTopThreeArr[key].repfile_name.split("-")[3] + ); + showTopThreeArr[key].createdDate = createdDate; + }); + + showTopThreeArr.sort(function compare(a, b) { + console.log(a.createdDate, b.createdDate); + var dateA = new Date(a.createdDate); + var dateB = new Date(b.createdDate); + return dateB - dateA; + }); + + const deleteItem = (caseID, topThreeType) => { + let cookies = parseCookies(); + //console.log("sssss", caseID, topThreeType); + topThreeType == "watchedCases" && + deleteWatchedCases(caseID) + .then((data) => data) + .then(() => { + getWatchedCasesProxy(cookies.pinsUser).then((data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + }); + }); + + topThreeType == "awaitingSubmission" && + deleteAwaitingSubmissions(caseID) + .then((data) => { + return data; + }) + .then(() => { + getAwaitingSubmissionProxy(cookies.pinsUser).then( + (data) => { + setAwaitingSubmission(data), + getDetails(data, "awaitingSubmission").then( + (data) => { + // console.log( + // "submission get details:", + // data + // ); + setAwaitingSubmissionDetails(data); + } + ); + } + ); + }); + }; + + const getDetails = (resultsObj, detailsType) => { + //console.log(resultsObj); + let detailsArr = []; + resultsObj = resultsObj.value; + const detailsObj = resultsObj.map((searchDetail, index) => { + if (searchDetail.pinswg_appealcasetype == null) { + console.log( + detailsType != "myWatchedCases" + ? searchDetail.ticketnumber + : searchDetail[ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ] + ); + } else { + detailsArr.push( + getPortalModuleDetailsProxy( + getFormCollectionByID( + searchDetail.pinswg_appealcasetype + ).LogicalCollectionName, + detailsType != "myWatchedCases" + ? searchDetail.ticketnumber + : searchDetail[ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ] + ) + ); + } + }); + //console.log(detailsArr); + return Promise.all(detailsArr); + }; + + const getIncidentId = (topThreeType, objArr) => { + switch (topThreeType) { + case "myCases": + return objArr.incidentid; + break; + case "watchedCases": + return objArr._pinswg_watchedcase_value; + break; + case "myRepresentations": + return objArr.casereference; + break; + case "awaitingSubmission": + return objArr.ticketnumber; + break; + default: + // code block + } + }; + + const repRaisedDate = (datePart) => { + var dateObj = new Date(parseInt(datePart.split("-")[3])); + return dateObj.toLocaleString(); + }; + + let topThreeOnlyArr = showTopThreeArr.slice(0, 3); + Object.keys(topThreeOnlyArr).map((key, index) => { + topthreeRow.push( +
    +
    +
    + {t("myportal:case-reference")}:{" "} + { + setCurrentReference({ + "currentReference": + showTopThreeArr[key].caseRef, + "currentType": topThreeType, + "incidentid": + showTopThreeArr[key].incidentID, + "appealType": + showTopThreeArr[key].appealType, + "repDetails": showTopThreeArr[key], + }); + }} + > + {showTopThreeArr[key].pinswg_name} + +
    +
    + {t("myportal:representation-type")}: + {" "} + {showTopThreeArr[key].representationType} +
    +
    + {t("myportal:capacity")}: + {" "} + {showTopThreeArr[key].representationCapacity} +
    +
    + {t("myportal:date-raised")}: + {" "} + {repRaisedDate(showTopThreeArr[key].repfile_name)} +
    {" "} +
    + LPA: + {" "} + + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + showTopThreeArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : showTopThreeArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || ""} +
    +
    +
    + ); + }); + + let noRecordsLabel = ""; + switch (topThreeType) { + case "watchedCases": + noRecordsLabel = t("myportal:norecords-watched-cases"); + break; + case "myRepresentations": + noRecordsLabel = t("myportal:norecords-representations"); + break; + case "myCases": + noRecordsLabel = t("myportal:norecords-cases"); + break; + case "awaitingSubmission": + noRecordsLabel = t("myportal:norecords-awaiting-submissions"); + break; + } + return ( + <> + {topthreeRow.length == 0 ? ( +
    {noRecordsLabel}
    + ) : ( + topthreeRow + )} + + ); +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentReference: (currentReference) => { + dispatch(setCurrentReference(currentReference)); + }, + setWatchedCases: (watchedCases) => { + dispatch(setWatchedCases(watchedCases)); + }, + setWatchedCasesDetails: (watchedCasesDetails) => { + dispatch(setWatchedCasesDetails(watchedCasesDetails)); + }, + setAwaitingSubmission: (awaitingSubmission) => { + dispatch(setAwaitingSubmission(awaitingSubmission)); + }, + setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => { + dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails)); + }, + }; +}; + +export default connect(null, mapDispatchToProps)(TopThree); diff --git a/components/myportal/uploadFile.js b/components/myportal/uploadFile.js index 45a82ccf..1e06e535 100644 --- a/components/myportal/uploadFile.js +++ b/components/myportal/uploadFile.js @@ -2,13 +2,18 @@ import Link from "next/link"; import { useState, useMemo } from "react"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import LoadingOverlay from "react-loading-overlay"; + import DropzoneComponent from "../newappeal/fileupload"; import { Field, reduxForm } from "redux-form"; import { connect } from "react-redux"; import Dropzone, { useDropzone } from "react-dropzone"; import { uploadFiles } from "../../actions"; import { getContainers } from "../../actions/azurestorage"; +import { + getFormCollectionByID, + getThumbnailIconByExtension, + bytesToSize, +} from "../utils"; const required = (errorMsg) => (value) => value || typeof value === "number" ? undefined : errorMsg; @@ -119,13 +124,6 @@ const RenderFileUpload = (field) => {
    )); - function bytesToSize(bytes) { - var sizes = ["Bytes", "KB", "MB", "GB", "TB"]; - if (bytes == 0) return "0 Byte"; - var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); - return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i]; - } - const getThumbnailIcon = (fileObj, fileType) => { switch (fileType) { case "text/html": diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index 078d73f5..925cd75f 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -20,7 +20,10 @@ const ViewAllResults = (props) => { const router = useRouter(); const { locale } = router; - + const repRaisedDate = (datePart) => { + var dateObj = new Date(datePart); + return dateObj.toLocaleString(); + }; var resultsArr = currentView.viewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.case @@ -35,15 +38,11 @@ const ViewAllResults = (props) => { return dd + "/" + mm + "/" + yyyy; } - // console.log( - // currentView.viewKey, - // props[currentView.viewKey], - // props[currentView.viewKey][currentView.viewKey].value - // ); - var searchDetailsObj = currentView.viewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.value + : currentView.viewKey == "myRepresentations" + ? props["myRepresentations"].myRepresentations.value : props[currentView.viewKey][currentView.viewKey + "Details"] || []; let resultsRowArr = []; @@ -54,12 +53,28 @@ const ViewAllResults = (props) => { ); detailsObj = detailsObj[0]; + //console.log(searchDetailsObj[key]); + + // searchDetailsObj[key] = + // currentView.viewKey == "myRepresentations" + // ? searchDetailsObj[key].value[0] + // : searchDetailsObj[key]; + resultsRowArr.push(
    { ? "/myportal/case" : "/case" } - > - { - setCurrentReference({ - "currentReference": - currentView.viewKey != "watchedCases" - ? resultsArr[key].ticketnumber - : resultsArr[key][ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ], + onClick={() => { + setCurrentReference({ + "currentReference": + currentView.viewKey != "watchedCases" + ? currentView.viewKey == + "myRepresentations" + ? resultsArr[key].caseRef + : resultsArr[key].ticketnumber + : resultsArr[key][ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ], - "currentType": currentView.viewKey, - "incidentid": - currentView.viewKey != "watchedCases" - ? resultsArr[key].incidentid - : resultsArr[key][ - "_pinswg_watchedcase_value" - ], + "currentType": currentView.viewKey, + "incidentid": + currentView.viewKey != "watchedCases" + ? resultsArr[key].incidentid + : resultsArr[key][ + "_pinswg_watchedcase_value" + ], - "appealType": - resultsArr[key].pinswg_appealcasetype, - }); - }} - > - - Case Reference: - + "appealType": + resultsArr[key].pinswg_appealcasetype, + "repDetails": + currentView.viewKey == + "myRepresentations" && + resultsArr[key], + }); + }}> + + + {t("search:searchresults-case-reference-label")} + : + + {currentView.viewKey != "watchedCases" + ? currentView.viewKey == "myRepresentations" + ? resultsArr[key].caseRef + : resultsArr[key].ticketnumber + : resultsArr[key][ + "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + ]} - {currentView.viewKey != "watchedCases" - ? resultsArr[key].ticketnumber - : resultsArr[key][ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ]} -
    @@ -139,16 +161,20 @@ const ViewAllResults = (props) => { )[0] : "" : ""} */} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddressline1") ? searchDetailsObj[key].pinswg_siteaddressline1 : ""} - {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline1 : ""} - + {currentView.viewKey == "myRepresentations" && + _.has(searchDetailsObj[key].pinswg_siteaddressline1) + ? searchDetailsObj[key].value[0].pinswg_siteaddressline1 + : ""} + {_.has(detailsObj, "pinswg_siteaddressline1") + ? detailsObj.pinswg_siteaddressline1 + : ""} {currentView.viewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], @@ -156,15 +182,20 @@ const ViewAllResults = (props) => { ) && searchDetailsObj[key].pinswg_siteaddressline1 != null &&
    } - + {currentView.viewKey == "myRepresentations" && + _.has(searchDetailsObj[key].pinswg_siteaddressline1) && + searchDetailsObj[key].value[0] + .pinswg_siteaddressline1 != null &&
    } {_.has(detailsObj, "pinswg_siteaddressline1") && detailsObj.pinswg_siteaddressline1 != null &&
    } - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddressline1") ? searchDetailsObj[key].pinswg_siteaddressline2 : ""} - + {currentView.viewKey == "myRepresentations" && + _.has(searchDetailsObj[key].pinswg_siteaddressline1) + ? searchDetailsObj[key].pinswg_siteaddressline2 + : ""} {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline2 : ""} @@ -176,18 +207,24 @@ const ViewAllResults = (props) => { searchDetailsObj[key].pinswg_siteaddressline2 != null &&
    } + {currentView.viewKey == "myRepresentations" && + _.has(searchDetailsObj[key].pinswg_siteaddressline2) && + searchDetailsObj[key].pinswg_siteaddressline1 != + null &&
    } + {_.has(detailsObj, "pinswg_siteaddressline2") && detailsObj.pinswg_siteaddressline2 != null &&
    } - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresstown") ? searchDetailsObj[key].pinswg_siteaddresstown : ""} - + {currentView.viewKey == "myRepresentations" && + _.has(searchDetailsObj[key], "pinswg_siteaddresstown") + ? searchDetailsObj[key].pinswg_siteaddresstown + : ""} {_.has(detailsObj, "pinswg_siteaddresstown") ? detailsObj.pinswg_siteaddresstown : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], @@ -196,18 +233,27 @@ const ViewAllResults = (props) => { searchDetailsObj[key].pinswg_siteaddresstown != null &&
    } + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key], + "pinswg_siteaddresstown" + ) && + searchDetailsObj[key].pinswg_siteaddresstown != + null &&
    } + {_.has(detailsObj, "pinswg_siteaddresstown") && detailsObj.pinswg_siteaddresstown != null &&
    } - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresscounty") ? searchDetailsObj[key].pinswg_siteaddresscounty : ""} - + {currentView.viewKey == "myRepresentations" && + _.has(searchDetailsObj[key], "pinswg_siteaddresscounty") + ? searchDetailsObj[key].pinswg_siteaddresscounty + : ""} {_.has(detailsObj, "pinswg_siteaddresscounty") ? detailsObj.pinswg_siteaddresscounty : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], @@ -215,15 +261,12 @@ const ViewAllResults = (props) => { ) && searchDetailsObj[key].pinswg_siteaddresscounty != null &&
    } - {_.has(detailsObj, "pinswg_siteaddresscounty") && detailsObj.pinswg_siteaddresscounty != null &&
    } - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresspostcode") ? searchDetailsObj[key].pinswg_siteaddresspostcode : ""} - {_.has(detailsObj, "pinswg_siteaddresspostcode") ? detailsObj.pinswg_siteaddresspostcode : ""} @@ -234,7 +277,6 @@ const ViewAllResults = (props) => { ? t("search:searchresults-created-on-label") : t("search:searchresults-applicant-label")} - {currentView.viewKey == "awaitingSubmissionDetails" ? formatDates(item.createdon) : _.has(detailsObj, [ @@ -243,6 +285,10 @@ const ViewAllResults = (props) => { ? detailsObj[ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] + : currentView.viewKey == "myRepresentations" + ? searchDetailsObj[key][ + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ] : resultsArr[key][ "_customerid_value@OData.Community.Display.V1.FormattedValue" ]} @@ -251,7 +297,6 @@ const ViewAllResults = (props) => { {t("search:searchresults-authority-label")}: - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(resultsArr[key], "pinswg_lpaname") ? router.locale == "cy" @@ -263,7 +308,6 @@ const ViewAllResults = (props) => { ) : resultsArr[key].pinswg_lpaname || "N/A" : ""} - {_.has(resultsArr[key], [ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", ]) @@ -280,6 +324,52 @@ const ViewAllResults = (props) => { "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ] || "N/A" : ""} + {_.has(searchDetailsObj[key], [ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue", + ]) + ? router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + searchDetailsObj[key].value[0][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee" + ] + + '")].value_cy' + ) + : currentView.viewKey == "myRepresentations" + ? searchDetailsObj[key].value + : searchDetailsObj[key].value[0][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || "N/A" + : ""} + {_.has(resultsArr[key], [ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue", + ]) + ? router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + resultsArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee" + ] + + '")].value_cy' + ) + : resultsArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || + (currentView.viewKey == "myRepresentations" + ? "" + : "N/A") + : currentView.viewKey == "myRepresentations" && + router.locale == "cy" && + jsonpath.query( + transLookup, + '$..[?(@.value=="' + + searchDetailsObj[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + )}
    @@ -309,11 +399,35 @@ const ViewAllResults = (props) => { ) : item[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" - ] || "N/A"} + ] || + (currentView.viewKey == "myRepresentations" + ? "" + : "N/A")} + + {currentView.viewKey == "myRepresentations" && + (router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + getFormCollectionByID( + searchDetailsObj[key].appealType + ).value + + '")].value_cy' + )[0] + : getFormCollectionByID( + searchDetailsObj[key].appealType + ).value)} + {_.has( + searchDetailsObj[key], + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + )}
    - {t("search:searchresults-status-label")}: + {currentView.viewKey == "myRepresentations" + ? "Created" + : t("search:searchresults-status-label")} + : {currentView.viewKey == "awaitingSubmissionDetails" @@ -330,16 +444,29 @@ const ViewAllResults = (props) => { item.statuscode + '")].value' ) || "N/A" - : router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - item[ - "statuscode@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy' - ) - : item[ + : currentView.viewKey == "myRepresentations" + ? repRaisedDate(item.createdDate) // ? router.locale == "cy" + : // ? jsonpath.query( + // transLookup, + // '$..[?(@.value=="' + + // searchDetailsObj[key].value[0][ + // "statuscode@OData.Community.Display.V1.FormattedValue" + // ] + + // '")].value_cy' + // ) + // : searchDetailsObj[key].value[0][ + // "statuscode@OData.Community.Display.V1.FormattedValue" + // ] || "N/A" + // : router.locale == "cy" + // ? jsonpath.query( + // transLookup, + // '$..[?(@.value=="' + + // item[ + // "statuscode@OData.Community.Display.V1.FormattedValue" + // ] + + // '")].value_cy' + // ) + item[ "statuscode@OData.Community.Display.V1.FormattedValue" ] || "N/A"}
    @@ -387,7 +514,9 @@ const ViewAllResults = (props) => { {t("search:searchresults-case-type-label")}
    - {t("search:searchresults-status-label")} + {currentView.viewKey == "myRepresentations" + ? "Created" + : t("search:searchresults-status-label")}
    diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index 1d871c80..e5ff6c13 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -28,18 +28,25 @@ const WatchedCases = (props) => { {props.watchedCases.watchedCases["@odata.count"] > 3 && (
    - - { - setCurrentView({ - "viewName": "Watched Cases", - "viewKey": "watchedCases", - }); - }} - > - {t("myportal:viewall-link")} - + { + setCurrentView({ + "viewName": "Watched Cases", + "viewKey": "watchedCases", + }); + }}> + + {t("myportal:viewall-link")} +
    )} @@ -51,7 +58,7 @@ const WatchedCases = (props) => { const mapDispatchToProps = (dispatch) => { return { setCurrentView: (currentView) => { - console.log(currentView); + //console.log(currentView); dispatch(setCurrentView(currentView)); }, }; diff --git a/components/myportal/youraccount.js b/components/myportal/youraccount.js index 439d5734..126a7d17 100644 --- a/components/myportal/youraccount.js +++ b/components/myportal/youraccount.js @@ -7,44 +7,42 @@ export default function YourAccount() { const router = useRouter(); const { locale } = router; - return ( - <> -
    -
    -

    - {t("myportal:yourdetails-card-title")} -

    -

    - {t("myportal:yourdetails-card-paragraph-one")} -

    + return <> +
    +
    +

    + {t("myportal:yourdetails-card-title")} +

    +

    + {t("myportal:yourdetails-card-paragraph-one")} +

    - +
    + + + {t("myportal:yourdetails-card-link")} + +
    - - {/*
    -

    - {t("myportal:changepassword-card-title")} -

    -

    - {" "} - {t("myportal:changepassword-card-paragraph-one")} -

    - - -
    */}
    - - ); + + {/*
    +

    + {t("myportal:changepassword-card-title")} +

    +

    + {" "} + {t("myportal:changepassword-card-paragraph-one")} +

    + + +
    */} +
    + ; } diff --git a/components/newappeal/aboutyou.js b/components/newappeal/aboutyou.js index 4af5e196..639f1f2d 100644 --- a/components/newappeal/aboutyou.js +++ b/components/newappeal/aboutyou.js @@ -731,7 +731,7 @@ let AboutYou = (props) => { label={t( "newappeal:about-you-agent-language-preferences-label" )} - options="[846040000|newappeal:about-you-agent-language-preferences-value-english,846040001|newappeal:about-you-agent-language-preferences-value-welsh]" + options="[846040001|newappeal:about-you-agent-language-preferences-value-welsh,846040000|newappeal:about-you-agent-language-preferences-value-english]" id={"pinswg_languagepreference"} className="govuk-radios__input" validate={[required]} diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js index 56b690d9..e4a88aa0 100644 --- a/components/newappeal/buildchecksection.js +++ b/components/newappeal/buildchecksection.js @@ -11,6 +11,12 @@ import { setFormComplete, } from "../../store/appealType/action"; +import { + getFormCollectionByID, + getThumbnailIconByExtension, + bytesToSize, +} from "../utils"; + let BuildCheckSection = (props) => { useEffect(() => { setFormComplete(); @@ -64,54 +70,6 @@ let BuildCheckSection = (props) => { alert(1); }; - function bytesToSize(bytes) { - var sizes = ["Bytes", "KB", "MB", "GB", "TB"]; - if (bytes == 0) return "0 Byte"; - var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); - return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i]; - } - - const getThumbnailIconByExtension = (blobName) => { - let fileType = blobName.slice(blobName.lastIndexOf(".") + 1); - - switch (fileType) { - case "html": - return "/assets/images/documenttypes/html.png"; - break; - case "txt": - return "/assets/images/documenttypes/txt.png"; - break; - case "doc": - return "/assets/images/documenttypes/doc.png"; - break; - case "pdf": - return "/assets/images/documenttypes/pdf.png"; - break; - case "docx": - return "/assets/images/documenttypes/docx.png"; - break; - case "csv": - return "/assets/images/documenttypes/csv.png"; - break; - case "xlsx": - return "/assets/images/documenttypes/xlsx.png"; - break; - - case "zip": - return "/assets/images/documenttypes/zip.png"; - break; - case "jpeg": - case "jpg": - return "/assets/images/documenttypes/jpg.png"; - case "png": - return "/assets/images/documenttypes/png.png"; - break; - default: - return "/assets/images/documenttypes/txt.png"; - break; - } - }; - return (
    @@ -140,9 +98,9 @@ let BuildCheckSection = (props) => {
    - {props.props.appealType.fileList.files.length > + {props.props.appealType.fileList.value.length > 0 - ? props.props.appealType.fileList.files.map( + ? props.props.appealType.fileList.value.map( (blob, i) => (
    { > {blob.name.slice( { /> - {blob.name.slice( - blob.name.indexOf( + {blob[i].name.slice( + blob[i].name.indexOf( "_" ) + 1 )} ( {bytesToSize( - blob.contentLength + blob[i].contentLength )} ) diff --git a/components/newappeal/buildsection.js b/components/newappeal/buildsection.js index eed58f38..05302282 100644 --- a/components/newappeal/buildsection.js +++ b/components/newappeal/buildsection.js @@ -79,7 +79,7 @@ let BuildSection = (props) => { ); const isProgressComplete = (progObj) => { - const progressCount = 0; + let progressCount = 0; for (let key in progObj) { progObj[key].allFieldsComplete === true && progressCount++; @@ -175,13 +175,14 @@ let BuildSection = (props) => { const reference = "PEDW-PARTIAL"; const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75"; + const templateIdCY = "f3c4a56b-bfb8-4d39-97dd-888df3062b0a"; const emailAddress = props.props.accountDetails.loggedinUserEmail; const personalisation = { "caseReference": props.appealType.caseReference.ticketnumber, "emailAddress": props.props.accountDetails.loggedinUserEmail, "returnLink": props.props.url + - "/myportal/" + + (router.locale != "en" ? "/cy/fymhorth/" : "/myportal/") + appTypeCollection.UrlName + "?lpa=" + props.appealType.appealLPA + @@ -195,12 +196,17 @@ let BuildSection = (props) => { }; sendSavedEmail == true && - sendEmail(templateId, emailAddress, personalisation, reference); + sendEmail( + router.locale != "en" ? templateIdCY : templateId, + emailAddress, + personalisation, + reference + ); useSaveStatus && router.replace( router.locale != "en" - ? router.locale + "/myportal" + ? "/" + router.locale + "/myportal" : "/myportal" ); }; diff --git a/components/newappeal/complete.js b/components/newappeal/complete.js index 7d915d0a..a559c675 100644 --- a/components/newappeal/complete.js +++ b/components/newappeal/complete.js @@ -1,13 +1,15 @@ -import jsonpath from "jsonpath"; import useTranslation from "next-translate/useTranslation"; import Link from "next/link"; import { useRouter } from "next/router"; import { useEffect } from "react"; import { connect } from "react-redux"; import { formValueSelector } from "redux-form"; -import xpath from "xpath"; -import { updateCase, patchCase, sendEmail } from "../../actions"; -import data from "../../data/collections.json"; +import { + patchCase, + sendCaseCompleteMessage, + sendEmail, + updateCase, +} from "../../actions"; import { setCurrentSection } from "../../store/appealType/action"; import { getFormCollectionByID } from "../utils"; @@ -60,6 +62,11 @@ let CompleteAppeal = (props) => { }; sendEmail(templateId, emailAddress, personalisation, reference); + sendCaseCompleteMessage( + props.appealType.caseReference.ticketnumber, + props.props.accountDetails.loggedinUserEmail + ); + console.log("patching////////"); patchCase(incidentId); }, [ @@ -131,17 +138,10 @@ let CompleteAppeal = (props) => {

    - - Back to My Portal + + Back to My Portal

    - -

    - - What did you think of this service? - - (takes 30 seconds) -

    ); diff --git a/components/nosession.js b/components/nosession.js new file mode 100644 index 00000000..5f717195 --- /dev/null +++ b/components/nosession.js @@ -0,0 +1,55 @@ +import Head from "next/head"; +import Header from "../components/header"; +import Banner from "../components/banner"; +import CookieBanner from "../components/cookieBanner"; +import Breadcrumbs from "../components/breadcrumbs"; +import Footer from "../components/footer"; +import useTranslation from "next-translate/useTranslation"; + +const NoSessionWarning = (props) => { + let { footerLinks, loading } = props; + + let { t, lang } = useTranslation(); + + return ( +
    + + + {t("search:page-title")} - {t("common:service-name")} + + +
    + +
    + +
    +
    +
    +
    +
    +
    +

    + { + (loading = !true + ? "Loading" + : "You are not logged in") + }{" "} +

    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + ); +}; + +export default NoSessionWarning; diff --git a/components/pdftemplates/appealRow_pdf.js b/components/pdftemplates/appealRow_pdf.js new file mode 100644 index 00000000..80b3019b --- /dev/null +++ b/components/pdftemplates/appealRow_pdf.js @@ -0,0 +1,348 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; +import xpath from "xpath"; +import jsonpath from "jsonpath"; +import { useSelector, shallowEqual, connect } from "react-redux"; +import fieldLookup from "../../data/crmfieldlookuptranslations.json"; +import { + getFormCollectionByID, + getPickListLabel, + getRadioLabel, +} from "../../components/utils"; + +import ReactPDF, { + Document, + Page, + Text, + View, + Image, + StyleSheet, + PDFViewer, + Font, +} from "@react-pdf/renderer"; +import _ from "lodash"; + +import { DOMParser, XMLSerializer } from "@xmldom/xmldom"; + +export const AppealRow_pdf = (props) => { + let { t } = useTranslation(); + + // const router = useRouter(); + // console.log(router); + // const { locale } = router; + + const { + formXML, + whichSection, + sectionCount, + onSubmit, + updateCurrentSection, + mandatoryFieldsData, + } = props; + + 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 parser = new DOMParser(); + var doc = parser.parseFromString(formXML, "text/xml"); + + var rowXML = xpath.select( + "/form/tabs/tab[" + + whichSection + + "]/columns//sections/section/rows/row", + doc + ); + + //console.log(rowXML); + + function formatDate(dateObj) { + var m = new Date(dateObj); + var dateString; + dateObj != null + ? (dateString = + ("0" + m.getDate()).slice(-2) + + "/" + + ("0" + (m.getMonth() + 1)).slice(-2) + + "/" + + m.getFullYear()) + : (dateString = ""); + + return dateString; + } + + const FieldsTranslations = (label) => { + // const router = useRouter(); + // const { locale } = router; + const { appealtypes } = router.query; + + let formObj = jsonpath.query(fieldLookup, "$['" + appealtypes + "']"); + + // let labelTrans = + // router.locale == "cy" + // ? jsonpath.query( + // formObj, + // "$..[?(@.value=='" + label + "')].value_cy" + // ) + // : label; + + let labelTrans = label; + return labelTrans; + }; + + return ( + <> + {Object.keys(rowXML).map((key, index) => { + var newRowXML = new XMLSerializer().serializeToString( + rowXML[key] + ); + //console.log(newRowXML); + var doc = parser.parseFromString(newRowXML, "text/xml"); + + var rows = xpath.select("//label/@description", doc); + var fieldtype = xpath.select("//@classid", doc); + var datafieldname = xpath.select("//@datafieldname", doc); + + return ( + <> + {(() => { + switch (fieldtype[0].value) { + case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}": + return ( + + + {/* {FieldsTranslations(rows[0].value)} */} + {rows[0].value} + + + + {formatDate( + props.props[ + datafieldname[0].value + ] + )}{" "} + + + ); + break; + case "{E0DECE4B-6FC8-4a8f-A065-082708572369}": + return ( + + + + {rows[0].value} + + + + + { + props.props[ + datafieldname[0] + .value + ] + } + + + + ); + break; + case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}": + return ( + + + + {rows[0].value} + + + + + { + props.props[ + datafieldname[0] + .value + ] + } + + + + ); + break; + + default: + return ( + + + {/* {FieldsTranslations(rows[0].value)} */} + {rows[0].value} + + + + { + props.props[ + datafieldname[0].value + ] + } + + + ); + break; + } + })()} + + {/* + {fieldtype[0].value == + "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}" + ? formatDate( + props.props.values[datafieldname[0].value] + ) + : fieldtype[0].value == + "{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}" + ? getPickListLabel( + props.props.formData.pickListData, + datafieldname[0].value, + props.props.values[datafieldname[0].value] + ) + : fieldtype[0].value == + "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" + ? getRadioLabel( + props.props.formData.pickListData, + datafieldname[0].value, + props.props.values[datafieldname[0].value] + ) + : fieldtype[0].value == + "{16D63FD6-119B-4353-BDCA-18358721C3FE}" + ? "ssss" + : props.props.values[datafieldname[0].value]} + */} + + ); + })} + + ); +}; diff --git a/components/pdftemplates/enforcement_pdf.js b/components/pdftemplates/enforcement_pdf.js new file mode 100644 index 00000000..ed49d754 --- /dev/null +++ b/components/pdftemplates/enforcement_pdf.js @@ -0,0 +1,1599 @@ +import ReactPDF, { + Document, + Page, + Text, + View, + Image, + StyleSheet, + PDFViewer, + Font, +} from "@react-pdf/renderer"; +import Html from "react-pdf-html"; +import { getFormCollectionByID } from "../../components/utils"; +import useTranslation from "next-translate/useTranslation"; + +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 EnforcementQuestionnaire_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; + let appealTypeValue = getFormCollectionByID(values.appealType); + + console.log("sdffhjdhjdjdgkj: ", values.procedureType); + return ( + + + + + + + Local Planning Authority Questionnaire + + + + For Planning Enforcement Appeals + + + + PEDW Logo + + + + + 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. + + {t( + "myrepresentations:s78-section-question-1" + )} + : + + + {values.caseRef} + + + + 2. + + {t( + "myrepresentations:s78-section-question-2" + )} + : + + + {values.lpaRef} + + + + 3. + + Site address/grid ref: + + + {values.siteAddress} + + + + + + + + {t("myrepresentations:s78-section-heading-one")} + + + + + + + 4. + + + Which procedure do you consider the + appeal should follow? + + + {values.procedureType} + + + {values.procedureType != + "Written representations" && ( + + + {values.procedureTypeEvidence} + + + )} + + + 5. + + Will the Inspector need to enter the appeal + site/property? + + + {values.enterToView} + + + + + + + 6. + + + Do you consider that the Inspector needs + to enter neighbouring private + land/property to view the site? + + + {values.enterNeighbouringLandToViewSite} + + + + {values.enterNeighbouringLandToViewSite == + "Yes" && ( + + + { + values.enterNeighbouringLandToViewSiteEvidence + } + + + )} + + + + + 7. + + + 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 + } + + + )} + + + + + 8. + + + 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 + } + + + )} + + + + + 9. + + + + LPA contact for site visit, hearing or + inquiry arrangements: + + + + + {values.LPAcontactDetails} + + + + + + + + + + Deemed Application Fee{" "} + + + + + + + 10. + + + Has the local planning authority + received the correct fee payable in + relation to this appeal for the deemed + planning application/ground (a) to be + considered? + + + {values.feePaid} + + + + + + + 11. + + + Is the appeal fee exempt? + + + {values.feeExempt} + + + {values.feeExempt == "Yes" && ( + + + {values.feeExemptEvidence} + + + )} + + + + + + + + Supporting documents + + + + + 12. + + Have any planning permissions or lawful + development certificates been granted + previously in respect of the development or + on the site? + + + {values.previousGrantedCerts} + + + {values.previousGrantedCerts == "Yes" && ( + + + {values.previousGrantedCertsEvidence} + + + )} + + 13. + + Has a Stop Notice been served in addition to + the Enforcement Notice? + + + {values.stopNoticeServed} + + + {values.stopNoticeServed == "Yes" && ( + + + {values.stopNoticeServedEvidence} + + + )} + + 14. + + Are there any related cases (e.g. appeals + under s78 of the Town and Country Planning + Act 1990) which are currently or have + previously been before the Welsh Ministers? + + + {values.relatedCases} + + + {values.relatedCases == "Yes" && ( + + + {values.relatedCasesEvidence} + + + )} + + 15. + + Has there been any previous enforcement + action on the site? + + + {values.previousEnforcement} + + + {values.previousEnforcement == "Yes" && ( + + + {values.previousEnforcementEvidence} + + + )} + + 16. + + Is the site subject to an Article 4 + Direction? + + + {values.subjectArticle4} + + + {values.subjectArticle4 == "Yes" && ( + + + {values.subjectArticle4Evidence} + + + )} + + 17. + + Have permitted development rights been + restricted by any previous planning + condition? + + + {values.previousPDRRestriction} + + + {values.previousPDRRestriction == "Yes" && ( + + + {values.previousPDRRestrictionEvidence} + + + )} + + + + + + + Supporting documents + + + + + 18. + + LPA’s adopted local development plan and + Proposals Map + + + + {values.LPAldpAndMap} + + + + + 19. + + Adopted local guidance relevant to the + proposal: + + + + {values.LPAlocalGuidance} + + + + + 20. + + If applicable, do you intend to submit a + full statement at the 4- week stage? + + + {values.LPAintentionToSubmitFullStatement} + + + + + + + + Statutory considerations + + + + + 21. + + Is all or part of the site within an Area of + Outstanding Natural Beauty? + + + {values.AONB} + + + + + + 22. + + + Does the site include any public rights + of way? + + + {values.ROW} + + + {values.ROW == "Yes" && ( + + + {values.ROWEvidence} + + + )} + + + + + 23. + + + Is all or part of the site within a + Conservation Area? + + + {values.conservationArea}{" "} + + + {values.conservationArea == "Yes" && ( + + + {values.conservationAreaEvidence} + + + )} + + + + + 24. + + + Does the development include works to, + or affect the setting of, a listed + building, Scheduled Monument or other + designated historic asset? + + + {values.affectListedBuilding} + + + {values.affectListedBuilding == "Yes" && ( + + + { + values.affectListedBuildingEvidence + } + + + )} + + + + + 25. + + + Is any part of the site subject to a + Tree Preservation Order? + + + {values.TPO} + + + {values.TPO == "Yes" && ( + + + {values.TPOEvidence} + + + )} + + + + + 26. + + + 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 + } + + + )} + + + + + 27. + + + Are any protected species likely to be + affected by the proposal? + + + {values.protectedSpecies} + + + {values.protectedSpecies == "Yes" && ( + + + {values.protectedSpeciesEvidence} + + + )} + + + 28. + + Does the case involve persons claiming + Gypsy/Traveller status, whether or not this + is accepted by the LPA? + + + {values.gypsyTravellerInvolvment} + + + + + + 29. + + + Is flooding an issue? + + + {values.floodingIssue} + + + {values.floodingIssue == "Yes" && ( + + + {values.floodingIssueEvidence} + + + )} + + + + + 30. + + + 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 + + + + + 31. + + If there is an appeal on ground (a), review + the following standard conditions and advise + whether they would be necessary if + permission is granted: + + + + + + + a) + + + 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 + } + + + )} + + + b) + + No development shall take place until a + scheme for biodiversity enhancement has been + submitted to and agreed in writing by the + local planning authority. Development shall + be carried out in accordance with the + approved details. Reason: In the interests + of maintaining and enhancing biodiversity, + in accordance with Future Wales Policy 9. + + + {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: + + + + + + + 33. + + + A true copy of the enforcement notice? + + + {values.copyOfEnforcementNotice} + + + + + {values.copyOfEnforcementNoticeEvidence} + + + + + + + + 34. + + + The enforcement notice plan. + + + {values.enforcementNoticePlan} + + + + + + {values.enforcementNoticePlan} + + + + + + + + 35. + + + A list of those served with the + enforcement notice. + + + {values.listOfNotifiedOfEnforcement} + + + + + { + values.listOfNotifiedOfEnforcementEvidence + } + + + + + + + 36. + + + 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 + } + + + + + + + + 37. + + + The LPA’s Environmental Impact + Assessment Screening Opinion and + ‘Regulation 45 Notice’*, if applicable? + + + {values.lpaEIAOS} + + + {values.lpaEIAOS == "Yes" && ( + + + {values.lpaEIAOSEvidence} + + + )} + + + + + 38. + + + 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 + } + + + )} + + + + + + 39. + + + 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 + } + + + )} + + + + + + 40. + + + 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} + + + + + + + Supporting documents + + + + + + + List of attached files + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + * Regulation 45 of the Town and Country Planning + (Environmental Impact Assessment) (Wales) + Regulations 2017 (as amended). + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/finalComments_pdf.js b/components/pdftemplates/finalComments_pdf.js new file mode 100644 index 00000000..a0a5e3ae --- /dev/null +++ b/components/pdftemplates/finalComments_pdf.js @@ -0,0 +1,423 @@ +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 { getFormCollectionByID } from "../../components/utils"; + +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", + }, +}); + +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; + + let datestr = values.repfile_name.split("-"); + let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; + let appealTypeValue = getFormCollectionByID(values.appealType); + + return ( + + + + + + + Final Comments + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + PEDW Logo + + + + + Case details + + + + 1a. + + Case reference : + + + {values.caseRef} + + + + + + Representation capacity: + + + {values.representationCapacity} + + + + + + Representation capacity{"\n"} details: + + + + { + values.conditional_representationCapacity_Comments + } + + + + + + 3. + + Site address/grid ref: + + + {values.siteAddress} + + + + 4. + + Case Type: + + + {appealTypeValue.value} + + + + + + + Comments + + + + + + 5. + + + Final Comments + + + + + {values.representationComments} + + + + + + + + + Supporting documents + + + + + 11. + + List of attached files + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + Declaration + + + + + + Signed: + + + {values.firstname} {values.lastname} + + + + + Date: + + + {signedDate} + + + + + + On behalf of: + + + {values.representationCapacity} + + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js new file mode 100644 index 00000000..29504b5c --- /dev/null +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -0,0 +1,1484 @@ +import ReactPDF, { + Document, + Page, + Text, + View, + Image, + StyleSheet, + PDFViewer, + Font, +} from "@react-pdf/renderer"; +import Html from "react-pdf-html"; +import { getFormCollectionByID } from "../../components/utils"; +import getT from "next-translate/getT"; +import useTranslation from "next-translate/useTranslation"; + +import transLookupCY from "../../locales/cy/myrepresentations.json"; +import transLookupEN from "../../locales/en/myrepresentations.json"; +import jsonpath from "jsonpath"; + +const getTrans = (locale, key) => { + let jsonQuery = `$.${key}`; + + let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; + + console.log(locale, jsonObj[key]); + return jsonObj[key]; +}; + +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; + let appealTypeValue = getFormCollectionByID(values.appealType); + + console.log("sdffhjdhjdjdgkj: ", values.procedureType); + return ( + + + + + + + {getTrans( + docProps.locale, + "lpa-questionnaire-heading" + )} + + + + {getTrans( + docProps.locale, + "s78-heading-para-one" + )} + + + + PEDW Logo + + + + + {getTrans(docProps.locale, "s78-heading-para-two")} + + + + + + {getTrans( + docProps.locale, + "section-heading-zero" + )} + + + + + 1. + + {getTrans( + docProps.locale, + "s78-section-question-1" + )} + + + {values.caseRef} + + + + 2. + + {getTrans( + docProps.locale, + "s78-section-question-2" + )} + + + {values.lpaRef} + + + + 3. + + {getTrans( + docProps.locale, + "s78-section-question-3" + )} + + + {values.siteAddress} + + + + 4. + + {getTrans( + docProps.locale, + "s78-section-question-4" + )} + + + {appealTypeValue.value} + + + + + + + + {getTrans( + docProps.locale, + "s78-section-heading-one" + )} + + + + + + + 5. + + + {getTrans( + docProps.locale, + "s78-section-question-5" + )} + + + {values.procedureType} + + + {values.procedureType != + "Written representations" && ( + + + {values.procedureTypeEvidence} + + + )} + + + 6. + + {getTrans( + docProps.locale, + "s78-section-question-6" + )} + + + {values.enterToView} + + + + + + + 7. + + + {getTrans( + docProps.locale, + "s78-section-question-7" + )} + + + {values.enterNeighbouringLandToViewSite} + + + + {values.enterNeighbouringLandToViewSite == + "Yes" && ( + + + { + values.enterNeighbouringLandToViewSiteEvidence + } + + + )} + + + + + 8. + + + {getTrans( + docProps.locale, + "s78-section-question-8" + )} + + + { + values.enterNeighbouringLandAccessRequired + } + + + {values.enterNeighbouringLandAccessRequired != + "Yes" && ( + + + { + values.enterNeighbouringLandAccessRequiredEvidence + } + + + )} + + + + + 9. + + + {getTrans( + docProps.locale, + "s78-section-question-9" + )} + + + {values.healthAndSafetyIssues} + + + {values.healthAndSafetyIssues == "Yes" && ( + + + { + values.healthAndSafetyIssuesEvidence + } + + + )} + + + + + 10. + + + + {getTrans( + docProps.locale, + "s78-section-question-10" + )} + + + + + {values.LPAcontactDetails} + + + + + + + + + {getTrans( + docProps.locale, + "s78-section-heading-two" + )} + + + + + 11. + + {getTrans( + docProps.locale, + "s78-section-question-11" + )} + + + + {values.LPAcaseFileAndReps} + + + + + 12. + + {getTrans( + docProps.locale, + "s78-section-question-12" + )} + + + + {values.LPAldpAndMap} + + + + + 13. + + {getTrans( + docProps.locale, + "s78-section-question-13" + )} + + + + {values.LPAlocalGuidance} + + + + + 14. + + {getTrans( + docProps.locale, + "s78-section-question-14" + )} + + + {values.LPAintentionToSubmitFullStatement} + + + + + + + + {getTrans( + docProps.locale, + "s78-section-heading-three" + )} + + + + + 15. + + {getTrans( + docProps.locale, + "s78-section-question-15" + )} + + + {values.AONB} + + + + + + 16. + + + {getTrans( + docProps.locale, + "s78-section-question-16" + )} + + + {values.ROW} + + + {values.ROW == "Yes" && ( + + + {values.ROWEvidence} + + + )} + + + + + 17. + + + {getTrans( + docProps.locale, + "s78-section-question-17" + )} + + + {values.conservationArea}{" "} + + + {values.conservationArea == "Yes" && ( + + + {values.conservationAreaEvidence} + + + )} + + + + + 18. + + + {getTrans( + docProps.locale, + "s78-section-question-18" + )} + + + {values.affectListedBuilding} + + + {values.affectListedBuilding == "Yes" && ( + + + { + values.affectListedBuildingEvidence + } + + + )} + + + + + 19. + + + {getTrans( + docProps.locale, + "s78-section-question-19" + )} + + + {values.TPO} + + + {values.TPO == "Yes" && ( + + + {values.TPOEvidence} + + + )} + + + + + 20. + + + {getTrans( + docProps.locale, + "s78-section-question-20" + )} + + + {values.natureConservationSite} + + + {values.natureConservationSite == "Yes" && ( + + + { + values.natureConservationSiteEvidence + } + + + )} + + + + + 21. + + + {getTrans( + docProps.locale, + "s78-section-question-21" + )} + + + {values.protectedSpecies} + + + {values.protectedSpecies == "Yes" && ( + + + {values.protectedSpeciesEvidence} + + + )} + + + 22. + + {getTrans( + docProps.locale, + "s78-section-question-22" + )} + + + {values.gypsyTravellerInvolvment} + + + + + + 23. + + + {getTrans( + docProps.locale, + "s78-section-question-23" + )} + + + {values.governmentDepartmentComments} + + + {values.governmentDepartmentComments == + "Yes" && ( + + + { + values.governmentDepartmentCommentsEvidence + } + + + )} + + + + + + + {getTrans( + docProps.locale, + "s78-section-heading-four" + )} + + + + + 24. + + {getTrans( + docProps.locale, + "s78-section-question-24" + )} + + + + a) + + {getTrans( + docProps.locale, + "s78-section-question-24a" + )} + + + { + values.developmentNotBeginLaterThanFiveYears + } + + + + + + b) + + + {getTrans( + docProps.locale, + "s78-section-question-24b" + )} + + + { + values.developmentCarriedOutInAccordance + } + + + {values.developmentCarriedOutInAccordance == + "Yes" && ( + + + { + values.developmentCarriedOutInAccordanceEvidence + } + + + )} + + + c) + + {getTrans( + docProps.locale, + "s78-section-question-24c" + )} + + + {values.developmentNotTakePlaceBiodiversity} + + + + d) + + {getTrans( + docProps.locale, + "s78-section-question-24d" + )} + + + {values.developmentNotTakePlaceBroadband} + + + + + + 25. + + + {getTrans( + docProps.locale, + "s78-section-question-25" + )} + + + {values.developmentAnyOtherConditions} + + + {values.developmentAnyOtherConditions == + "Yes" && ( + + + { + values.developmentAnyOtherConditionsEvidence + } + + + )} + + + + + + + {getTrans( + docProps.locale, + "s78-section-heading-five" + )} + + + + + + + 26. + + + {getTrans( + docProps.locale, + "s78-section-question-26" + )} + + + {values.copyOfApplicantsCertificate} + + + + + { + values.copyOfApplicantsCertificateEvidence + } + + + + + + + + 27. + + + {getTrans( + docProps.locale, + "s78-section-question-27" + )} + + + {values.advertismentGiven} + + + + + + {values.advertismentGivenEvidence} + + + + + + + + 28. + + + {getTrans( + docProps.locale, + "s78-section-question-28" + )} + + + { + values.copyOfLetterOfAppealNotification + } + + + + + { + values.copyOfLetterOfAppealNotificationEvidence + } + + + + + + + + 29. + + + {getTrans( + docProps.locale, + "s78-section-question-29" + )} + + + {values.lpaEIAOS} + + + {values.lpaEIAOS == "Yes" && ( + + + {values.lpaEIAOSEvidence} + + + )} + + + + + + 30. + + + {getTrans( + docProps.locale, + "s78-section-question-30" + )} + + + { + values.advertismentConsentDiscontinuanceNotice + } + + + {values.advertismentConsentDiscontinuanceNotice == + "Yes" && ( + + + { + values.advertismentConsentDiscontinuanceNoticeEvidence + } + + + )} + + + + + + 31. + + + {getTrans( + docProps.locale, + "s78-section-question-31" + )} + + + {values.detailsOfOtherAppeals} + + + {values.detailsOfOtherAppeals == "Yes" && ( + + + { + values.detailsOfOtherAppealsEvidence + } + + + )} + + + + + + 32. + + + {getTrans( + docProps.locale, + "s78-section-question-32" + )} + + + {values.detailsOfPreviousAppeals} + + + {values.detailsOfPreviousAppeals == "Yes" && ( + + + { + values.detailsOfPreviousAppealsEvidence + } + + + )} + + + + + + 33. + + + {getTrans( + docProps.locale, + "s78-section-question-33" + )} + + + {values.otherRelevantInformation} + + + {values.otherRelevantInformation == "Yes" && ( + + + { + values.otherRelevantInformationEvidence + } + + + )} + + + + + + + {" "} + {getTrans( + docProps.locale, + "s78-section-heading-seven" + )} + + + + + + + {getTrans( + docProps.locale, + "s78-section-question-signed" + )} + + + {values.caseOfficer} + + + + + {getTrans( + docProps.locale, + "s78-section-question-date" + )} + + + {formatDates(values.signedDate)} + + + + + + {getTrans( + docProps.locale, + "s78-section-question-onbehalf" + )} + + + {values.onBehalfOfLPA} + + + + + + + {getTrans( + docProps.locale, + "lpa-list-supporting-documents-heading" + )} + + + + + + + {getTrans( + docProps.locale, + "lpa-list-supporting-documents-list" + )} + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + {getTrans(docProps.locale, "s78-footnote-one")} + + + {getTrans(docProps.locale, "s78-footnote-two")}{" "} + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/other_pdf.js b/components/pdftemplates/other_pdf.js new file mode 100644 index 00000000..bd7d04cd --- /dev/null +++ b/components/pdftemplates/other_pdf.js @@ -0,0 +1,403 @@ +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 { getFormCollectionByID } from "../../components/utils"; + +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", + }, +}); + +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; + + let datestr = values.pinswg_name.split("-"); + let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; + const isLPA = values.representationCapacity == "lpa" ? true : false; + + return ( + + + + + + + Other + + + + For Planning Appeal, Planning Conditions, + Listed Building and Conservation Area + Appeal, Lawful Development Appeal, Planning + Obligations, Community Infrastructure Levy, + Enforcement Notice appeal, Enforcement + Listed Building Appeal, Maintenance of land, + Called in Application applications/appeals + + + + PEDW Logo + + + + + Case details + + + + 1. + + {t( + "myrepresentations:s78-section-question-1" + )} + : + + + {values.caseRef} + + + + + 3. + + Site address/grid ref: + + + {values.siteAddress} + + + + 4. + + Case Type: + + + { + getFormCollectionByID(values.appealType) + .value + } + + + + + + + Comments + + + + + + 5. + + + Other Comments + + + + + {values.representationComments} + + + + + + + + + Supporting documents + + + + + 11. + + List of attached files + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + Declaration + + + + + + Signed: + + + {values.firstname} {values.lastname} + + + + + Date: + + + {signedDate} + + + + {isLPA && ( + + + On behalf of: + + + {values.representationCapacity} + + + )} + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/planningappeals78_pdf.js b/components/pdftemplates/planningappeals78_pdf.js new file mode 100644 index 00000000..72667bd3 --- /dev/null +++ b/components/pdftemplates/planningappeals78_pdf.js @@ -0,0 +1,367 @@ +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 { getFormCollectionByID } from "../utils"; +import fs from "fs"; +import xpath from "xpath"; +import renderers, { renderBlock } from "react-pdf-html/dist/renderers"; +import _ from "lodash"; +import { DOMParser, XMLSerializer } from "@xmldom/xmldom"; +import { AppealRow_pdf } from "./appealRow_pdf"; + +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 planningappeals78_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; + + let datestr = values.pinswg_name.split("-"); + let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; + let appealTypeValue = getFormCollectionByID(values.pinswg_appealcasetype); + + var path = require("path"); + const configDirectory = path.resolve(process.cwd(), "data/formsxml"); + var xmlStr = fs.readFileSync( + path.join(configDirectory, "planningappeals78" + ".xml"), + "utf8" + ); + + xmlStr = xmlStr.replace(/\t/g, ""); + xmlStr = xmlStr.replace(/\n/g, ""); + xmlStr = xmlStr.replace(/> <"/g, "><"); + xmlStr = xmlStr.toString(); + + console.log(xmlStr); + + const parser = new DOMParser(); + var doc = parser.parseFromString(xmlStr, "text/xml"); + var titles = xpath.select( + "//form/tabs/tab[*]/labels/label/@description", + doc + ); + var rowXML = xpath.select( + "/form/tabs/tab[*]/columns//sections/section/rows/row", + doc + ); + + var titleList = xpath.select( + "//form/tabs/tab[*]/labels/label/@description", + doc + ); + + //console.log(titles); + + return ( + + + + + + + Planning Appeals s78 + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + PEDW Logo + + + + + Case details + + + + 1. + + {t( + "myrepresentations:s78-section-question-1" + )} + : + + + {values.caseRef} + + + + + 3. + + Site address/grid ref: + + + {values.siteAddress} + + + + 4. + + Case Type: + + + {appealTypeValue.value} + + + + + + {Object.keys(titles).map((key) => ( + + + + {parseInt(key) + 1} {titles[key].value} + + + + + + + + + + + ))} + + + + + Supporting documents + + + + + 11. + + List of attached files + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/statement_pdf.js b/components/pdftemplates/statement_pdf.js new file mode 100644 index 00000000..ba7d000a --- /dev/null +++ b/components/pdftemplates/statement_pdf.js @@ -0,0 +1,426 @@ +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 { getFormCollectionByID } from "../../components/utils"; + +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", + }, +}); + +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; + + let datestr = values.pinswg_name.split("-"); + let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; + let appealTypeValue = getFormCollectionByID(values.appealType); + + return ( + + + + + + + Statement + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + PEDW Logo + + + + + Case details + + + + 1. + + {t( + "myrepresentations:s78-section-question-1" + )} + : + + + {values.caseRef} + + + + 1a. + + Representation capacity: + + + {values.representationCapacity} + + + + 1c. + + Representation capacity details: + + + + { + values.conditional_representationCapacity_Comments + } + + + + + + 3. + + Site address/grid ref: + + + {values.siteAddress} + + + + 4. + + Case Type: + + + {appealTypeValue.value} + + + + + + + Comments + + + + + + 5. + + + Statement + + + + + {values.representationComments} + + + + + + + + + Supporting documents + + + + + 11. + + List of attached files + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + Declaration + + + + + + Signed: + + + {values.firstname} {values.lastname} + + + + + Date: + + + {signedDate} + + + + + + On behalf of: + + + {values.representationCapacity} + + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/pdftemplates/writtenStatement_pdf.js b/components/pdftemplates/writtenStatement_pdf.js new file mode 100644 index 00000000..382eec0b --- /dev/null +++ b/components/pdftemplates/writtenStatement_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 { getFormCollectionByID } from "../../components/utils"; + +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", + }, +}); + +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; + + let datestr = values.pinswg_name.split("-"); + let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; + let appealTypeValue = getFormCollectionByID(values.appealType); + + return ( + + + + + + + Written Statement + + + + For Planning, Conservation area, Listed + Building and Advertisement + applications/appeals + + + + PEDW Logo + + + + + Case details + + + + 1. + + {t( + "myrepresentations:s78-section-question-1" + )} + : + + + {values.caseRef} + + + + + 3. + + Site address/grid ref: + + + {values.siteAddress} + + + + 4. + + Case Type: + + + {appealTypeValue.value} + + + + + + + Comments + + + + + + 5. + + + Statement + + + + + {values.representationComments} + + + + + + + + + Supporting documents + + + + + 11. + + List of attached files + + + {values.hasOwnProperty("filesList") && + values.filesList.map(function (p) { + return ( + + + {p.name} - {p.size} + + + ); + })} + + + + + + + Declaration + + + + + + Signed: + + + {values.firstname} {values.lastname} + + + + + Date: + + + {signedDate} + + + + + + On behalf of: + + + {values.representationCapacity} + + + + + + + `${pageNumber} / ${totalPages}` + } + fixed + /> + + + + ); +}; diff --git a/components/search/advancedsearch.js b/components/search/advancedsearch.js index 286734f3..f746bc0c 100644 --- a/components/search/advancedsearch.js +++ b/components/search/advancedsearch.js @@ -6,7 +6,7 @@ import { reduxForm, formValueSelector, Field } from "redux-form"; import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; import jsonpath from "jsonpath"; import data from "../../data/collections.json"; -import LoadingOverlay from "react-loading-overlay"; + import transLookup from "../../data/lookuptranslations.json"; const required = (errorMsg) => (value) => @@ -275,98 +275,96 @@ let AdvancedSearch = (props) => { label, errormsg, }) => { - return ( - <> -
    - - {touched && error && ( - - - Error: - {" "} - {errormsg} - - )} -
    - props.onChangeSelectAppealType(e)} + > + + {_.isEmpty(optionsObj) + ? "" + : Object.keys(optionsObj).map((key, index) => { + return ( +
    + ? "" + : optionsObj[key] + .attributevalue + + "," + + optionsObj[key].value + .replace( + /(\band|[\s\-\+\(\)\,\&])/g, + "" + ) + .toLowerCase() + } + > + {_.isEmpty(optionsObj[key]) + ? "" + : _.isEmpty(optionsObj[key]) + ? "" + : _.isEmpty( + optionsObj[key].value + ) + ? "" + : router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + optionsObj[key] + .value + + '")].value_cy' + ) + : optionsObj[key].value || + t( + "case:summary-no-date-entered-label" + )} + + ); + })} +
    - - ); +
    + ; }; // const [showSpinnerState, setShowSpinnerState] = useState(false); @@ -512,7 +510,9 @@ let AdvancedSearch = (props) => { }, ]} //validate={[required]} - label={"Case Status"} + label={t( + "search:case-status-label" + )} errormsg="Local authority is required" /> {/*
    @@ -613,11 +613,6 @@ let AdvancedSearch = (props) => {
    - {/* */} ); }; diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index 71366d13..637af5f3 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -7,7 +7,7 @@ import _ from "lodash"; import transLookup from "../../data/lookuptranslations.json"; import PaginationControl from "./pagination"; import { useState, useEffect, useCallback } from "react"; -import LoadingOverlay from "react-loading-overlay"; + import { getBasicDNSSearchPaged, getBasicSearchDetailsPaged, @@ -356,31 +356,29 @@ const DNSSearchResults = (props) => { : "") + "/dnsdetails" } - > - { - setCurrentReference({ - "currentReference": - item.title, - "currentType": - "searchResultsObj", - "incidentid": - item.incidentid, - "appealType": - item.pinswg_appealcasetype, - "showMap": showMap, - }); - }} - > - - {t( - "search:searchresults-case-reference-label" - )} - : - - {item.title} - + className="govuk-link--no-underline" + onClick={() => { + setCurrentReference({ + "currentReference": + item.title, + "currentType": + "searchResultsObj", + "incidentid": + item.incidentid, + "appealType": + item.pinswg_appealcasetype, + "showMap": showMap, + }); + }}> + + + {t( + "search:searchresults-case-reference-label" + )} + : + + {item.title} +
    @@ -542,11 +540,14 @@ const DNSSearchResults = (props) => { "watchedCases" ); alert( - "You have stopped watching case " + - item.title + t( + "case:you-have-stopped-watching-label" + ) + item.title ); }} - title="Stop watching this case" + title={t( + "case:stop-watching-case-link" + )} > @@ -560,11 +561,14 @@ const DNSSearchResults = (props) => { item.pinswg_appealcasetype ); alert( - "You are watching case " + - item.title + t( + "case:you-are-watching-label" + ) + item.title ); }} - title="Watch this case" + title={t( + "case:watch-this-case-link" + )} > @@ -768,11 +772,6 @@ const DNSSearchResults = (props) => {
    )} - {/* */} ); }; diff --git a/components/search/searchresults.js b/components/search/searchresults.js index 5ccd6ce2..00fa889b 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -18,12 +18,12 @@ import { } from "../../actions"; import data from "../../data/collections.json"; import { useCallback, useState } from "react"; -import LoadingOverlay from "react-loading-overlay"; import { setSearchResults, setSearchDetails, } from "../../store/searchOutput/action"; +import { setLoggedInUserId } from "../../store/accountDetails/action"; import { setWatchedCases, setWatchedCasesDetails, @@ -76,6 +76,7 @@ const SearchResults = (props) => { const [selectedOption, setSelectedOption] = useState(10); const [orderByState, setOrderbyState] = useState("createdon"); const [fieldSortState, setfieldSortState] = useState("asc"); + const [loginToWatch, setLoginToWatch] = useState("true"); let spinnerState = () => { showSpinnerState == true @@ -95,12 +96,14 @@ const SearchResults = (props) => { createWatchedCases(updateBody) .then((data) => data) .then(() => { - getWatchedCasesProxy(cookies.pinsUser).then((data) => { - setWatchedCases(data), - getDetails(data, "myWatchedCases").then((data) => { - setWatchedCasesDetails(data); - }); - }); + getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( + (data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + } + ); }); }; @@ -119,7 +122,9 @@ const SearchResults = (props) => { deleteWatchedCases(caseID) .then((data) => data) .then(() => { - getWatchedCasesProxy(cookies.pinsUser).then((data) => { + getWatchedCasesProxy( + props.accountDetails.loggedinUserId + ).then((data) => { setWatchedCases(data), getDetails(data, "myWatchedCases").then((data) => { setWatchedCasesDetails(data); @@ -129,7 +134,7 @@ const SearchResults = (props) => { }; const getDetails = (resultsObj, detailsType) => { - //console.log(resultsObj); + console.log(resultsObj); let detailsArr = []; resultsObj = resultsObj.value; const detailsObj = resultsObj.map((searchDetail, index) => { @@ -293,32 +298,27 @@ const SearchResults = (props) => { ? "/myportal/case" : "/case" } + className="govuk-link--no-underline" + onClick={() => { + setCurrentReference({ + "currentReference": + item.title, + "currentType": + "searchResultsObj", + "incidentid": + item.incidentid, + "appealType": + item.pinswg_appealcasetype, + }); + }} > - { - setCurrentReference({ - "currentReference": - item.title, - "currentType": - "searchResultsObj", - "incidentid": - item.incidentid, - "appealType": - item.pinswg_appealcasetype, - "showreps": - props.showLoginCheck, - }); - }} - > - - {t( - "search:searchresults-case-reference-label" - )} - : - - {item.title} - + + {t( + "search:searchresults-case-reference-label" + )} + : + + {item.title}
    @@ -355,7 +355,7 @@ const SearchResults = (props) => { : ""} {/* {detailsObj.pinswg_siteaddressline1 != - null &&
    } */} + null &&
    } */} {_.has( detailsObj, @@ -507,11 +507,14 @@ const SearchResults = (props) => { "watchedCases" ); alert( - "You have stopped watching case " + - item.title + t( + "case:you-have-stopped-watching-label" + ) + item.title ); }} - title="Stop watching this case" + title={t( + "case:stop-watching-case-link" + )} > @@ -520,16 +523,20 @@ const SearchResults = (props) => { className="govuk-summary-list__actionLink watchLink" onClick={() => { selectWatchedCase( - cookies.pinsUser, + props.accountDetails + .loggedinUserId, item.incidentid, item.pinswg_appealcasetype ); alert( - "You are watching case " + - item.title + t( + "case:you-are-watching-label" + ) + item.title ); }} - title="Watch this case" + title={t( + "case:watch-this-case-link" + )} > @@ -541,9 +548,18 @@ const SearchResults = (props) => { { - signIn("email"); + // signIn("email"); + signIn(undefined, { + callbackUrl: + "/myportal/searchresults?q=" + + searchString + + "&toWatch=" + + item.incidentid + + "_" + + item.pinswg_appealcasetype, + }); // selectWatchedCase( - // cookies.pinsUser, + // props.accountDetails.loggedinUserId, // item.incidentid, // item.pinswg_appealcasetype // ); @@ -552,7 +568,9 @@ const SearchResults = (props) => { item.title ); }} - title="Watch this case" + title={t( + "case:watch-this-case-link" + )} > @@ -666,6 +684,28 @@ const SearchResults = (props) => { }; useEffect(() => { + const selectWatchedCase = (loggedInUser, incidentID, appealType) => { + let updateBody = { + "pinswg_WatchedCase@odata.bind": + "/incidents(" + incidentID + ")", + "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", + "pinswg_appealcasetype": +appealType, + }; + + createWatchedCases(updateBody) + .then((data) => data) + .then(() => { + getWatchedCasesProxy( + props.accountDetails.loggedinUserId + ).then((data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + }); + }); + }; + if (searchLoaded) { if (selectedOption) { setShowSpinnerState(true); @@ -674,12 +714,41 @@ const SearchResults = (props) => { } else { setSearchLoaded(true); } + if (loginToWatch && router.query.hasOwnProperty("toWatch")) { + console.log("am in here"); + let now = new Date(); + let expDate = new Date(now); + + expDate.setDate(now.getDate() + 1); + + setLoggedInUserId(props.accountDetails.loggedinUserId); + setCookie(null, "pinsUser", props.accountDetails.loggedinUserId, { + path: "/", + expires: expDate, + }); + selectWatchedCase( + props.accountDetails.loggedinUserId, + router.query.toWatch.split("_")[0], + router.query.toWatch.split("_")[1] + ); + getSearchPageResults(1, orderByState, fieldSortState); + setLoginToWatch(false); + } else { + console.log("or am in here"); + + setLoginToWatch(false); + } }, [ selectedOption, fieldSortState, orderByState, searchLoaded, + loginToWatch, + setWatchedCases, getSearchPageResults, + setWatchedCasesDetails, + props.accountDetails.loggedinUserId, + router.query, ]); // console.log( // "page is here ", @@ -766,11 +835,6 @@ const SearchResults = (props) => { )} - {/* */} ); }; @@ -798,4 +862,12 @@ const mapDispatchToProps = (dispatch) => { }; }; -export default connect(null, mapDispatchToProps)(SearchResults); +const mapStateToProps = (state) => { + return { + // currentView: state.currentView, + accountDetails: state.accountDetails, + // search: state.search, + // searchResultsObj: state.searchResultsObj, + }; +}; +export default connect(mapStateToProps, mapDispatchToProps)(SearchResults); diff --git a/components/search/viewall.js b/components/search/viewall.js index ec4e33f9..26fc2264 100644 --- a/components/search/viewall.js +++ b/components/search/viewall.js @@ -14,12 +14,12 @@ export default function ViewAllResults(props) {
    - - - Case Reference: - - {resultsArr[key].title} - + + + Case Reference: + + {resultsArr[key].title} +
    @@ -90,12 +90,12 @@ export default function ViewAllResults(props) { : "/case" } > - - - Case Reference: - - {item.title} - + + + Case Reference: + + {item.title} +
    diff --git a/components/searchresults.js b/components/searchresults.js index ec39b08b..50dc5df1 100644 --- a/components/searchresults.js +++ b/components/searchresults.js @@ -58,12 +58,12 @@ export default function Search(props) {
    - - - {t( - "search:searchresults-search-button-label" - )} - + + + {t( + "search:searchresults-search-button-label" + )} + {/* router.back()} diff --git a/components/seo/Page.js b/components/seo/Page.js index a3b9fb44..731f988d 100644 --- a/components/seo/Page.js +++ b/components/seo/Page.js @@ -1,5 +1,4 @@ import Head from "next/head"; -import { string } from "prop-types"; // ALl options are conditional apart from title const PageMeta = ({ @@ -96,24 +95,4 @@ const PageMeta = ({ ); }; -PageMeta.propTypes = { - title: string, - createdAt: string, - updatedAt: string, - ogImage: string, - ogUrl: string, - ogTitle: string, - ogType: string, - ogDescription: string, - canonicalURL: string, - description: string, - keywords: string, - createdAt: string, - updatedAt: string, - robots: string, - twitterDescription: string, - twitterTitle: string, - twitterImage: string, -}; - export default PageMeta; diff --git a/components/timeout/index.js b/components/timeout/index.js index afa15428..3a525c14 100644 --- a/components/timeout/index.js +++ b/components/timeout/index.js @@ -41,7 +41,10 @@ const TimeOut = (props) => { const handleLogout = () => { console.info("////////////\n" + "logout" + "\n////////////"); window.localStorage.clear(), - destroyCookie({}, "pinsUser"), + destroyCookie(null, "next-auth.csrf-token"), + destroyCookie(null, "next-auth.callback-url"), + destroyCookie(null, "pedw_locale"), + destroyCookie(null, "pinsUser"), signOut({ callbackUrl: "/logout" }); }; diff --git a/components/utils/index.js b/components/utils/index.js index b6ccd460..bc6e7818 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -66,7 +66,15 @@ export const getSearchDetails = (searchResultsObj) => { searchResultsObj = searchResultsObj.value; const detailsObj = searchResultsObj.map((searchDetail, index) => { if (searchDetail.pinswg_appealcasetype == null) { - console.log(searchDetail.title); + //console.log(searchDetail.title); + detailsArr.push( + getBasicSearchDetails( + "pinswg_dnses", + searchDetail.title, + "pinswg_dnsid", + searchDetail.incidentid + ) + ); } else { let formMeta = getFormCollectionByID( searchDetail.pinswg_appealcasetype @@ -220,8 +228,8 @@ export const getProgressObj = ( "totalFields": formObj[key].fieldsTotal, "allFieldsComplete": titleList[key].value == "Upload documents" - ? _.has(props.props.appealType.fileList, "files") && - props.props.appealType.fileList.files.length > 0 + ? _.has(props.props.appealType.fileList, "value") && + props.props.appealType.fileList.value.length > 0 : rowCount == formObj[key].fieldsTotal, }; }); @@ -230,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)) { (""); @@ -361,3 +369,69 @@ export const getTempCaseRef = () => { randomString(6).toUpperCase() ); }; + +export const getThumbnailIconByExtension = (blobName) => { + let fileType = blobName.slice(blobName.lastIndexOf(".") + 1); + + switch (fileType) { + case "html": + return "/assets/images/documenttypes/html.png"; + break; + case "txt": + return "/assets/images/documenttypes/txt.png"; + break; + case "doc": + return "/assets/images/documenttypes/doc.png"; + break; + case "pdf": + return "/assets/images/documenttypes/pdf.png"; + break; + case "docx": + return "/assets/images/documenttypes/docx.png"; + break; + case "csv": + return "/assets/images/documenttypes/csv.png"; + break; + case "xlsx": + return "/assets/images/documenttypes/xlsx.png"; + break; + + case "zip": + return "/assets/images/documenttypes/zip.png"; + break; + case "jpeg": + case "jpg": + return "/assets/images/documenttypes/jpg.png"; + case "png": + return "/assets/images/documenttypes/png.png"; + break; + default: + return "/assets/images/documenttypes/txt.png"; + break; + } +}; + +export const bytesToSize = (bytes) => { + var sizes = ["Bytes", "KB", "MB", "GB", "TB"]; + if (bytes == 0) return "0 Byte"; + var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); + return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i]; +}; + +export const formatDates = (dateObj, showTime) => { + 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(); + var hh = dateObj.getHours(); + hh = ("0" + hh).slice(-2); + var mins = dateObj.getMinutes(); + mins = ("0" + mins).slice(-2); + + const dateStr = showTime + ? hh == 0 && mins == 0 + ? "" + : hh + ":" + mins + : dd + "/" + mm + "/" + yyyy + " "; + return dateStr; +}; diff --git a/components/viewall.js b/components/viewall.js index 1452b9c7..e8798d5b 100644 --- a/components/viewall.js +++ b/components/viewall.js @@ -29,8 +29,8 @@ export default function ViewAll(props) {
    - - Back + + Back
    diff --git a/i18n.js b/i18n.js index ed1cfc49..3aff356a 100644 --- a/i18n.js +++ b/i18n.js @@ -10,13 +10,13 @@ module.exports = { ], "pages": { "*": ["common", "newappeal", "search"], - "/": ["common", "home"], + "/": ["common", "home", "case"], "/error": ["common", "home", "myportal"], "/myportal": ["myportal", "common", "home"], "/myportal/viewall": ["search", "myportal"], "/myportal/advancedsearch": ["search", "myportal"], "/myportal/advancedsearchresults": ["search", "myportal"], - "/myportal/searchresults": ["search", "myportal"], + "/myportal/searchresults": ["search", "myportal", "case"], "/myportal/case": ["case"], "/myportal/dnsapplications": ["search", "dnsCommon", "dnsApplications"], "/myportal/dnsdetails": [ @@ -27,10 +27,10 @@ module.exports = { ], "/advancedsearch": ["search", "myportal"], "/advancedsearchresults": ["search"], - "/searchresults": ["search"], + "/searchresults": ["search", "case"], "/viewall": ["search"], "/case": ["case"], - "/myportal/representation": ["case"], + "/myportal/representation": ["case", "myrepresentations", "common"], "/myportal/error": ["myportal", "common"], "/newappeal": ["newappeal"], "/newappeal/*": ["newappeal"], @@ -44,7 +44,7 @@ module.exports = { "/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"], "/help/cookies": ["common", "cookies"], "/account/register": ["common", "account"], - "/account/personaldetails": ["common", "search"], + "/account/personaldetails": ["common", "search", "account"], "/details-about-cookies": ["common", "cookies"], "/terms-and-conditions": ["common"], "/account/passwordreset": ["common", "home"], diff --git a/locales/cy/account.json b/locales/cy/account.json index bcb31768..ec0be5ad 100644 --- a/locales/cy/account.json +++ b/locales/cy/account.json @@ -37,5 +37,25 @@ "register-new-account-sub-heading-what-next": "Beth sy'n digwydd nesaf", "register-new-account-paragraph-what-next": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a metus non quam mollis egestas. Integer ac leo cursus, laoreet nulla sed, tempus tellus. Mauris condimentum erat arcu.", "register-new-account-my-portal-link": "Mewngofnodi i'm Porth", - "register-new-account-account-failed": "Rhowch gynnig arall arni gyda chyfeiriad e-bost gwahanol" + "register-new-account-account-failed": "Rhowch gynnig arall arni gyda chyfeiriad e-bost gwahanol", + "account-title": "Eich cyfrif", + "account-about-you-label": "Amdanat ti", + "account-role-label": "Rôl", + "account-preferred-language-label": "Hoff iaith", + "account-preferred-language-english": "Saesneg", + "account-preferred-language-welsh": "Cymraeg", + "account-first-name-label": "Enw cyntaf", + "account-last-name-label": "Enw olaf", + "account-email-address-label": "Cyfeiriad ebost", + "account-telephone-label": "Ffon", + "account-company-group-label": "Cwmni/Grŵp", + "account-your-address-label": "Beth yw eich cyfeiriad?", + "account-address-line-1-label": "Llinell Cyfeiriad 1", + "account-address-line-2-label": "Llinell cyfeiriad 2", + "account-town-city-label": "Tref/Dinas", + "account-county-label": "Sir", + "account-postcode-label": "Côd post", + "account-complete-para-1": "Mae eich manylion wedi'u diweddaru", + "account-complete-para-2": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a metus non quam mollis egestas. Integer ac leo cursus, laoreet nulla sed, tempus tellus. Mauris condimentum erat arcu.", + "account-complete-return-to-portal-link": "Dychwelyd i Fy mhorth" } \ No newline at end of file diff --git a/locales/cy/case.json b/locales/cy/case.json index 255a77cc..8af17e5c 100644 --- a/locales/cy/case.json +++ b/locales/cy/case.json @@ -2,7 +2,7 @@ "page-title": "Cyfeirnod", "case-card-title": "Reference: APP/B1415/W/20/3271702", "summary-reference-label": "Cyfeirnod", - "summary-applicant-label": "Apelydd/Ymgeisydd", + "summary-applicant-label": "Apelydd", "summary-applicantonly-label": "Ymgeisydd", "summary-appellantonly-label": "Apelydd", "summary-agent-label": "Asiant", @@ -79,5 +79,15 @@ "summary-case-website-label": "Gwefan", "summary-case-recommendation-label": "Argymhelliad", "summary-no-details-label": "Nid oes unrhyw fanylion ar gael ar hyn o bryd", - "summary-case-relevant-authoritylabel": "Awdurdod perthnasol" + "summary-case-relevant-authoritylabel": "Awdurdod perthnasol", + "representation-representation-type": "Pa fath o gynrychiolaeth ydych chi'n ei wneud?", + "representation-onbehalfof": "A ydych yn gweithredu ar ran cwmni, grŵp neu sefydliad", + "representation-onbehalfof-details": "Enw'r cwmni/grŵp/sefydliad", + "representation-comments": "Sylwadau", + "representation-files": "Ffeiliau perthnasol", + "representation-period-ended-on-label": "Daeth y Cyfnod Cynrychiolaeth i ben ar ", + "stop-watching-case-link": "Stopiwch wylio'r achos hwn", + "watch-this-case-link": "Gwyliwch yr achos hwn", + "you-are-watching-label": "Rydych chi'n gwylio achos ", + "you-have-stopped-watching-label": "Rydych chi wedi rhoi'r gorau i wylio'r achos " } \ No newline at end of file diff --git a/locales/cy/common.json b/locales/cy/common.json index e0b01da7..9b509311 100644 --- a/locales/cy/common.json +++ b/locales/cy/common.json @@ -17,6 +17,7 @@ "search-button": "Chwilio", "submit-button": "Cyflwyno", "back-link": "Yn ol", + "cancel-link": "Canslo", "save-exit-button": "Cadw a gadael", "submit-and-start": "Cyflwyno a dechrau'r cwrs", "footer-terms-conditions-link-label": "Telerau ac amodau", @@ -47,6 +48,7 @@ "breadcrumb-my-portal": "Fy mhorth", "breadcrumb-new-appeal": "Apêl newydd", "breadcrumb-case-reference": "Cyfeirnod Achos", + "breadcrumb-your-cases": "Eich achosion", "spinner-loading": "Llwytho...", "spinner-searching": "Chwilio...", "spinner-fetching-data": "Nôl data", diff --git a/locales/cy/home.json b/locales/cy/home.json index f48950f8..2188c035 100644 --- a/locales/cy/home.json +++ b/locales/cy/home.json @@ -41,6 +41,6 @@ "dns-card-title": "Gweld yr holl Ddatblygiadau o Arwyddocâd Cenedlaethol", "dns-card-paragraph": "Mae Datblygiad o Arwyddocâd Cenedlaethol yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr o bwysigrwydd cenedlaethol.", "dns-card-button": "Gweld pob cais", - "logging-in-heading": "Mewngofnodi", + "logging-in-heading": "Rydym yn dilysu eich cyfrif arhoswch a pheidiwch ag adnewyddu", "logging-in-paragraph": "Arhoswch os gwelwch yn dda..." } \ No newline at end of file diff --git a/locales/cy/myportal.json b/locales/cy/myportal.json index d83271ee..c0ddc67e 100644 --- a/locales/cy/myportal.json +++ b/locales/cy/myportal.json @@ -33,5 +33,9 @@ "norecords-awaiting-submissions": "Nid oes gennych unrhyw gyflwyniadau sy'n aros", "on-behalf-of-label": "Ar ran", "appeal-type-label": "Math o apêl", - "raised-by-label": "Codwyd gan" + "raised-by-label": "Codwyd gan", + "representation-id": "Id cynrychiolaeth", + "representation-type": "Math o gynrychiolaeth", + "capacity": "Gallu", + "date-raised": "Dyddiad codi" } \ No newline at end of file diff --git a/locales/cy/myrepresentations.json b/locales/cy/myrepresentations.json new file mode 100644 index 00000000..e732b67d --- /dev/null +++ b/locales/cy/myrepresentations.json @@ -0,0 +1,196 @@ +{ + "make-a-representation-on-label": "Gwnewch gynrychioliad ar", + "make-a-representation-for-label": "Gwnewch gynrychiolaeth ar gyfer", + "timetable-title": "Amserlen", + "questionnaire-due-label": "Holiadur yn ddyledus", + "statements-due-label": "Datganiadau yn ddyledus", + "final-comments-due-label": "Sylwadau terfynol yn ddyledus", + "representation-from-an-agent-heading": "Cynrychiolaeth gan Asiant", + "representation-from-an-appellant-heading": "Cynrychiolaeth gan Apelydd", + "representation-from-an-interested-person-heading": "Cynrychiolaeth gan Barti/Person â Diddordeb", + "kind-of-rep-label": "Pa fath o gynrychiolaeth ydych chi'n ei wneud?", + "enter-comment-label": "Gallwch nodi eich sylwadau yn y gofod a ddarperir neu atodi dogfen ar wahân.", + "comments-set-out-label": "Mae fy sylwadau wedi'u nodi yn", + "publish-policy-label": "Sylwch y gall yr holl sylwadau gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich sylw yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi. Os yw'n cynnwys cynnwys hiliol, enllibus neu sarhaus caiff ei ddychwelyd atoch a gofynnir i chi ddarparu fersiwn ddiwygiedig.", + "questionnaire-publish-policy-label": "Sylwch y gall holl ddogfennau holiadur gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich holiadur yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi", + "add-files-label": "Ychwanegwch eich ffeiliau", + "capacity-para-one": "Mae'r ffurflen hon yn eich galluogi i gyflwyno sylwadau ar achos i Benderfyniadau Cynllunio ac Amgylchedd Cymru.", + "capacity-para-two": "Sylwch fod angen gwneud sylwadau gan bartïon â diddordeb o fewn yr amserlen. Mae hwn i'w weld ar y ‘Crynodeb Achos‘ tudalen. Gall sylwadau a gyflwynir ar ôl y dyddiad hwn gael eu hystyried yn annilys.", + "capacity-select-your-details": "Eich manylion", + "capacity-select-what-capacity-label": "Ym mha rinwedd ydych chi am gyflwyno sylwadau ar yr achos hwn?", + "capacity-options-arr-appellant": "Apelydd", + "capacity-options-arr-agent": "Asiant", + "capacity-options-arr-interested": "Parti â diddordeb", + "rep-check-submit-heading": "Gwiriwch eich cynrychiolaeth", + "rep-check-your-rep-heading": "Eich cynrychiolaeth", + "rep-check-tandc-para-one": "Mae casglu a phrosesu dilynol y data personol a ddarparwyd gennych chi ar y ffurflen hon, yn unol â thelerau ein cofrestriad o dan Ddeddf Diogelu Data 2018.", + "rep-check-tandc-para-two": "Mae’r Arolygiaeth Gynllunio yn cymryd ei chyfrifoldebau diogelu data am y wybodaeth a roddwch i ni o ddifrif. I gael gwybod mwy am sut rydym yn defnyddio ac yn rheoli eich data personol, ewch i'n hysbysiad preifatrwydd.", + "rep-check-tandc-para-three": "Cadarnhaf fod pob adran o’r ffurflen hon wedi’u llenwi’n llawn a bod y manylion yn gywir hyd eithaf fy ngwybodaeth.", + "rep-check-tandc-para-four": "Cadarnhaf fy mod wedi darllen yr uchod.", + "rep-complete-heading": "Cyflwyno Sylwadau", + "rep-complete-para-one": "Diolch i chi am gyflwyno eich sylw(au) gan ddefnyddio'r Porth Gwaith Achos Apeliadau.", + "rep-complete-para-two": "Cofiwch fod angen i ni dderbyn unrhyw ddogfennaeth ategol o fewn y terfyn amser priodol ar gyfer yr achos. Rhaid i unrhyw beth y byddwch yn ei anfon atom gael ei farcio'n glir gyda chyfeirnod yr achos a chyfeiriad y safle (gan gynnwys y cod post, os yw'n hysbys).", + "rep-complete-para-three": "Byddwch yn derbyn cadarnhad yn fuan i'r cyfeiriad e-bost yr ydych wedi'i ddarparu.", + "lpa-capacity-para-one": "Mae’r ffurflen hon yn eich galluogi i gyflwyno datganiadau, sylwadau ac holiaduron ar achos i Benderfyniadau Cynllunio ac Amgylchedd Cymru.", + "s78-section-heading-one": "Trefn apelio ac ymweliad safle", + "s78-section-question-1": "Cyfeirnod PEDW:", + "s78-section-question-2": "Cyfeirnod yr LPA:", + "s78-section-question-4": "Math o apêl:", + "s78-section-question-3": "Cyfeiriad Safle:", + "s78-section-question-5": "Pa weithdrefn ydych chi'n ystyried y dylai'r apêl ei dilyn?", + "s78-section-question-6": "A fydd angen i'r Arolygydd fynd i mewn i safle/eiddo'r apźl?", + "s78-section-question-7": "A ydych yn ystyried bod angen i'r Arolygydd fynd ar dir/eiddo preifat cyfagos i weld y safle?", + "s78-section-question-8": "Os oes angen mynediad i dir/adeiladau preifat, a ydych yn fodlon i’r Arolygydd ymweld â’r safle ar sail ‘angen mynediad’, gyda dim ond y tirfeddiannwr neu ei gynrychiolydd yn bresennol?", + "s78-section-question-9": "A ydych yn ymwybodol o unrhyw faterion iechyd a diogelwch y byddai angen eu hystyried pan fydd yr Arolygydd yn ymweld â'r safle?", + "s78-section-question-10": "Cyswllt ACLl ar gyfer ymweliad safle, gwrandawiad neu drefniadau ymchwiliad:", + "s78-section-heading-two": "Dogfennau ategol", + "s78-section-question-11": "Ffeil achos yr ACLl a sylwadau", + "s78-section-question-11-hint": "Mewnosod dolen(nau) gwe i ffeil achos a sylwadau ar borth cyhoeddus yr ACLl. Rhaid i hyn gynnwys yr holl ddogfennau a oedd gerbron yr ACLl ar adeg ei benderfyniad neu pan wnaed yr apêl. Sicrhewch eich bod yn cysylltu’n uniongyrchol â’r rhestr dogfennau achos, nid â thudalen generig ar borth yr ACLl. Os gwnaed sylwadau ar y we hefyd, rhowch ail ddolen i'r dudalen honno. Fel arall, nodwch yma os ydych yn anfon dogfennau ffeil achos perthnasol o dan glawr ar wahân.", + "s78-section-question-12": "Cynllun datblygu lleol mabwysiedig yr ACLl a’r Map Cynigion:", + "s78-section-question-12-hint": "Mewnosod dolenni gwe i Ddatganiad Ysgrifenedig y CDLl/CDU mabwysiedig, a'r Map Cynigion cysylltiedig (gan gynnwys allwedd map). Fel arall, rhestrwch y polisïau perthnasol yma ac atodwch ddyfyniadau.", + "s78-section-question-13": "Canllawiau lleol wedi'u mabwysiadu sy'n berthnasol i'r cynnig", + "s78-section-question-13-hint": "Mewnosod dolen(nau) gwe i unrhyw ganllawiau lleol perthnasol (e.e. Canllawiau Cynllunio Atodol, gwerthusiadau Ardaloedd Cadwraeth) y mae’r ACLl yn eu hystyried yn berthnasol, gan nodi enw’r ddogfen cyn y ddolen we. Fel arall, rhestrwch y canllawiau perthnasol ac atodwch gopïau/dyfyniadau.", + "s78-section-question-14": "Os yw'n berthnasol, a ydych yn bwriadu cyflwyno datganiad llawn yn ystod y cyfnod 4 wythnos?", + "s78-section-heading-three": "Ystyriaeth statudols", + "s78-section-question-15": "Ydy’r safle cyfan neu ran ohono o fewn Ardal o Harddwch Naturiol Eithriadol?", + "s78-section-question-16": "A yw'r safle'n cynnwys unrhyw hawliau tramwy cyhoeddus?", + "s78-section-question-16-hint": "Os Oes, atodwch neu mewnosodwch ddolen i'r map a'r datganiad diffiniol ar gyfer yr ardal leol", + "s78-section-question-17": "Ydy’r safle cyfan neu ran ohono o fewn Ardal Gadwraeth?", + "s78-section-question-17-hint": "Os Oes, atodwch neu mewnosodwch ddolenni i gynllun sy'n dangos ffin yr Ardal Gadwraeth", + "s78-section-question-18": "A fyddai’r cynnig yn golygu gwaith i, neu’n effeithio ar leoliad, adeilad rhestredig, Heneb Gofrestredig neu ased hanesyddol dynodedig arall?", + "s78-section-question-18-hint": "Os Oes, atodwch neu mewnosodwch ddolenni i'r disgrifiad(au) rhestru a'r cynllun lleoliad", + "s78-section-question-19": "A oes unrhyw ran o'r safle yn destun Gorchymyn Cadw Coed?", + "s78-section-question-19-hint": "Os Oes, atodwch neu rhowch ddolenni i'r cynllun a'r manylion perthnasol", + "s78-section-question-20": "A yw’r safle o fewn neu’n debygol o effeithio ar Safle Dynodedig Rhyngwladol neu Genedlaethol ar gyfer cadwraeth natur (fel y’i diffinnir ym Mholisi Cynllunio Cymru)?", + "s78-section-question-20-hint": "Os Oes, nodwch yr enw ac atodwch unrhyw fanylion perthnasol", + "s78-section-question-21": "A yw unrhyw rywogaethau a warchodir yn debygol o gael eu heffeithio gan y cynnig?", + "s78-section-question-21-hint": "Os Oes, nodwch pa un ac atodwch unrhyw fanylion perthnasol", + "s78-section-question-22": "A yw'r achos yn ymwneud â phobl sy'n hawlio statws Sipsiwn/Teithwyr, p'un a yw'r ACLl yn derbyn hyn ai peidio?", + "s78-section-question-23": "A ydych wedi derbyn sylwadau neu gyfarwyddiadau gan unrhyw adran/asiantaeth o’r llywodraeth neu ymgymerwr statudol, gan gynnwys mewn ymateb i hysbysiad statudol neu ymgynghoriad?", + "s78-section-question-23-hint": "Os Oes, nodwch pa un ac atodwch unrhyw fanylion perthnasol", + "s78-section-heading-four": "Amodau a awgrymir", + "s78-section-question-24": "Adolygu’r amodau safonol canlynol a chynghori a fyddent yn angenrheidiol pe bai caniatâd yn cael ei roi (ddim yn berthnasol i gynigion caniatâd Hysbysebu):", + "s78-section-question-24a": "a) Bydd y datblygiad yn dechrau ddim hwyrach na phum mlynedd o ddyddiad y penderfyniad hwn. Rheswm: Cydymffurfio ag Adran 91 o Ddeddf Cynllunio Gwlad a Thref 1990 / Adran 18 o Ddeddf Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) 1990 .", + "s78-section-question-24b": "b) Rhaid cyflawni'r datblygiad yn unol â'r cynlluniau a'r dogfennau cymeradwy a ganlyn: .................................... Rheswm: Er mwyn sicrhau'r datblygiad yn cael ei wneud yn unol â’r dogfennau, cynlluniau a lluniadau cymeradwy a gyflwynwyd gyda’r cais.", + "s78-section-question-24b-hint": "Os Oes, rhestrwch y cynlluniau, dogfennau a lluniadau cymeradwy yma neu rhestrwch nhw mewn dogfen atodedig", + "s78-section-question-24c": "c) Ni chaniateir unrhyw ddatblygiad hyd nes y bydd cynllun gwella bioamrywiaeth wedi ei gyflwyno i'r awdurdod cynllunio lleol a'i gytuno'n ysgrifenedig ganddo. Bydd datblygiad yn cael ei wneud yn unol â'r manylion a gymeradwywyd. Rheswm: Er budd cynnal a gwella bioamrywiaeth, yn unol â Pholisi 9 Cymru’r Dyfodol.", + "s78-section-question-24d": "d) Ni chyflawnir unrhyw ddatblygiad hyd nes y bydd cynllun i alluogi darparu seilwaith band eang galluog gigabit o ffin y safle i’r anheddau/adeiladau a ganiateir drwy hyn wedi’i gyflwyno i’r awdurdod cynllunio lleol a’i gytuno’n ysgrifenedig ganddo. Bydd datblygiad yn cael ei wneud yn unol â'r manylion a gymeradwywyd. Rheswm: Cefnogi’r gwaith o gyflwyno seilwaith cyfathrebu digidol ledled Cymru yn unol â Pholisi 13 Cymru’r Dyfodol.", + "s78-section-question-25": "A ydych yn ystyried bod amodau eraill, neu fersiynau diwygiedig o'r amodau safonol uchod, yn angenrheidiol?", + "s78-section-question-25-hint": "Os Oes, rhestrwch nhw yma neu mewn dogfen atodedig. Cynnwys rhesymau a pholisïau cynllun datblygu perthnasol. Os ydych yn bwriadu anfon amodau a awgrymir ochr yn ochr â’ch datganiad 4 wythnos, nodwch hyn yma.", + "s78-section-heading-five": "Cyn anfon, ydych chi wedi atodi neu ddarparu dolen we i:", + "s78-section-question-26": "Copi o dystysgrif yr ymgeisydd yn cadarnhau ei fod wedi hysbysu pobl sydd â buddiant yn y tir?", + "s78-section-question-26-hint": "Rhowch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "s78-section-question-27": "Tystiolaeth o unrhyw gyhoeddusrwydd a roddwyd i'r cais, gan gynnwys rhybuddion safle a hysbyseb lleol?**", + "s78-section-question-27-hint": "Rhowch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "s78-section-question-28": "Copi o'r llythyr y gwnaethoch hysbysu pobl am yr apêl gydag ef A rhestr o'r bobl y gwnaethoch eu hysbysu?", + "s78-section-question-28-hint": "Rhowch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "s78-section-question-29": "Barn Sgrinio Asesiad o’r Effaith Amgylcheddol yr ACLl, os yw’n berthnasol?", + "s78-section-question-29-hint": "Rhowch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "s78-section-question-30": "Cynigion caniatâd hysbyseb yn unig: Copi cywir o'r Hysbysiad Terfynu (os oes un wedi'i gyhoeddi)?", + "s78-section-question-30-hint": "Os Oes, nodwch sut mae defnyddio'r safle neu arddangos yr hysbyseb(ion) yn mwynhau budd caniatâd tybiedig", + "s78-section-question-31": "Manylion apeliadau neu geisiadau eraill sy’n ymwneud â’r safle, neu safle cyfagos, sy’n dal i gael eu hystyried gan PEDW neu Weinidogion Cymru?", + "s78-section-question-31-hint": "Os Oes, rhowch rifau cyfeirnod ac, os yw'n berthnasol, atodwch neu rhowch ddolenni i'r dogfennau perthnasol", + "s78-section-question-32": "Manylion unrhyw benderfyniad apêl blaenorol yn ymwneud â’r safle neu safle cyfagos y cyfeiriwyd ato gan yr ACLl neu’r ymgeisydd?", + "s78-section-question-32-hint": "Os Oes, rhowch y rhif(au) cyfeirnod a’r cyfeiriad(au) ac atodwch neu mewnosodwch ddolenni i’r penderfyniad(au) ac unrhyw ddogfennau cais perthnasol", + "s78-section-question-33": "Unrhyw wybodaeth berthnasol arall y dylem wybod amdani?", + "s78-section-question-33-hint": "Os Oes, rhowch ddisgrifiad byr ac atodwch neu mewnosodwch ddolenni i'r manylion perthnasol", + "s78-section-heading-seven": "Datganiad", + "s78-section-question-signed": "Llofnodwyd", + "s78-section-question-onbehalf": "Ar ran", + "s78-section-question-date": "Dyddiad", + "enf-section-heading-one": "Trefn apelio ac ymweliad safle", + "enf-section-question-1": "Cyfeirnod PEDW:", + "enf-section-question-2": "Cyfeirnod yr ACLl:", + "enf-section-question-3": "Cyfeiriad y Safle:", + "enf-section-question-4": "Pa weithdrefn y dylai'r apêl ei dilyn yn eich barn chi?", + "enf-section-question-4-hint": "Os Gwrandawiad neu Ymholiad, rhowch resymau yma pam yr ydych yn ystyried bod cyfiawnhad dros hyn. Os ydych yn ystyried bod angen Ymchwiliad, nodwch nifer amcangyfrifedig y diwrnodau eistedd.", + "enf-section-question-5": "A fydd angen i'r Arolygydd fynd i mewn i safle/eiddo'r apźl?", + "enf-section-question-6": "A ydych yn ystyried bod angen i'r Arolygydd fynd ar dir/eiddo preifat cyfagos i weld y safle?", + "enf-section-question-6-hint": "Os Oes, rhowch resymau a rhowch gyfeiriad y safle cyfagos. Os oes gennych rai, rhowch fanylion cyswllt y tirfeddiannwr mewn atodiad.", + "enf-section-question-7": "Os oes angen mynediad i dir/adeiladau preifat, a ydych yn fodlon i'r Arolygydd ymweld â'r safle ar sail 'angen mynediad', gyda dim ond y tirfeddiannwr neu ei gynrychiolydd yn bresennol?", + "enf-section-question-7-hint": "Os Na, rhowch resymau pam yr ydych yn ystyried bod angen Ymweliad Safle Cydymaith", + "enf-section-question-8": "A ydych yn ymwybodol o unrhyw faterion iechyd a diogelwch y byddai angen eu hystyried pan fydd yr Arolygydd yn ymweld â'r safle?", + "enf-section-question-8-hint": "Os Oes, disgrifiwch y materion iechyd a diogelwch i'w hystyried", + "enf-section-question-9": "Cyswllt ACLl ar gyfer trefniadau ymweliad safle, gwrandawiad neu ymholiad:", + "enf-section-heading-two": "Ffi Ymgeisio Tybiedig", + "enf-section-question-10": "A yw'r awdurdod cynllunio lleol wedi derbyn y ffi gywir sy'n daladwy mewn perthynas â'r apêl hon er mwyn i'r cais cynllunio tybiedig/sail (a) gael ei ystyried?", + "enf-section-question-11": "A yw ffi'r apêl wedi'i heithrio?", + "enf-section-question-11-hint": "Os Oes, eglurwch", + "enf-section-heading-three": "Hanes Cynllunio a Statws Presennol", + "enf-section-question-12": "A oes unrhyw ganiatâd cynllunio neu dystysgrifau datblygiad cyfreithlon wedi'u rhoi yn flaenorol mewn perthynas â'r datblygiad neu ar y safle?", + "enf-section-question-12-hint": "Os Oes, cyflwynwch unrhyw ddogfennau angenrheidiol ar gyfer ei ddehongli a'i restru yma. e.e. Hysbysiad o Benderfyniad, Cynlluniau Perthnasol, ac ati.", + "enf-section-question-13": "A gyflwynwyd Hysbysiad Atal yn ogystal â'r Hysbysiad Gorfodi?", + "enf-section-question-13-hint": "Os Oes, cyflwynwch gopi o'r Hysbysiad Atal a chofnodwch unrhyw wybodaeth berthnasol yma.", + "enf-section-question-14": "A oes unrhyw achosion cysylltiedig (e.e. apeliadau o dan a78 o Ddeddf Cynllunio Gwlad a Thref 1990) sydd ar hyn o bryd neu wedi bod gerbron Gweinidogion Cymru?", + "enf-section-question-14-hint": "Os Oes, rhowch fanylion yma, gan gynnwys cyfeirnodau apêl.", + "enf-section-question-15": "A fu unrhyw gamau gorfodi blaenorol ar y safle?", + "enf-section-question-15-hint": "Os Oes, rhowch fanylion a chyflwynwch unrhyw ddogfennau perthnasol, gan eu rhestru yma.", + "enf-section-question-16": "A yw'r wefan yn destun Cyfarwyddyd Erthygl 4?", + "enf-section-question-16-hint": "Os Oes, rhowch fanylion a chyflwynwch gopi o'r Cyfarwyddyd perthnasol.", + "enf-section-question-17": "A yw hawliau datblygu a ganiateir wedi'u cyfyngu gan unrhyw amod cynllunio blaenorol?", + "enf-section-question-17-hint": "Os Oes, rhowch fanylion a chyflwynwch unrhyw ddogfennau perthnasol, gan eu rhestru yma.", + "enf-section-heading-four": "Dogfennau Ategol", + "enf-section-question-18": "Cynllun datblygu lleol mabwysiedig yr ACLl a'r Map Cynigion:", + "enf-section-question-18-hint": "Rhowch ddolenni gwe i Ddatganiad Ysgrifenedig y CDLl/CDU mabwysiedig, a'r Map Cynigion cysylltiedig (gan gynnwys allwedd map). Fel arall, rhestrwch y polisïau perthnasol yma ac atodwch ddyfyniadau.", + "enf-section-question-19": "Canllawiau lleol wedi'u mabwysiadu sy'n berthnasol i'r cynnig", + "enf-section-question-19-hint": "Rhowch ddolen(nau) gwe i unrhyw ganllawiau lleol perthnasol (e.e. Canllawiau Cynllunio Atodol, gwerthusiadau Ardaloedd Cadwraeth) y mae'r ACLl yn eu hystyried yn berthnasol, gan nodi enw'r ddogfen cyn y ddolen we. Fel arall , rhestrwch y canllawiau perthnasol ac atodwch gopïau/dyfyniadau.", + "enf-section-question-20": "Os yw'n berthnasol, a ydych yn bwriadu cyflwyno datganiad llawn yn ystod y cyfnod 4 wythnos?", + "enf-section-heading-five": "Ystyriaethau statudol", + "enf-section-question-21": "A yw'r safle cyfan neu ran ohono o fewn Ardal o Harddwch Naturiol Eithriadol?", + "enf-section-question-22": "A yw'r safle yn cynnwys unrhyw hawliau tramwy cyhoeddus?", + "enf-section-question-22-hint": "Os Oes, atodwch neu mewnosodwch ddolen i'r map a datganiad diffiniol ar gyfer yr ardal leol", + "enf-section-question-23": "A yw'r safle cyfan neu ran ohono o fewn Ardal Gadwraeth?", + "enf-section-question-23-hint": "Os Oes, atodwch neu mewnosodwch ddolenni i gynllun sy'n dangos ffin yr Ardal Gadwraeth", + "enf-section-question-24": "A yw'r datblygiad yn cynnwys gwaith i, neu'n effeithio ar leoliad, adeilad rhestredig, Heneb Gofrestredig neu ased hanesyddol dynodedig arall?", + "enf-section-question-24-hint": "Os Oes, atodwch neu mewnosodwch ddolenni i'r disgrifiad(au) rhestru a'r cynllun lleoliad", + "enf-section-question-25": "A oes unrhyw ran o'r safle yn destun Gorchymyn Cadw Coed?", + "enf-section-question-25-hint": "Os Oes, atodwch neu mewnosodwch ddolenni i'r cynllun a'r manylion perthnasol", + "enf-section-question-26": "A yw'r safle o fewn neu'n debygol o effeithio ar Safle Dynodedig Rhyngwladol neu Genedlaethol ar gyfer cadwraeth natur (fel y'i diffinnir ym Mholisi Cynllunio Cymru)?", + "enf-section-question-26-hint": "Os Oes, nodwch yr enw ac atodwch unrhyw fanylion perthnasol", + "enf-section-question-27": "A yw unrhyw rywogaethau a warchodir yn debygol o gael eu heffeithio gan y cynnig?", + "enf-section-question-27-hint": "Os Oes, nodwch pa un ac atodwch unrhyw fanylion perthnasol", + "enf-section-question-28": "A yw'r achos yn ymwneud â phobl sy'n hawlio statws Sipsiwn/Teithwyr, p'un a yw'r ACLl yn derbyn hyn ai peidio?", + "enf-section-question-29": "A yw llifogydd yn broblem?", + "enf-section-question-29-hint": "Os Oes, nodwch ac atodwch unrhyw fanylion perthnasol", + "enf-section-question-30": "A ydych wedi derbyn sylwadau neu gyfarwyddiadau gan unrhyw adran/asiantaeth o'r llywodraeth neu ymgymerwr statudol, gan gynnwys mewn ymateb i hysbysiad statudol neu ymgynghoriad?", + "enf-section-question-30-hint": "Os Oes, nodwch pa un ac atodwch unrhyw fanylion perthnasol", + "enf-section-heading-six": "Amodau a awgrymir", + "enf-section-question-31": "Adolygu'r amodau safonol canlynol a chynghori a fyddent yn angenrheidiol os rhoddir caniatâd (amherthnasol i gynigion caniatâd Hysbyseb):", + "enf-section-question-31a": "Rhaid cyflawni'r datblygiad yn unol â'r cynlluniau a'r dogfennau cymeradwy a ganlyn: ............................. Rheswm: Er mwyn sicrhau bod y datblygiad yn cael ei wneud yn unol â'r dogfennau, cynlluniau a lluniadau a gymeradwywyd a gyflwynwyd gyda'r cais.", + "enf-section-question-31a-hint": "Os Oes, rhestrwch y cynlluniau, y dogfennau a'r lluniadau a gymeradwywyd yma neu rhestrwch nhw mewn dogfen atodedig", + "enf-section-question-31b": "Ni chaniateir unrhyw waith datblygu hyd nes y bydd cynllun gwella bioamrywiaeth wedi'i gyflwyno i'r awdurdod cynllunio lleol a'i gytuno'n ysgrifenedig ganddo. Rhaid cyflawni'r datblygiad yn unol â'r manylion a gymeradwywyd. Rheswm: Er budd cynnal a gwella bioamrywiaeth, yn unol â Pholisi Cymru’r Dyfodol 9.", + "enf-section-question-31c": "Ni fydd unrhyw ddatblygiad yn digwydd hyd nes y bydd cynllun i alluogi darparu seilwaith band eang galluog gigabit o ffin y safle i'r anheddau/adeiladau a ganiateir drwy hyn wedi'i gyflwyno a'i gytuno'n ysgrifenedig ganddynt. yr awdurdod cynllunio lleol Bydd datblygiad yn cael ei wneud yn unol â'r manylion a gymeradwywyd Rheswm: Er mwyn cefnogi'r gwaith o gyflwyno seilwaith cyfathrebu digidol ledled Cymru yn unol â Pholisi 13 Cymru'r Dyfodol.", + "enf-section-question-32": "A ydych yn ystyried bod amodau eraill, neu fersiynau diwygiedig o'r amodau safonol uchod, yn angenrheidiol?", + "enf-section-question-32-hint": "Os Oes, rhestrwch nhw yma neu mewn dogfen atodedig. Cynhwyswch resymau a pholisïau cynllun datblygu perthnasol. Os ydych yn bwriadu anfon amodau awgrymedig ochr yn ochr â'ch datganiad 4 wythnos, nodwch hyn yma.", + "enf-section-heading-seven": "Cyn anfon, ydych chi wedi atodi neu ddarparu dolen we i:", + "enf-section-question-33": "Copi gwir o'r hysbysiad gorfodi?", + "enf-section-question-33-hint": "Mewnosodwch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "enf-section-question-34": "Cynllun yr hysbysiad gorfodi.", + "enf-section-question-34-hint": "Mewnosodwch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "enf-section-question-35": "Rhestr o'r rhai y cyflwynwyd yr hysbysiad gorfodi iddynt.", + "enf-section-question-35-hint": "Mewnosodwch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "enf-section-question-36": "Copi o'r llythyr y gwnaethoch hysbysu pobl am yr apêl gydag ef A rhestr o'r bobl y gwnaethoch eu hysbysu?", + "enf-section-question-36-hint": "Mewnosodwch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "enf-section-question-37": "Barn Sgrinio Asesiad o'r Effaith Amgylcheddol yr ACLl a 'Hysbysiad Rheoliad 45'*, os yw'n berthnasol?", + "enf-section-question-37-hint": "Mewnosodwch ddolen we yma os yw ar gael ar-lein. Os Na, rhowch resymau", + "enf-section-question-38": "Manylion apeliadau neu geisiadau eraill sy'n ymwneud â'r safle, neu safle cyfagos, sy'n dal i gael eu hystyried gan PEDW neu Weinidogion Cymru?", + "enf-section-question-38-hint": "Os Oes, rhowch rifau cyfeirnod ac, os yw'n berthnasol, atodwch neu mewnosodwch ddolenni i ddogfennau perthnasol", + "enf-section-question-39": "Manylion unrhyw benderfyniad apêl blaenorol yn ymwneud â'r safle neu safle cyfagos y cyfeiriwyd ato gan yr ACLl neu'r ymgeisydd?", + "enf-section-question-39-hint": "Os Oes, rhowch y cyfeirnod(au) a'r cyfeiriad(au) ac atodwch neu mewnosodwch ddolenni i'r penderfyniad(au) ac unrhyw ddogfennau cais perthnasol", + "enf-section-question-40": "Unrhyw wybodaeth berthnasol arall y dylem wybod amdani?", + "enf-section-question-40-hint": "Os Oes, rhowch ddisgrifiad byr ac atodwch neu mewnosodwch ddolenni i'r manylion perthnasol", + "enf-section-heading-eight": "Datganiad", + "enf-section-question-signed": "Arwyddwyd", + "enf-section-question-onbehalf": "Ar ran", + "enf-section-question-date": "Dyddiad", + "questionnaire-yes": "Oes", + "questionnaire-no": "Nac ydw", + "lpa-questionnaire-heading": "Awdurdod Cynllunio Lleol Holiadur", + "lpa-list-supporting-documents-heading": " Rhestr o ddogfennau ategol", + "lpa-list-supporting-documents-list": " Rhestr o'r ffeiliau sydd wedi'u hatodi ", + "s78-heading-para-one": "Ar gyfer ceisiadau/apeliadau Cynllunio, Ardal Gadwraeth, Adeilad Rhestredig a Hysbysebu", + "s78-heading-para-two": "Rhaid i'r ACLl anfon yr holiadur wedi'i gwblhau ac unrhyw atodiadau i PEDW.gwaithachos@llyw.cymru a'r apelydd (neu ei asiant) o fewn 5 diwrnod gwaith i'r dyddiad dechrau a nodir yn ein llythyr cychwyn. ", + "section-heading-zero": "Manylion yr Achos", + "s78-footnote-one": "* Erthygl 11 o Orchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Rheoliad 7 o Reoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012", + "s78-footnote-two": "** Erthygl 12 o Orchymyn Cynllunio Gwlad a Thref (Gweithdrefn Rheoli Datblygu) (Cymru) 2012; Adran 67/73 o Ddeddf Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) 1990; Rheoliad 10 o Reoliadau Cynllunio Gwlad a Thref (Adeiladau Rhestredig ac Ardaloedd Cadwraeth) (Cymru) 2012" +} \ No newline at end of file diff --git a/locales/cy/search.json b/locales/cy/search.json index 6ffd9cfc..6ad735c1 100644 --- a/locales/cy/search.json +++ b/locales/cy/search.json @@ -10,6 +10,7 @@ "lpa-label": "Awdurdod Cynllunio Lleol", "lpa-reference-label": "Cyfeirnod yr Awdurdod Cynllunio Lleol", "appealtype-label": "Dewiswch fath o achos", + "case-status-label": "Statws Achos", "case-type-label": "Math o Achos", "case-type-option-1": "--Dewiswch--", "case-type-option-2": "Unrhyw fath/Pob math", diff --git a/locales/en/account.json b/locales/en/account.json index 6ec50ee2..676b3db5 100644 --- a/locales/en/account.json +++ b/locales/en/account.json @@ -37,5 +37,25 @@ "register-new-account-sub-heading-what-next": "What happens next", "register-new-account-paragraph-what-next": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a metus non quam mollis egestas. Integer ac leo cursus, laoreet nulla sed, tempus tellus. Mauris condimentum erat arcu.", "register-new-account-my-portal-link": "Login to My Portal", - "register-new-account-account-failed": "Please try again with a different email address" + "register-new-account-account-failed": "Please try again with a different email address", + "account-title": "Your account", + "account-about-you-label": "About you", + "account-role-label": "Role", + "account-preferred-language-label": "Prefered language", + "account-preferred-language-english": "English", + "account-preferred-language-welsh": "Welsh", + "account-first-name-label": "First name", + "account-last-name-label": "Last name", + "account-email-address-label": "Email address", + "account-telephone-label": "Telephone", + "account-company-group-label": "Company/Group", + "account-your-address-label": "What is your address?", + "account-address-line-1-label": "Address line 1", + "account-address-line-2-label": "Address line 2", + "account-town-city-label": "Town/City", + "account-county-label": "County", + "account-postcode-label": "Postcode", + "account-complete-para-1": "Your details have been updated", + "account-complete-para-2": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a metus non quam mollis egestas. Integer ac leo cursus, laoreet nulla sed, tempus tellus. Mauris condimentum erat arcu.", + "account-complete-return-to-portal-link": "Return to My portal" } \ No newline at end of file diff --git a/locales/en/case.json b/locales/en/case.json index 9226ee0d..bdd0acce 100644 --- a/locales/en/case.json +++ b/locales/en/case.json @@ -2,7 +2,7 @@ "page-title": "Reference", "case-card-title": "Reference: APP/B1415/W/20/3271702", "summary-reference-label": "Reference", - "summary-applicant-label": "Appellant/Applicant", + "summary-applicant-label": "Appellant", "summary-applicantonly-label": "Applicant", "summary-appellantonly-label": "Appellant", "summary-agent-label": "Agent", @@ -79,5 +79,15 @@ "summary-case-website-label": "Website", "summary-case-recommendation-label": "Recommendation", "summary-no-details-label": "No details currently held", - "summary-case-relevant-authoritylabel": "Relevant authority" + "summary-case-relevant-authoritylabel": "Relevant authority", + "representation-representation-type": "What kind of representation are you making?", + "representation-onbehalfof": "Are you acting on behalf of a company, group or organisation", + "representation-onbehalfof-details": "Name of the company/group/organisation", + "representation-comments": "Comments", + "representation-files": "Relevant files", + "representation-period-ended-on-label": "Representation Period ended on ", + "stop-watching-case-link": "Stop watching this case", + "watch-this-case-link": "Watch this case", + "you-are-watching-label": "You are watching case ", + "you-have-stopped-watching-label": "You have stopped watching case " } \ No newline at end of file diff --git a/locales/en/common.json b/locales/en/common.json index e31d8ee4..ae4e7255 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -17,6 +17,7 @@ "search-button": "Search", "submit-button": "Submit", "back-link": "Back", + "cancel-link": "Cancel", "save-exit-button": "Save and exit", "submit-and-start": "Submit and start course", "footer-terms-conditions-link-label": "Terms and conditions", @@ -47,6 +48,7 @@ "breadcrumb-my-portal": "My portal", "breadcrumb-new-appeal": "New appeal", "breadcrumb-case-reference": "Case Reference", + "breadcrumb-your-cases": "Your cases", "spinner-loading": "Loading...", "spinner-searching": "Searching...", "spinner-fetching-data": "Fetching data", diff --git a/locales/en/home.json b/locales/en/home.json index 6d66e076..0c6f0dd6 100644 --- a/locales/en/home.json +++ b/locales/en/home.json @@ -41,6 +41,6 @@ "dns-card-title": "View all Developments of National Significance ", "dns-card-paragraph": "A Development of National Significance is a type of planning application for a large infrastructure project of national importance.", "dns-card-button": "View all applications", - "logging-in-heading": "Logging in", + "logging-in-heading": "We are authenticating your account please wait and don't refresh", "logging-in-paragraph": "Please wait..." } \ No newline at end of file diff --git a/locales/en/myportal.json b/locales/en/myportal.json index 6ccc0ff5..4484f71e 100644 --- a/locales/en/myportal.json +++ b/locales/en/myportal.json @@ -33,5 +33,9 @@ "norecords-awaiting-submissions": "You have no awaiting submissions", "on-behalf-of-label": "On behalf of", "appeal-type-label": "Appeal type", - "raised-by-label": "Raised by" + "raised-by-label": "Raised by", + "representation-id": "Representation ID", + "representation-type": "Representation type", + "capacity": "Capacity", + "date-raised": "Date raised" } \ No newline at end of file diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json new file mode 100644 index 00000000..474d890f --- /dev/null +++ b/locales/en/myrepresentations.json @@ -0,0 +1,196 @@ +{ + "make-a-representation-on-label": "Make a representation on", + "make-a-representation-for-label": "Make a representation for", + "timetable-title": "Timetable", + "questionnaire-due-label": "Questionnaire due", + "statements-due-label": "Statements due", + "final-comments-due-label": "Final comments due", + "representation-from-an-agent-heading": "Representation from an Agent", + "representation-from-an-appellant-heading": "Representation from an Appellant", + "representation-from-an-interested-person-heading": "Representation from an Interested Party/Person", + "kind-of-rep-label": "What kind of representation are you making?", + "enter-comment-label": "You can enter your comments in the space provided or attach a separate document.", + "comments-set-out-label": "My comments are set out in", + "publish-policy-label": "Please note that all representations may be published in line with our Publishing Policy. Should your representation include any sensitive information or potentially defamatory information, it may be redacted before publishing. If it contains racist, libellous or offensive content it will be returned to you and you will be asked to provide an amended version.", + "questionnaire-publish-policy-label": "Please note that all questionnaire documents may be published in line with our Publishing Policy. Should your questionnaire include any sensitive information or potentially defamatory information, it may be redacted before publishing", + "add-files-label": "Add your files", + "capacity-para-one": "This form enables you to submit comments on a case to Planning and Environment Decisions Wales.", + "capacity-para-two": "Please note that comments from interested parties need to be made within the timetable. This can be found on the previous ‘Case Summary‘ page. Comments submitted after this date may be considered invalid.", + "capacity-select-your-details": "Your details", + "capacity-select-what-capacity-label": "In what capacity do you wish to make representations on this case?", + "capacity-options-arr-appellant": "Appellant", + "capacity-options-arr-agent": "Agent", + "capacity-options-arr-interested": "Interested party", + "rep-check-submit-heading": "Check your representation", + "rep-check-your-rep-heading": "Your representation", + "rep-check-tandc-para-one": "The gathering and subsequent processing of the personal data supplied by you in this form, is in accordance with the terms of our registration under the Data Protection Act 2018.", + "rep-check-tandc-para-two": "The Planning Inspectorate takes its data protection responsibilities for the information you provide us with very seriously. To find out more about how we use and manage your personal data, please go to our privacy notice.", + "rep-check-tandc-para-three": "I confirm that all sections of this form have been fully completed and that the details are correct to the best of my knowledge.", + "rep-check-tandc-para-four": "I confirm I have read the above.", + "rep-complete-heading": "Submission of Representation", + "rep-complete-para-one": "Thank you for submitting your representation(s) using the Appeals Casework Portal.", + "rep-complete-para-two": "Please remember that any supporting documentation needs to be received by us within the appropriate deadline for the case. Anything you send to us must be clearly marked with the case reference number and the site address (including the postcode, where known).", + "rep-complete-para-three": "You will shortly receive confirmation to the email address you have provided.", + "lpa-capacity-para-one": "This form enables you to submit statements, comments and questionaires on a case to Planning and Environment Decisions Wales.", + "s78-section-heading-one": "Appeal procedure and site visit", + "s78-section-question-1": "PEDW Reference: ", + "s78-section-question-2": "LPA reference:", + "s78-section-question-4": "Appeal type:", + "s78-section-question-3": "Site Address: ", + "s78-section-question-5": "Which procedure do you consider the appeal should follow?", + "s78-section-question-6": "Will the Inspector need to enter the appeal site/property?", + "s78-section-question-7": "Do you consider that the Inspector needs to enter neighbouring private land/property to view the site?", + "s78-section-question-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?", + "s78-section-question-9": "Are you aware of any health and safety issues which would need to be considered when the Inspector visits the site?", + "s78-section-question-10": "LPA contact for site visit, hearing or inquiry arrangements:", + "s78-section-heading-two": "Supporting documents", + "s78-section-question-11": "LPA case file and representations", + "s78-section-question-11-hint": "Insert weblink(s) to case file and representations on the LPA’s public portal. This must include all documents which were before the LPA at the time of its decision or when the appeal was made. Ensure that you link directly to the case documents list, not to a generic page on the LPA’s portal. If web-based comments were also made, insert a second link to that page. Alternatively, state here if you are sending relevant case file documents under separate cover.", + "s78-section-question-12": "LPA’s adopted local development plan and Proposals Map:", + "s78-section-question-12-hint": "Insert weblinks to the Written Statement of the adopted LDP/UDP, and the accompanying Proposals Map (including map key). Alternatively, list relevant policies here and attach excerpts.", + "s78-section-question-13": "Adopted local guidance relevant to the proposal", + "s78-section-question-13-hint": "Insert weblink(s) to any relevant any local guidance (e.g. Supplementary Planning Guidance, Conservation Area appraisals) which the LPA considers relevant, specifying the document name before the web link. Alternatively, list the relevant guidance and attach copies/excerpts.", + "s78-section-question-14": "If applicable, do you intend to submit a full statement at the 4- week stage?", + "s78-section-heading-three": "Statutory considerations", + "s78-section-question-15": "Is all or part of the site within an Area of Outstanding Natural Beauty?", + "s78-section-question-16": "Does the site include any public rights of way?", + "s78-section-question-16-hint": "If Yes, attach or insert a link to the definitive map and statement for the local area", + "s78-section-question-17": "Is all or part of the site within a Conservation Area?", + "s78-section-question-17-hint": "If Yes, attach or insert links to a plan showing the Conservation Area boundary", + "s78-section-question-18": "Would the proposal involve works to, or affect the setting of, a listed building, Scheduled Monument or other designated historic asset?", + "s78-section-question-18-hint": "If Yes, attach or insert links to the listing description(s) and location plan", + "s78-section-question-19": "Is any part of the site subject to a Tree Preservation Order?", + "s78-section-question-19-hint": "If Yes, attach or insert links to the relevant plan and details", + "s78-section-question-20": "Is the site within or likely to affect an International or National Designated Site for nature conservation (as defined in Planning Policy Wales)?", + "s78-section-question-20-hint": "If Yes, specify the name and attach any relevant details", + "s78-section-question-21": "Are any protected species likely to be affected by the proposal?", + "s78-section-question-21-hint": "If Yes, specify which and attach any relevant details", + "s78-section-question-22": "Does the case involve persons claiming Gypsy/Traveller status, whether or not this is accepted by the LPA?", + "s78-section-question-23": "Have you received comments or directions from any government department/agency or statutory undertaker, including in response to a statutory notification or consultation?", + "s78-section-question-23-hint": "If Yes, specify which and attach any relevant details", + "s78-section-heading-four": "Suggested conditions", + "s78-section-question-24": "Review the following standard conditions and advise whether they would be necessary if permission/consent is granted (not applicable to Advertisement consent proposals):", + "s78-section-question-24a": "a) The development shall begin not later than five years from the date of this decision. Reason: To comply with Section 91 of the Town and Country Planning Act 1990 / Section 18 of the Town and Country Planning (Listed Building and Conservation Areas) Act 1990.", + "s78-section-question-24b": "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.", + "s78-section-question-24b-hint": "If Yes, list the approved plans, documents and drawings here or list them in an attached document", + "s78-section-question-24c": "c) No development shall take place until a scheme for biodiversity enhancement has been submitted to and agreed in writing by the local planning authority. Development shall be carried out in accordance with the approved details. Reason: In the interests of maintaining and enhancing biodiversity, in accordance with Future Wales Policy 9.", + "s78-section-question-24d": "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.", + "s78-section-question-25": "Do you consider other conditions, or amended versions of the above standard conditions, to be necessary?", + "s78-section-question-25-hint": "If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here.", + "s78-section-heading-five": "Before sending, have you attached or provided a web link to:", + "s78-section-question-26": "A copy of the applicant’s certificate confirming that they notified persons with an interest in the land?", + "s78-section-question-26-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-27": "Evidence of any publicity given to the application, including site notices and local advertisement?**", + "s78-section-question-27-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-28": "A copy of the letter with which you notified people of the appeal AND a list of the people you notified?", + "s78-section-question-28-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-29": "he LPA’s Environmental Impact Assessment Screening Opinion, if applicable?", + "s78-section-question-29-hint": "Insert weblink here if available online. If No, give reasons", + "s78-section-question-30": "Advertisement consent proposals only: A true copy of the Discontinuance Notice (if one has been issued)?", + "s78-section-question-30-hint": "If Yes, state how the use of the site or the display of the advertisement(s) enjoys the benefit of deemed consent", + "s78-section-question-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?", + "s78-section-question-31-hint": "If Yes, provide reference numbers and, if applicable, attach or insert links to relevant documents", + "s78-section-question-32": "Details of any previous appeal decision relating to the site or a nearby site referred to by the LPA or applicant?", + "s78-section-question-32-hint": "If Yes, provide the reference number(s) and address(es) and attach or insert links to the decision(s) and any relevant application documents", + "s78-section-question-33": "Any other relevant information that we should know about?", + "s78-section-question-33-hint": "If Yes, provide a brief description and attach or insert links to the relevant details", + "s78-section-heading-seven": "Declaration", + "s78-section-question-signed": "Signed", + "s78-section-question-onbehalf": "On behalf of", + "s78-section-question-date": "Date", + "enf-section-heading-one": "Appeal procedure and site visit", + "enf-section-question-1": "PEDW Reference: ", + "enf-section-question-2": "LPA reference:", + "enf-section-question-3": "Site Address: ", + "enf-section-question-4": "Which procedure do you consider the appeal should follow?", + "enf-section-question-4-hint": "If Hearing or Inquiry, provide reasons here for why you consider this to be justified. If you consider an Inquiry is necessary, please state your estimated number of sitting days.", + "enf-section-question-5": "Will the Inspector need to enter the appeal site/property?", + "enf-section-question-6": "Do you consider that the Inspector needs to enter neighbouring private land/property to view the site?", + "enf-section-question-6-hint": "If Yes, give reasons and provide the neighbouring site address. If you have them, provide the contact details of the landowner in an attachment.", + "enf-section-question-7": "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?", + "enf-section-question-7-hint": "If No, give reasons for why you consider an Accompanied Site Visit to be necessary", + "enf-section-question-8": "Are you aware of any health and safety issues which would need to be considered when the Inspector visits the site?", + "enf-section-question-8-hint": "If Yes, describe the health and safety issues to be considered", + "enf-section-question-9": "LPA contact for site visit, hearing or inquiry arrangements:", + "enf-section-heading-two": "Deemed Application Fee", + "enf-section-question-10": "Has the local planning authority received the correct fee payable in relation to this appeal for the deemed planning application/ground (a) to be considered?", + "enf-section-question-11": "Is the appeal fee exempt?", + "enf-section-question-11-hint": "If Yes, please explain", + "enf-section-heading-three": "Planning History and Current Statuss", + "enf-section-question-12": "Have any planning permissions or lawful development certificates been granted previously in respect of the development or on the site?", + "enf-section-question-12-hint": "If Yes, please submit any documents necessary for its interpretation and list here. E.g. Decision Notice, Relevant Plans, etc.", + "enf-section-question-13": "Has a Stop Notice been served in addition to the Enforcement Notice?", + "enf-section-question-13-hint": "If Yes, please submit a copy of the Stop Notice and record any relevant information here.", + "enf-section-question-14": "Are there any related cases (e.g. appeals under s78 of the Town and Country Planning Act 1990) which are currently or have previously been before the Welsh Ministers?", + "enf-section-question-14-hint": "If Yes, please provide details here, including appeal reference numbers.", + "enf-section-question-15": "Has there been any previous enforcement action on the site?", + "enf-section-question-15-hint": "If Yes, please provide details and submit any relevant documents, listing them here.", + "enf-section-question-16": "Is the site subject to an Article 4 Direction?", + "enf-section-question-16-hint": "If Yes, please provide details and submit a copy of the relevant Direction.", + "enf-section-question-17": "Have permitted development rights been restricted by any previous planning condition?", + "enf-section-question-17-hint": "If Yes, please provide details and submit any relevant documents, listing them here.", + "enf-section-heading-four": "Supporting Documents", + "enf-section-question-18": "LPA’s adopted local development plan and Proposals Map:", + "enf-section-question-18-hint": "Insert weblinks to the Written Statement of the adopted LDP/UDP, and the accompanying Proposals Map (including map key). Alternatively, list relevant policies here and attach excerpts.", + "enf-section-question-19": "Adopted local guidance relevant to the proposal", + "enf-section-question-19-hint": "Insert weblink(s) to any relevant any local guidance (e.g. Supplementary Planning Guidance, Conservation Area appraisals) which the LPA considers relevant, specifying the document name before the web link. Alternatively, list the relevant guidance and attach copies/excerpts.", + "enf-section-question-20": "If applicable, do you intend to submit a full statement at the 4- week stage?", + "enf-section-heading-five": "Statutory considerations", + "enf-section-question-21": "Is all or part of the site within an Area of Outstanding Natural Beauty?", + "enf-section-question-22": "Does the site include any public rights of way?", + "enf-section-question-22-hint": "If Yes, attach or insert a link to the definitive map and statement for the local area", + "enf-section-question-23": "Is all or part of the site within a Conservation Area?", + "enf-section-question-23-hint": "If Yes, attach or insert links to a plan showing the Conservation Area boundary", + "enf-section-question-24": "Does the development include works to, or affect the setting of, a listed building, Scheduled Monument or other designated historic asset?", + "enf-section-question-24-hint": "If Yes, attach or insert links to the listing description(s) and location plan", + "enf-section-question-25": "Is any part of the site subject to a Tree Preservation Order?", + "enf-section-question-25-hint": "If Yes, attach or insert links to the relevant plan and details", + "enf-section-question-26": "Is the site within or likely to affect an International or National Designated Site for nature conservation (as defined in Planning Policy Wales)?", + "enf-section-question-26-hint": "If Yes, specify the name and attach any relevant details", + "enf-section-question-27": "Are any protected species likely to be affected by the proposal?", + "enf-section-question-27-hint": "If Yes, specify which and attach any relevant details", + "enf-section-question-28": "Does the case involve persons claiming Gypsy/Traveller status, whether or not this is accepted by the LPA?", + "enf-section-question-29": "Is flooding an issue?", + "enf-section-question-29-hint": "If Yes, specify which and attach any relevant details", + "enf-section-question-30": "Have you received comments or directions from any government department/agency or statutory undertaker, including in response to a statutory notification or consultation?", + "enf-section-question-30-hint": "If Yes, specify which and attach any relevant details", + "enf-section-heading-six": "Suggested conditions", + "enf-section-question-31": "Review the following standard conditions and advise whether they would be necessary if permission/consent is granted (not applicable to Advertisement consent proposals):", + "enf-section-question-31a": "a) 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.", + "enf-section-question-31a-hint": "If Yes, list the approved plans, documents and drawings here or list them in an attached document", + "enf-section-question-31b": "b) No development shall take place until a scheme for biodiversity enhancement has been submitted to and agreed in writing by the local planning authority. Development shall be carried out in accordance with the approved details. Reason: In the interests of maintaining and enhancing biodiversity, in accordance with Future Wales Policy 9.", + "enf-section-question-31c": "c) 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.", + "enf-section-question-32": "Do you consider other conditions, or amended versions of the above standard conditions, to be necessary?", + "enf-section-question-32-hint": "If Yes, list them here or in an attached document. Include reasons and relevant development plan policies. If you intend to send suggested conditions alongside your 4 week statement, state this here.", + "enf-section-heading-seven": "Before sending, have you attached or provided a web link to:", + "enf-section-question-33": "A true copy of the enforcement notice?", + "enf-section-question-33-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-34": "The enforcement notice plan.", + "enf-section-question-34-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-35": "A list of those served with the enforcement notice.", + "enf-section-question-35-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-36": "A copy of the letter with which you notified people of the appeal AND a list of the people you notified?", + "enf-section-question-36-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-37": "The LPA’s Environmental Impact Assessment Screening Opinion and ‘Regulation 45 Notice’*, if applicable?", + "enf-section-question-37-hint": "Insert weblink here if available online. If No, give reasons", + "enf-section-question-38": "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?", + "enf-section-question-38-hint": "If Yes, provide reference numbers and, if applicable, attach or insert links to relevant documents", + "enf-section-question-39": "Details of any previous appeal decision relating to the site or a nearby site referred to by the LPA or applicant?", + "enf-section-question-39-hint": "If Yes, provide the reference number(s) and address(es) and attach or insert links to the decision(s) and any relevant application documents", + "enf-section-question-40": "Any other relevant information that we should know about?", + "enf-section-question-40-hint": "If Yes, provide a brief description and attach or insert links to the relevant details", + "enf-section-heading-eight": "Declaration", + "enf-section-question-signed": "Signed", + "enf-section-question-onbehalf": "On behalf of", + "enf-section-question-date": "Date", + "questionnaire-yes": "Yes", + "questionnaire-no": "No", + "lpa-questionnaire-heading": "Local Planning Authority Questionnaire", + "lpa-list-supporting-documents-heading": "List of Supporting documents", + "lpa-list-supporting-documents-list": "List of attached files", + "s78-heading-para-one": "For Planning, Conservation area, Listed Building and Advertisement applications/appeals", + "s78-heading-para-two": "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", + "section-heading-zero": "Case Details", + "s78-footnote-one": "* 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", + "s78-footnote-two": "** 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" +} \ No newline at end of file diff --git a/locales/en/search.json b/locales/en/search.json index 600d20ac..d42f5bc3 100644 --- a/locales/en/search.json +++ b/locales/en/search.json @@ -10,6 +10,7 @@ "lpa-label": "Local Planning Authority", "lpa-reference-label": "LPA reference number", "appealtype-label": "Select a case type", + "case-status-label": "Case Status", "case-type-label": "Case type", "case-type-option-1": "-- Select --", "case-type-option-2": "Any/All", diff --git a/next-env.d.ts b/next-env.d.ts new file mode 100644 index 00000000..fd36f949 --- /dev/null +++ b/next-env.d.ts @@ -0,0 +1,6 @@ +/// +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/next-swagger-doc.json b/next-swagger-doc.json new file mode 100644 index 00000000..b8a717fa --- /dev/null +++ b/next-swagger-doc.json @@ -0,0 +1,588 @@ +{ + "apiFolder": "pages/api", + "schemaFolders": [ + "models" + ], + "definition": { + "openapi": "3.0.3", + "info": { + "title": "PEDW API", + "version": "1.0" + }, + "components": { + "schemas": { + "emailBody": { + "type": "object", + "properties": { + "reference": { + "type": "string", + "example": "PEDW-COMPLETE" + }, + "templateId": { + "type": "string", + "example": "618e0463-b092-4733-a024-bf8a3bbde808" + }, + "emailAddress": { + "type": "string", + "example": "rob@rdbtech.co.uk" + }, + "personalisation": { + "type": "object", + "example": { + "caseReference": "CAS-TEST-TEST", + "emailAddress": "rob@rdbtech.co.uk", + "linkExpiry": "10 * 60" + } + } + } + } + }, + "securitySchemes": { + "pedw_auth": { + "type": "oauth2", + "flows": { + "clientCredentials": { + "tokenUrl": "https://login.microsoftonline.com/9ac1a5ab-cd58-409e-a1b6-6b10422a68f5/oauth2/v2.0/token", + "scopes": "https://dev-pedw-ns.servicebus.windows.net/.default" + } + } + }, + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + } + } + }, + "paths": { + "/api/auth/[...nextauth]": { + "get": { + "tags": [ + "Login" + ], + "description": "NextAuth", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/documents/download/{id}": { + "get": { + "tags": [ + "Documents" + ], + "description": "Get document", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "iShare ID", + "type": "string", + "required": true, + "default": "A41567436" + }, + { + "name": "hash", + "in": "query", + "description": "Hash string", + "default": "e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71" + } + ], + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/email/notify": { + "post": { + "tags": [ + "Email" + ], + "summary": "Email to user", + "consumes": [ + "application/json" + ], + "description": "Send email via gov notify", + "produces": [ + "application/json", + "application/xml" + ], + "requestBody": { + "name": "Email", + "description": "Email body", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/emailBody" + } + } + } + }, + "responses": { + "405": { + "description": "Failed" + } + } + } + }, + "/api/endpoint/createaccount_api": { + "post": { + "tags": [ + "Account" + ], + "description": "Create password", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/createcase_api": { + "post": { + "tags": [ + "Case" + ], + "description": "Create case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/createmywatchedcases_api": { + "post": { + "tags": [ + "Portal", + "Case" + ], + "description": "Create my watched cases", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteawaitingsubmissions_api": { + "delete": { + "tags": [ + "Case" + ], + "description": "Delete awaiting case submission", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteamyrepresentations_api": { + "delete": { + "tags": [ + "Portal", + "Representations" + ], + "description": "Delete my representations", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteamywatchedcases_api": { + "delete": { + "tags": [ + "Portal", + "Case" + ], + "description": "Delete my watched cases", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getadvancedsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Advanced search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getadvancedsearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Advanced search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealid_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal ID", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealtypes_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal Types", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealtypesfornewappeal_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal Types for appeal", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getawaitingsubmission_api": { + "get": { + "tags": [ + "Case" + ], + "description": "get awaiting case submission", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getawaitingsubmissionproxy_api": { + "get": { + "tags": [ + "Case" + ], + "description": "get awaiting case submission proxy", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchdetails_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnsurlsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search URL", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchdetails_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getcase_api": { + "get": { + "tags": [ + "Case" + ], + "summary": "Not used", + "description": "Get case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getlogin_api": { + "get": { + "tags": [ + "Login" + ], + "description": "Returns the hello world", + "responses": { + "200": { + "description": "hello world" + } + } + } + }, + "/api/endpoint/getlpa_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Get list of LPA's", + "responses": { + "200": { + "description": "Success" + } + }, + "security": [ + { + "relay_auth": [] + } + ] + } + }, + "/api/endpoint/getsearchdocumentdetails_api": { + "get": { + "tags": [ + "Search", + "Documents" + ], + "description": "Basic search documents details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumentdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumenthistory_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumenthistorypaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumentTypes_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/patchcase_api": { + "patch": { + "tags": [ + "Case" + ], + "description": "Patch case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updateaccount_api": { + "patch": { + "tags": [ + "Account" + ], + "description": "Update account", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updatecase_api": { + "patch": { + "tags": [ + "Case" + ], + "description": "Update case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updatepassword_api": { + "patch": { + "tags": [ + "Account" + ], + "description": "Update password", + "responses": { + "200": { + "description": "Success" + } + } + } + } + }, + "tags": [] + } +} \ No newline at end of file diff --git a/next.config.js b/next.config.js index 403fbd2f..0dd67f77 100644 --- a/next.config.js +++ b/next.config.js @@ -1,22 +1,22 @@ // next.config.js -const withStyles = require("@webdeb/next-styles"); +//const withStyles = require("@webdeb/next-styles"); //const { nextI18NextRewrites } = require("next-i18next/rewrites"); -const nextTranslate = require("next-translate"); +const nextTranslate = require("next-translate-plugin"); -module.exports = withStyles({ - sass: true, // use .scss files - modules: true, // style.(m|module).css & style.(m|module).scss for module files - sassLoaderOptions: { - sassOptions: { - includePaths: [ - "/styles/sass", - "node_modules/govuk-frontend/govuk/all", - "/styles/sass/patterns", - "/styles/sass/prevent-training", - ], // @import 'variables'; # loads (src/styles/varialbes.scss), you got it.. - }, - }, -}); +// module.exports = withStyles({ +// sass: true, // use .scss files +// modules: true, // style.(m|module).css & style.(m|module).scss for module files +// sassLoaderOptions: { +// sassOptions: { +// includePaths: [ +// "/styles/sass", +// "node_modules/govuk-frontend/govuk/all", +// "/styles/sass/patterns", +// "/styles/sass/welshgov", +// ], // @import 'variables'; # loads (src/styles/varialbes.scss), you got it.. +// }, +// }, +// }); const securityHeaders = [ { @@ -54,6 +54,15 @@ const securityHeaders = [ ]; module.exports = { + swcMinify: false, + sassOptions: { + includePaths: [ + "/styles/sass", + "node_modules/govuk-frontend/govuk/all", + "/styles/sass/patterns", + "/styles/sass/welshgov", + ], // @import 'variables'; # loads (src/styles/varialbes.scss), you got it.. + }, async headers() { return [ { @@ -114,6 +123,14 @@ module.exports = { source: "/fymhorth/achos", destination: "/myportal/case", }, + { + source: "/fymhorth/gweldpopeth", + destination: "/myportal/viewall", + }, + { + source: "/fymhorth/:slug", + destination: "/myportal/:slug", + }, { source: "/allgofnodi", destination: "/logout", @@ -150,6 +167,26 @@ module.exports = { source: "/telerau-ac-amodau", destination: "/terms-and-conditions", }, + { + source: "/awd/mewngofnodi", + destination: "/auth/signin", + }, + { + source: "/awd/mewngofnodi/ebost", + destination: "/auth/signin/email", + }, + { + source: "/awd/gwall", + destination: "/auth/error", + }, + { + source: "/awd/gwirio-cais", + destination: "/auth/verify-request", + }, + { + source: "/cyfrif/cofrestr", + destination: "/account/register", + }, // { // source: "/cy:path*", diff --git a/notusedmiddleware.js b/notusedmiddleware.js new file mode 100644 index 00000000..3a6a684c --- /dev/null +++ b/notusedmiddleware.js @@ -0,0 +1,13 @@ +// export { default } from "next-auth/middleware"; + +// export const config = { +// matcher: ["/myportal/", "/myportal/:path*"], +// }; + +// import { withAuth } from 'next-auth/middleware'; + +// export default withAuth({ +// pages: { +// signIn: '/login', +// }, +// }); diff --git a/package.json b/package.json index 5885aa2e..4ec2a1fb 100644 --- a/package.json +++ b/package.json @@ -1,91 +1,91 @@ { - "name": "acp", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "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", - "lint": "next lint" - }, - "dependencies": { - "@azure/identity": "^2.0.5", - "@azure/storage-blob": "^12.12.0", - "@googlemaps/react-wrapper": "^1.1.24", - "@magic-sdk/admin": "^1.4.0", - "@next-auth/prisma-adapter": "^1.0.4", - "@prisma/client": "^3.12.0", - "@redux-devtools/extension": "^3.2.3", - "@webdeb/next-styles": "^1.1.1", - "applicationinsights": "^2.2.0", - "axios": "^0.24.0", - "compression": "^1.7.4", - "cookie-cutter": "^0.2.0", - "cookies": "^0.8.0", - "crypto-js": "^4.1.1", - "date-fns": "^2.28.0", - "dom": "^0.0.3", - "dynamics-web-api": "^1.7.4", - "express": "^4.17.2", - "formidable": "^2.0.1", - "fs": "^0.0.1-security", - "google-map-react": "^2.1.10", - "govuk-frontend": "3.13.0", - "https": "^1.0.0", - "hyco-https": "^1.4.5", - "jsonpath": "^1.1.1", - "jsonpath-plus": "^6.0.1", - "leaflet": "^1.7.1", - "leaflet-defaulticon-compatibility": "^0.1.1", - "lodash": "^4.17.21", - "magic-sdk": "^8.1.0", - "moment": "^2.29.1", - "multer": "^1.4.4", - "multiparty": "^4.2.3", - "mysql": "^2.18.1", - "nanoid": "^3.2.0", - "next": "^12.0.8", - "next-auth": "^4.3.4", - "next-connect": "^0.12.2", - "next-redux-wrapper": "^7.0.5", - "next-translate": "^1.2.0", - "nodemailer": "^6.7.8", - "nookies": "^2.5.2", - "notifications-node-client": "^5.1.1", - "ospoint": "^0.2.1", - "path": "^0.12.7", - "react": "17.0.2", - "react-accessible-accordion": "^4.0.0", - "react-autosuggest": "^10.1.0", - "react-cookie-consent": "^7.2.1", - "react-datepicker": "^4.6.0", - "react-dom": "17.0.2", - "react-dropzone": "^11.5.1", - "react-idle-timer": "^4.6.4", - "react-leaflet": "^3.2.5", - "react-loading-overlay": "^1.0.1", - "react-quill": "^2.0.0", - "react-redux": "^7.2.6", - "react-xml-parser": "^1.1.8", - "redux-form": "^8.3.8", - "redux-persist": "^6.0.0", - "redux-thunk": "^2.4.1", - "sass": "1.32", - "sass-loader": "^12.4.0", - "swr": "^1.1.2", - "typeorm": "^0.3.5", - "uuid": "^8.3.2", - "webpack": "^5.66.0", - "xml2js": "^0.4.23", - "xmldom": "^0.6.0", - "xmlhttprequest": "^1.8.0", - "xpath": "^0.0.32" - }, - "devDependencies": { - "eslint": "^8.6.0", - "eslint-config-next": "^12.0.8", - "prettier": "2.5.1", - "prisma": "^3.12.0" - } + "name": "acp", + "version": "0.1.0", + "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", + "lint": "next lint" + }, + "browser": { + "child_process": false + }, + "dependencies": { + "@auth/prisma-adapter": "^1.0.1", + "@azure/identity": "^3.2.4", + "@azure/storage-blob": "^12.12.0", + "@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", + "@xmldom/xmldom": "^0.8.10", + "applicationinsights": "^2.2.0", + "axios": "^0.24.0", + "compression": "^1.7.4", + "cookie-cutter": "^0.2.0", + "crypto-js": "^4.1.1", + "date-fns": "^2.28.0", + "dom": "^0.0.3", + "express": "^4.17.2", + "fs": "0.0.2", + "google-map-react": "^2.1.10", + "govuk-frontend": "3.13.0", + "jsonpath": "^1.1.1", + "leaflet": "^1.7.1", + "leaflet-defaulticon-compatibility": "^0.1.1", + "lodash": "^4.17.21", + "moment": "^2.29.1", + "multiparty": "^4.2.3", + "mysql": "^2.18.1", + "nanoid": "^3.2.0", + "next": "^14.0.1", + "next-auth": "^4.24.4", + "next-connect": "^0.12.2", + "next-redux-wrapper": "^7.0.5", + "next-swagger-doc": "^0.3.6", + "next-translate": "^1.2.0", + "nodemailer": "^6.9.1", + "nookies": "^2.5.2", + "notifications-node-client": "^5.1.1", + "ospoint": "^0.2.1", + "path": "^0.12.7", + "prop-types": "^15.8.1", + "raw-loader": "^4.0.2", + "react": "^18.2.0", + "react-accessible-accordion": "^4.0.0", + "react-autosuggest": "^10.1.0", + "react-cookie-consent": "^7.2.1", + "react-datepicker": "4.10.0", + "react-dom": "^18.2.0", + "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", + "redux-form": "^8.3.9", + "redux-persist": "^6.0.0", + "redux-thunk": "^2.4.2", + "sass": "1.32", + "sass-loader": "13.2.0", + "swagger-ui": "^4.17.1", + "swagger-ui-react": "^4.17.0", + "typescript": "^4.9.5", + "uuid": "9.0.0", + "webpack": "^5.66.0", + "xpath": "^0.0.32" + }, + "devDependencies": { + "eslint": "^8.6.0", + "eslint-config-next": "^14.0.1", + "eslint-plugin-jsdoc": "^40.0.1", + "next-translate-plugin": "^2.6.2", + "prisma": "^5.0.0" + } } diff --git a/pages/404.js b/pages/404.js index f9d320e8..03bd1aeb 100644 --- a/pages/404.js +++ b/pages/404.js @@ -27,7 +27,7 @@ const FourOhFour = (props) => {

    {t("common:404-not-found-title")}

    - {t("common:404-not-found-link")} + {t("common:404-not-found-link")}
    diff --git a/pages/_document.js b/pages/_document.js index e8ec0253..b7976a35 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -2,6 +2,8 @@ import Document, { Html, Head, Main, NextScript } from "next/document"; import SkipLink from "../components/skiplink"; import { Tracking, TrackingNoScript } from "../components/tracking"; import { nanoid } from "nanoid"; +import { setCookie } from "nookies"; +import Script from "next/script"; class MyDocument extends Document { static async getInitialProps(ctx) { @@ -19,12 +21,16 @@ class MyDocument extends Document { useGATracking = false; } + setCookie(ctx, "pedw_locale", ctx.locale, { + path: "/", + }); + return { ...initialProps, useGATracking }; } render() { const googleTagManagerID = process.env.GOOGLE_TAG_MANAGER || null; - const { useGATracking } = this.props; + const { useGATracking, locale } = this.props; const generatedNonce = nanoid(); @@ -39,7 +45,7 @@ class MyDocument extends Document { csp += `style-src 'self' https://fonts.googleapis.com 'unsafe-inline' data:;`; return ( - + {useGATracking && ( @@ -58,15 +64,27 @@ class MyDocument extends Document { )} {!process.browser && ( <> - - +