Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a536e158c | ||
|
|
6f37064eba | ||
|
|
af5354d19f | ||
|
|
f9f7b777e7 | ||
|
|
3c38da1400 | ||
|
|
1acb84959b | ||
|
|
3566da1989 | ||
|
|
fa4c765799 | ||
|
|
30a7e426af | ||
|
|
7a3671f0a3 | ||
|
|
700d3ac67e | ||
|
|
d94b3b3e5a | ||
|
|
adcff32d73 | ||
|
|
8a512f6c46 | ||
|
|
c43b0db9e7 | ||
|
|
3161e05a3b | ||
|
|
d44a58eb6a | ||
|
|
e10b25857e | ||
|
|
59a37c4823 | ||
|
|
e10692898d | ||
|
|
5204ba80d9 | ||
|
|
ef16ce0a32 | ||
|
|
914c788351 | ||
|
|
ac236339d4 | ||
|
|
8254cbdeb7 | ||
|
|
f13493ac46 | ||
|
|
0083df2209 | ||
|
|
90684b6b42 | ||
|
|
a084b569c9 | ||
|
|
a0f777e6cb | ||
|
|
a1c21fd369 | ||
|
|
441268b026 | ||
|
|
f3fcef69bc | ||
|
|
d55b42a5ab | ||
|
|
367ed19a70 | ||
|
|
75eec56345 | ||
|
|
5288b6dfb5 | ||
|
|
45c43b27bf | ||
|
|
df4e51259b | ||
|
|
b09b15ca1c | ||
|
|
94d2d13fce | ||
|
|
6efc1c4777 | ||
|
|
80ea9a970f | ||
|
|
2af0a7c93e | ||
|
|
e8303a47f6 | ||
|
|
932b953163 | ||
|
|
3b687e5566 | ||
|
|
f0f15b4f6e | ||
|
|
58f468c275 |
-131
@@ -1,131 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
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 = e082def0-3453-461f-9a5e-f4ab127dc015
|
|
||||||
CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
|
||||||
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 = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
|
||||||
//CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
|
||||||
//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 = false
|
|
||||||
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"
|
|
||||||
|
|
||||||
API_ROOT = "http://localhost:3000"
|
|
||||||
|
|
||||||
|
|
||||||
GOOGLE_MAP_API_KEY = AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo
|
|
||||||
|
|
||||||
|
|
||||||
//EMAIL_SERVER_HOST=smtp.livemail.co.uk
|
|
||||||
//EMAIL_SERVER_PORT=465
|
|
||||||
//EMAIL_SERVER_USER=rob@rdbsolutions.co.uk
|
|
||||||
//EMAIL_SERVER_PASSWORD=R0b3rt72
|
|
||||||
//EMAIL_FROM=rob@rdbsolutions.co.uk
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_MAGIC_PK=pk_live_674E13244D1BB0A4
|
|
||||||
MAGIC_SK=sk_live_F0E74A9557051A65
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NEXTAUTH_URL=http://localhost:3000
|
|
||||||
NEXTAUTH_SECRET= # Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
|
||||||
|
|
||||||
APPLE_ID=
|
|
||||||
APPLE_TEAM_ID=
|
|
||||||
APPLE_PRIVATE_KEY=
|
|
||||||
APPLE_KEY_ID=
|
|
||||||
|
|
||||||
AUTH0_ID=
|
|
||||||
AUTH0_SECRET=
|
|
||||||
AUTH0_ISSUER=
|
|
||||||
|
|
||||||
FACEBOOK_ID=
|
|
||||||
FACEBOOK_SECRET=
|
|
||||||
|
|
||||||
GITHUB_ID=
|
|
||||||
GITHUB_SECRET=
|
|
||||||
|
|
||||||
GOOGLE_ID=
|
|
||||||
GOOGLE_SECRET=
|
|
||||||
|
|
||||||
TWITTER_ID=
|
|
||||||
TWITTER_SECRET=
|
|
||||||
|
|
||||||
//EMAIL_SERVER=smtp://username:password@smtp.example.com:587
|
|
||||||
//EMAIL_FROM=NextAuth <noreply@example.com>
|
|
||||||
|
|
||||||
//DATABASE_URL=sqlite://localhost/:memory:?synchronize=true
|
|
||||||
DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
|
||||||
|
|
||||||
SECRET=SuperSecret
|
|
||||||
+23
-70
@@ -1,32 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||||
//ESNR Tenant
|
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||||
//TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
||||||
//WGO Tenant
|
|
||||||
TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
|
||||||
GRANT_TYPE = "client_credentials"
|
GRANT_TYPE = "client_credentials"
|
||||||
|
|
||||||
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||||
NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||||
|
|
||||||
|
|
||||||
//Dev oauth ESNR
|
//Dev oauth
|
||||||
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
//CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
|
||||||
//CLIENT_SECRET = 4Vt8Q~olL1hx7n01B0~tXf-N2YL5DyC_Fk6waagX
|
//CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
||||||
CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE
|
//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
||||||
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
||||||
RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
//RELAYPATH = "dev-pedw-hc"
|
||||||
RELAYPATH = "dev-pedw-hc"
|
|
||||||
|
|
||||||
|
|
||||||
//Test Oauth ESNR
|
//Test Oauth
|
||||||
//CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
||||||
//CLIENT_SECRET = IXI8Q~D5oqsC-nrtayHHc~tUAfjQFzNiKVQ~fc2S
|
CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
||||||
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||||
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||||
//RELAYPATH = "test-pedw-hc"
|
RELAYPATH = "test-pedw-hc"
|
||||||
|
|
||||||
|
|
||||||
//Preprod Oauth WGO
|
//Preprod Oauth
|
||||||
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||||
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
|
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
|
||||||
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
||||||
@@ -35,9 +34,9 @@ RELAYPATH = "dev-pedw-hc"
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Prod Oauth WGO
|
//Prod Oauth
|
||||||
//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
//CLIENT_ID = 01904c07-9035-4cf9-a535-3945f6e470d2
|
||||||
//CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~
|
//CLIENT_SECRET = PRo7Q~GQoKSdARRqF-NOXQDx2Ka8UCINyvagk
|
||||||
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
||||||
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
||||||
//RELAYPATH = "prod-pedw-hc"
|
//RELAYPATH = "prod-pedw-hc"
|
||||||
@@ -45,10 +44,8 @@ RELAYPATH = "dev-pedw-hc"
|
|||||||
|
|
||||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||||
SHOWLOGIN = "true"
|
SHOWLOGIN = "true"
|
||||||
SHOWREPRESENTATIONS = false
|
SHOWREPRESENTATIONS = "false"
|
||||||
SHOWFILEUPLOAD = "false"
|
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||||
SHOWMAPS = "true"
|
|
||||||
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
|
||||||
|
|
||||||
|
|
||||||
PORT= "3000"
|
PORT= "3000"
|
||||||
@@ -64,8 +61,7 @@ I18N_DOMAIN = "cymru.local"
|
|||||||
GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration"
|
GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration"
|
||||||
GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||||
GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS
|
GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS
|
||||||
//GG_REDIRECT_URI = "http://localhost:3000"
|
GG_REDIRECT_URI = "http://localhost:3000"
|
||||||
GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales"
|
|
||||||
|
|
||||||
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||||
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
||||||
@@ -73,46 +69,3 @@ NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
|||||||
API_ROOT = "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_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
|
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "next/core-web-vitals",
|
"extends": "next",
|
||||||
"rules": {
|
"rules": {
|
||||||
"@next/next/no-img-element": "off",
|
"@next/next/no-img-element": "off"
|
||||||
"react/no-unknown-property": "error"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,569 +0,0 @@
|
|||||||
import { v4 as uuidv4 } from "uuid";
|
|
||||||
const {
|
|
||||||
ContainerClient,
|
|
||||||
BlockBlobClient,
|
|
||||||
BlobServiceClient,
|
|
||||||
BlobSASPermissions,
|
|
||||||
ContainerSASPermissions,
|
|
||||||
generateBlobSASQueryParameters,
|
|
||||||
SASProtocol,
|
|
||||||
} = require("@azure/storage-blob");
|
|
||||||
import { DefaultAzureCredential } from "@azure/identity";
|
|
||||||
import { consoleLogger, conLog, hashAPIPath } from ".";
|
|
||||||
import _ from "lodash";
|
|
||||||
const STORAGE_PATH = process.env.AZURE_PEDW_STORAGE_ENDPOINT;
|
|
||||||
const STORAGE_CONTAINER = process.env.AZURE_PEDW_CONTAINER;
|
|
||||||
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
|
|
||||||
|
|
||||||
export const createContainerSas = async (containerName) => {
|
|
||||||
// Get environment variables
|
|
||||||
|
|
||||||
// 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_BEFORE_NOW = new Date(NOW.valueOf() - TEN_MINUTES);
|
|
||||||
const TEN_MINUTES_AFTER_NOW = new Date(NOW.valueOf() + TEN_MINUTES);
|
|
||||||
|
|
||||||
// Best practice: use managed identity - DefaultAzureCredential
|
|
||||||
const blobServiceClient = new BlobServiceClient(
|
|
||||||
`${STORAGE_PATH}`,
|
|
||||||
new DefaultAzureCredential()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Best practice: delegation key is time-limited
|
|
||||||
// When using a user delegation key, container must already exist
|
|
||||||
const userDelegationKey = await blobServiceClient.getUserDelegationKey(
|
|
||||||
TEN_MINUTES_BEFORE_NOW,
|
|
||||||
TEN_MINUTES_AFTER_NOW
|
|
||||||
);
|
|
||||||
|
|
||||||
// Need only list permission to list blobs
|
|
||||||
const containerPermissions = "rcwltd";
|
|
||||||
|
|
||||||
// Best practice: SAS options are time-limited
|
|
||||||
const sasOptions = {
|
|
||||||
containerName,
|
|
||||||
permissions: ContainerSASPermissions.parse(containerPermissions),
|
|
||||||
protocol: SASProtocol.HttpsAndHttp,
|
|
||||||
startsOn: TEN_MINUTES_BEFORE_NOW,
|
|
||||||
expiresOn: TEN_MINUTES_AFTER_NOW,
|
|
||||||
};
|
|
||||||
|
|
||||||
//conLogJSON.stringify(sasOptions));
|
|
||||||
|
|
||||||
const sasToken = generateBlobSASQueryParameters(
|
|
||||||
sasOptions,
|
|
||||||
userDelegationKey,
|
|
||||||
accountName
|
|
||||||
).toString();
|
|
||||||
|
|
||||||
return sasToken;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createBlobSas = async (containerName, blobName) => {
|
|
||||||
// Get environment variables
|
|
||||||
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
|
|
||||||
|
|
||||||
// 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_BEFORE_NOW = new Date(NOW.valueOf() - TEN_MINUTES);
|
|
||||||
const TEN_MINUTES_AFTER_NOW = new Date(NOW.valueOf() + TEN_MINUTES);
|
|
||||||
|
|
||||||
// Best practice: use managed identity - DefaultAzureCredential
|
|
||||||
const blobServiceClient = new BlobServiceClient(
|
|
||||||
`https://${accountName}.blob.core.windows.net`,
|
|
||||||
new DefaultAzureCredential()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Best practice: delegation key is time-limited
|
|
||||||
// When using a user delegation key, container must already exist
|
|
||||||
const userDelegationKey = await blobServiceClient.getUserDelegationKey(
|
|
||||||
TEN_MINUTES_BEFORE_NOW,
|
|
||||||
TEN_MINUTES_AFTER_NOW
|
|
||||||
);
|
|
||||||
|
|
||||||
// Need only create/write permission to upload file
|
|
||||||
const blobPermissionsForAnonymousUser = "rcwt";
|
|
||||||
|
|
||||||
// Best practice: SAS options are time-limited
|
|
||||||
const sasOptions = {
|
|
||||||
blobName,
|
|
||||||
containerName,
|
|
||||||
permissions: BlobSASPermissions.parse(blobPermissionsForAnonymousUser),
|
|
||||||
protocol: SASProtocol.HttpsAndHttp,
|
|
||||||
startsOn: TEN_MINUTES_BEFORE_NOW,
|
|
||||||
expiresOn: TEN_MINUTES_AFTER_NOW,
|
|
||||||
};
|
|
||||||
|
|
||||||
const sasToken = generateBlobSASQueryParameters(
|
|
||||||
sasOptions,
|
|
||||||
userDelegationKey,
|
|
||||||
accountName
|
|
||||||
).toString();
|
|
||||||
|
|
||||||
return sasToken;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createContainer = async (containerName) => {
|
|
||||||
const creds = new DefaultAzureCredential();
|
|
||||||
|
|
||||||
//containerName = containerName.toLowerCase();
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// "container name:",
|
|
||||||
// containerName,
|
|
||||||
// STORAGE_PATH + "/" + containerName
|
|
||||||
// );
|
|
||||||
|
|
||||||
const containerClient = new ContainerClient(
|
|
||||||
`${STORAGE_PATH}/${containerName}`,
|
|
||||||
creds
|
|
||||||
);
|
|
||||||
|
|
||||||
const blobServiceClient = new BlobServiceClient(`${STORAGE_PATH}`, creds);
|
|
||||||
|
|
||||||
const createContainerResponse = await containerClient.createIfNotExists();
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
"\n//////////////////\n container name :",
|
|
||||||
containerName,
|
|
||||||
"\n//////////////////\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
return containerName;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getContainers = async () => {
|
|
||||||
const creds = new DefaultAzureCredential();
|
|
||||||
const blobServiceClient = new BlobServiceClient(`${STORAGE_PATH}`, creds);
|
|
||||||
|
|
||||||
console.log("Containers:");
|
|
||||||
for await (const container of blobServiceClient.listContainers()) {
|
|
||||||
console.log(`- ${container.name}`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getBlobs = async (containerName, casefolderID) => {
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
|
||||||
|
|
||||||
//conLog"getBlobs " + sasUrl);
|
|
||||||
|
|
||||||
const blobObj = [];
|
|
||||||
for await (const blob of containerClient.listBlobsFlat({
|
|
||||||
prefix: casefolderID + "/files/",
|
|
||||||
})) {
|
|
||||||
let blobDocumentType = blob.name
|
|
||||||
.split("/")[2]
|
|
||||||
.slice(0, blob.name.split("/")[2].indexOf("_"));
|
|
||||||
|
|
||||||
blobObj.push({
|
|
||||||
"name": blob.name.split("/")[2],
|
|
||||||
"path": blob.name,
|
|
||||||
"documentType": blobDocumentType,
|
|
||||||
"versionId": blob.versionId,
|
|
||||||
"caseObj": casefolderID + "/" + casefolderID + "_case.json",
|
|
||||||
"isCurrentVersion": blob.isCurrentVersion,
|
|
||||||
"contentLength": blob.properties.contentLength,
|
|
||||||
"contentType": blob.contentType,
|
|
||||||
"lastModified": blob.properties.lastModified,
|
|
||||||
"filepath":
|
|
||||||
"/api/file/downloadblob?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
casefolderID +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name.split("/")[2],
|
|
||||||
"hashedfilepath": hashAPIPath(
|
|
||||||
"/api/file/downloadblob?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
casefolderID +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name.split("/")[2]
|
|
||||||
),
|
|
||||||
"deletepath":
|
|
||||||
"/api/file/deleteblob?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
casefolderID +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name.split("/")[2],
|
|
||||||
"hasheddeletepath": hashAPIPath(
|
|
||||||
"/api/file/deleteblob?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
casefolderID +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name.split("/")[2]
|
|
||||||
),
|
|
||||||
"hashgetblobs": hashAPIPath(
|
|
||||||
"/api/file/getbloblist?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
casefolderID
|
|
||||||
),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//console.log("blobObj:", blobObj);
|
|
||||||
|
|
||||||
return blobObj;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createBlob = async (formContent, containerName, caseref) => {
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
|
||||||
|
|
||||||
formContent = JSON.parse(formContent);
|
|
||||||
let caseID = "";
|
|
||||||
|
|
||||||
caseID = _.has(formContent, "pinswg_name")
|
|
||||||
? formContent.pinswg_name
|
|
||||||
: caseref;
|
|
||||||
|
|
||||||
const content = JSON.stringify(formContent);
|
|
||||||
|
|
||||||
console.log(content);
|
|
||||||
const blobName = caseID + "/" + caseID + "_appeal.json";
|
|
||||||
|
|
||||||
console.log("blobName:", blobName);
|
|
||||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
|
||||||
|
|
||||||
const uploadBlobResponse = await blockBlobClient.upload(
|
|
||||||
content,
|
|
||||||
Buffer.byteLength(content)
|
|
||||||
);
|
|
||||||
|
|
||||||
const tags = {
|
|
||||||
containerid: containerName,
|
|
||||||
caseID: caseID,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("the tags:", tags);
|
|
||||||
const withTags = await blockBlobClient.setTags(tags);
|
|
||||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
|
||||||
|
|
||||||
return formContent.pinswg_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const deleteBlob = async (containerName, blobName) => {
|
|
||||||
const creds = new DefaultAzureCredential();
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
deleteSnapshots: "include", // or 'only'
|
|
||||||
};
|
|
||||||
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
|
||||||
|
|
||||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
|
||||||
|
|
||||||
await blockBlobClient.delete(options);
|
|
||||||
|
|
||||||
console.log(`deleted blob ${blobName}`);
|
|
||||||
|
|
||||||
return { "deleted": blobName };
|
|
||||||
};
|
|
||||||
|
|
||||||
export const deleteBlobCase = async (containerName, blobName) => {
|
|
||||||
const creds = new DefaultAzureCredential();
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
deleteSnapshots: "include", // or 'only'
|
|
||||||
};
|
|
||||||
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
|
||||||
|
|
||||||
//conLog"deleteBlobCase ");
|
|
||||||
|
|
||||||
console.log("blob to delete:", blobName);
|
|
||||||
|
|
||||||
for await (const blob of containerClient.listBlobsFlat({
|
|
||||||
prefix: blobName,
|
|
||||||
})) {
|
|
||||||
console.log(" ------ :", blob.name);
|
|
||||||
containerClient.deleteBlob(blob.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
containerClient.deleteBlob(blobName);
|
|
||||||
console.log(`deleted blob ${blobName}`);
|
|
||||||
for await (const blob of containerClient.listBlobsFlat()) {
|
|
||||||
console.log(" ------ :", blob.name);
|
|
||||||
}
|
|
||||||
return { "deleted": blobName };
|
|
||||||
};
|
|
||||||
|
|
||||||
export const uploadFile = 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("files...", files, Object.keys(files).length, foldername);
|
|
||||||
|
|
||||||
for (const prop in files) {
|
|
||||||
console.log(`files[${prop}] = ${files[prop][0].size}`);
|
|
||||||
const blobName = foldername + "/files/" + files[prop][0].fieldName;
|
|
||||||
|
|
||||||
console.log(blobName);
|
|
||||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
|
||||||
const uploadBlobResponse = await blockBlobClient.uploadFile(
|
|
||||||
files[prop][0].path,
|
|
||||||
files[prop].size
|
|
||||||
);
|
|
||||||
const tags = {
|
|
||||||
containerid: containerName,
|
|
||||||
caseID: foldername,
|
|
||||||
documentType: files[prop][0].fieldName.slice(
|
|
||||||
0,
|
|
||||||
files[prop][0].fieldName.indexOf("_")
|
|
||||||
),
|
|
||||||
};
|
|
||||||
const withTags = await blockBlobClient.setTags(tags);
|
|
||||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
`Uploaded block blob ${files[prop][0].fieldName} successfully`,
|
|
||||||
uploadBlobResponse.requestId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const downloadFile = async (containerName, blobName) => {
|
|
||||||
//console.log.apply(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(0);
|
|
||||||
|
|
||||||
const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody);
|
|
||||||
return downloaded;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const downloadProgressFile = async (
|
|
||||||
containerName,
|
|
||||||
blobName,
|
|
||||||
casefolderID
|
|
||||||
) => {
|
|
||||||
//console.log.apply(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 downloadAllProgressFiles = async (
|
|
||||||
containerName,
|
|
||||||
progressBlobObj
|
|
||||||
) => {
|
|
||||||
console.log(
|
|
||||||
"/////////////////////////\n downloading files: " +
|
|
||||||
JSON.stringify(progressBlobObj) +
|
|
||||||
"\n/////////////////////////\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
|
||||||
|
|
||||||
let blobClient = {};
|
|
||||||
let downloadedBlob = {};
|
|
||||||
let downloaded = "";
|
|
||||||
let caseBlob = {};
|
|
||||||
let caseDownloaded = "";
|
|
||||||
let blobCount = 0;
|
|
||||||
|
|
||||||
for (const prop in progressBlobObj) {
|
|
||||||
console.log(`Progress - ${prop}: ${progressBlobObj[prop].path}`);
|
|
||||||
blobClient = containerClient.getBlobClient(progressBlobObj[prop].path);
|
|
||||||
downloadedBlob = await blobClient.download(0);
|
|
||||||
downloaded =
|
|
||||||
downloaded +
|
|
||||||
(await streamToBuffer(downloadedBlob.readableStreamBody)) +
|
|
||||||
",";
|
|
||||||
blobCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
downloaded = downloaded.substring(0, downloaded.length - 1);
|
|
||||||
|
|
||||||
for (const prop in progressBlobObj) {
|
|
||||||
console.log(`Cases - ${prop}: ${progressBlobObj[prop].caseObj}`);
|
|
||||||
blobClient = containerClient.getBlobClient(
|
|
||||||
progressBlobObj[prop].caseObj
|
|
||||||
);
|
|
||||||
caseBlob = await blobClient.download(0);
|
|
||||||
caseDownloaded =
|
|
||||||
caseDownloaded +
|
|
||||||
(await streamToBuffer(caseBlob.readableStreamBody)) +
|
|
||||||
",";
|
|
||||||
}
|
|
||||||
|
|
||||||
caseDownloaded = caseDownloaded.substring(0, caseDownloaded.length - 1);
|
|
||||||
|
|
||||||
return JSON.parse(
|
|
||||||
'{ "@odata.count": ' +
|
|
||||||
blobCount +
|
|
||||||
',"value": [' +
|
|
||||||
downloaded +
|
|
||||||
'],"case":[' +
|
|
||||||
caseDownloaded +
|
|
||||||
"]}"
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const streamToBuffer = async (readableStream) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const chunks = [];
|
|
||||||
readableStream.on("data", (data) => {
|
|
||||||
chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
||||||
});
|
|
||||||
readableStream.on("end", () => {
|
|
||||||
resolve(Buffer.concat(chunks));
|
|
||||||
});
|
|
||||||
readableStream.on("error", reject);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getCaseBlob = async (
|
|
||||||
containerName,
|
|
||||||
caseReference,
|
|
||||||
formContent
|
|
||||||
) => {
|
|
||||||
const content = JSON.stringify(formContent);
|
|
||||||
const blobName = caseReference + "/case/" + caseReference + "_case.json";
|
|
||||||
|
|
||||||
const containerBlobToken = await createBlobSas(containerName, blobName);
|
|
||||||
|
|
||||||
const blobSasUrl = `${STORAGE_PATH}/${containerName}/${blobName}?${containerBlobToken}`;
|
|
||||||
|
|
||||||
const blockBlobClient = new BlockBlobClient(blobSasUrl);
|
|
||||||
|
|
||||||
const uploadBlobResponse = await blockBlobClient.upload(
|
|
||||||
content,
|
|
||||||
Buffer.byteLength(content)
|
|
||||||
);
|
|
||||||
return blobName;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getProgressBlobs = async (containerName, caseReference) => {
|
|
||||||
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.listBlobsFlat({
|
|
||||||
prefix: caseReference,
|
|
||||||
})) {
|
|
||||||
blobCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("this is the caasefolder:", caseReference, blobCount);
|
|
||||||
|
|
||||||
let blobObj = [];
|
|
||||||
for await (const blob of containerClient.listBlobsFlat({
|
|
||||||
prefix: caseReference + "/" + caseReference + "_appeal.json",
|
|
||||||
})) {
|
|
||||||
console.log("in here");
|
|
||||||
blobObj.push({
|
|
||||||
"name": blob.name.split("/")[1],
|
|
||||||
"path": blob.name,
|
|
||||||
"versionId": blob.versionId,
|
|
||||||
"caseObj": caseReference + "/" + caseReference + "_case.json",
|
|
||||||
"isCurrentVersion": blob.isCurrentVersion,
|
|
||||||
"contentLength": blob.properties.contentLength,
|
|
||||||
"contentType": blob.contentType,
|
|
||||||
"lastModified": blob.properties.lastModified,
|
|
||||||
"hashedfilepath": hashAPIPath(
|
|
||||||
"/api/file/downloadblob?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
caseReference +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name.split("/")[1]
|
|
||||||
),
|
|
||||||
"hasheddeletepath": hashAPIPath(
|
|
||||||
"/api/file/deleteblob?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
caseReference +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name.split("/")[1]
|
|
||||||
),
|
|
||||||
"hashgetblobs": hashAPIPath(
|
|
||||||
"/api/file/getbloblist?container=" +
|
|
||||||
containerName +
|
|
||||||
"&casefolderID=" +
|
|
||||||
caseReference
|
|
||||||
),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
blobObj = _.sortBy(blobObj, [
|
|
||||||
function (o) {
|
|
||||||
return o.lastModified;
|
|
||||||
},
|
|
||||||
]).reverse()[0];
|
|
||||||
|
|
||||||
//console.log("blobObjwwwww:", blobObj);
|
|
||||||
|
|
||||||
return blobObj;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getAllProgressBlobs = async (containerName) => {
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
|
||||||
|
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
|
||||||
|
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
|
||||||
|
|
||||||
let blobCount = 0;
|
|
||||||
|
|
||||||
let blobObj = [];
|
|
||||||
for await (const blob of containerClient.listBlobsFlat()) {
|
|
||||||
blob.name.split("/")[1].indexOf(".json") > 0 &&
|
|
||||||
blob.name.split("/")[1].indexOf("undefined") < 0 &&
|
|
||||||
blobObj.push({
|
|
||||||
"name": blob.name.split("/")[1],
|
|
||||||
"path": blob.name,
|
|
||||||
"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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//console.log("blobObj:", blobObj);
|
|
||||||
|
|
||||||
return blobObj;
|
|
||||||
};
|
|
||||||
+58
-14
@@ -1,5 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { hashAPIPath, consoleLogger } from "./";
|
import { hashAPIPath } from "./";
|
||||||
|
|
||||||
const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT;
|
const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT;
|
||||||
const ggClientID = process.env.GG_CLIENT_ID;
|
const ggClientID = process.env.GG_CLIENT_ID;
|
||||||
@@ -8,19 +8,6 @@ const WEBAPI_URL =
|
|||||||
process.env.RELAY_ROOT ||
|
process.env.RELAY_ROOT ||
|
||||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||||
|
|
||||||
const azureHeaders = (access_token) => {
|
|
||||||
return {
|
|
||||||
headers: {
|
|
||||||
"OData-MaxVersion": "4.0",
|
|
||||||
"OData-Version": "4.0",
|
|
||||||
"Accept": "application/json;odata.metadata=none",
|
|
||||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Authorization": "Bearer " + access_token,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getProviderConfig = () => {
|
export const getProviderConfig = () => {
|
||||||
return axios
|
return axios
|
||||||
.get(configEndpoint)
|
.get(configEndpoint)
|
||||||
@@ -31,6 +18,37 @@ export const getProviderConfig = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getGGToken = (tokenURL, authCode, redirectUri) => {
|
||||||
|
const tokenBody =
|
||||||
|
"grant_type=authorization_code" +
|
||||||
|
"&code=" +
|
||||||
|
authCode +
|
||||||
|
"&redirect_uri=" +
|
||||||
|
redirectUri;
|
||||||
|
|
||||||
|
const basicAuthBase64 = (ggClientID + ":" + ggClientSecret).toString();
|
||||||
|
//console.log("base64 " + Base64.encode(basicAuthBase64));
|
||||||
|
|
||||||
|
const tokenConfig = {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Authorization": "Basic " + Base64.encode(basicAuthBase64),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.post(tokenURL, tokenBody, tokenConfig)
|
||||||
|
.then((res) => res.data)
|
||||||
|
.catch((error) => {
|
||||||
|
// if (error.response) {
|
||||||
|
// console.log(error.response.data);
|
||||||
|
// console.log(error.response.status);
|
||||||
|
// console.log(error.response.headers);
|
||||||
|
// }
|
||||||
|
return error.response;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const getUserInfo = (userInfoURL, authToken) => {
|
export const getUserInfo = (userInfoURL, authToken) => {
|
||||||
const tokenConfig = {
|
const tokenConfig = {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -47,6 +65,32 @@ export const getUserInfo = (userInfoURL, authToken) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getPortalLogin = (emailAddress, token) => {
|
||||||
|
var queryUrl =
|
||||||
|
"contacts?$filter=emailaddress1 eq '" +
|
||||||
|
emailAddress +
|
||||||
|
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then((res) => res.data)
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("thiserror", error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const azureHeaders = (access_token) => {
|
||||||
|
return {
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json;odata.metadata=none",
|
||||||
|
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Authorization": "Bearer " + access_token,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
var Base64 = {
|
var Base64 = {
|
||||||
_keyStr:
|
_keyStr:
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||||
|
|||||||
+108
-759
File diff suppressed because it is too large
Load Diff
+16
-32
@@ -1,63 +1,47 @@
|
|||||||
export const getSelectQuery = (appealTypeName) => {
|
export const getSelectQuery = (appealTypeName) => {
|
||||||
switch (appealTypeName) {
|
switch (appealTypeName) {
|
||||||
case "pinswg_advertses":
|
case "pinswg_advertses":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode";
|
||||||
break;
|
break;
|
||||||
case "pinswg_callinss77s":
|
case "pinswg_callinss77s":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode,pinswg_dateexportedtoiss,pinswg_startdateofevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode";
|
||||||
break;
|
break;
|
||||||
case "pinswg_commonlands":
|
case "pinswg_commonlands":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_starttimeoftheevent,pinswg_typeofevent";
|
|
||||||
break;
|
|
||||||
case "pinswg_environmentalpermittings":
|
case "pinswg_environmentalpermittings":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
|
||||||
break;
|
|
||||||
case "pinswg_hedgeshedgerowstreepreservationreplacems":
|
case "pinswg_hedgeshedgerowstreepreservationreplacems":
|
||||||
case "pinswg_miscellaneouscaseworks":
|
case "pinswg_miscellaneouscaseworks":
|
||||||
case "pinswg_wayleaves":
|
case "pinswg_wayleaves":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
|
||||||
break;
|
break;
|
||||||
case "pinswg_communityinfrastructurelevys117118119s":
|
case "pinswg_communityinfrastructurelevys117118119s":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_startdate,statuscode";
|
||||||
break;
|
break;
|
||||||
case "pinswg_compulsorypurchaseorderses":
|
case "pinswg_compulsorypurchaseorderses":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_dnses":
|
case "pinswg_dnses":
|
||||||
return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,_pinswg_dnsids_value,pinswg_startdateofevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectdescription,pinswg_projectlocation,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_electricityacts":
|
case "pinswg_electricityacts":
|
||||||
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_householderappealhases":
|
case "pinswg_householderappealhases":
|
||||||
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_otherpartiesstatement,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
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_otherpartiesstatement,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_enforcementnoticeappeals174s":
|
case "pinswg_enforcementnoticeappeals174s":
|
||||||
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_startdateoftheevent,pinswg_typeofevent";
|
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";
|
||||||
break;
|
|
||||||
case "pinswg_enforcementlistedbuildingconservationaps":
|
case "pinswg_enforcementlistedbuildingconservationaps":
|
||||||
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_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
|
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_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_maintenanceoflands217s":
|
case "pinswg_maintenanceoflands217s":
|
||||||
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_startdates,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
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_startdates,pinswg_statementduedate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_lawfuldevelopmentcertificates":
|
case "pinswg_lawfuldevelopmentcertificates":
|
||||||
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_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
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_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_listedbuildingandconservationareaconsens":
|
case "pinswg_listedbuildingandconservationareaconsens":
|
||||||
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";
|
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";
|
||||||
break;
|
|
||||||
case "pinswg_planningappeals78s":
|
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";
|
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_planningconditionss73s79s":
|
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";
|
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";
|
||||||
break;
|
|
||||||
case "pinswg_planningobligationappeals106s":
|
case "pinswg_planningobligationappeals106s":
|
||||||
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_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
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_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
|
||||||
break;
|
|
||||||
case "pinswg_rows":
|
case "pinswg_rows":
|
||||||
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_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent";
|
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_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
{"@odata.context":"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/$metadata#contacts(address1_addressid,address1_addresstypecode,address1_city,address1_country,address1_county,address1_fax,firstname,lastname)",value:[0:{@odata.etag:"W/"509484"",address1_addressid:"6c267cf9-1ba2-4e38-9f48-2b94a341e392",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname: null ,lastname:"Trembath",contactid:"9d481bc3-7c64-eb11-aaba-00224800be9c"},1:{@odata.etag:"W/"509501"",address1_addressid:"9a546d64-b7b5-42bf-bafd-b547e718fddd",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname: null ,lastname:"Jones",contactid:"1e2e0e6f-7e64-eb11-aaba-00224800be9c"},2:{@odata.etag:"W/"509506"",address1_addressid:"214e5b63-9bc8-478a-90e2-39417d9e096b",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname: null ,lastname:"Thomas",contactid:"d1658f77-7e64-eb11-aaba-00224800be9c"},3:{@odata.etag:"W/"694902"",address1_addressid:"6258fd0c-2d18-41dd-b629-123c880f16a1",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"James",lastname:"Hollowhead",contactid:"755e07ea-82ad-eb11-aac3-00224800be9c"},4:{@odata.etag:"W/"694906"",address1_addressid:"436104d2-5ee0-4494-b0f8-3059f738e9cf",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"T",lastname:"Gillbert",contactid:"b8022d00-83ad-eb11-aac3-00224800be9c"},5:{@odata.etag:"W/"694910"",address1_addressid:"36e9cccc-ac84-4023-ae92-d6b9556d8ddf",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Mike",lastname:"Parker",contactid:"99b3220f-83ad-eb11-aac3-00224800be9c"},6:{@odata.etag:"W/"694914"",address1_addressid:"83169722-1283-4a4c-b346-28f50cd208cd",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Lloyd",lastname:"Evans",contactid:"5bee9821-83ad-eb11-aac3-00224800be9c"},7:{@odata.etag:"W/"694918"",address1_addressid:"a164b5d8-f9d2-46d4-b97b-b59327173f0a",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Mr",lastname:"Bartlett",contactid:"c2be7d2e-83ad-eb11-aac3-00224800be9c"},8:{@odata.etag:"W/"709237"",address1_addressid:"b75d552e-3896-46a7-bd65-a743f457f119",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Zoe",lastname:"Dawson",contactid:"003eef05-29ba-eb11-aac4-00224800be9c"},9:{@odata.etag:"W/"750707"",address1_addressid:"34bbd453-7d23-4c17-806e-1edf2e981cc8",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Appellant Contact",lastname:"Gary Trembath",contactid:"985cc5f8-1dd8-eb11-aac5-00224800be9c"},10:{@odata.etag:"W/"750703"",address1_addressid:"20ce70a9-571c-4a81-b410-f521d64d3dcb",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address1_fax: null ,firstname:"Agent Contact",lastname:"Gary Trembath",contactid:"9eb124a5-1ed8-eb11-aac5-00224800be9c"},11:{@odata.etag:"W/"750860"",address1_addressid:"a6a4641c-0875-4d5e-8360-99355eb73ee4",address1_addresstypecode: null ,address1_city: null ,address1_country: null ,address1_county: null ,address
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
0:{@odata.context:"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/$metadata#accounts(name)",value:[0:{@odata.etag:"W/"547952"",name:"Bridgend CBC",accountid:"56e7ef63-7e64-eb11-aaba-00224800be9c"},1:{@odata.etag:"W/"694923"",name:"Bishop Landaff High School",accountid:"c9389617-82ad-eb11-aac3-00224800be9c"},2:{@odata.etag:"W/"694925"",name:"Stanwell High school",accountid:"24537624-82ad-eb11-aac3-00224800be9c"},3:{@odata.etag:"W/"694927"",name:"Barry Boys High School",accountid:"80d99a34-82ad-eb11-aac3-00224800be9c"},4:{@odata.etag:"W/"694929"",name:"St Sirus High School",accountid:"6d337b5a-82ad-eb11-aac3-00224800be9c"},5:{@odata.etag:"W/"694931"",name:"Fitzalan High School",accountid:"984d0e75-82ad-eb11-aac3-00224800be9c"},6:{@odata.etag:"W/"709453"",name:"Zoe",accountid:"41fead24-29ba-eb11-aac4-00224800be9c"},7:{@odata.etag:"W/"755017"",name:"Blaenau Gwent County Borough Council",accountid:"744c69f4-48da-eb11-aac5-00224800be9c"},8:{@odata.etag:"W/"755020"",name:"Caerphilly County Borough Council",accountid:"243c0009-49da-eb11-aac5-00224800be9c"},9:{@odata.etag:"W/"755026"",name:"Bridgend County Borough Council",accountid:"c35f6f84-49da-eb11-aabd-00224800d1bd"},10:{@odata.etag:"W/"755029"",name:"Cardiff Council",accountid:"c75f6f84-49da-eb11-aabd-00224800d1bd"},11:{@odata.etag:"W/"755032"",name:"Carmarthenshire County Council",accountid:"c95f6f84-49da-eb11-aabd-00224800d1bd"},12:{@odata.etag:"W/"755035"",name:"Ceredigion County Council",accountid:"cb5f6f84-49da-eb11-aabd-00224800d1bd"},13:{@odata.etag:"W/"755038"",name:"Conwy County Borough Council",accountid:"cd5f6f84-49da-eb11-aabd-00224800d1bd"},14:{@odata.etag:"W/"755041"",name:"Denbighshire County Council",accountid:"cf5f6f84-49da-eb11-aabd-00224800d1bd"},15:{@odata.etag:"W/"755044"",name:"Flintshire County Council",accountid:"d15f6f84-49da-eb11-aabd-00224800d1bd"},16:{@odata.etag:"W/"755047"",name:"Gwynedd Council",accountid:"d35f6f84-49da-eb11-aabd-00224800d1bd"},17:{@odata.etag:"W/"755050"",name:"Isle of Anglesey County Council",accountid:"d55f6f84-49da-eb11-aabd-00224800d1bd"},18:{@odata.etag:"W/"755053"",name:"Merthyr Tydfil County Borough Council",accountid:"d75f6f84-49da-eb11-aabd-00224800d1bd"},19:{@odata.etag:"W/"755056"",name:"Monmouthshire County Council",accountid:"d95f6f84-49da-eb11-aabd-00224800d1bd"},20:{@odata.etag:"W/"755059"",name:"Neath Port Talbot County Borough Council",accountid:"db5f6f84-49da-eb11-aabd-00224800d1bd"},21:{@odata.etag:"W/"755062"",name:"Newport City Council",accountid:"dd5f6f84-49da-eb11-aabd-00224800d1bd"},22:{@odata.etag:"W/"755065"",name:"Pembrokeshire County Council",accountid:"df5f6f84-49da-eb11-aabd-00224800d1bd"},23:{@odata.etag:"W/"755068"",name:"Powys County Council",accountid:"e15f6f84-49da-eb11-aabd-00224800d1bd"},24:{@odata.etag:"W/"755071"",name:"Rhondda Cynon Taf County Borough Council",accountid:"e35f6f84-49da-eb11-aabd-00224800d1bd"},25:{@odata.etag:"W/"755074"",name:"Swansea Council",accountid:"e55f6f84-49da-eb11-aabd-00224800d1bd"},26:{@odata.etag:"W/"755077"",name:"Torfaen County Borough Council",accountid:"e75f6f84-49da-eb11-aabd-00224800d1bd"},27:{@odata.etag:"W/"755080"",name:"Vale of Glamorgan Council",accountid:"e95f6f84-49da-eb11-aabd-00224800d1bd"},28:{@odata.etag:"W/"755083"",name:"Wrexham County Borough Council",accountid:"eb5f6f84-49da-eb11-aabd-00224800d1bd"}]}
|
||||||
@@ -112,17 +112,6 @@ let PersonalDetails = (props) => {
|
|||||||
About you
|
About you
|
||||||
</h2>
|
</h2>
|
||||||
</legend>
|
</legend>
|
||||||
<div className="govuk-form-group ">
|
|
||||||
<span className="govuk-label ">
|
|
||||||
Role:{" "}
|
|
||||||
{
|
|
||||||
props.props.accountDetails
|
|
||||||
.accountDetails[
|
|
||||||
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<Field
|
<Field
|
||||||
name="firstname"
|
name="firstname"
|
||||||
id="firstname"
|
id="firstname"
|
||||||
|
|||||||
@@ -99,10 +99,7 @@ const RegisterComplete = (props) => {
|
|||||||
<a
|
<a
|
||||||
className="govuk-link"
|
className="govuk-link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLogout(),
|
setLogout(), window.localStorage.clear();
|
||||||
window.localStorage.clear(),
|
|
||||||
destroyCookie({}, "pinsUser"),
|
|
||||||
signOut({ callbackUrl: "/logout" });
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t(
|
{t(
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ const RegisterForm = (props) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <Field
|
<Field
|
||||||
name="pinswg_custom_password"
|
name="pinswg_custom_password"
|
||||||
id="pinswg_custom_password"
|
id="pinswg_custom_password"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
@@ -226,7 +226,7 @@ const RegisterForm = (props) => {
|
|||||||
errorMsg={t(
|
errorMsg={t(
|
||||||
"account:register-new-account-confirm-password-label-errormsg"
|
"account:register-new-account-confirm-password-label-errormsg"
|
||||||
)}
|
)}
|
||||||
/> */}
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset className="govuk-fieldset">
|
<fieldset className="govuk-fieldset">
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||||
|
|||||||
+30
-194
@@ -5,7 +5,6 @@ import { useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import LoadingOverlay from "react-loading-overlay";
|
import LoadingOverlay from "react-loading-overlay";
|
||||||
import { getSession, useSession } from "next-auth/react";
|
|
||||||
|
|
||||||
const Breadcrumbs = (props) => {
|
const Breadcrumbs = (props) => {
|
||||||
const { courseContent, slug, currentView } = props;
|
const { courseContent, slug, currentView } = props;
|
||||||
@@ -46,9 +45,6 @@ const Breadcrumbs = (props) => {
|
|||||||
// ? setShowSpinnerState(false)
|
// ? setShowSpinnerState(false)
|
||||||
// : setShowSpinnerState(true);
|
// : setShowSpinnerState(true);
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const { data: session, status } = useSession();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<nav
|
<nav
|
||||||
@@ -68,9 +64,17 @@ const Breadcrumbs = (props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
</li> */}
|
</li> */}
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
<Link href={"/"}>
|
<Link
|
||||||
|
href={
|
||||||
|
router.pathname.includes("/dns/")
|
||||||
|
? "/dns"
|
||||||
|
: "/"
|
||||||
|
}
|
||||||
|
>
|
||||||
<a className="govuk-breadcrumbs__link">
|
<a className="govuk-breadcrumbs__link">
|
||||||
{t("common:service-name-breadcrumb")}
|
{router.pathname.includes("/dns/")
|
||||||
|
? t("dnsCommon:service-name")
|
||||||
|
: t("common:service-name-breadcrumb")}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
@@ -234,53 +238,6 @@ const Breadcrumbs = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
{router.pathname == "/newappeal/[appealtypes]" ? (
|
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale != "en"
|
|
||||||
? router.locale + "/myportal"
|
|
||||||
: "/myportal"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="govuk-breadcrumbs__link">
|
|
||||||
{t("newappeal:parent-page-title")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("newappeal:page-title")}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{router.pathname == "/myportal/[appealtypes]" ? (
|
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale != "en"
|
|
||||||
? router.locale + "/myportal"
|
|
||||||
: "/myportal"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="govuk-breadcrumbs__link">
|
|
||||||
{t("newappeal:parent-page-title")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("newappeal:page-title")}
|
|
||||||
</li>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{props.formTitle}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{router.pathname == "/newappeal/selectappeal" ? (
|
{router.pathname == "/newappeal/selectappeal" ? (
|
||||||
<>
|
<>
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
@@ -344,9 +301,7 @@ const Breadcrumbs = (props) => {
|
|||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
router.locale != "en"
|
router.locale != "en"
|
||||||
? "/" +
|
? router.locale + "/myportal"
|
||||||
router.locale +
|
|
||||||
"/myportal"
|
|
||||||
: "/myportal"
|
: "/myportal"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -356,20 +311,7 @@ const Breadcrumbs = (props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
{currentView.viewKey ==
|
{currentView.viewName}
|
||||||
"awaitingSubmissionDetails" &&
|
|
||||||
t(
|
|
||||||
"myportal:awatitingsubmission-card-title"
|
|
||||||
)}
|
|
||||||
{currentView.viewKey == "watchedCases" &&
|
|
||||||
t("myportal:watchedcases-card-title")}
|
|
||||||
{currentView.viewKey == "myCases" &&
|
|
||||||
t("myportal:mycases-card-title")}
|
|
||||||
{currentView.viewKey ==
|
|
||||||
"myRepresentations" &&
|
|
||||||
t(
|
|
||||||
"myportal:myrepresentations-card-title"
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@@ -414,64 +356,6 @@ const Breadcrumbs = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{router.pathname == "/myportal/dnsapplications" ? (
|
|
||||||
<>
|
|
||||||
{" "}
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale != "en"
|
|
||||||
? router.locale + "/myportal"
|
|
||||||
: "/myportal"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="govuk-breadcrumbs__link">
|
|
||||||
{t("common:breadcrumb-my-portal")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("dnsCommon:service-name")}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{router.pathname == "/myportal/dnsdetails" ? (
|
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale != "en"
|
|
||||||
? router.locale + "/myportal"
|
|
||||||
: "/myportal"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="govuk-breadcrumbs__link">
|
|
||||||
{t("common:breadcrumb-my-portal")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
<Link href={"/myportal/dnsapplications"}>
|
|
||||||
<a className="govuk-breadcrumbs__link">
|
|
||||||
{t("dnsCommon:service-name")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("common:breadcrumb-case-reference")}:{" "}
|
|
||||||
{
|
|
||||||
props.props.currentView.caseReference
|
|
||||||
.currentReference
|
|
||||||
}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
|
|
||||||
{router.pathname == "/case" ? (
|
{router.pathname == "/case" ? (
|
||||||
<>
|
<>
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
@@ -513,24 +397,19 @@ const Breadcrumbs = (props) => {
|
|||||||
)}
|
)}
|
||||||
{router.pathname == "/myportal/representation" ? (
|
{router.pathname == "/myportal/representation" ? (
|
||||||
<>
|
<>
|
||||||
{session != null && (
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<Link
|
||||||
<Link
|
href={
|
||||||
href={
|
router.locale != "en"
|
||||||
router.locale != "en"
|
? router.locale + "/myportal"
|
||||||
? router.locale +
|
: "/myportal"
|
||||||
"/myportal"
|
}
|
||||||
: "/myportal"
|
>
|
||||||
}
|
<a className="govuk-breadcrumbs__link">
|
||||||
>
|
{t("common:breadcrumb-my-portal")}
|
||||||
<a className="govuk-breadcrumbs__link">
|
</a>
|
||||||
{t(
|
</Link>
|
||||||
"common:breadcrumb-my-portal"
|
</li>
|
||||||
)}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
Make representation for:{" "}
|
Make representation for:{" "}
|
||||||
{
|
{
|
||||||
@@ -596,22 +475,13 @@ const Breadcrumbs = (props) => {
|
|||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
{router.pathname == "/dns" ? (
|
{router.pathname == "/dns" ? (
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("dnsCommon:service-name")}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{router.pathname == "/dns/[developmentName]" ? (
|
|
||||||
<>
|
<>
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
router.locale == "en"
|
router.locale != "en"
|
||||||
? router.locale + "/../../dns"
|
? router.locale + "/dns"
|
||||||
: "/../../dns"
|
: "/dns"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<a className="govuk-breadcrumbs__link">
|
<a className="govuk-breadcrumbs__link">
|
||||||
@@ -619,13 +489,6 @@ const Breadcrumbs = (props) => {
|
|||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("common:breadcrumb-case-reference")}:{" "}
|
|
||||||
{
|
|
||||||
props.props.currentView.caseReference
|
|
||||||
.currentReference
|
|
||||||
}
|
|
||||||
</li>
|
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
@@ -765,34 +628,7 @@ const Breadcrumbs = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
{router.pathname == "/auth/signin" ? (
|
{!_.isEmpty(slug) ? (
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("auth:auth-page-title")}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{router.pathname == "/auth/verify-request" ? (
|
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("auth:auth-check-email-page-title")}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{router.pathname == "/auth/error" ? (
|
|
||||||
<>
|
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
|
||||||
{t("auth:auth-error-signin-error-title")}
|
|
||||||
</li>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
{/* {!_.isEmpty(slug) ? (
|
|
||||||
<>
|
<>
|
||||||
<li className="govuk-breadcrumbs__list-item">
|
<li className="govuk-breadcrumbs__list-item">
|
||||||
<Link
|
<Link
|
||||||
@@ -826,7 +662,7 @@ const Breadcrumbs = (props) => {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)} */}
|
)}
|
||||||
|
|
||||||
<Breadcrumb />
|
<Breadcrumb />
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
+2
-2
@@ -35,8 +35,6 @@ const Case = (props) => {
|
|||||||
searchDetailsObj={props.searchDetailsObj}
|
searchDetailsObj={props.searchDetailsObj}
|
||||||
searchString={props.searchString}
|
searchString={props.searchString}
|
||||||
incidentid={props.incidentid}
|
incidentid={props.incidentid}
|
||||||
showMap={props.showMap}
|
|
||||||
showLoginCheck={props.showLoginCheck}
|
|
||||||
/>
|
/>
|
||||||
<Documents
|
<Documents
|
||||||
incidentid={props.incidentid}
|
incidentid={props.incidentid}
|
||||||
@@ -44,6 +42,7 @@ const Case = (props) => {
|
|||||||
searchResultsObj={props.searchResultsObj}
|
searchResultsObj={props.searchResultsObj}
|
||||||
searchDetailsObj={props.searchDetailsObj}
|
searchDetailsObj={props.searchDetailsObj}
|
||||||
documentDetailsObj={props.documentDetailsObj}
|
documentDetailsObj={props.documentDetailsObj}
|
||||||
|
documentHistoryObj={props.documentHistoryObj}
|
||||||
/>
|
/>
|
||||||
{showRepresentations == "true" && (
|
{showRepresentations == "true" && (
|
||||||
<RepresentationList
|
<RepresentationList
|
||||||
@@ -51,6 +50,7 @@ const Case = (props) => {
|
|||||||
caseReference={props.caseReference}
|
caseReference={props.caseReference}
|
||||||
representationsObj={props.representationsObj}
|
representationsObj={props.representationsObj}
|
||||||
documentDetailsObj={props.documentDetailsObj}
|
documentDetailsObj={props.documentDetailsObj}
|
||||||
|
documentHistoryObj={props.documentHistoryObj}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+195
-358
@@ -2,26 +2,27 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import jsonpath from "jsonpath";
|
import jsonpath from "jsonpath";
|
||||||
import { useState, useEffect, useRef, useCallback } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
import transLookup from "../../data/lookuptranslations.json";
|
||||||
import PaginationControl from "./pagination";
|
import PaginationControl from "./pagination";
|
||||||
import LoadingOverlay from "react-loading-overlay";
|
import LoadingOverlay from "react-loading-overlay";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
|
||||||
import { setCurrentPage } from "../../store/currentView/action";
|
|
||||||
import {
|
import {
|
||||||
getBasicSearch,
|
getBasicSearch,
|
||||||
getBasicSearchDetails,
|
getBasicSearchDetails,
|
||||||
getSearchDocumentDetails,
|
getSearchDocumentDetails,
|
||||||
|
getSearchDocumentHistory,
|
||||||
|
getSearchDocumentHistoryPaged,
|
||||||
getSearchDocumentDetailsPaged,
|
getSearchDocumentDetailsPaged,
|
||||||
getSearchDocumentTypes,
|
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
setSearchResults,
|
setSearchResults,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
setDocumentDetails,
|
setDocumentDetails,
|
||||||
|
setDocumentHistory,
|
||||||
getSearchResultsObj,
|
getSearchResultsObj,
|
||||||
} from "../../store/searchOutput/action";
|
} from "../../store/searchOutput/action";
|
||||||
|
|
||||||
@@ -34,8 +35,9 @@ const DocumentDetails = (props) => {
|
|||||||
searchResultsObj,
|
searchResultsObj,
|
||||||
searchDetailsObj,
|
searchDetailsObj,
|
||||||
documentDetailsObj,
|
documentDetailsObj,
|
||||||
|
documentHistoryObj,
|
||||||
setDocumentDetails,
|
setDocumentDetails,
|
||||||
setCurrentPage,
|
setDocumentHistory,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -43,13 +45,10 @@ const DocumentDetails = (props) => {
|
|||||||
|
|
||||||
var documentDetailsArr = documentDetailsObj || [];
|
var documentDetailsArr = documentDetailsObj || [];
|
||||||
|
|
||||||
const [selectedOption, setSelectedOption] = useState(10);
|
|
||||||
const [documentTypes, setDocumentTypes] = useState([{}]);
|
|
||||||
const [selectedDocumentType, setSelectedDocumentType] = useState("all");
|
|
||||||
|
|
||||||
const DocumentView = (documentDetailsArr) => {
|
const DocumentView = (documentDetailsArr) => {
|
||||||
documentDetailsArr = documentDetailsArr.value;
|
//console.log(documentDetailsArr);
|
||||||
|
|
||||||
|
documentDetailsArr = documentDetailsArr.value;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>
|
||||||
@@ -61,279 +60,130 @@ const DocumentDetails = (props) => {
|
|||||||
? t("case:documents-count-label-2")
|
? t("case:documents-count-label-2")
|
||||||
: t("case:documents-count-label-2a")}
|
: t("case:documents-count-label-2a")}
|
||||||
</p>
|
</p>
|
||||||
<div className="documentFilters govuk-!-margin-top-5">
|
|
||||||
<div
|
|
||||||
id="recordDocumentTypeSelect"
|
|
||||||
className="govuk-grid-row govuk-!-margin-left-0"
|
|
||||||
>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label className="govuk-label-s " htmlFor="sort">
|
|
||||||
{t("case:documents-show-label")}
|
|
||||||
<select
|
|
||||||
onChange={(e) => {
|
|
||||||
setSelectedDocumentType(e.target.value);
|
|
||||||
setCurrentPage(1);
|
|
||||||
}}
|
|
||||||
value={selectedDocumentType}
|
|
||||||
className="govuk-select"
|
|
||||||
id="showDocumentType"
|
|
||||||
name="showDocumentType"
|
|
||||||
>
|
|
||||||
<option value="all">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="All")].value_cy'
|
|
||||||
)
|
|
||||||
: "All"}
|
|
||||||
</option>
|
|
||||||
{documentTypes.map((item, key) => {
|
|
||||||
return (
|
|
||||||
<option
|
|
||||||
key={key}
|
|
||||||
value={
|
|
||||||
item.pinswg_isharedocumentlocations
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
item.pinswg_isharedocumentlocationsLabel +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: item.pinswg_isharedocumentlocationsLabel ||
|
|
||||||
t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
|
||||||
{t("case:documents-count-label-2")}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{documentDetailsObj["@odata.count"] > 5 && (
|
|
||||||
<div
|
|
||||||
id="recordCountSelect"
|
|
||||||
className="govuk-grid-row govuk-!-margin-left-0"
|
|
||||||
>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label
|
|
||||||
className="govuk-label-s "
|
|
||||||
htmlFor="sort"
|
|
||||||
>
|
|
||||||
{t(
|
|
||||||
"search:searchresults-show-records-label-a"
|
|
||||||
)}
|
|
||||||
<select
|
|
||||||
onChange={(e) => {
|
|
||||||
setSelectedOption(e.target.value);
|
|
||||||
setCurrentPage(1);
|
|
||||||
}}
|
|
||||||
value={selectedOption}
|
|
||||||
className="govuk-select"
|
|
||||||
id="showNumberOfRecords"
|
|
||||||
name="showNumberOfRecords"
|
|
||||||
>
|
|
||||||
<option value="5">5</option>
|
|
||||||
<option value="10">10</option>
|
|
||||||
<option value="20">20</option>
|
|
||||||
<option value="30">30</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
</select>{" "}
|
|
||||||
{t(
|
|
||||||
"search:searchresults-show-records-label-b"
|
|
||||||
)}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<dl className="documentList govuk-summary-list govuk-!-margin-bottom-9 results">
|
<dl className="documentList govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||||
<div className="govuk-summary-list__row results-headings">
|
<div className="govuk-summary-list__row results-headings">
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 ">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16 ">
|
||||||
<button
|
{t("case:documents-name-label")}
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("pinswg_name")}
|
|
||||||
className={
|
|
||||||
orderByState == "pinswg_name"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("case:documents-name-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{/* {t("case:documents-doc-type-label")} */}
|
{t("case:documents-doc-type-label")}
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() =>
|
|
||||||
sortDataBy("pinswg_isharedocumentlocations")
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
orderByState ==
|
|
||||||
"pinswg_isharedocumentlocations"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("case:documents-doc-type-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{/* {t("case:documents-date-published-label")} */}
|
{t("case:documents-date-published-label")}
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("createdon")}
|
|
||||||
className={
|
|
||||||
orderByState == "createdon"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("case:documents-date-published-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
{/* <dd className="govuk-summary-list__key govuk-!-font-size-16">
|
{/* <dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("case:documents-size-label")}
|
{t("case:documents-size-label")}
|
||||||
</dd> */}
|
</dd> */}
|
||||||
</div>
|
</div>
|
||||||
{showSpinnerState == true ? (
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<div className="govuk-!-margin-top-4 govuk-!-margin-bottom-4 govuk-!-font-weight-bold govuk-!-font-size-20 ">
|
|
||||||
{t("common:spinner-fetching-data")}
|
|
||||||
<img
|
|
||||||
className="data-loading-icon"
|
|
||||||
src="/assets/images/loading.gif"
|
|
||||||
alt={
|
|
||||||
router.locale == "cy"
|
|
||||||
? "Nôl data"
|
|
||||||
: "Fetching data"
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
documentDetailsArr.map((item, key) => {
|
|
||||||
let detailsObj = jsonpath.query(
|
|
||||||
item,
|
|
||||||
"$..[?(@._pinswg_documentids_value=='" +
|
|
||||||
incidentid +
|
|
||||||
"')]"
|
|
||||||
);
|
|
||||||
detailsObj = item;
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="govuk-summary-list__row"
|
|
||||||
key={key}
|
|
||||||
>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
|
||||||
{showDownloadingState === key && (
|
|
||||||
<div className="coverLoadingLink downloading">
|
|
||||||
{/* <img
|
|
||||||
className="data-loading-icon"
|
|
||||||
src="/assets/images/loading.gif"
|
|
||||||
alt={
|
|
||||||
router.locale ==
|
|
||||||
"cy"
|
|
||||||
? "Nôl data"
|
|
||||||
: "Fetching data"
|
|
||||||
}
|
|
||||||
/> */}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Link
|
{documentDetailsArr.map((item) => {
|
||||||
scroll={false}
|
let detailsObj = jsonpath.query(
|
||||||
href={detailsObj.pinswg_hashlink}
|
item,
|
||||||
|
"$..[?(@._pinswg_documentids_value=='" +
|
||||||
|
incidentid +
|
||||||
|
"')]"
|
||||||
|
);
|
||||||
|
detailsObj = item;
|
||||||
|
|
||||||
|
if (typeof detailsObj != "undefined") {
|
||||||
|
var documentHistoryArr = documentHistoryObj || [];
|
||||||
|
return documentHistoryArr.map(
|
||||||
|
(historyItem, key) => {
|
||||||
|
let historyObj = jsonpath.query(
|
||||||
|
documentHistoryObj[key],
|
||||||
|
"$..value[?(@._pinswg_documentid_value=='" +
|
||||||
|
detailsObj.pinswg_documentid +
|
||||||
|
"')]"
|
||||||
|
);
|
||||||
|
|
||||||
|
historyObj = historyObj[0];
|
||||||
|
return !_.isEmpty(historyObj) ? (
|
||||||
|
<div
|
||||||
|
className="govuk-summary-list__row"
|
||||||
|
key={key}
|
||||||
>
|
>
|
||||||
<a
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
key={key}
|
<a
|
||||||
onClick={() => {
|
href={
|
||||||
toggleDownLoadLink(key);
|
detailsObj.pinswg_hashlink
|
||||||
}}
|
}
|
||||||
>
|
>
|
||||||
|
<span className="results-visually-hidden">
|
||||||
|
{t(
|
||||||
|
"case:documents-name-label"
|
||||||
|
)}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
{_.has(historyObj, [
|
||||||
|
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue",
|
||||||
|
])
|
||||||
|
? historyObj[
|
||||||
|
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue"
|
||||||
|
]
|
||||||
|
: ""}
|
||||||
|
</a>
|
||||||
|
</dd>
|
||||||
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t(
|
{t(
|
||||||
"case:documents-name-label"
|
"case:documents-doc-type-label"
|
||||||
)}
|
)}
|
||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_name"
|
|
||||||
)
|
|
||||||
? detailsObj.pinswg_name
|
|
||||||
: ""}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</dd>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t("case:documents-doc-type-label")}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.value=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj[
|
detailsObj[
|
||||||
|
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||||
|
] +
|
||||||
|
'")].value_cy'
|
||||||
|
)
|
||||||
|
: detailsObj[
|
||||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||||
] +
|
] ||
|
||||||
'")].value_cy'
|
t(
|
||||||
)
|
"case:summary-no-date-entered-label"
|
||||||
: detailsObj[
|
)}
|
||||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
</dd>
|
||||||
] ||
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
t(
|
<span className="results-visually-hidden">
|
||||||
"case:summary-no-date-entered-label"
|
{t(
|
||||||
)}
|
"case:documents-date-published-label"
|
||||||
</dd>
|
)}
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
:
|
||||||
<span className="results-visually-hidden">
|
</span>
|
||||||
{t(
|
|
||||||
"case:documents-date-published-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{_.has(
|
{_.has(historyObj, [
|
||||||
detailsObj,
|
"pinswg_publisheddate@OData.Community.Display.V1.FormattedValue",
|
||||||
"pinswg_latestpublisheddate"
|
])
|
||||||
)
|
? formatDates(
|
||||||
? formatDates(
|
historyObj[
|
||||||
detailsObj.pinswg_latestpublisheddate
|
"pinswg_publisheddate@OData.Community.Display.V1.FormattedValue"
|
||||||
)
|
]
|
||||||
: ""}
|
)
|
||||||
</dd>
|
: ""}
|
||||||
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
</dd>
|
||||||
|
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t("case:documents-size-label")}:
|
{t("case:documents-size-label")}:
|
||||||
</span>
|
</span>
|
||||||
92
|
92
|
||||||
</dd> */}
|
</dd> */}
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
})
|
}
|
||||||
)}
|
})}
|
||||||
</dl>
|
</dl>
|
||||||
<PaginationControl
|
<PaginationControl
|
||||||
showNoOfRecords={selectedOption}
|
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
searchResultsObj={documentDetailsObj}
|
searchResultsObj={documentDetailsObj}
|
||||||
spinnerState={spinnerState}
|
// spinnerState={spinnerState}
|
||||||
orderBy={orderByState}
|
|
||||||
fieldSort={fieldSortState}
|
|
||||||
getDocumentResults={getDocumentResults}
|
getDocumentResults={getDocumentResults}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -341,94 +191,110 @@ const DocumentDetails = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDocumentTypes();
|
|
||||||
if (selectedOption) {
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
getDocumentResults(1, orderByState, fieldSortState);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedDocumentType) {
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
getDocumentResults(
|
|
||||||
1,
|
|
||||||
orderByState,
|
|
||||||
fieldSortState,
|
|
||||||
selectedDocumentType
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const docDetailsObj = async () => {
|
const docDetailsObj = async () => {
|
||||||
let docObj = await getSearchDocumentDetails(incidentid).then(
|
let docObj = await getSearchDocumentDetails(incidentid)
|
||||||
(data) => {
|
.then((data) => {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
setDocumentSearchState(true);
|
return data;
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
let historyObj = getDocumentHistory(data.value).then(
|
||||||
|
(result) => {
|
||||||
|
setDocumentHistory(result);
|
||||||
|
setDocumentSearchState(true);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
return docObj;
|
return docObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getDocumentHistory = async (searchDocumentDetailsObj) => {
|
||||||
|
let historyArr = [];
|
||||||
|
searchDocumentDetailsObj = searchDocumentDetailsObj || [];
|
||||||
|
|
||||||
|
const detailsObj = searchDocumentDetailsObj.map(
|
||||||
|
(historyDetail, index) => {
|
||||||
|
if (historyDetail.pinswg_publishtoweb != true) {
|
||||||
|
console.log(historyDetail.pinswg_documentid);
|
||||||
|
} else {
|
||||||
|
historyArr.push(
|
||||||
|
getSearchDocumentHistory(
|
||||||
|
historyDetail.pinswg_documentid
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return Promise.all(historyArr);
|
||||||
|
};
|
||||||
const searchDocumentResultsObj = docDetailsObj();
|
const searchDocumentResultsObj = docDetailsObj();
|
||||||
}, [
|
}, [incidentid, setDocumentHistory, setDocumentDetails]);
|
||||||
incidentid,
|
|
||||||
setDocumentDetails,
|
|
||||||
selectedOption,
|
|
||||||
selectedDocumentType,
|
|
||||||
fieldSortState,
|
|
||||||
orderByState,
|
|
||||||
getDocumentTypes,
|
|
||||||
getDocumentResults,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const getDocumentTypes = useCallback(() => {
|
const getDocumentResults = (pageNumber) => {
|
||||||
getSearchDocumentTypes(props.incidentid).then((data) => {
|
getSearchDocumentDetailsPaged(incidentid, pageNumber)
|
||||||
setDocumentTypes(data);
|
.then((data) => {
|
||||||
});
|
//console.log(data);
|
||||||
}, [props.incidentid]);
|
setDocumentDetails(data);
|
||||||
|
return data;
|
||||||
const getDocumentResults = useCallback(
|
})
|
||||||
(pageNumber, orderBy, fieldSort) => {
|
.then((data) => {
|
||||||
getSearchDocumentDetailsPaged(
|
//console.log("getting details", data);
|
||||||
props.incidentid,
|
return getDocumentHistory(data.value).then((data) => {
|
||||||
pageNumber,
|
setDocumentHistory(data);
|
||||||
orderBy,
|
//setShowSpinnerState(false);
|
||||||
fieldSort,
|
|
||||||
selectedOption,
|
|
||||||
selectedDocumentType
|
|
||||||
)
|
|
||||||
.then((data) => data)
|
|
||||||
.then((data) => {
|
|
||||||
//console.log("getting details", data);
|
|
||||||
setDocumentDetails(data);
|
|
||||||
setShowSpinnerState(false);
|
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
[
|
};
|
||||||
props.incidentid,
|
|
||||||
selectedOption,
|
|
||||||
selectedDocumentType,
|
|
||||||
setDocumentDetails,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
const getDocumentDetails = async () => {
|
const getDocumentDetails = async () => {
|
||||||
let docObj = await getSearchDocumentDetailsPaged(
|
let docObj = await getSearchDocumentDetailsPaged(incidentid, pageNumber)
|
||||||
incidentid,
|
.then((data) => {
|
||||||
pageNumber,
|
//console.log(data);
|
||||||
orderBy,
|
setDocumentDetails(data);
|
||||||
fieldSort
|
return data;
|
||||||
).then((data) => {
|
})
|
||||||
//console.log(data);
|
.then((data) => {
|
||||||
setDocumentDetails(data);
|
let historyObj = getDocumentHistory(
|
||||||
return data;
|
data.value,
|
||||||
});
|
pageNumber
|
||||||
|
).then((result) => {
|
||||||
|
setDocumentHistory(result);
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
|
||||||
return docObj;
|
return docObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getDocumentHistory = async (searchDocumentDetailsObj, pageNumber) => {
|
||||||
|
let historyArr = [];
|
||||||
|
searchDocumentDetailsObj = searchDocumentDetailsObj || [];
|
||||||
|
|
||||||
|
const detailsObj = searchDocumentDetailsObj.map(
|
||||||
|
(historyDetail, index) => {
|
||||||
|
if (historyDetail.pinswg_publishtoweb != true) {
|
||||||
|
console.log(historyDetail.pinswg_documentid);
|
||||||
|
} else {
|
||||||
|
historyArr.push(
|
||||||
|
getSearchDocumentHistoryPaged(
|
||||||
|
historyDetail.pinswg_documentid,
|
||||||
|
pageNumber
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return Promise.all(historyArr);
|
||||||
|
};
|
||||||
|
|
||||||
function formatDates(dateObj) {
|
function formatDates(dateObj) {
|
||||||
var dateObj = new Date(dateObj);
|
var dateObj = new Date(dateObj);
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
var dd = String(dateObj.getDate()).padStart(2, "0");
|
||||||
@@ -459,30 +325,15 @@ const DocumentDetails = (props) => {
|
|||||||
)
|
)
|
||||||
: pagesCount;
|
: pagesCount;
|
||||||
|
|
||||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
//const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||||
|
|
||||||
const [showDownloadingState, setShowDownloadingState] = useState(null);
|
// let spinnerState = () => {
|
||||||
|
// showSpinnerState == true
|
||||||
const toggleDownLoadLink = (i) => {
|
// ? setShowSpinnerState(false)
|
||||||
setShowDownloadingState(i);
|
// : setShowSpinnerState(true);
|
||||||
|
// };
|
||||||
const downloadTime = setTimeout(hideDownloadCover, 5000);
|
|
||||||
downloadTime;
|
|
||||||
};
|
|
||||||
|
|
||||||
function hideDownloadCover() {
|
|
||||||
setShowDownloadingState(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
let spinnerState = () => {
|
|
||||||
showSpinnerState == true
|
|
||||||
? setShowSpinnerState(false)
|
|
||||||
: setShowSpinnerState(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const [showDocumentSearchState, setDocumentSearchState] = useState(false);
|
const [showDocumentSearchState, setDocumentSearchState] = useState(false);
|
||||||
const [orderByState, setOrderbyState] = useState("createdon");
|
|
||||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
|
||||||
|
|
||||||
let documentSearchState = () => {
|
let documentSearchState = () => {
|
||||||
showDocumentSearchState == true
|
showDocumentSearchState == true
|
||||||
@@ -490,27 +341,13 @@ const DocumentDetails = (props) => {
|
|||||||
: setDocumentSearchState(true);
|
: setDocumentSearchState(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortDataBy = (whichField) => {
|
|
||||||
setOrderbyState(whichField);
|
|
||||||
setfieldSortState("asc");
|
|
||||||
|
|
||||||
getDocumentResults(1, whichField, fieldSortState);
|
|
||||||
whichField == orderByState
|
|
||||||
? fieldSortState == "desc"
|
|
||||||
? setfieldSortState("asc")
|
|
||||||
: setfieldSortState("desc")
|
|
||||||
: setfieldSortState("asc");
|
|
||||||
setCurrentPage(1);
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<h2>{t("case:documents-heading-label")}</h2>
|
<h2>{t("case:documents-heading-label")}</h2>
|
||||||
{_.isEmpty(documentDetailsObj.value) ? (
|
{_.isEmpty(documentHistoryObj) ? (
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-two-thirds">
|
<div className="govuk-grid-column-two-thirds">
|
||||||
<h3>
|
<h3>
|
||||||
@@ -548,8 +385,8 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setDocumentDetails: (detailsObj) => {
|
setDocumentDetails: (detailsObj) => {
|
||||||
dispatch(setDocumentDetails(detailsObj));
|
dispatch(setDocumentDetails(detailsObj));
|
||||||
},
|
},
|
||||||
setCurrentPage: (currentPage) => {
|
setDocumentHistory: (historyObj) => {
|
||||||
dispatch(setCurrentPage(currentPage));
|
dispatch(setDocumentHistory(historyObj));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,30 +1,21 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { useState } from "react";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { setCurrentPage } from "../../store/currentView/action";
|
|
||||||
|
|
||||||
const PaginationControl = (props) => {
|
const PaginationControl = (props) => {
|
||||||
const {
|
const {
|
||||||
showNoOfRecords,
|
|
||||||
orderBy,
|
|
||||||
fieldSort,
|
|
||||||
searchString,
|
searchString,
|
||||||
searchResultsObj,
|
searchResultsObj,
|
||||||
currentPage,
|
currentPage,
|
||||||
spinnerState,
|
spinnerState,
|
||||||
getDocumentResults,
|
getDocumentResults,
|
||||||
setCurrentPage,
|
|
||||||
} = props;
|
} = props;
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const pagesCount = Math.ceil(
|
const pagesCount = Math.ceil(searchResultsObj["@odata.count"] / 10);
|
||||||
searchResultsObj["@odata.count"] / showNoOfRecords
|
|
||||||
);
|
|
||||||
|
|
||||||
const getRange = (start, end) => {
|
const getRange = (start, end) => {
|
||||||
//console.log(start, end);
|
//console.log(start, end);
|
||||||
@@ -36,15 +27,13 @@ const PaginationControl = (props) => {
|
|||||||
const paginationNumbers = (currentPage, pageCount) => {
|
const paginationNumbers = (currentPage, pageCount) => {
|
||||||
//console.log(currentPage);
|
//console.log(currentPage);
|
||||||
let delta;
|
let delta;
|
||||||
|
if (pageCount <= 10) {
|
||||||
if (pageCount <= 7) {
|
|
||||||
// delta === 7: [1 2 3 4 5 6 7]
|
// delta === 7: [1 2 3 4 5 6 7]
|
||||||
delta = 7;
|
delta = 10;
|
||||||
} else {
|
} else {
|
||||||
// delta === 2: [1 ... 4 5 6 ... 10]
|
// delta === 2: [1 ... 4 5 6 ... 10]
|
||||||
// delta === 4: [1 2 3 4 5 ... 10]
|
// delta === 4: [1 2 3 4 5 ... 10]
|
||||||
//delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4;
|
delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 6;
|
||||||
delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const range = {
|
const range = {
|
||||||
@@ -80,31 +69,20 @@ const PaginationControl = (props) => {
|
|||||||
return pages;
|
return pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
const paginationArray = paginationNumbers(
|
const paginationArray = paginationNumbers(currentPage, pagesCount);
|
||||||
props.currentView.currentPage,
|
|
||||||
pagesCount
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{pagesCount > 1 && (
|
{pagesCount > 1 ? (
|
||||||
<div className="govuk-!-margin-bottom-7 ">
|
<div className="govuk-!-margin-bottom-7 ">
|
||||||
<div className="govuk-grid-row paginationWrapper">
|
<div className="govuk-grid-row paginationWrapper">
|
||||||
<div className="govuk-grid-column-one-quarter paginationPrevious">
|
<div className="govuk-grid-column-one-quarter paginationPrevious">
|
||||||
{props.currentView.currentPage != 1 ? (
|
{currentPage != 1 ? (
|
||||||
<span
|
<span
|
||||||
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
|
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
spinnerState(),
|
// spinnerState(),
|
||||||
setCurrentPage(
|
getDocumentResults(currentPage - 1);
|
||||||
props.currentView.currentPage -
|
|
||||||
1
|
|
||||||
),
|
|
||||||
getDocumentResults(
|
|
||||||
props.currentView.currentPage -
|
|
||||||
1,
|
|
||||||
orderBy,
|
|
||||||
fieldSort
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("common:previous-link-button")}
|
{t("common:previous-link-button")}
|
||||||
@@ -117,7 +95,7 @@ const PaginationControl = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-column-one-half paginationContainer">
|
<div className="govuk-grid-column-one-half paginationContainer">
|
||||||
{paginationArray.map((e, i) =>
|
{paginationArray.map((e, i) =>
|
||||||
props.currentView.currentPage == e ? (
|
currentPage == i + 1 ? (
|
||||||
<span
|
<span
|
||||||
key={i}
|
key={i}
|
||||||
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold "
|
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold "
|
||||||
@@ -136,13 +114,9 @@ const PaginationControl = (props) => {
|
|||||||
className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
||||||
key={i}
|
key={i}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
spinnerState();
|
// spinnerState();
|
||||||
setCurrentPage(e),
|
console.log(i + 1);
|
||||||
getDocumentResults(
|
getDocumentResults(i + 1);
|
||||||
e,
|
|
||||||
orderBy,
|
|
||||||
fieldSort
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{e}
|
{e}
|
||||||
@@ -151,21 +125,12 @@ const PaginationControl = (props) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-column-one-quarter paginationNext">
|
<div className="govuk-grid-column-one-quarter paginationNext">
|
||||||
{props.currentView.currentPage < pagesCount ? (
|
{currentPage != pagesCount ? (
|
||||||
<span
|
<span
|
||||||
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
|
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
spinnerState(),
|
// spinnerState(),
|
||||||
setCurrentPage(
|
getDocumentResults(currentPage + 1);
|
||||||
props.currentView.currentPage +
|
|
||||||
1
|
|
||||||
),
|
|
||||||
getDocumentResults(
|
|
||||||
props.currentView.currentPage +
|
|
||||||
1,
|
|
||||||
orderBy,
|
|
||||||
fieldSort
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("common:next-link-button")}
|
{t("common:next-link-button")}
|
||||||
@@ -183,23 +148,11 @@ const PaginationControl = (props) => {
|
|||||||
{t("common:of-label")} {pagesCount}
|
{t("common:of-label")} {pagesCount}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
export default PaginationControl;
|
||||||
return {
|
|
||||||
currentView: state.currentView,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {
|
|
||||||
setCurrentPage: (currentPage) => {
|
|
||||||
dispatch(setCurrentPage(currentPage));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(PaginationControl);
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import RepAgent from "./representationAgent";
|
|||||||
import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
|
import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
|
||||||
import RepLandOwner from "./representationLandowner";
|
import RepLandOwner from "./representationLandowner";
|
||||||
import RepCompleteSubmit from "./representationCompleteSubmit";
|
import RepCompleteSubmit from "./representationCompleteSubmit";
|
||||||
import { useSession, signIn, signOut } from "next-auth/react";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RenderPickList,
|
RenderPickList,
|
||||||
@@ -40,7 +39,6 @@ let MakeRepresentation = (props) => {
|
|||||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||||
|
|
||||||
const [clearRepForm, setClearRepForm] = useState(false);
|
const [clearRepForm, setClearRepForm] = useState(false);
|
||||||
const { data: session } = useSession();
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
@@ -128,7 +126,6 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
props={props}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -145,7 +142,6 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
props={props}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -162,7 +158,6 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
props={props}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -179,7 +174,6 @@ let MakeRepresentation = (props) => {
|
|||||||
onHandleSubmit={onHandleSubmit}
|
onHandleSubmit={onHandleSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
props={props}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -208,18 +202,16 @@ let MakeRepresentation = (props) => {
|
|||||||
setRepresentationSubmit={setRepresentationSubmit}
|
setRepresentationSubmit={setRepresentationSubmit}
|
||||||
currentView={currentView}
|
currentView={currentView}
|
||||||
setSubmitBack={setSubmitBack}
|
setSubmitBack={setSubmitBack}
|
||||||
props={props}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
// console.log(
|
console.log(
|
||||||
// values,
|
values.representationCapacity,
|
||||||
// values.representationCapacity,
|
currentView.representationCapacity
|
||||||
// currentView.representationCapacity
|
);
|
||||||
// );
|
|
||||||
|
|
||||||
// console.log(_.isEmpty(currentView.representationCapacity));
|
// console.log(_.isEmpty(currentView.representationCapacity));
|
||||||
// console.log(
|
// console.log(
|
||||||
@@ -234,22 +226,15 @@ let MakeRepresentation = (props) => {
|
|||||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
)
|
)
|
||||||
: setRepresentationSubmit("true");
|
: setRepresentationSubmit(true);
|
||||||
|
|
||||||
window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const repForm = props.props.form;
|
const repForm = props.props.form;
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// "waht is representationSubmit:",
|
|
||||||
// currentView.representationSubmit
|
|
||||||
// );
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
{currentView.representationSubmit == "true" ? (
|
{representationSubmit == true ? (
|
||||||
<RepCompleteSubmit
|
<RepCompleteSubmit
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
capacityOptionsArr={capacityOptionsArr}
|
capacityOptionsArr={capacityOptionsArr}
|
||||||
@@ -265,32 +250,11 @@ let MakeRepresentation = (props) => {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{!session ? (
|
<h1 className="govuk-heading-l">
|
||||||
<>
|
Make a representation on:{" "}
|
||||||
<div>
|
{currentView.caseReference.currentReference}
|
||||||
<p className="govuk-body">
|
</h1>
|
||||||
Some text in here to explain about
|
{whichControl()}
|
||||||
raising a representation and why logging
|
|
||||||
in
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
className="govuk-button withChevron govuk-button-cta"
|
|
||||||
type="button"
|
|
||||||
onClick={() => signIn("email")}
|
|
||||||
>
|
|
||||||
Sign in to raise representation
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<h1 className="govuk-heading-l">
|
|
||||||
Make a representation on:{" "}
|
|
||||||
{currentView.caseReference.currentReference}
|
|
||||||
</h1>
|
|
||||||
{whichControl()}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -3,20 +3,17 @@ import { connect } from "react-redux";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { Field, reduxForm, reset } from "redux-form";
|
import { Field, reduxForm, reset } from "redux-form";
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RenderPickList,
|
RenderPickList,
|
||||||
RenderTextfield,
|
RenderTextfield,
|
||||||
RenderRadioList,
|
RenderRadioList,
|
||||||
RenderMultiline,
|
RenderMultiline,
|
||||||
RenderFileUpload,
|
|
||||||
} from "./representationElements";
|
} from "./representationElements";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
// import {
|
import {
|
||||||
// setRepresentationCapacity,
|
setRepresentationCapacity,
|
||||||
// setRepresentationSubmit,
|
setRepresentationSubmit,
|
||||||
// } from "../../../store/currentView/action";
|
} from "../../../store/currentView/action";
|
||||||
|
|
||||||
const RepAppellant = (props) => {
|
const RepAppellant = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -31,8 +28,11 @@ const RepAppellant = (props) => {
|
|||||||
currentView,
|
currentView,
|
||||||
} = props;
|
} = props;
|
||||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||||
|
const files = acceptedFiles.map((file) => (
|
||||||
// console.log(props);
|
<li key={file.path}>
|
||||||
|
{file.path} - {file.size} bytes
|
||||||
|
</li>
|
||||||
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="rep-appellant">
|
<div id="rep-appellant">
|
||||||
@@ -141,6 +141,7 @@ const RepAppellant = (props) => {
|
|||||||
className="govuk-checkboxes__input"
|
className="govuk-checkboxes__input"
|
||||||
id="documentBox"
|
id="documentBox"
|
||||||
name="documentBox"
|
name="documentBox"
|
||||||
|
value="email"
|
||||||
data-aria-controls="documentBox"
|
data-aria-controls="documentBox"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
@@ -173,28 +174,25 @@ const RepAppellant = (props) => {
|
|||||||
}
|
}
|
||||||
id="conditional-documentBox"
|
id="conditional-documentBox"
|
||||||
>
|
>
|
||||||
<h2 className="govuk-heading-s">
|
<div className="govuk-form-group">
|
||||||
{props.label}{" "}
|
<section className="container">
|
||||||
</h2>
|
<div
|
||||||
<Field
|
{...getRootProps({
|
||||||
name="repsFiles"
|
className: "dropzone",
|
||||||
id="repsFiles"
|
})}
|
||||||
component={RenderFileUpload}
|
>
|
||||||
className="govuk-input govuk-input--width-20"
|
<input {...getInputProps()} />
|
||||||
//validate={[required]}
|
<p>
|
||||||
label={props.label}
|
Drag and drop files here or
|
||||||
errorMsg="Is required"
|
click to select files
|
||||||
ticketnumber={props.caseReference}
|
</p>
|
||||||
documentTypeCode={
|
</div>
|
||||||
props.documentTypeCode
|
<aside>
|
||||||
}
|
<h4>Files</h4>
|
||||||
hint={props.hint}
|
<ul>{files}</ul>
|
||||||
fileList={props.fileList}
|
</aside>
|
||||||
setFilesForAppeal={
|
</section>
|
||||||
props.setFilesForAppeal
|
</div>
|
||||||
}
|
|
||||||
containerID={props.containerID}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -210,13 +208,13 @@ const RepAppellant = (props) => {
|
|||||||
Continue
|
Continue
|
||||||
</button>
|
</button>
|
||||||
{/* <a
|
{/* <a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(true);
|
setRepresentationSubmit(false);
|
||||||
}}
|
}}
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
>
|
>
|
||||||
Continue ww
|
Continue
|
||||||
</a> */}
|
</a> */}
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ let RepCapacitySelection = (props) => {
|
|||||||
options={capacityOptionsArr}
|
options={capacityOptionsArr}
|
||||||
id="representationCapacity"
|
id="representationCapacity"
|
||||||
className="govuk-radios__input"
|
className="govuk-radios__input"
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
errorMsg="Select an option"
|
||||||
component={RenderRadioList}
|
component={RenderRadioList}
|
||||||
validate={[required]}
|
validate={[required]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ const RepComplete = (props) => {
|
|||||||
return (
|
return (
|
||||||
<div id="rep-appellant">
|
<div id="rep-appellant">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="govuk-grid-row govuk-body">
|
<div className="govuk-grid-row">
|
||||||
<h1 className="govuk-heading-m ">
|
<h2 className="govuk-heading-m ">
|
||||||
Submission of Representation
|
Submission of Representation
|
||||||
</h1>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
Thank you for submitting your representation(s) using
|
Thank you for submitting your representation(s) using
|
||||||
the Appeals Casework Portal.
|
the Appeals Casework Portal.
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ const RepCompleteSubmit = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
<div id="rep-appellant">
|
<div id="rep-appellant">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="govuk-grid-row govuk-body">
|
<div className="govuk-grid-row">
|
||||||
<h1 className="govuk-heading-m ">Submit</h1>
|
<h2 className="govuk-heading-m ">Submit</h2>
|
||||||
<p>
|
<p>
|
||||||
The gathering and subsequent processing of the
|
The gathering and subsequent processing of the
|
||||||
personal data supplied by you in this form, is
|
personal data supplied by you in this form, is
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
import { Field, Fields, reduxForm } from "redux-form";
|
import { Field, reduxForm } from "redux-form";
|
||||||
import router from "next/router";
|
import router from "next/router";
|
||||||
import React, { useState, useMemo } from "react";
|
import React, { useState } from "react";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import jsonpath from "jsonpath";
|
|
||||||
import Dropzone, { useDropzone } from "react-dropzone";
|
|
||||||
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";
|
|
||||||
|
|
||||||
export const RenderRadioList = ({
|
export const RenderRadioList = ({
|
||||||
datafieldname,
|
datafieldname,
|
||||||
@@ -156,40 +149,14 @@ export const RenderMultiline = ({
|
|||||||
meta: { touched, error },
|
meta: { touched, error },
|
||||||
...custom
|
...custom
|
||||||
}) => {
|
}) => {
|
||||||
const [editValue, setEditValue] = useState(
|
|
||||||
input.value != null ? input.value : ""
|
|
||||||
);
|
|
||||||
|
|
||||||
const changeEdit = (valStr) => {
|
|
||||||
setEditValue(valStr);
|
|
||||||
input.onChange(valStr);
|
|
||||||
};
|
|
||||||
|
|
||||||
var modules = {
|
|
||||||
toolbar: [
|
|
||||||
[{ "header": [1, 2, false] }],
|
|
||||||
["bold", "italic", "underline", "blockquote"],
|
|
||||||
[{ "list": "ordered" }, { "list": "bullet" }],
|
|
||||||
["clean"],
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ReactQuill
|
|
||||||
modules={modules}
|
|
||||||
theme="snow"
|
|
||||||
value={editValue}
|
|
||||||
onChange={changeEdit}
|
|
||||||
/>
|
|
||||||
<textarea
|
<textarea
|
||||||
{...input}
|
{...input}
|
||||||
id={id}
|
id={id}
|
||||||
name={name}
|
name={name}
|
||||||
rows={rows}
|
rows={rows}
|
||||||
className={className}
|
className={className}
|
||||||
value={editValue}
|
|
||||||
style={{ display: "none" }}
|
|
||||||
></textarea>
|
></textarea>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -225,339 +192,3 @@ export function MultiLinefield(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseStyle = {
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
padding: "20px",
|
|
||||||
borderWidth: 2,
|
|
||||||
borderRadius: 2,
|
|
||||||
borderColor: "#eeeeee",
|
|
||||||
borderStyle: "dashed",
|
|
||||||
backgroundColor: "#fafafa",
|
|
||||||
color: "#bdbdbd",
|
|
||||||
transition: "border .3s ease-in-out",
|
|
||||||
};
|
|
||||||
|
|
||||||
const activeStyle = {
|
|
||||||
borderColor: "#2196f3",
|
|
||||||
};
|
|
||||||
|
|
||||||
const acceptStyle = {
|
|
||||||
borderColor: "#00e676",
|
|
||||||
};
|
|
||||||
|
|
||||||
const rejectStyle = {
|
|
||||||
borderColor: "#ff1744",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const RenderFileUpload = (field) => {
|
|
||||||
const files = field.input.value;
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
const style = useMemo(
|
|
||||||
() => ({
|
|
||||||
...baseStyle,
|
|
||||||
// ...(isDragActive ? activeStyle : {}),
|
|
||||||
// ...(isDragAccept ? acceptStyle : {}),
|
|
||||||
// ...(isDragReject ? rejectStyle : {}),
|
|
||||||
}),
|
|
||||||
[]
|
|
||||||
// [isDragActive, isDragReject, isDragAccept]
|
|
||||||
);
|
|
||||||
const [filesList, setFilesList] = useState([]);
|
|
||||||
|
|
||||||
const thumbs = filesList.map((file) => (
|
|
||||||
<div key={file.name} className="govuk-!-margin-bottom-5 fileThumb">
|
|
||||||
<img src={file.preview} alt={file.name} width="50" /> -{" "}
|
|
||||||
<span className="govuk-body">
|
|
||||||
{file.name} ({file.size / 1024}kb)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
));
|
|
||||||
|
|
||||||
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":
|
|
||||||
return "/assets/images/documenttypes/html.png";
|
|
||||||
break;
|
|
||||||
case "text/plain":
|
|
||||||
return "/assets/images/documenttypes/txt.png";
|
|
||||||
break;
|
|
||||||
case "application/msword":
|
|
||||||
return "/assets/images/documenttypes/doc.png";
|
|
||||||
break;
|
|
||||||
case "application/pdf":
|
|
||||||
return "/assets/images/documenttypes/pdf.png";
|
|
||||||
break;
|
|
||||||
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
|
|
||||||
return "/assets/images/documenttypes/docx.png";
|
|
||||||
break;
|
|
||||||
case "text/csv":
|
|
||||||
return "/assets/images/documenttypes/csv.png";
|
|
||||||
break;
|
|
||||||
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
|
||||||
return "/assets/images/documenttypes/xlsx.png";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "application/zip":
|
|
||||||
return "/assets/images/documenttypes/zip.png";
|
|
||||||
break;
|
|
||||||
case "image/jpeg":
|
|
||||||
case "image/png":
|
|
||||||
return URL.createObjectURL(fileObj);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return "/assets/images/documenttypes/txt.png";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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":
|
|
||||||
return "000001";
|
|
||||||
break;
|
|
||||||
case "000002":
|
|
||||||
return "000002";
|
|
||||||
break;
|
|
||||||
case "000003":
|
|
||||||
return "000003";
|
|
||||||
break;
|
|
||||||
case "000004":
|
|
||||||
return "000004";
|
|
||||||
break;
|
|
||||||
case "000005":
|
|
||||||
return "000005";
|
|
||||||
break;
|
|
||||||
case "000006":
|
|
||||||
return "000006";
|
|
||||||
break;
|
|
||||||
case "000007":
|
|
||||||
return "000007";
|
|
||||||
break;
|
|
||||||
case "000008":
|
|
||||||
return "000008";
|
|
||||||
break;
|
|
||||||
case "000009":
|
|
||||||
return "000009";
|
|
||||||
break;
|
|
||||||
case "000010":
|
|
||||||
return "000010";
|
|
||||||
break;
|
|
||||||
case "000011":
|
|
||||||
return "000011";
|
|
||||||
break;
|
|
||||||
case "000012":
|
|
||||||
return "000012";
|
|
||||||
break;
|
|
||||||
case "000013":
|
|
||||||
return "000013";
|
|
||||||
break;
|
|
||||||
case "000014":
|
|
||||||
return "000014";
|
|
||||||
break;
|
|
||||||
case "000015":
|
|
||||||
return "000015";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return "000000";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const filelistObj = field.fileList || {};
|
|
||||||
|
|
||||||
const blobList = jsonpath.query(
|
|
||||||
filelistObj,
|
|
||||||
"$..[?(@.documentType=='" + field.documentTypeCode + "')]"
|
|
||||||
);
|
|
||||||
|
|
||||||
const deleteThisBlob = async (
|
|
||||||
containerName,
|
|
||||||
blobName,
|
|
||||||
deleteblobhash,
|
|
||||||
getblobshash,
|
|
||||||
casefolderID
|
|
||||||
) => {
|
|
||||||
//console.log(containerName, blobName, deleteblobhash);
|
|
||||||
deleteBlob(containerName, blobName, deleteblobhash, casefolderID)
|
|
||||||
.then((data) => data)
|
|
||||||
.then(() => {
|
|
||||||
getFilesFromBlobHashed(
|
|
||||||
containerName,
|
|
||||||
getblobshash,
|
|
||||||
casefolderID
|
|
||||||
).then((newfilelist) => field.setFilesForAppeal(newfilelist));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Dropzone
|
|
||||||
accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/tiff,image/jpeg,application/zip"
|
|
||||||
onDrop={(filesToUpload, e) => {
|
|
||||||
const renamedAcceptedFiles = filesToUpload.map(
|
|
||||||
(file) =>
|
|
||||||
new File(
|
|
||||||
[file],
|
|
||||||
`${getDocumentType(field.documentTypeCode)}_${
|
|
||||||
file.name
|
|
||||||
}`,
|
|
||||||
{
|
|
||||||
type: file.type,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
field.input.onChange(renamedAcceptedFiles);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ getRootProps, getInputProps }) => (
|
|
||||||
<>
|
|
||||||
{/* {field.hint != false && (
|
|
||||||
<div className="govuk-hint">ss{t(field.hint)}</div>
|
|
||||||
)}
|
|
||||||
<div className="govuk-form-group"></div> */}
|
|
||||||
<section className="container">
|
|
||||||
<div {...getRootProps({ style })}>
|
|
||||||
{" "}
|
|
||||||
<input id={field.id} {...getInputProps()} />
|
|
||||||
<div>
|
|
||||||
{t(
|
|
||||||
"newappeal:new-appeal-fileupload-drop-label"
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<em>
|
|
||||||
(
|
|
||||||
{t(
|
|
||||||
"newappeal:new-appeal-fileupload-file-list-label"
|
|
||||||
)}
|
|
||||||
)
|
|
||||||
</em>
|
|
||||||
</div>
|
|
||||||
<aside>{thumbs}</aside>
|
|
||||||
</section>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Dropzone>
|
|
||||||
{field.meta.touched && field.meta.error && (
|
|
||||||
<span className="error">{field.meta.error}</span>
|
|
||||||
)}
|
|
||||||
{files && Array.isArray(files) && (
|
|
||||||
<ul>
|
|
||||||
{files.map((file, i) => (
|
|
||||||
<div
|
|
||||||
key={file.name}
|
|
||||||
className="govuk-!-margin-bottom-5 fileThumb"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={getThumbnailIcon(file, file.type)}
|
|
||||||
alt={file.name}
|
|
||||||
width="50"
|
|
||||||
/>
|
|
||||||
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
|
|
||||||
{file.name} ({bytesToSize(file.size)})
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
)}
|
|
||||||
{blobList.map((blob, i) => (
|
|
||||||
<div
|
|
||||||
key={blob.name + "_" + i}
|
|
||||||
className="govuk-!-margin-bottom-5 fileThumb govuk-!-margin-top-5"
|
|
||||||
>
|
|
||||||
<div className="">
|
|
||||||
<span
|
|
||||||
className="govuk-summary-list__actionLink watched_link govuk-!-margin-right-5 govuk-!-text-align-left"
|
|
||||||
onClick={() => {
|
|
||||||
deleteThisBlob(
|
|
||||||
field.containerID,
|
|
||||||
blob.name,
|
|
||||||
blob.hasheddeletepath,
|
|
||||||
blob.hashgetblobs,
|
|
||||||
field.ticketnumber
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
title="Remove this file"
|
|
||||||
>
|
|
||||||
−
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<img
|
|
||||||
src={getThumbnailIconByExtension(blob.name)}
|
|
||||||
alt={blob.name}
|
|
||||||
width="50"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Link
|
|
||||||
key={i}
|
|
||||||
scroll={false}
|
|
||||||
href={
|
|
||||||
"/api/file/downloadblob?container=" +
|
|
||||||
field.containerID +
|
|
||||||
"&casefolderID=" +
|
|
||||||
field.ticketnumber +
|
|
||||||
"&blobname=" +
|
|
||||||
blob.name +
|
|
||||||
blob.hashedfilepath
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link">
|
|
||||||
{blob.name} ({bytesToSize(blob.contentLength)})
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
))}{" "}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -294,14 +294,7 @@ const RepInterestedPartyPerson = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
<button
|
<Link href="/representation">
|
||||||
type="submit"
|
|
||||||
className="govuk-button"
|
|
||||||
data-module="govuk-button"
|
|
||||||
>
|
|
||||||
Continue
|
|
||||||
</button>
|
|
||||||
{/* <Link href="/representation">
|
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(true);
|
setRepresentationSubmit(true);
|
||||||
@@ -310,7 +303,7 @@ const RepInterestedPartyPerson = (props) => {
|
|||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</a>
|
</a>
|
||||||
</Link> */}
|
</Link>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
@@ -202,14 +202,7 @@ const RepLandOwner = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
<button
|
<Link href="/representation">
|
||||||
type="submit"
|
|
||||||
className="govuk-button"
|
|
||||||
data-module="govuk-button"
|
|
||||||
>
|
|
||||||
Continue
|
|
||||||
</button>
|
|
||||||
{/* <Link href="/representation">
|
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(true);
|
setRepresentationSubmit(true);
|
||||||
@@ -218,7 +211,7 @@ const RepLandOwner = (props) => {
|
|||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</a>
|
</a>
|
||||||
</Link> */}
|
</Link>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
+12
-116
@@ -15,7 +15,6 @@ import {
|
|||||||
} from "../../store/currentView/action";
|
} from "../../store/currentView/action";
|
||||||
|
|
||||||
import { getFormCollectionByID } from "../utils";
|
import { getFormCollectionByID } from "../utils";
|
||||||
import { getSession, useSession } from "next-auth/react";
|
|
||||||
|
|
||||||
import Pinswg_advertsid from "./summaryTypes/pinswg_advertsid";
|
import Pinswg_advertsid from "./summaryTypes/pinswg_advertsid";
|
||||||
import Pinswg_callinss77id from "./summaryTypes/pinswg_callinss77id";
|
import Pinswg_callinss77id from "./summaryTypes/pinswg_callinss77id";
|
||||||
@@ -62,13 +61,9 @@ const CaseSummary = (props) => {
|
|||||||
setCurrentLinkedCases,
|
setCurrentLinkedCases,
|
||||||
linkedCasesReference,
|
linkedCasesReference,
|
||||||
setCurrentReference,
|
setCurrentReference,
|
||||||
showMap,
|
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { data: session, status } = useSession();
|
const noRepresentationLink = ["/case", "/dnsdetails"];
|
||||||
//console.log("session status:", status, session);
|
|
||||||
|
|
||||||
const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"];
|
|
||||||
|
|
||||||
let setCaseQueryObj = props[currentType];
|
let setCaseQueryObj = props[currentType];
|
||||||
let setCaseDetailsObj = props[currentType + "Details"];
|
let setCaseDetailsObj = props[currentType + "Details"];
|
||||||
@@ -80,16 +75,6 @@ const CaseSummary = (props) => {
|
|||||||
searchResultsObj,
|
searchResultsObj,
|
||||||
'$..[?(@.title=="' + caseReference + '")]'
|
'$..[?(@.title=="' + caseReference + '")]'
|
||||||
))
|
))
|
||||||
: currentType == "watchedCases"
|
|
||||||
? (casesObj = jsonpath.query(
|
|
||||||
setCaseQueryObj,
|
|
||||||
'$..[?(@.pinswg_title=="' + caseReference + '")]'
|
|
||||||
))
|
|
||||||
: currentType == "myCases"
|
|
||||||
? (casesObj = jsonpath.query(
|
|
||||||
setCaseQueryObj,
|
|
||||||
'$..[?(@.pinswg_title=="' + caseReference + '")]'
|
|
||||||
))
|
|
||||||
: (casesObj = jsonpath.query(
|
: (casesObj = jsonpath.query(
|
||||||
setCaseQueryObj,
|
setCaseQueryObj,
|
||||||
'$..[?(@.reference=="' + caseReference + '")]'
|
'$..[?(@.reference=="' + caseReference + '")]'
|
||||||
@@ -128,14 +113,7 @@ const CaseSummary = (props) => {
|
|||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{getFormCollectionByID(appealTypeID)
|
{t("case:summary-applicant-label")}
|
||||||
.PrimaryIdAttribute == "pinswg_dnsid"
|
|
||||||
? t("case:summary-applicantonly-label")
|
|
||||||
: getFormCollectionByID(appealTypeID)
|
|
||||||
.PrimaryIdAttribute ==
|
|
||||||
"pinswg_nonvalidationid"
|
|
||||||
? t("case:summary-appellantonly-label")
|
|
||||||
: t("case:summary-applicant-label")}
|
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{detailsObj[
|
{detailsObj[
|
||||||
@@ -170,23 +148,6 @@ const CaseSummary = (props) => {
|
|||||||
{t("case:summary-site-address-label")}
|
{t("case:summary-site-address-label")}
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{getFormCollectionByID(appealTypeID)
|
|
||||||
.PrimaryIdAttribute == "pinswg_dnsid"
|
|
||||||
? detailsObj.pinswg_projectlocation !=
|
|
||||||
null
|
|
||||||
? detailsObj.pinswg_projectlocation.indexOf(
|
|
||||||
";"
|
|
||||||
) < 0
|
|
||||||
? detailsObj.pinswg_projectlocation
|
|
||||||
: router.locale == "cy"
|
|
||||||
? detailsObj.pinswg_projectlocation.split(
|
|
||||||
";"
|
|
||||||
)[1]
|
|
||||||
: detailsObj.pinswg_projectlocation.split(
|
|
||||||
";"
|
|
||||||
)[0]
|
|
||||||
: ""
|
|
||||||
: ""}
|
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddressline1"
|
"pinswg_siteaddressline1"
|
||||||
@@ -240,70 +201,14 @@ const CaseSummary = (props) => {
|
|||||||
: ""}
|
: ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{casesObj.description != null && (
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-description-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{casesObj.description.indexOf(";") < 0
|
|
||||||
? casesObj.description
|
|
||||||
: router.locale == "cy"
|
|
||||||
? casesObj.description.split(";")[1]
|
|
||||||
: casesObj.description.split(
|
|
||||||
";"
|
|
||||||
)[0]}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{detailsObj.pinswg_casestage != null && (
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-case-stage-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_casestage@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_casestage@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] ||
|
|
||||||
t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* 1{" "}
|
<div className="govuk-grid-row">
|
||||||
{_.has(detailsObj, "pinswg_startdatetimeiftheevent") &&
|
|
||||||
detailsObj.pinswg_startdatetimeiftheevent}
|
|
||||||
2{" "}
|
|
||||||
{_.has(detailsObj, "pinswg_startdateoftheevent") &&
|
|
||||||
detailsObj.pinswg_startdateoftheevent}
|
|
||||||
3{" "}
|
|
||||||
{_.has(detailsObj, "pinswg_startdateofevent") &&
|
|
||||||
detailsObj.pinswg_startdateofevent}
|
|
||||||
4{" "}
|
|
||||||
{_.has(detailsObj, "pinswg_starttimeoftheevent") &&
|
|
||||||
detailsObj.pinswg_starttimeoftheevent} */}
|
|
||||||
{/* <div className="govuk-grid-row">
|
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
{props.currentView.caseReference.showreps !=
|
{noRepresentationLink.includes(router.pathname) ==
|
||||||
"true" ? (
|
true ? (
|
||||||
""
|
|
||||||
) : noRepresentationLink.includes(
|
|
||||||
router.pathname
|
|
||||||
) == true ? (
|
|
||||||
""
|
""
|
||||||
) : (
|
) : (
|
||||||
<Link href="/myportal/representation">
|
<Link href="/myportal/representation">
|
||||||
@@ -315,7 +220,7 @@ const CaseSummary = (props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<a
|
{/* <a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
//spinnerState();
|
//spinnerState();
|
||||||
router.back();
|
router.back();
|
||||||
@@ -323,10 +228,11 @@ const CaseSummary = (props) => {
|
|||||||
className="govuk-button govuk-button--secondary"
|
className="govuk-button govuk-button--secondary"
|
||||||
>
|
>
|
||||||
{t("case:summary-back-button-label")}
|
{t("case:summary-back-button-label")}
|
||||||
</a>
|
</a> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> */}
|
</div>
|
||||||
|
|
||||||
{showSummary(casesObj, detailsObj)}
|
{showSummary(casesObj, detailsObj)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -438,7 +344,6 @@ const CaseSummary = (props) => {
|
|||||||
formatDates={formatDates}
|
formatDates={formatDates}
|
||||||
linkedCasesList={linkedCasesList}
|
linkedCasesList={linkedCasesList}
|
||||||
currentView={props.currentView}
|
currentView={props.currentView}
|
||||||
showMap={showMap}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -475,7 +380,7 @@ const CaseSummary = (props) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "pinswg_enforcementpermittingid":
|
case "pinswg_environmentalpermittingid":
|
||||||
return (
|
return (
|
||||||
<Pinswg_environmentalpermittingid
|
<Pinswg_environmentalpermittingid
|
||||||
casesObj={casesObj}
|
casesObj={casesObj}
|
||||||
@@ -678,22 +583,13 @@ const CaseSummary = (props) => {
|
|||||||
// : setShowSpinnerState(true);
|
// : setShowSpinnerState(true);
|
||||||
// };
|
// };
|
||||||
|
|
||||||
function formatDates(dateObj, showTime) {
|
function formatDates(dateObj) {
|
||||||
var dateObj = new Date(dateObj);
|
var dateObj = new Date(dateObj);
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
var dd = String(dateObj.getDate()).padStart(2, "0");
|
||||||
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
||||||
var yyyy = dateObj.getFullYear();
|
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
|
return dd + "/" + mm + "/" + yyyy;
|
||||||
? hh == 0 && mins == 0
|
|
||||||
? ""
|
|
||||||
: hh + ":" + mins
|
|
||||||
: dd + "/" + mm + "/" + yyyy + " ";
|
|
||||||
return dateStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function linkedCasesList(linkedCasesReference) {
|
function linkedCasesList(linkedCasesReference) {
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_advertsid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -343,31 +324,6 @@ const Pinswg_advertsid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_callinss77id = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -278,32 +259,6 @@ const Pinswg_callinss77id = (props) => {
|
|||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-date-exported-to-iss-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_dateexportedtoiss"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_dateexportedtoiss
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_dateexportedtoiss
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div> */}
|
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t(
|
{t(
|
||||||
@@ -440,31 +395,6 @@ const Pinswg_callinss77id = (props) => {
|
|||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_commonlandid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -219,16 +200,11 @@ const Pinswg_commonlandid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -444,31 +420,6 @@ const Pinswg_commonlandid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_starttimeoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_starttimeoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_starttimeoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_communityinfrastructurelevyid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -342,31 +323,6 @@ const Pinswg_communityinfrastructurelevyid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -78,25 +78,6 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -201,16 +182,11 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -426,31 +402,6 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -136,27 +136,6 @@ const Pinswg_electricityactid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-type-of-event-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_enforcementnoticeappeals174id = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_enforcementnoticeappeals174id = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_environmentalpermittingid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -219,16 +200,11 @@ const Pinswg_environmentalpermittingid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -444,31 +420,6 @@ const Pinswg_environmentalpermittingid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -219,16 +200,11 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -444,31 +420,6 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -349,31 +349,6 @@ const Pinswg_householderappealhasid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_ldpid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_ldpid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_listedbuildingandconservationrid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_listedbuildingandconservationrid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_starttimeofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_starttimeofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_starttimeofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_maintenanceoflands217id = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_maintenanceoflands217id = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_miscellaneouscasewordid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -219,16 +200,11 @@ const Pinswg_miscellaneouscasewordid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -444,31 +420,6 @@ const Pinswg_miscellaneouscasewordid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const Pinswg_nonvalidationid = (props) => {
|
|||||||
: ""}
|
: ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-procedure-label")}
|
{t("case:summary-procedure-label")}
|
||||||
</dt>
|
</dt>
|
||||||
@@ -95,7 +95,7 @@ const Pinswg_nonvalidationid = (props) => {
|
|||||||
"pinswg_procedure@OData.Community.Display.V1.FormattedValue"
|
"pinswg_procedure@OData.Community.Display.V1.FormattedValue"
|
||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div> */}
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -128,12 +128,12 @@ const Pinswg_nonvalidationid = (props) => {
|
|||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.value=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj[
|
detailsObj[
|
||||||
"pinswg_decisionissued@OData.Community.Display.V1.FormattedValue"
|
"pinswg_decision@OData.Community.Display.V1.FormattedValue"
|
||||||
] +
|
] +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: detailsObj[
|
: detailsObj[
|
||||||
"pinswg_decisionissued@OData.Community.Display.V1.FormattedValue"
|
"pinswg_decision@OData.Community.Display.V1.FormattedValue"
|
||||||
] ||
|
] ||
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
@@ -164,12 +164,12 @@ const Pinswg_nonvalidationid = (props) => {
|
|||||||
{t("case:summary-start-date-label")}
|
{t("case:summary-start-date-label")}
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{_.has(detailsObj, "pinswg_validdate")
|
{_.has(detailsObj, "pinswg_startdate")
|
||||||
? !_.isEmpty(
|
? !_.isEmpty(
|
||||||
detailsObj.pinswg_validdate
|
detailsObj.pinswg_startdate
|
||||||
)
|
)
|
||||||
? formatDates(
|
? formatDates(
|
||||||
detailsObj.pinswg_validdate
|
detailsObj.pinswg_startdate
|
||||||
)
|
)
|
||||||
: t(
|
: t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
@@ -200,13 +200,13 @@ const Pinswg_nonvalidationid = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_decisionissueddate"
|
"pinswg_casedecisiondate"
|
||||||
)
|
)
|
||||||
? !_.isEmpty(
|
? !_.isEmpty(
|
||||||
detailsObj.pinswg_decisionissueddate
|
detailsObj.pinswg_casedecisiondate
|
||||||
)
|
)
|
||||||
? formatDates(
|
? formatDates(
|
||||||
detailsObj.pinswg_decisionissueddate
|
detailsObj.pinswg_casedecisiondate
|
||||||
)
|
)
|
||||||
: t(
|
: t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -147,12 +128,12 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.value=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj[
|
detailsObj[
|
||||||
"pinswg_dicision@OData.Community.Display.V1.FormattedValue"
|
"pinswg_decision@OData.Community.Display.V1.FormattedValue"
|
||||||
] +
|
] +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: detailsObj[
|
: detailsObj[
|
||||||
"pinswg_dicision@OData.Community.Display.V1.FormattedValue"
|
"pinswg_decision@OData.Community.Display.V1.FormattedValue"
|
||||||
] ||
|
] ||
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
@@ -167,29 +148,6 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
</Link> */}
|
</Link> */}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-decision-date-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_casedecisiondate"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_casedecisiondate
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_casedecisiondate
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
{casesObj.numberofchildincidents > 0 && (
|
{casesObj.numberofchildincidents > 0 && (
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
@@ -306,7 +264,7 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t(
|
{t(
|
||||||
"case:summary-statement-interested-party-due-date-label"
|
"case:summary-statement-due-date-label"
|
||||||
)}
|
)}
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
@@ -329,7 +287,7 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* <div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t(
|
{t(
|
||||||
"case:summary-interested-party-date-label"
|
"case:summary-interested-party-date-label"
|
||||||
@@ -366,12 +324,12 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
</div> */}
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t(
|
{t(
|
||||||
"case:summary-final-comments-date-label"
|
"case:summary-applicant-final-comments-date-label"
|
||||||
)}
|
)}
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
@@ -418,7 +376,7 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
</div> */}
|
</div> */}
|
||||||
{/* <div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-event-date-label")}
|
{t("case:summary-event-date-label")}
|
||||||
</dt>
|
</dt>
|
||||||
@@ -440,22 +398,22 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
</div> */}
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-event-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_startdatetimeiftheevent"
|
"pinswg_casedecisiondate"
|
||||||
)
|
)
|
||||||
? !_.isEmpty(
|
? !_.isEmpty(
|
||||||
detailsObj.pinswg_startdatetimeiftheevent
|
detailsObj.pinswg_casedecisiondate
|
||||||
)
|
)
|
||||||
? formatDates(
|
? formatDates(
|
||||||
detailsObj.pinswg_startdatetimeiftheevent
|
detailsObj.pinswg_casedecisiondate
|
||||||
)
|
)
|
||||||
: t(
|
: t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
@@ -465,40 +423,6 @@ const Pinswg_planningappeals78id = (props) => {
|
|||||||
)}
|
)}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{detailsObj.pinswg_typeofevent == 846040002 ||
|
|
||||||
detailsObj.pinswg_typeofevent == 846040007 ||
|
|
||||||
detailsObj.pinswg_typeofevent == 846040012 ||
|
|
||||||
detailsObj.pinswg_typeofevent == 846040009 ? (
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-time-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdatetimeiftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdatetimeiftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdatetimeiftheevent,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_planningconditionss73s79id = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_planningconditionss73s79id = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_planningobligationappeals106id = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -419,31 +400,6 @@ const Pinswg_planningobligationappeals106id = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_rowid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -219,16 +200,11 @@ const Pinswg_rowid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -444,31 +420,6 @@ const Pinswg_rowid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateoftheevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateoftheevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -96,25 +96,6 @@ const Pinswg_wayleaveid = (props) => {
|
|||||||
] || ""}
|
] || ""}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t("case:summary-type-of-event-label")}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-status-label")}
|
{t("case:summary-status-label")}
|
||||||
@@ -219,16 +200,11 @@ const Pinswg_wayleaveid = (props) => {
|
|||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
'$..[?(@.value=="' +
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
detailsObj.pinswg_relevantauthorityname +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: jsonpath.query(
|
: detailsObj.pinswg_relevantauthorityname ||
|
||||||
transLookup,
|
|
||||||
'$..[?(@.pinswg_lpa=="' +
|
|
||||||
detailsObj.pinswg_relevantauthorityname +
|
|
||||||
'")].value'
|
|
||||||
) ||
|
|
||||||
t(
|
t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
)}
|
)}
|
||||||
@@ -444,31 +420,6 @@ const Pinswg_wayleaveid = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{t(
|
|
||||||
"case:summary-start-event-date-label"
|
|
||||||
)}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__value">
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_startdateofevent"
|
|
||||||
)
|
|
||||||
? !_.isEmpty(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
? formatDates(
|
|
||||||
detailsObj.pinswg_startdateofevent
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)
|
|
||||||
: t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-summary-list__row">
|
<div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">
|
<dt className="govuk-summary-list__key">
|
||||||
{t("case:summary-decision-date-label")}
|
{t("case:summary-decision-date-label")}
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ const CookieManagementMain = (props) => {
|
|||||||
name="usage"
|
name="usage"
|
||||||
className="govuk-radios__input"
|
className="govuk-radios__input"
|
||||||
id="usage-1"
|
id="usage-1"
|
||||||
|
component="input"
|
||||||
type="radio"
|
type="radio"
|
||||||
value="revoked"
|
value="revoked"
|
||||||
checked={
|
checked={
|
||||||
@@ -233,6 +234,7 @@ const CookieManagementMain = (props) => {
|
|||||||
name="usage"
|
name="usage"
|
||||||
type="radio"
|
type="radio"
|
||||||
value="accepted"
|
value="accepted"
|
||||||
|
component="input"
|
||||||
checked={
|
checked={
|
||||||
usageState ===
|
usageState ===
|
||||||
"accepted"
|
"accepted"
|
||||||
@@ -350,6 +352,7 @@ const CookieManagementMain = (props) => {
|
|||||||
name="settings"
|
name="settings"
|
||||||
type="radio"
|
type="radio"
|
||||||
value="revoked"
|
value="revoked"
|
||||||
|
component="input"
|
||||||
checked={
|
checked={
|
||||||
settingsState === "revoked"
|
settingsState === "revoked"
|
||||||
}
|
}
|
||||||
@@ -376,6 +379,7 @@ const CookieManagementMain = (props) => {
|
|||||||
name="settings"
|
name="settings"
|
||||||
type="radio"
|
type="radio"
|
||||||
value="accepted"
|
value="accepted"
|
||||||
|
component="input"
|
||||||
checked={
|
checked={
|
||||||
settingsState === "accepted"
|
settingsState === "accepted"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const DNSLinks = (props) => {
|
|||||||
<ul className="govuk-list">
|
<ul className="govuk-list">
|
||||||
<li>
|
<li>
|
||||||
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
||||||
<Link href="/dnsapplications">
|
<Link href="/dns/applications">
|
||||||
<a className="govuk-link govuk-link--no-underline">
|
<a className="govuk-link govuk-link--no-underline">
|
||||||
{t("dnsHome:links-applications-title")}
|
{t("dnsHome:links-applications-title")}
|
||||||
</a>
|
</a>
|
||||||
@@ -25,7 +25,7 @@ const DNSLinks = (props) => {
|
|||||||
</p>
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
</li>
|
</li>
|
||||||
{/* <li>
|
<li>
|
||||||
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
||||||
<Link href="/dns/help">
|
<Link href="/dns/help">
|
||||||
<a className="govuk-link govuk-link--no-underline">
|
<a className="govuk-link govuk-link--no-underline">
|
||||||
@@ -36,14 +36,14 @@ const DNSLinks = (props) => {
|
|||||||
{t("dnsHome:links-help-intro-paragraph")}
|
{t("dnsHome:links-help-intro-paragraph")}
|
||||||
</p>
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
</li> */}
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-column-one-half">
|
<div className="govuk-grid-column-one-half">
|
||||||
<ul className="govuk-list">
|
<ul className="govuk-list">
|
||||||
<li>
|
<li>
|
||||||
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
||||||
<Link href="https://gov.wales/developments-national-significance-dns-guidance">
|
<Link href="/dns/application-process">
|
||||||
<a className="govuk-link govuk-link--no-underline ">
|
<a className="govuk-link govuk-link--no-underline ">
|
||||||
{t("dnsHome:links-help-title")}
|
{t("dnsHome:links-help-title")}
|
||||||
</a>
|
</a>
|
||||||
@@ -53,7 +53,7 @@ const DNSLinks = (props) => {
|
|||||||
</p>
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
</li>
|
</li>
|
||||||
{/* <li>
|
<li>
|
||||||
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
<h3 className="govuk-heading-l govuk-!-font-size-27">
|
||||||
<Link href="/dns/contact-us">
|
<Link href="/dns/contact-us">
|
||||||
<a className="govuk-link govuk-link--no-underline">
|
<a className="govuk-link govuk-link--no-underline">
|
||||||
@@ -65,7 +65,7 @@ const DNSLinks = (props) => {
|
|||||||
{t("dnsHome:links-contactus-intro-paragraph")}
|
{t("dnsHome:links-contactus-intro-paragraph")}
|
||||||
</p>
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
</li> */}
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,13 +4,9 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
|
|
||||||
const LatestApplications = (props) => {
|
const LatestApplications = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
const { dnsList } = props;
|
|
||||||
|
|
||||||
dnsList = dnsList.value;
|
|
||||||
let dnsListArr = dnsList.slice(0, 3);
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-panel govuk-grid-column-one-third govuk-panel--latest">
|
<div className="govuk-panel govuk-grid-column-one-third govuk-panel--latest">
|
||||||
<h2 className="govuk-heading-m">
|
<h2 className="govuk-heading-m">
|
||||||
@@ -19,25 +15,32 @@ const LatestApplications = (props) => {
|
|||||||
</h2>
|
</h2>
|
||||||
<div className="govuk-panel__body">
|
<div className="govuk-panel__body">
|
||||||
<ul className="govuk-list">
|
<ul className="govuk-list">
|
||||||
{Object.keys(dnsListArr).map((key, index) => {
|
<li className="govuk-body-s ">
|
||||||
return (
|
{" "}
|
||||||
<li className="govuk-body-s " key={key}>
|
<Link href="/dns/application-view">
|
||||||
<Link
|
<a href="">Brynrhyd Solar Farm</a>
|
||||||
href={
|
</Link>
|
||||||
"/dns/" +
|
</li>
|
||||||
(dnsList[key].title.indexOf(" - ") < 0
|
<li className="govuk-body-s ">
|
||||||
? dnsList[key].title
|
{" "}
|
||||||
: dnsList[key].title
|
<Link href="/dns/application-view">
|
||||||
.split(" - ")[1]
|
<a href="">Brynrhyd Solar Farm</a>
|
||||||
.split(" ")
|
</Link>
|
||||||
.join("-"))
|
</li>
|
||||||
}
|
|
||||||
>
|
<li className="govuk-body-s ">
|
||||||
<a>{dnsList[key].title}</a>
|
{" "}
|
||||||
</Link>
|
<Link href="/dns/application-view">
|
||||||
</li>
|
<a href="">Brynrhyd Solar Farm</a>
|
||||||
);
|
</Link>
|
||||||
})}
|
</li>
|
||||||
|
|
||||||
|
<li className="govuk-body-s ">
|
||||||
|
{" "}
|
||||||
|
<Link href="/dns/application-view">
|
||||||
|
<a href="">Brynrhyd Solar Farm</a>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,21 +1,75 @@
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import AutoSuggest from "react-autosuggest";
|
import AutoSuggest from "react-autosuggest";
|
||||||
|
|
||||||
|
const dnsSites = [
|
||||||
|
{ id: 1, name: "30MW Energy Plant - Wrexham" },
|
||||||
|
{ id: 1, name: "Abertillery Wind Farm" },
|
||||||
|
{ id: 1, name: "Alaw Mon Solar Farm" },
|
||||||
|
{ id: 1, name: "Alwen Forest - Wind" },
|
||||||
|
{ id: 1, name: "Blackberry Lane Solar Park" },
|
||||||
|
{ id: 1, name: "Bretton Hall Solar Farm" },
|
||||||
|
{ id: 1, name: "Brynllewelyn Farm - Renewable Energy Project" },
|
||||||
|
{ id: 1, name: "Brynrhyd Solar Farm" },
|
||||||
|
{ id: 1, name: "Brynwell Farm Renewable Energy Hub" },
|
||||||
|
{ id: 1, name: "Buttington Quarry - ERF" },
|
||||||
|
{ id: 1, name: "Coed Darcy - STOR" },
|
||||||
|
{ id: 1, name: "Coity Road - STOR" },
|
||||||
|
{ id: 1, name: "Craig Y Perchyll Solar" },
|
||||||
|
{ id: 1, name: "Egnedol - Sustainable Energy" },
|
||||||
|
{ id: 1, name: "Elwy Solar Energy" },
|
||||||
|
{ id: 1, name: "Erebus - Floating Offshore Wind Demonstration Project" },
|
||||||
|
{ id: 1, name: "Felindre Road - STOR" },
|
||||||
|
{ id: 1, name: "Gaerwen Wind Farm" },
|
||||||
|
{ id: 1, name: "Garn Fach Wind Farm" },
|
||||||
|
{ id: 1, name: "Holyhead Harbour Revision Order" },
|
||||||
|
{ id: 1, name: "Holyhead Marina Harbour Revision Order" },
|
||||||
|
{ id: 1, name: "Holyhead Waterfront Regeneration Scheme HRO" },
|
||||||
|
{ id: 1, name: "Legacy Substation Gas Peaking Plant" },
|
||||||
|
{ id: 1, name: "Llantarnam - SToR" },
|
||||||
|
{ id: 1, name: "Llanwern - Solar" },
|
||||||
|
{ id: 1, name: "Lluest y Gwynt Wind Farm" },
|
||||||
|
{ id: 1, name: "Llynfi Energy Recovery Facility" },
|
||||||
|
{ id: 1, name: "Manmoel Wind Farm" },
|
||||||
|
{ id: 1, name: "Môn Solar Farm" },
|
||||||
|
{ id: 1, name: "Mor Hafren: Energy Recovery Facility" },
|
||||||
|
{ id: 1, name: "Mynydd Carn-y-Cefn Wind Farm" },
|
||||||
|
{ id: 1, name: "Mynydd Llanhilleth Wind Farm" },
|
||||||
|
{ id: 1, name: "Pancross & Oaklands Solar Farm" },
|
||||||
|
{ id: 1, name: "Parc Dyffryn Solar Park" },
|
||||||
|
{ id: 1, name: "Parc Solar Traffwll" },
|
||||||
|
{ id: 1, name: "Pen March Wind Farm" },
|
||||||
|
{ id: 1, name: "Pen-y-Fan - Power Plant" },
|
||||||
|
{ id: 1, name: "Pencaerlan Solar Farm" },
|
||||||
|
{ id: 1, name: "Penderi Solar Farm" },
|
||||||
|
{ id: 1, name: "Penpergwm Solar Farm" },
|
||||||
|
{ id: 1, name: "Pentre Bach Solar Farm" },
|
||||||
|
{ id: 1, name: "Plas Power Estate Solar Farm" },
|
||||||
|
{ id: 1, name: "Project Valorous" },
|
||||||
|
{ id: 1, name: "Rhoscrowther Wind Farm" },
|
||||||
|
{ id: 1, name: "Rush Wall Solar Park Ltd" },
|
||||||
|
{ id: 1, name: "Sudbrook - Peaking Gas" },
|
||||||
|
{ id: 1, name: "TWA - Morlais Demonstration Zone" },
|
||||||
|
{ id: 1, name: "Twyn Hywel Energy Park" },
|
||||||
|
{ id: 1, name: "Tycroes Solar" },
|
||||||
|
{ id: 1, name: "Upper Ogmore - Wind Turbines" },
|
||||||
|
{ id: 1, name: "Valero - Cogeneration Facility" },
|
||||||
|
{ id: 1, name: "Vattenfall - Renewable Energy" },
|
||||||
|
{ id: 1, name: "Wauntysswg - Solar" },
|
||||||
|
{ id: 1, name: "Wentlooge - renewable energy hub" },
|
||||||
|
{ id: 1, name: "Y Bryn Wind Farm" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const lowerCasedCompanies = dnsSites.map((company) => {
|
||||||
|
return {
|
||||||
|
id: company.id,
|
||||||
|
name: company.name,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const TitleContent = (props) => {
|
const TitleContent = (props) => {
|
||||||
const { dnsList } = props;
|
|
||||||
|
|
||||||
const dnsSites = dnsList.value;
|
|
||||||
|
|
||||||
const lowerCasedCompanies = dnsSites.map((company) => {
|
|
||||||
return {
|
|
||||||
id: company.ticketnumber,
|
|
||||||
name: company.title,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -38,11 +92,12 @@ const TitleContent = (props) => {
|
|||||||
<div className="govuk-panel__body">
|
<div className="govuk-panel__body">
|
||||||
<p className="govuk-body-s">{t("dnsHome:title-paragraph")}</p>
|
<p className="govuk-body-s">{t("dnsHome:title-paragraph")}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-form-group govuk-!-margin-bottom-0 flex-container react-autosuggest">
|
<div className="govuk-form-group govuk-!-margin-bottom-0 flex-container">
|
||||||
<AutoSuggest
|
<AutoSuggest
|
||||||
suggestions={suggestions}
|
suggestions={suggestions}
|
||||||
onSuggestionsClearRequested={() => setSuggestions([])}
|
onSuggestionsClearRequested={() => setSuggestions([])}
|
||||||
onSuggestionsFetchRequested={({ value }) => {
|
onSuggestionsFetchRequested={({ value }) => {
|
||||||
|
console.log(value);
|
||||||
setValue(value);
|
setValue(value);
|
||||||
setSuggestions(getSuggestions(value));
|
setSuggestions(getSuggestions(value));
|
||||||
}}
|
}}
|
||||||
@@ -65,15 +120,8 @@ const TitleContent = (props) => {
|
|||||||
}}
|
}}
|
||||||
highlightFirstSuggestion={true}
|
highlightFirstSuggestion={true}
|
||||||
/>
|
/>
|
||||||
<Link
|
<Link href="/dns/application-view">
|
||||||
href={
|
<a className="govuk-button govuk-!-margin-bottom-0 govuk-!-margin-left-2">
|
||||||
"/dns/" +
|
|
||||||
(value.indexOf(" - ") > 0
|
|
||||||
? value.split(" - ")[1].split(" ").join("-")
|
|
||||||
: value)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a className="govuk-button govuk-!-margin-bottom-0 ">
|
|
||||||
{t("dnsHome:title-application-search-button")}
|
{t("dnsHome:title-application-search-button")}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import LatestApplications from "./homepage/latestApplications";
|
|||||||
import DNSLinks from "./homepage/dnsLinks";
|
import DNSLinks from "./homepage/dnsLinks";
|
||||||
import ApplicationsForComment from "./homepage/applicationsForComment";
|
import ApplicationsForComment from "./homepage/applicationsForComment";
|
||||||
|
|
||||||
export default function Main({ children, pages, props }) {
|
export default function Main({ children, pages }) {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -22,12 +22,8 @@ export default function Main({ children, pages, props }) {
|
|||||||
<div className="govuk-grid-row govuk-!-margin-bottom-0">
|
<div className="govuk-grid-row govuk-!-margin-bottom-0">
|
||||||
<div className="govuk-grid-column-full govuk-!-padding-bottom-0">
|
<div className="govuk-grid-column-full govuk-!-padding-bottom-0">
|
||||||
<div className="flex-container grid-row govuk-body govuk-!-margin-bottom-0 ">
|
<div className="flex-container grid-row govuk-body govuk-!-margin-bottom-0 ">
|
||||||
<TitleContent
|
<TitleContent />
|
||||||
dnsList={props.searchResultsObj.searchResultsObj}
|
<LatestApplications />
|
||||||
/>
|
|
||||||
<LatestApplications
|
|
||||||
dnsList={props.searchResultsObj.searchResultsObj}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,7 +31,7 @@ export default function Main({ children, pages, props }) {
|
|||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="flex-container grid-row govuk-body ">
|
<div className="flex-container grid-row govuk-body ">
|
||||||
<DNSLinks />
|
<DNSLinks />
|
||||||
{/* <ApplicationsForComment /> */}
|
<ApplicationsForComment />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import DNSSearchResults from "./search/dnssearchresults";
|
|||||||
import CRMError from "./crmError";
|
import CRMError from "./crmError";
|
||||||
|
|
||||||
export default function Search(props) {
|
export default function Search(props) {
|
||||||
const { searchString, searchResultsObj, myportal, watchedCases, showMap } =
|
const { searchString, searchResultsObj } = props;
|
||||||
props;
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -40,10 +39,6 @@ export default function Search(props) {
|
|||||||
searchDetailsObj={
|
searchDetailsObj={
|
||||||
searchResultsObj.searchDetailsObj
|
searchResultsObj.searchDetailsObj
|
||||||
}
|
}
|
||||||
dnsCoords={searchResultsObj.dnsCoordsObj.value}
|
|
||||||
myportal={myportal}
|
|
||||||
watchedCases={watchedCases}
|
|
||||||
showMap={showMap}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+132
-1192
File diff suppressed because it is too large
Load Diff
@@ -154,7 +154,7 @@ export default function Footer(props) {
|
|||||||
"common:footer-contact-us-link"
|
"common:footer-contact-us-link"
|
||||||
)}
|
)}
|
||||||
className="govuk-footer__link"
|
className="govuk-footer__link"
|
||||||
id="aContactUs"
|
id="aAccess"
|
||||||
>
|
>
|
||||||
{t(
|
{t(
|
||||||
"common:footer-contact-us-link-label"
|
"common:footer-contact-us-link-label"
|
||||||
@@ -176,7 +176,7 @@ export default function Footer(props) {
|
|||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
className="govuk-footer__link"
|
className="govuk-footer__link"
|
||||||
id="aAccessibility"
|
id="aAccess"
|
||||||
>
|
>
|
||||||
{t(
|
{t(
|
||||||
"common:footer-accessibility-link-label"
|
"common:footer-accessibility-link-label"
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
|||||||
import { setLogout } from "../store/accountDetails/action";
|
import { setLogout } from "../store/accountDetails/action";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||||
|
|
||||||
import { useSession, signIn, signOut } from "next-auth/react";
|
|
||||||
|
|
||||||
const Header = (props) => {
|
const Header = (props) => {
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
@@ -36,11 +33,9 @@ const Header = (props) => {
|
|||||||
"/myportal/error",
|
"/myportal/error",
|
||||||
"/accessibility",
|
"/accessibility",
|
||||||
"/details-about-cookies",
|
"/details-about-cookies",
|
||||||
"/auth/verify-request",
|
|
||||||
"/auth/signin",
|
|
||||||
"/auth/error",
|
|
||||||
];
|
];
|
||||||
const hasContactLink = [
|
const hasContactLink = [
|
||||||
|
"/dns",
|
||||||
"/dns/application-process",
|
"/dns/application-process",
|
||||||
"/dns/help",
|
"/dns/help",
|
||||||
"/dns/contact-us",
|
"/dns/contact-us",
|
||||||
@@ -219,9 +214,8 @@ const Header = (props) => {
|
|||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.localStorage.clear(),
|
destroyCookie({}, "pinsUser"),
|
||||||
destroyCookie({}, "pinsUser"),
|
window.localStorage.clear();
|
||||||
signOut({ callbackUrl: "/logout" });
|
|
||||||
}}
|
}}
|
||||||
className="govuk-header__link govuk-!-margin-right-3"
|
className="govuk-header__link govuk-!-margin-right-3"
|
||||||
>
|
>
|
||||||
|
|||||||
+184
-203
@@ -9,8 +9,6 @@ import { getLogin } from "../../actions";
|
|||||||
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
||||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||||
|
|
||||||
import { useSession, signIn, signOut } from "next-auth/react";
|
|
||||||
|
|
||||||
const required = (errorMsg) => (value) =>
|
const required = (errorMsg) => (value) =>
|
||||||
value || typeof value === "number" ? undefined : errorMsg;
|
value || typeof value === "number" ? undefined : errorMsg;
|
||||||
|
|
||||||
@@ -56,13 +54,7 @@ const RenderTextfield = ({
|
|||||||
{error}
|
{error}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<input
|
<input {...input} className={className} name={name} id={id} />
|
||||||
{...input}
|
|
||||||
className={className}
|
|
||||||
name={name}
|
|
||||||
id={id}
|
|
||||||
autoComplete="username"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -108,7 +100,6 @@ const RenderPasswordfield = ({
|
|||||||
className={className}
|
className={className}
|
||||||
name={name}
|
name={name}
|
||||||
id={id}
|
id={id}
|
||||||
autoComplete="current-password"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -117,10 +108,15 @@ const RenderPasswordfield = ({
|
|||||||
|
|
||||||
let Login = (props) => {
|
let Login = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
const { handleSubmit, pristine, reset, submitting, setLoggedInUserId } =
|
const {
|
||||||
props;
|
handleSubmit,
|
||||||
|
pristine,
|
||||||
const { data: session } = useSession();
|
reset,
|
||||||
|
submitting,
|
||||||
|
setLoggedInUserId,
|
||||||
|
GG_CLIENT_ID,
|
||||||
|
GG_REDIRECT_URI,
|
||||||
|
} = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
@@ -128,6 +124,17 @@ let Login = (props) => {
|
|||||||
// const [showSpinnerState, setShowSpinnerState] = useState(false);
|
// const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||||
const [validLoginID, setValidLoginID] = useState(null);
|
const [validLoginID, setValidLoginID] = useState(null);
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// "built login url path:",
|
||||||
|
// props.govGateway.config.authorization_endpoint +
|
||||||
|
// "?response_type=code&scope=openid&client_id=" +
|
||||||
|
// GG_CLIENT_ID +
|
||||||
|
// "&redirect_uri=" +
|
||||||
|
// GG_REDIRECT_URI +
|
||||||
|
// "&ui_locales=" +
|
||||||
|
// (router.locale == "cy" ? "cy" : "en-GB")
|
||||||
|
// );
|
||||||
|
|
||||||
// let spinnerState = () => {
|
// let spinnerState = () => {
|
||||||
// showSpinnerState == true
|
// showSpinnerState == true
|
||||||
// ? setShowSpinnerState(false)
|
// ? setShowSpinnerState(false)
|
||||||
@@ -154,6 +161,7 @@ let Login = (props) => {
|
|||||||
router.replace({
|
router.replace({
|
||||||
pathname:
|
pathname:
|
||||||
router.locale == "cy" ? "/fymhorth" : "/myportal",
|
router.locale == "cy" ? "/fymhorth" : "/myportal",
|
||||||
|
shallow: true,
|
||||||
}))
|
}))
|
||||||
: //setShowSpinnerState(false),
|
: //setShowSpinnerState(false),
|
||||||
setValidLoginID(false);
|
setValidLoginID(false);
|
||||||
@@ -171,214 +179,186 @@ let Login = (props) => {
|
|||||||
: "";
|
: "";
|
||||||
}, [cookies.pinsUser, router]);
|
}, [cookies.pinsUser, router]);
|
||||||
|
|
||||||
if (session === "loading") {
|
const govGatwayLoginRedirect = () => {
|
||||||
return <h1>loading...</h1>;
|
let ggUrl =
|
||||||
}
|
props.govGateway.config.authorization_endpoint +
|
||||||
|
"?response_type=code&scope=openid&client_id=" +
|
||||||
|
GG_CLIENT_ID +
|
||||||
|
"&redirect_uri=" +
|
||||||
|
GG_REDIRECT_URI +
|
||||||
|
"&ui_locales=" +
|
||||||
|
(router.locale == "cy" ? "cy" : "en-GB");
|
||||||
|
|
||||||
|
console.log("login Url:", ggUrl);
|
||||||
|
|
||||||
|
router.replace(ggUrl);
|
||||||
|
};
|
||||||
|
|
||||||
|
const govGatwayForgottenLink = () => {
|
||||||
|
let ggUrl =
|
||||||
|
props.govGateway.config.authorization_endpoint +
|
||||||
|
"/login/forgot-password";
|
||||||
|
router.replace(ggUrl);
|
||||||
|
};
|
||||||
|
|
||||||
if (session) {
|
|
||||||
<>
|
|
||||||
<div>Signed in as {session.user?.email}</div>
|
|
||||||
<br />
|
|
||||||
<button type="button" onClick={() => signOut()}>
|
|
||||||
Signout
|
|
||||||
</button>
|
|
||||||
</>;
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="card" id="login-card">
|
||||||
<div className="card" id="login-card">
|
<div className="card-body active">
|
||||||
<div className="card-body active">
|
<h3 className="heading-small card-heading">
|
||||||
<h3 className="heading-small card-heading">
|
{t("home:login-card-title")}
|
||||||
{/* {t("home:login-card-title")} */}
|
</h3>{" "}
|
||||||
{t("home:login-card-title-temp")}
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
</h3>{" "}
|
{validLoginID == false && (
|
||||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
<div className="govuk-error-message govuk-form-group--error">
|
||||||
<div className="govuk-body">
|
Incorrect username or password
|
||||||
{session && "Signed in as " + session.user?.email}
|
|
||||||
</div>
|
</div>
|
||||||
<br />
|
)}
|
||||||
{!session && (
|
<Field
|
||||||
<button
|
// validate={[
|
||||||
className="govuk-button withChevron govuk-button-cta"
|
// required(
|
||||||
type="button"
|
// t("home:casesearch-search-validation-required")
|
||||||
onClick={() =>
|
// ),
|
||||||
signIn("email", {
|
// minLength(
|
||||||
callbackUrl: "/",
|
// t("home:casesearch-search-validation-minlength")
|
||||||
})
|
// ),
|
||||||
}
|
// ]}
|
||||||
>
|
className="govuk-input"
|
||||||
{t("home:login-via-nextuth-label")}
|
component={RenderTextfield}
|
||||||
</button>
|
id="loginUserID"
|
||||||
)}
|
name="loginUserID"
|
||||||
{session && (
|
type="text"
|
||||||
<button
|
aria-describedby="basicSearch-hint"
|
||||||
className="govuk-button"
|
hint1={t("home:login-card-id-label")}
|
||||||
type="button"
|
label={t("home:login-card-id-hint")}
|
||||||
onClick={() => signOut()}
|
/>
|
||||||
>
|
|
||||||
Magic Link Sign Out
|
<Field
|
||||||
</button>
|
// validate={[
|
||||||
)}
|
// required(
|
||||||
|
// t("home:casesearch-search-validation-required")
|
||||||
|
// ),
|
||||||
|
// minLength(
|
||||||
|
// t("home:casesearch-search-validation-minlength")
|
||||||
|
// ),
|
||||||
|
// ]}
|
||||||
|
className="govuk-input"
|
||||||
|
component={RenderPasswordfield}
|
||||||
|
id="loginUserPassword"
|
||||||
|
name="loginUserPassword"
|
||||||
|
type="password"
|
||||||
|
label="Password"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="govuk-form-group">
|
||||||
|
<button type="submit" className="govuk-button">
|
||||||
|
{t("home:login-card-button")}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p className="govuk-body-s">
|
</form>
|
||||||
{t("home:login-comingsoon-temp-1")}{" "}
|
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||||
|
<p className="govuk-body-xs">
|
||||||
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
govGatwayLoginRedirect();
|
||||||
|
}}
|
||||||
|
className="govuk-button withChevron govuk-button-cta"
|
||||||
|
>
|
||||||
|
{t("home:login-via-gov-gateway-label")}
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p className="govuk-body-s">
|
<p className="govuk-body-s">
|
||||||
{t("home:login-comingsoon-temp-1a")}{" "}
|
{t("home:login-card-register-label")}{" "}
|
||||||
</p>
|
<Link
|
||||||
{/* <form onSubmit={handleSubmit(onHandleSubmit)}>
|
href={
|
||||||
{validLoginID == false && (
|
router.locale == "cy"
|
||||||
<div className="govuk-error-message govuk-form-group--error">
|
? "/cyfrif/cofrestr"
|
||||||
Incorrect username or password
|
: "/account/register"
|
||||||
</div>
|
}
|
||||||
)}
|
>
|
||||||
<Field
|
<a className="govuk-link--no-underline">
|
||||||
// validate={[
|
|
||||||
// required(
|
|
||||||
// t("home:casesearch-search-validation-required")
|
|
||||||
// ),
|
|
||||||
// minLength(
|
|
||||||
// t("home:casesearch-search-validation-minlength")
|
|
||||||
// ),
|
|
||||||
// ]}
|
|
||||||
className="govuk-input"
|
|
||||||
component={RenderTextfield}
|
|
||||||
id="loginUserID"
|
|
||||||
name="loginUserID"
|
|
||||||
type="text"
|
|
||||||
aria-describedby="basicSearch-hint"
|
|
||||||
hint1={t("home:login-card-id-label")}
|
|
||||||
label={t("home:login-card-id-hint")}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Field
|
|
||||||
className="govuk-input"
|
|
||||||
component={RenderPasswordfield}
|
|
||||||
id="loginUserPassword"
|
|
||||||
name="loginUserPassword"
|
|
||||||
type="password"
|
|
||||||
label="Password"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<button type="submit" className="govuk-button">
|
|
||||||
{t("home:login-card-button")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form> */}
|
|
||||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
|
||||||
{/* <p className="govuk-body-xs">
|
|
||||||
<a
|
|
||||||
onClick={() => {
|
|
||||||
govGatwayLoginRedirect();
|
|
||||||
}}
|
|
||||||
className="govuk-button withChevron govuk-button-cta"
|
|
||||||
>
|
|
||||||
{t("home:login-via-gov-gateway-label")}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<p className="govuk-body-s">
|
|
||||||
{t("home:login-card-register-label")}{" "}
|
|
||||||
<a
|
|
||||||
href={
|
|
||||||
router.locale == "cy"
|
|
||||||
? "https://www.ete.access.service.gov.uk/login/create-account?lang=cy"
|
|
||||||
: "https://www.ete.access.service.gov.uk/login/create-account"
|
|
||||||
}
|
|
||||||
className="govuk-link--no-underline"
|
|
||||||
>
|
|
||||||
{t("home:login-card-register-link")}
|
{t("home:login-card-register-link")}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</Link>
|
||||||
*/}
|
</p>
|
||||||
{/* <p className="govuk-body-s">
|
<p className="govuk-body-s">
|
||||||
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
govGatwayForgottenLink();
|
||||||
|
}}
|
||||||
|
className="govuk-link--no-underline"
|
||||||
|
>
|
||||||
|
{t("home:login-card-forgotten-label")}{" "}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<hr className="govuk-!-margin-bottom-4" />
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
{t("home:login-comingsoon-temp-2")}
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
|
||||||
govGatwayForgottenLink();
|
|
||||||
}}
|
|
||||||
className="govuk-link--no-underline"
|
className="govuk-link--no-underline"
|
||||||
|
target="_blank"
|
||||||
|
href={t("home:login-comingsoon-forms-link-1")}
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
{t("home:login-card-forgotten-label")}{" "}
|
{t("home:login-comingsoon-forms-label-1")}
|
||||||
</a>
|
</a>
|
||||||
</p> */}
|
</li>
|
||||||
<hr className="govuk-!-margin-bottom-4" />
|
<li>
|
||||||
<p className="govuk-body-s">
|
{" "}
|
||||||
{t("home:login-comingsoon-temp-2")}
|
<a
|
||||||
</p>
|
className="govuk-link--no-underline"
|
||||||
<ul>
|
target="_blank"
|
||||||
<li>
|
href={t("home:login-comingsoon-forms-link-2")}
|
||||||
<a
|
rel="noreferrer"
|
||||||
className="govuk-link--no-underline"
|
>
|
||||||
target="_blank"
|
{t("home:login-comingsoon-forms-label-2")}
|
||||||
href={t(
|
</a>
|
||||||
"home:login-comingsoon-forms-link-1"
|
</li>
|
||||||
)}
|
<li>
|
||||||
rel="noreferrer"
|
{" "}
|
||||||
>
|
<a
|
||||||
{t("home:login-comingsoon-forms-label-1")}
|
className="govuk-link--no-underline"
|
||||||
</a>
|
target="_blank"
|
||||||
</li>
|
href={t("home:login-comingsoon-forms-link-3")}
|
||||||
<li>
|
rel="noreferrer"
|
||||||
{" "}
|
>
|
||||||
<a
|
{t("home:login-comingsoon-forms-label-3")}
|
||||||
className="govuk-link--no-underline"
|
</a>
|
||||||
target="_blank"
|
</li>
|
||||||
href={t(
|
<li>
|
||||||
"home:login-comingsoon-forms-link-2"
|
{" "}
|
||||||
)}
|
<a
|
||||||
rel="noreferrer"
|
className="govuk-link--no-underline"
|
||||||
>
|
target="_blank"
|
||||||
{t("home:login-comingsoon-forms-label-2")}
|
href={t("home:login-comingsoon-forms-link-4")}
|
||||||
</a>
|
rel="noreferrer"
|
||||||
</li>
|
>
|
||||||
<li>
|
{t("home:login-comingsoon-forms-label-4")}
|
||||||
{" "}
|
</a>
|
||||||
<a
|
</li>
|
||||||
className="govuk-link--no-underline"
|
</ul>
|
||||||
target="_blank"
|
<br />
|
||||||
href={t(
|
|
||||||
"home:login-comingsoon-forms-link-3"
|
|
||||||
)}
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
{t("home:login-comingsoon-forms-label-3")}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{" "}
|
|
||||||
<a
|
|
||||||
className="govuk-link--no-underline"
|
|
||||||
target="_blank"
|
|
||||||
href={t(
|
|
||||||
"home:login-comingsoon-forms-link-4"
|
|
||||||
)}
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
{t("home:login-comingsoon-forms-label-4")}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<p className="govuk-body-s">
|
<p className="govuk-body-s">
|
||||||
{t("home:login-comingsoon-email-link-label")}{" "}
|
{t("home:login-comingsoon-email-link-label")}{" "}
|
||||||
<a
|
<a
|
||||||
href={"mailto:" + t("home:login-contact-email")}
|
href={"mailto:" + t("home:login-contact-email")}
|
||||||
className="govuk-link--no-underline"
|
className="govuk-link--no-underline"
|
||||||
>
|
>
|
||||||
{t("home:login-contact-email")}
|
{t("home:login-contact-email")}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* <LoadingOverlay
|
{/* <LoadingOverlay
|
||||||
active={showSpinnerState}
|
active={showSpinnerState}
|
||||||
spinner
|
spinner
|
||||||
text="Logging in"
|
text="Logging in"
|
||||||
/> */}
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -394,6 +374,7 @@ const mapStateToProps = (state) => {
|
|||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
|
govGateway: state.govGateway,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+9
-13
@@ -12,7 +12,7 @@ import Dns from "./homepage/dns";
|
|||||||
const MainHome = (props) => {
|
const MainHome = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const { showLogin, session } = props;
|
const { showLogin, GG_REDIRECT_URI, GG_CLIENT_ID } = props;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
@@ -25,20 +25,16 @@ const MainHome = (props) => {
|
|||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="flex-container grid-row govuk-body ">
|
<div className="flex-container grid-row govuk-body ">
|
||||||
{showLogin != "true" && (
|
<LoginSoon />
|
||||||
<>
|
<CaseSearch />
|
||||||
<LoginSoon />
|
|
||||||
<CaseSearch />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{showLogin == "true" && (
|
|
||||||
<>
|
|
||||||
<CaseSearch />
|
|
||||||
<Login session={session} />
|
|
||||||
</>
|
|
||||||
)}{" "}
|
|
||||||
<CaseComment />
|
<CaseComment />
|
||||||
<Dns />
|
<Dns />
|
||||||
|
{showLogin == "true" && (
|
||||||
|
<Login
|
||||||
|
GG_CLIENT_ID={GG_CLIENT_ID}
|
||||||
|
GG_REDIRECT_URI={GG_REDIRECT_URI}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{/* <Inspectorate /> */}
|
{/* <Inspectorate /> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
import GoogleMapReact from "google-map-react";
|
|
||||||
const GoogleMapComponent = (props) => {
|
|
||||||
const { center, zoom } = props;
|
|
||||||
|
|
||||||
let data = [center];
|
|
||||||
|
|
||||||
const ModelsMap = (map, maps) => {
|
|
||||||
//instantiate array that will hold your Json Data
|
|
||||||
let dataArray = [];
|
|
||||||
//push your Json Data in the array
|
|
||||||
{
|
|
||||||
data.map((markerJson) => dataArray.push(markerJson));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Loop through the dataArray to create a marker per data using the coordinates in the json
|
|
||||||
for (let i = 0; i < dataArray.length; i++) {
|
|
||||||
let marker = new maps.Marker({
|
|
||||||
position: { lat: dataArray[i].lat, lng: dataArray[i].lng },
|
|
||||||
map,
|
|
||||||
label: dataArray[i].id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<GoogleMapReact
|
|
||||||
options={function (maps) {
|
|
||||||
return {
|
|
||||||
overviewMapControl: true,
|
|
||||||
mapTypeControl: true,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
bootstrapURLKeys={{
|
|
||||||
key: "AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo",
|
|
||||||
}}
|
|
||||||
defaultCenter={center}
|
|
||||||
defaultZoom={zoom}
|
|
||||||
yesIWantToUseGoogleMapApiInternals
|
|
||||||
onGoogleApiLoaded={({ map, maps }) => ModelsMap(map, maps)}
|
|
||||||
></GoogleMapReact>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default GoogleMapComponent;
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
import L from "leaflet";
|
|
||||||
import { useRef, useMemo } from "react";
|
|
||||||
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
|
|
||||||
|
|
||||||
const OSMapComponent = (props) => {
|
|
||||||
const { center, zoom } = props;
|
|
||||||
const markerRef = useRef(null);
|
|
||||||
let data = [center];
|
|
||||||
|
|
||||||
// const ModelsMap = (map, maps) => {
|
|
||||||
// //instantiate array that will hold your Json Data
|
|
||||||
// let dataArray = [];
|
|
||||||
// //push your Json Data in the array
|
|
||||||
// {
|
|
||||||
// data.map((markerJson) => dataArray.push(markerJson));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Loop through the dataArray to create a marker per data using the coordinates in the json
|
|
||||||
// for (let i = 0; i < dataArray.length; i++) {
|
|
||||||
// let marker = new maps.Marker({
|
|
||||||
// position: { lat: dataArray[i].lat, lng: dataArray[i].lng },
|
|
||||||
// map,
|
|
||||||
// label: dataArray[i].id,
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MapContainer center={center} zoom={zoom}>
|
|
||||||
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
|
||||||
|
|
||||||
<Marker position={center} ref={markerRef}>
|
|
||||||
<Popup>hello</Popup>
|
|
||||||
</Marker>
|
|
||||||
</MapContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
export default OSMapComponent;
|
|
||||||
+71
-73
@@ -1,32 +1,58 @@
|
|||||||
import { signOut } from "next-auth/react";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { destroyCookie } from "nookies";
|
import { useContext } from "react";
|
||||||
import TimeOut from "../components/timeout";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import AwaitingSubmission from "./myportal/awaitingsubmission";
|
|
||||||
import AwaitingSubmissionFromBlob from "./myportal/awaitingsubmissionfromblob";
|
|
||||||
|
|
||||||
import Dns from "./myportal/dns";
|
|
||||||
import MakeNewAppeal from "./myportal/makenewappeal";
|
import MakeNewAppeal from "./myportal/makenewappeal";
|
||||||
import MyCases from "./myportal/mycases";
|
import MyCases from "./myportal/mycases";
|
||||||
import MyRepresentations from "./myportal/myrepresentations";
|
|
||||||
import SearchCases from "./myportal/searchcases";
|
import SearchCases from "./myportal/searchcases";
|
||||||
import UploadFile from "./myportal/uploadFile";
|
import AwaitingSubmission from "./myportal/awaitingsubmission";
|
||||||
|
import MyRepresentations from "./myportal/myrepresentations";
|
||||||
import WatchedCases from "./myportal/watchedcases";
|
import WatchedCases from "./myportal/watchedcases";
|
||||||
|
import YourAccount from "./myportal/youraccount";
|
||||||
|
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||||
|
|
||||||
|
import IdleTimer from "react-idle-timer";
|
||||||
|
import TimeoutModal from "../components/timeoutmodal";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
const MyPortal = (props) => {
|
const MyPortal = (props) => {
|
||||||
const { showFileUpload } = props;
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
const inactiveTimeOut = 12000; // in seconds
|
||||||
|
const reminderTimeout = 60; // in seconds
|
||||||
|
|
||||||
|
let idleTimer = null;
|
||||||
|
let logoutTimer = null;
|
||||||
|
|
||||||
|
let onIdle = () => {
|
||||||
|
togglePopup();
|
||||||
|
logoutTimer = setTimeout(() => {
|
||||||
|
handleLogout();
|
||||||
|
}, 1000 * reminderTimeout * 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
let togglePopup = () => {
|
||||||
|
showModal == true ? setShowModal(false) : setShowModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
let handleStayLoggedIn = () => {
|
||||||
|
if (logoutTimer) {
|
||||||
|
clearTimeout(logoutTimer);
|
||||||
|
logoutTimer = null;
|
||||||
|
}
|
||||||
|
idleTimer.reset();
|
||||||
|
togglePopup();
|
||||||
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
console.info("////////////\n" + "logout" + "\n////////////");
|
console.log("////////////", "\n", "logout", "\n", "//////////");
|
||||||
window.localStorage.clear(),
|
destroyCookie({}, "pinsUser"),
|
||||||
destroyCookie({}, "pinsUser"),
|
window.localStorage.clear(),
|
||||||
signOut({ callbackUrl: "/logout" });
|
router.replace(props.ggLogout);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -55,24 +81,8 @@ const MyPortal = (props) => {
|
|||||||
alt={router.locale == "cy" ? "Defnyddiwr" : "User"}
|
alt={router.locale == "cy" ? "Defnyddiwr" : "User"}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
<div className="serviceBanner_userDetails_name">
|
<div className="serviceBanner_userDetails_name">
|
||||||
<Link href="/account/personaldetails">
|
{props.accountDetails.accountDetails.firstname}{" "}
|
||||||
<a className="govuk-button-secondary">
|
{props.accountDetails.accountDetails.lastname}
|
||||||
{
|
|
||||||
props.accountDetails.accountDetails
|
|
||||||
.firstname
|
|
||||||
}{" "}
|
|
||||||
{
|
|
||||||
props.accountDetails.accountDetails
|
|
||||||
.lastname
|
|
||||||
}
|
|
||||||
{" - "}
|
|
||||||
{
|
|
||||||
props.accountDetails.accountDetails[
|
|
||||||
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Link
|
<Link
|
||||||
@@ -98,51 +108,39 @@ const MyPortal = (props) => {
|
|||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div className="flex-container grid-row govuk-body ">
|
<div className="flex-container grid-row govuk-body ">
|
||||||
<MakeNewAppeal />
|
<MakeNewAppeal />
|
||||||
|
<MyCases myCases={props.myCases} />
|
||||||
<SearchCases />
|
<SearchCases />
|
||||||
{/* {props.awaitingSubmission.awaitingSubmission[
|
<AwaitingSubmission
|
||||||
"@odata.count"
|
awaitingSubmission={props.awaitingSubmission}
|
||||||
] > 0 && (
|
/>
|
||||||
<AwaitingSubmission
|
<MyRepresentations
|
||||||
awaitingSubmission={
|
myRepresentations={props.myRepresentations}
|
||||||
props.awaitingSubmission
|
/>
|
||||||
}
|
<WatchedCases watchedCases={props.watchedCases} />
|
||||||
/>
|
</div>
|
||||||
)} */}
|
<div className="flex-container grid-row govuk-body ">
|
||||||
{props.awaitingSubmission
|
<YourAccount />
|
||||||
.awaitingSubmissionFromBlob["@odata.count"] >
|
|
||||||
0 && (
|
|
||||||
<AwaitingSubmissionFromBlob
|
|
||||||
containerID={props.containerID}
|
|
||||||
awaitingSubmissionFromBlob={
|
|
||||||
props.awaitingSubmission
|
|
||||||
.awaitingSubmissionFromBlob
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{props.myCases.myCases["@odata.count"] > 0 && (
|
|
||||||
<MyCases myCases={props.myCases} />
|
|
||||||
)}
|
|
||||||
{props.watchedCases.watchedCases["@odata.count"] >
|
|
||||||
0 && (
|
|
||||||
<WatchedCases
|
|
||||||
watchedCases={props.watchedCases}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{props.myRepresentations.myRepresentations[
|
|
||||||
"@odata.count"
|
|
||||||
] > 0 && (
|
|
||||||
<MyRepresentations
|
|
||||||
myRepresentations={props.myRepresentations}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Dns />
|
|
||||||
{/* <YourAccount /> */}
|
|
||||||
{showFileUpload == "true" && <UploadFile />}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<TimeOut />
|
<IdleTimer
|
||||||
|
ref={(ref) => {
|
||||||
|
idleTimer = ref;
|
||||||
|
}}
|
||||||
|
element={document}
|
||||||
|
stopOnIdle={true}
|
||||||
|
onActive={console.log(" bbis active", idleTimer)}
|
||||||
|
onIdle={onIdle}
|
||||||
|
timeout={1000 * inactiveTimeOut * 1}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TimeoutModal
|
||||||
|
remainingCountdown={reminderTimeout}
|
||||||
|
showModal={showModal}
|
||||||
|
togglePopup={togglePopup}
|
||||||
|
handleStayLoggedIn={handleStayLoggedIn}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,513 +0,0 @@
|
|||||||
import Link from "next/link";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
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) =>
|
|
||||||
value || typeof value === "number" ? undefined : errorMsg;
|
|
||||||
|
|
||||||
export const minLength = (errorMsg) => (value) =>
|
|
||||||
value && value.length < 4
|
|
||||||
? errorMsg //`Must be ${min} characters or more`
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
let AdvancedSearch = (props) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
|
|
||||||
const { LPAData, onSubmit, handleSubmit } = props;
|
|
||||||
|
|
||||||
console.log("props here:", props.props);
|
|
||||||
|
|
||||||
const appealOptionsObj = _.isEmpty(props)
|
|
||||||
? [{}]
|
|
||||||
: _.isEmpty(props.appealType)
|
|
||||||
? [{}]
|
|
||||||
: _.isEmpty(props.appealType.appealTypeOptions)
|
|
||||||
? [{}]
|
|
||||||
: _.isEmpty(props.appealType.appealTypeOptions.value)
|
|
||||||
? [{}]
|
|
||||||
: props.appealType.appealTypeOptions.value;
|
|
||||||
|
|
||||||
let lpaOptionsObj = _.isEmpty(props)
|
|
||||||
? [{}]
|
|
||||||
: _.isEmpty(props.LPAData)
|
|
||||||
? [{}]
|
|
||||||
: _.isEmpty(props.LPAData.LPAData)
|
|
||||||
? [{}]
|
|
||||||
: _.isEmpty(props.LPAData.LPAData)
|
|
||||||
? [{}]
|
|
||||||
: props.LPAData.LPAData.value;
|
|
||||||
|
|
||||||
const RenderTextfield = ({
|
|
||||||
id,
|
|
||||||
className,
|
|
||||||
rows,
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
input,
|
|
||||||
hint1,
|
|
||||||
hint2,
|
|
||||||
hint3,
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<div id="basicSearch-hint" className="govuk-hint ">
|
|
||||||
<label className="govuk-label" htmlFor="caseRef">
|
|
||||||
{t("search:casereference-label")}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
{...input}
|
|
||||||
className={className}
|
|
||||||
name={name}
|
|
||||||
id={id}
|
|
||||||
/>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message govuk-form-group--error"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{error}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const RenderLPAList = ({
|
|
||||||
name,
|
|
||||||
id,
|
|
||||||
input,
|
|
||||||
optionsObj,
|
|
||||||
meta: { touched, error },
|
|
||||||
label,
|
|
||||||
errormsg,
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
<label className="govuk-label" htmlFor={id}>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{errormsg}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div>
|
|
||||||
<select
|
|
||||||
{...input}
|
|
||||||
className="govuk-select govuk-input--error"
|
|
||||||
id={id}
|
|
||||||
name={name}
|
|
||||||
//onChange={(e) => props.onChangeSelectLPA(e)}
|
|
||||||
>
|
|
||||||
<option value="" disabled defaultValue>
|
|
||||||
{t("common:drop-down-select")}
|
|
||||||
</option>
|
|
||||||
{_.isEmpty(optionsObj)
|
|
||||||
? ""
|
|
||||||
: Object.keys(optionsObj).map((key, index) => {
|
|
||||||
return (
|
|
||||||
<option
|
|
||||||
key={key}
|
|
||||||
value={optionsObj[key].accountid}
|
|
||||||
>
|
|
||||||
{/* {optionsObj[key].name} */}
|
|
||||||
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
optionsObj[key]
|
|
||||||
.name +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: optionsObj[key].name ||
|
|
||||||
t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const RenderAppealTypeList = ({
|
|
||||||
name,
|
|
||||||
id,
|
|
||||||
input,
|
|
||||||
optionsObj,
|
|
||||||
meta: { touched, error },
|
|
||||||
label,
|
|
||||||
errormsg,
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<label className="govuk-label" htmlFor={id}>
|
|
||||||
{label}
|
|
||||||
{name}
|
|
||||||
</label>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id="passport-issued-error"
|
|
||||||
className="govuk-error-message"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{errormsg}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div>
|
|
||||||
<select
|
|
||||||
{...input}
|
|
||||||
className="govuk-select"
|
|
||||||
id={id}
|
|
||||||
name={name}
|
|
||||||
//onChange={(e) => props.onChangeSelectAppealType(e)}
|
|
||||||
>
|
|
||||||
<option value="" disabled defaultValue>
|
|
||||||
{t("common:drop-down-select")}
|
|
||||||
</option>
|
|
||||||
{_.isEmpty(optionsObj)
|
|
||||||
? ""
|
|
||||||
: Object.keys(optionsObj).map((key, index) => {
|
|
||||||
return (
|
|
||||||
<option
|
|
||||||
key={key}
|
|
||||||
value={
|
|
||||||
_.isEmpty(optionsObj[key])
|
|
||||||
? ""
|
|
||||||
: _.isEmpty(
|
|
||||||
optionsObj[key]
|
|
||||||
)
|
|
||||||
? ""
|
|
||||||
: _.isEmpty(
|
|
||||||
optionsObj[key]
|
|
||||||
.value
|
|
||||||
)
|
|
||||||
? ""
|
|
||||||
: 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"
|
|
||||||
)}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// const [showSpinnerState, setShowSpinnerState] = useState(false);
|
|
||||||
|
|
||||||
// let spinnerState = () => {
|
|
||||||
// showSpinnerState == true
|
|
||||||
// ? setShowSpinnerState(false)
|
|
||||||
// : setShowSpinnerState(true);
|
|
||||||
// };
|
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
|
||||||
event.preventDefault();
|
|
||||||
//spinnerState();
|
|
||||||
|
|
||||||
var searchString = "";
|
|
||||||
|
|
||||||
searchString +=
|
|
||||||
values.caseRef != null ? "?q=" + values.caseRef.trim() : "";
|
|
||||||
searchString +=
|
|
||||||
values.lpaTypes != null
|
|
||||||
? (typeof values.caseRef == "undefined" ? "?" : "&") +
|
|
||||||
"lpa=" +
|
|
||||||
values.lpaTypes
|
|
||||||
: "";
|
|
||||||
|
|
||||||
searchString +=
|
|
||||||
values.appealTypes != null
|
|
||||||
? (typeof values.caseRef == "undefined" &&
|
|
||||||
typeof values.lpaTypes == "undefined"
|
|
||||||
? "?"
|
|
||||||
: "&") +
|
|
||||||
("apt=" + values.appealTypes.split(",")[0])
|
|
||||||
: "";
|
|
||||||
|
|
||||||
router.replace(
|
|
||||||
(router.locale == "cy"
|
|
||||||
? "/fymhorth/canlyniadauchwiliouwch"
|
|
||||||
: "/myportal/advancedsearchresults") + searchString,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
shallow: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div>
|
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
|
||||||
<div className="govuk-grid-row">
|
|
||||||
<div className="govuk-grid-column-full">
|
|
||||||
<div className="card" id="searchforcase-card">
|
|
||||||
<div className="card-body">
|
|
||||||
<div className="govuk-body-m ">
|
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
|
|
||||||
<h1 className="govuk-fieldset__heading govuk-heading-m">
|
|
||||||
{t("search:search-title-label")}
|
|
||||||
</h1>
|
|
||||||
</legend>
|
|
||||||
|
|
||||||
<Field
|
|
||||||
validate={[
|
|
||||||
minLength(
|
|
||||||
t(
|
|
||||||
"myportal:searchcases-validation-minlength"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
]}
|
|
||||||
className="govuk-input govuk-!-width-two-thirds"
|
|
||||||
component={RenderTextfield}
|
|
||||||
id="caseRef"
|
|
||||||
name="caseRef"
|
|
||||||
type="text"
|
|
||||||
aria-describedby="caseRef-hint"
|
|
||||||
hint1={t(
|
|
||||||
"myportal:searchcases-card-search-hint"
|
|
||||||
)}
|
|
||||||
hint2={t(
|
|
||||||
"myportal:searchcases-card-search-example-label-1"
|
|
||||||
)}
|
|
||||||
hint3={t(
|
|
||||||
"myportal:searchcases-card-search-example-label-2"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Field
|
|
||||||
name="appealTypes"
|
|
||||||
id="appealTypes"
|
|
||||||
component={RenderAppealTypeList}
|
|
||||||
optionsObj={appealOptionsObj}
|
|
||||||
// validate={[required]}
|
|
||||||
label={t("search:appealtype-label")}
|
|
||||||
errormsg="Appeal type is required"
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name="lpaTypes"
|
|
||||||
id="lpaTypes"
|
|
||||||
component={RenderLPAList}
|
|
||||||
optionsObj={lpaOptionsObj}
|
|
||||||
//validate={[required]}
|
|
||||||
label={t("search:lpa-label")}
|
|
||||||
errormsg="Local authority is required"
|
|
||||||
/>
|
|
||||||
{/* <fieldset className="govuk-fieldset">
|
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
|
|
||||||
<h3 className="govuk-heading-m">
|
|
||||||
{t(
|
|
||||||
"search:sitelocation-legend"
|
|
||||||
)}
|
|
||||||
</h3>
|
|
||||||
</legend>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label
|
|
||||||
className="govuk-label"
|
|
||||||
htmlFor="address-line-1"
|
|
||||||
>
|
|
||||||
{t(
|
|
||||||
"search:address-line-one-label"
|
|
||||||
)}
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
className="govuk-input"
|
|
||||||
id="address-line-1"
|
|
||||||
name="address-line-1"
|
|
||||||
type="text"
|
|
||||||
autoComplete="address-line1"
|
|
||||||
onChange={handleParam(
|
|
||||||
setQuery
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label
|
|
||||||
className="govuk-label"
|
|
||||||
htmlFor="address-town"
|
|
||||||
>
|
|
||||||
{t("search:town-label")}
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
className="govuk-input govuk-!-width-two-thirds"
|
|
||||||
id="address-town"
|
|
||||||
name="address-town"
|
|
||||||
type="text"
|
|
||||||
autoComplete="address-level2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label
|
|
||||||
className="govuk-label"
|
|
||||||
htmlFor="address-county"
|
|
||||||
>
|
|
||||||
{t("search:county-label")}
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
className="govuk-input govuk-!-width-two-thirds"
|
|
||||||
id="address-county"
|
|
||||||
name="address-county"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label
|
|
||||||
className="govuk-label"
|
|
||||||
htmlFor="address-postcode"
|
|
||||||
>
|
|
||||||
{t("search:postcode-label")}
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
className="govuk-input govuk-input--width-10"
|
|
||||||
id="address-postcode"
|
|
||||||
name="address-postcode"
|
|
||||||
type="text"
|
|
||||||
autoComplete="postal-code"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
*/}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-grid-row">
|
|
||||||
<div className="govuk-grid-column-full">
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
name="search"
|
|
||||||
className="govuk-button"
|
|
||||||
>
|
|
||||||
{t("common:search-button")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{/* <LoadingOverlay
|
|
||||||
active={showSpinnerState}
|
|
||||||
spinner
|
|
||||||
text={t("common:spinner-searching")}
|
|
||||||
/> */}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
|
||||||
return {
|
|
||||||
currentView: state.currentView,
|
|
||||||
search: state.search,
|
|
||||||
searchResultsObj: state.searchResultsObj,
|
|
||||||
formData: state.formData,
|
|
||||||
appealType: state.appealType,
|
|
||||||
LPAData: state.LPAData,
|
|
||||||
//form: state.form,
|
|
||||||
myCases: state.myCases,
|
|
||||||
watchedCases: state.watchedCases,
|
|
||||||
myRepresentations: state.myRepresentations,
|
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
const selector = formValueSelector("advancedSearchForm"); // <-- same as form name
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(
|
|
||||||
reduxForm({
|
|
||||||
form: "advancedSearchForm",
|
|
||||||
destroyOnUnmount: false,
|
|
||||||
})(AdvancedSearch)
|
|
||||||
);
|
|
||||||
@@ -13,7 +13,7 @@ const AwaitingSubmission = (props) => {
|
|||||||
const { setCurrentView } = props;
|
const { setCurrentView } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" id="casescomment-card">
|
<div className="card card-3" id="casescomment-card">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:awatitingsubmission-card-title")}
|
{t("myportal:awatitingsubmission-card-title")}
|
||||||
@@ -23,30 +23,24 @@ const AwaitingSubmission = (props) => {
|
|||||||
showTopThree={
|
showTopThree={
|
||||||
props.awaitingSubmission.awaitingSubmission
|
props.awaitingSubmission.awaitingSubmission
|
||||||
}
|
}
|
||||||
showDetails={
|
|
||||||
props.awaitingSubmission.awaitingSubmissionDetails
|
|
||||||
}
|
|
||||||
topThreeType={"awaitingSubmission"}
|
topThreeType={"awaitingSubmission"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{props.awaitingSubmission.awaitingSubmission["@odata.count"] >
|
<div className="cardVieAll">
|
||||||
3 && (
|
<Link href="/myportal/viewall">
|
||||||
<div className="cardVieAll">
|
<a
|
||||||
<Link href="/myportal/viewall">
|
className="govuk-link--no-underline"
|
||||||
<a
|
onClick={() => {
|
||||||
className="govuk-link--no-underline"
|
setCurrentView({
|
||||||
onClick={() => {
|
"viewName": "Awaiting Submission",
|
||||||
setCurrentView({
|
"viewKey": "awaitingSubmission",
|
||||||
"viewName": "Awaiting Submission",
|
});
|
||||||
"viewKey": "awaitingSubmission",
|
}}
|
||||||
});
|
>
|
||||||
}}
|
{t("myportal:viewall-link")}
|
||||||
>
|
</a>
|
||||||
{t("myportal:viewall-link")}
|
</Link>
|
||||||
</a>
|
</div>
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,252 +0,0 @@
|
|||||||
import Link from "next/link";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import TopThree from "./topthree";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import {
|
|
||||||
setCurrentView,
|
|
||||||
setCurrentReference,
|
|
||||||
} from "../../store/currentView/action";
|
|
||||||
import jsonpath from "jsonpath";
|
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
|
||||||
import {
|
|
||||||
deleteAwaitingSubmissionsFromBlob,
|
|
||||||
getAwaitingSubmissionFromBlobProxy,
|
|
||||||
} from "../../actions";
|
|
||||||
import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action";
|
|
||||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
|
||||||
import { getFormCollectionByID } from "../../components/utils";
|
|
||||||
|
|
||||||
const AwaitingSubmissionFromBlob = (props) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
const { setCurrentView } = props;
|
|
||||||
|
|
||||||
let topthreeRow = [];
|
|
||||||
let showTopThreeArr = props.awaitingSubmissionFromBlob.value;
|
|
||||||
let showTopThreeArrDets = props.awaitingSubmissionFromBlob.case;
|
|
||||||
|
|
||||||
const deleteCaseItem = (containerID, caseID) => {
|
|
||||||
let cookies = parseCookies();
|
|
||||||
console.log("sssss", containerID, caseID);
|
|
||||||
|
|
||||||
deleteAwaitingSubmissionsFromBlob(containerID, caseID)
|
|
||||||
.then((data) => {
|
|
||||||
return data;
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
getAwaitingSubmissionFromBlobProxy(containerID).then((data) => {
|
|
||||||
props.setAwaitingSubmissionFromBlob(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let topThreeOnlyArr = showTopThreeArr.slice(0, 3);
|
|
||||||
//console.log(showTopThreeArr);
|
|
||||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
|
||||||
//console.log(key, showTopThreeArr[key].pinswg_appealcasetype);
|
|
||||||
//console.log("subsssss:", showTopThreeArr[key]);
|
|
||||||
let urlname = getFormCollectionByID(
|
|
||||||
showTopThreeArr[key].pinswg_appealcasetype
|
|
||||||
).UrlName;
|
|
||||||
|
|
||||||
topthreeRow.push(
|
|
||||||
<div className="cardModuleItem" key={index}>
|
|
||||||
<div className="cardModuleDetails">
|
|
||||||
<div className="cardModuleReference">
|
|
||||||
<b>{t("myportal:case-reference")}:</b>
|
|
||||||
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale == "cy"
|
|
||||||
? "/fymhorth/parhauigyflwyno"
|
|
||||||
: "/myportal" +
|
|
||||||
"/" +
|
|
||||||
urlname +
|
|
||||||
"?lpa=" +
|
|
||||||
showTopThreeArr[key][
|
|
||||||
"_pinswg_associatedlpa_value"
|
|
||||||
] +
|
|
||||||
"&apt=" +
|
|
||||||
showTopThreeArr[key]
|
|
||||||
.pinswg_appealcasetype +
|
|
||||||
"&casereference=" +
|
|
||||||
showTopThreeArr[key].pinswg_name +
|
|
||||||
"&inid=" +
|
|
||||||
showTopThreeArr[key].incidentid
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
className="govuk-link--no-underline"
|
|
||||||
data-id={index}
|
|
||||||
onClick={() => {
|
|
||||||
props.setCurrentReference({
|
|
||||||
"currentReference":
|
|
||||||
showTopThreeArr[key].ticketnumber,
|
|
||||||
|
|
||||||
"currentType": "awaitingSubmission",
|
|
||||||
|
|
||||||
"incidentid":
|
|
||||||
showTopThreeArr[key].incidentid,
|
|
||||||
|
|
||||||
"appealType":
|
|
||||||
showTopThreeArr[key]
|
|
||||||
.pinswg_appealcasetype,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{showTopThreeArr[index].pinswg_name}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<b>{t("myportal:appeal-type-label")}:</b>{" "}
|
|
||||||
{
|
|
||||||
getFormCollectionByID(
|
|
||||||
showTopThreeArr[key].pinswg_appealcasetype
|
|
||||||
).value
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div className="carModuleAddress">
|
|
||||||
<b>{t("myportal:case-address")}:</b>{" "}
|
|
||||||
{_.isEmpty(showTopThreeArr)
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: _.isEmpty(showTopThreeArr[index])
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: _.isEmpty(showTopThreeArr[index])
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: _.isEmpty(
|
|
||||||
showTopThreeArr[index].pinswg_siteaddressline1
|
|
||||||
)
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: showTopThreeArr[index].pinswg_siteaddressline1 +
|
|
||||||
(!_.isEmpty(
|
|
||||||
showTopThreeArr[index].pinswg_siteaddressline2
|
|
||||||
)
|
|
||||||
? ", " +
|
|
||||||
showTopThreeArr[index]
|
|
||||||
.pinswg_siteaddressline2
|
|
||||||
: "") +
|
|
||||||
(!_.isEmpty(
|
|
||||||
showTopThreeArr[index].pinswg_siteaddresstown
|
|
||||||
)
|
|
||||||
? ", " +
|
|
||||||
showTopThreeArr[index]
|
|
||||||
.pinswg_siteaddresstown
|
|
||||||
: "")}
|
|
||||||
</div>
|
|
||||||
{showTopThreeArrDets[key].pinswg_appellantagent != null && (
|
|
||||||
<div>
|
|
||||||
{showTopThreeArrDets[key].pinswg_appellantagent !=
|
|
||||||
846040000 && (
|
|
||||||
<b>{t("myportal:raised-by-label")}: </b>
|
|
||||||
)}
|
|
||||||
{showTopThreeArrDets[key].pinswg_appellantagent !=
|
|
||||||
846040000 &&
|
|
||||||
(showTopThreeArrDets[key]
|
|
||||||
.pinswg_agentcompanyname != null &&
|
|
||||||
showTopThreeArrDets[key]
|
|
||||||
.pinswg_agentcompanyname + ", ") +
|
|
||||||
showTopThreeArrDets[key]
|
|
||||||
.pinswg_agentfirstname +
|
|
||||||
" " +
|
|
||||||
showTopThreeArrDets[key]
|
|
||||||
.pinswg_agentlastname}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{showTopThreeArrDets[key].pinswg_appellantfirstname !=
|
|
||||||
null && (
|
|
||||||
<div>
|
|
||||||
<b>{t("myportal:on-behalf-of-label")}: </b>
|
|
||||||
{showTopThreeArrDets[key]
|
|
||||||
.pinswg_appellantfirstname +
|
|
||||||
" " +
|
|
||||||
showTopThreeArrDets[key]
|
|
||||||
.pinswg_appellantlastname}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
showTopThreeArrDets[key]["pinswg_lpaname"] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: showTopThreeArrDets[key]["pinswg_lpaname"] || ""}
|
|
||||||
</div>
|
|
||||||
<div className="">
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
|
||||||
onClick={() => {
|
|
||||||
event.preventDefault();
|
|
||||||
deleteCaseItem(
|
|
||||||
props.containerID,
|
|
||||||
showTopThreeArr[key].pinswg_name
|
|
||||||
);
|
|
||||||
alert(
|
|
||||||
"You have deleted case " +
|
|
||||||
showTopThreeArr[key].pinswg_name
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
—
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="card" id="casescomment-card">
|
|
||||||
<div className="card-body">
|
|
||||||
<h3 className="heading-small card-heading">
|
|
||||||
{t("myportal:awatitingsubmission-card-title")}
|
|
||||||
</h3>
|
|
||||||
<div className="cardModuleContainer">
|
|
||||||
{topthreeRow}
|
|
||||||
{/* <TopThree
|
|
||||||
showTopThree={props.awaitingSubmissionFromBlob}
|
|
||||||
showDetails={props.awaitingSubmissionFromBlob}
|
|
||||||
topThreeType={"awaitingSubmissionFromBlob"}
|
|
||||||
/> */}
|
|
||||||
</div>
|
|
||||||
{props.awaitingSubmissionFromBlob["@odata.count"] > 3 && (
|
|
||||||
<div className="cardVieAll">
|
|
||||||
<Link href="/myportal/viewall">
|
|
||||||
<a
|
|
||||||
className="govuk-link--no-underline"
|
|
||||||
onClick={() => {
|
|
||||||
setCurrentView({
|
|
||||||
"viewName": "Awaiting Submission",
|
|
||||||
"viewKey": "awaitingSubmissionDetails",
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("myportal:viewall-link")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {
|
|
||||||
setCurrentView: (currentView) => {
|
|
||||||
dispatch(setCurrentView(currentView));
|
|
||||||
},
|
|
||||||
setCurrentReference: (currentReference) => {
|
|
||||||
dispatch(setCurrentReference(currentReference));
|
|
||||||
},
|
|
||||||
setAwaitingSubmissionFromBlob: (awaitingSubmission) => {
|
|
||||||
dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(AwaitingSubmissionFromBlob);
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
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();
|
|
||||||
//const [showSpinnerState, setShowSpinnerState] = useState(false);
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
|
|
||||||
// let spinnerState = () => {
|
|
||||||
// showSpinnerState == true
|
|
||||||
// ? setShowSpinnerState(false)
|
|
||||||
// : setShowSpinnerState(true);
|
|
||||||
// };
|
|
||||||
return (
|
|
||||||
<div className="card" id="casesearch-card">
|
|
||||||
<div className="card-body">
|
|
||||||
<h3 className="heading-small card-heading">
|
|
||||||
{t("home:dns-card-title")}
|
|
||||||
</h3>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<p className="govuk-body-s">
|
|
||||||
{t("home:dns-card-paragraph")}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale == "cy"
|
|
||||||
? "/fymhorth/ceisiadaudns"
|
|
||||||
: "/myportal/dnsapplications"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
className="govuk-button withChevron govuk-button-cta"
|
|
||||||
// onClick={() => {
|
|
||||||
// spinnerState();
|
|
||||||
// }}
|
|
||||||
>
|
|
||||||
{t("home:dns-card-button")}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* <LoadingOverlay
|
|
||||||
active={showSpinnerState}
|
|
||||||
spinner
|
|
||||||
text={t("common:spinner-loading")}
|
|
||||||
/> */}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ export default function MakeNewAppeal() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
return (
|
return (
|
||||||
<div className="card" id="casescomment-card">
|
<div className="card card-3" id="casescomment-card">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h2 className="govuk-heading-s">
|
<h2 className="govuk-heading-s">
|
||||||
{t("myportal:makenewappeal-card-title")}
|
{t("myportal:makenewappeal-card-title")}
|
||||||
@@ -20,7 +20,11 @@ export default function MakeNewAppeal() {
|
|||||||
{t("myportal:makenewappeal-card-paragraph-two")}
|
{t("myportal:makenewappeal-card-paragraph-two")}
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<Link href={"/newappeal"}>
|
<Link
|
||||||
|
href={
|
||||||
|
router.locale == "cy" ? "/apelnewydd" : "/newappeal"
|
||||||
|
}
|
||||||
|
>
|
||||||
<a className="govuk-button">
|
<a className="govuk-button">
|
||||||
{t("myportal:makenewappeal-card-button-label")}
|
{t("myportal:makenewappeal-card-button-label")}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const MyCases = (props) => {
|
|||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
const { setCurrentView } = props;
|
const { setCurrentView } = props;
|
||||||
return (
|
return (
|
||||||
<div className="card" id="casescomment-card">
|
<div className="card card-3" id="casescomment-card">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:mycases-card-title")}
|
{t("myportal:mycases-card-title")}
|
||||||
@@ -24,9 +24,9 @@ const MyCases = (props) => {
|
|||||||
topThreeType={"myCases"}
|
topThreeType={"myCases"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{props.myCases.myCases["@odata.count"] > 3 && (
|
{props.myCases.myCases["@odata.count"] != 0 && (
|
||||||
<div className="cardVieAll">
|
<div className="cardVieAll">
|
||||||
<Link href="/myportal/viewall">
|
<Link href="/myportal/viewall" shallow>
|
||||||
<a
|
<a
|
||||||
className="govuk-link--no-underline"
|
className="govuk-link--no-underline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const MyRepresentations = (props) => {
|
|||||||
const { setCurrentView } = props;
|
const { setCurrentView } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" id="casescomment-card">
|
<div className="card card-3" id="casescomment-card">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:myrepresentations-card-title")}
|
{t("myportal:myrepresentations-card-title")}
|
||||||
@@ -21,15 +21,12 @@ const MyRepresentations = (props) => {
|
|||||||
<div className="cardModuleContainer">
|
<div className="cardModuleContainer">
|
||||||
<TopThree
|
<TopThree
|
||||||
showTopThree={props.myRepresentations.myRepresentations}
|
showTopThree={props.myRepresentations.myRepresentations}
|
||||||
showDetails={
|
|
||||||
props.myRepresentations.myRepresentationsDetails
|
|
||||||
}
|
|
||||||
topThreeType={"myRepresentations"}
|
topThreeType={"myRepresentations"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{props.myRepresentations.myRepresentations["@odata.count"] >
|
{props.myRepresentations.myRepresentations["@odata.count"] !=
|
||||||
3 && (
|
0 && (
|
||||||
<div className="cardVieAll">
|
<div className="cardVieAll">
|
||||||
<Link href="/myportal/viewall" shallow>
|
<Link href="/myportal/viewall" shallow>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ let CaseSearch = (props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="card" id="casesearch-card">
|
<div className="card card-3" id="casesearch-card">
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
|
|||||||
+27
-164
@@ -9,19 +9,12 @@ import {
|
|||||||
getWatchedCasesProxy,
|
getWatchedCasesProxy,
|
||||||
getPortalModuleDetailsProxy,
|
getPortalModuleDetailsProxy,
|
||||||
deleteWatchedCases,
|
deleteWatchedCases,
|
||||||
deleteAwaitingSubmissions,
|
|
||||||
getAwaitingSubmissionProxy,
|
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import jsonpath from "jsonpath";
|
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
|
||||||
import {
|
import {
|
||||||
setWatchedCases,
|
setWatchedCases,
|
||||||
setWatchedCasesDetails,
|
setWatchedCasesDetails,
|
||||||
} from "../../store/watchedCases/action";
|
} from "../../store/watchedCases/action";
|
||||||
import {
|
|
||||||
setAwaitingSubmission,
|
|
||||||
setAwaitingSubmissionDetails,
|
|
||||||
} from "../../store/awaitingSubmission/action";
|
|
||||||
import { getFormCollectionByID } from "../../components/utils";
|
import { getFormCollectionByID } from "../../components/utils";
|
||||||
|
|
||||||
const TopThree = (props) => {
|
const TopThree = (props) => {
|
||||||
@@ -33,8 +26,6 @@ const TopThree = (props) => {
|
|||||||
topThreeType,
|
topThreeType,
|
||||||
setWatchedCases,
|
setWatchedCases,
|
||||||
setWatchedCasesDetails,
|
setWatchedCasesDetails,
|
||||||
setAwaitingSubmission,
|
|
||||||
setAwaitingSubmissionDetails,
|
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -46,7 +37,6 @@ const TopThree = (props) => {
|
|||||||
|
|
||||||
const deleteItem = (caseID, topThreeType) => {
|
const deleteItem = (caseID, topThreeType) => {
|
||||||
let cookies = parseCookies();
|
let cookies = parseCookies();
|
||||||
//console.log("sssss", caseID, topThreeType);
|
|
||||||
topThreeType == "watchedCases" &&
|
topThreeType == "watchedCases" &&
|
||||||
deleteWatchedCases(caseID)
|
deleteWatchedCases(caseID)
|
||||||
.then((data) => data)
|
.then((data) => data)
|
||||||
@@ -58,28 +48,6 @@ const TopThree = (props) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
@@ -126,7 +94,6 @@ const TopThree = (props) => {
|
|||||||
return objArr.ticketnumber;
|
return objArr.ticketnumber;
|
||||||
break;
|
break;
|
||||||
case "awaitingSubmission":
|
case "awaitingSubmission":
|
||||||
return objArr.ticketnumber;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// code block
|
// code block
|
||||||
@@ -139,30 +106,13 @@ const TopThree = (props) => {
|
|||||||
<div className="cardModuleItem" key={index}>
|
<div className="cardModuleItem" key={index}>
|
||||||
<div className="cardModuleDetails">
|
<div className="cardModuleDetails">
|
||||||
<div className="cardModuleReference">
|
<div className="cardModuleReference">
|
||||||
<b>{t("myportal:case-reference")}:</b>
|
<b>{t("myportal:case-reference")}:</b>{" "}
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
topThreeType == "awaitingSubmission" ||
|
topThreeType == "awaitingSubmission"
|
||||||
topThreeType == "awaitingSubmissionFromBlob"
|
|
||||||
? router.locale == "cy"
|
? router.locale == "cy"
|
||||||
? "/fymhorth/parhauigyflwyno"
|
? "/fymhorth/cynrychiolaeth"
|
||||||
: "/myportal" +
|
: "/myportal/representation"
|
||||||
"/" +
|
|
||||||
getFormCollectionByID(
|
|
||||||
showTopThreeArr[key]
|
|
||||||
.pinswg_appealcasetype
|
|
||||||
).UrlName +
|
|
||||||
"?lpa=" +
|
|
||||||
showTopThreeArr[key][
|
|
||||||
"_pinswg_associatedlpa_value"
|
|
||||||
] +
|
|
||||||
"&apt=" +
|
|
||||||
showTopThreeArr[key]
|
|
||||||
.pinswg_appealcasetype +
|
|
||||||
"&casereference=" +
|
|
||||||
showTopThreeArr[key].pinswg_title +
|
|
||||||
"&inid=" +
|
|
||||||
showTopThreeArr[key].incidentid
|
|
||||||
: router.locale == "cy"
|
: router.locale == "cy"
|
||||||
? "/fymhorth/achos"
|
? "/fymhorth/achos"
|
||||||
: "/myportal/case"
|
: "/myportal/case"
|
||||||
@@ -206,101 +156,41 @@ const TopThree = (props) => {
|
|||||||
]
|
]
|
||||||
: showTopThreeArr[key][
|
: showTopThreeArr[key][
|
||||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
]}{" "}
|
]}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
{/* {(topThreeType == "awaitingSubmission" ||
|
{topThreeType != "awaitingSubmission" ? (
|
||||||
topThreeType == "watchedCases") && ( */}
|
<div className="carModuleAddress">
|
||||||
<div>
|
<b>{t("myportal:case-address")}:</b>{" "}
|
||||||
<b>{t("myportal:appeal-type-label")}:</b>{" "}
|
{_.isEmpty(showDetails)
|
||||||
{
|
? t("myportal:case-address-not-entered")
|
||||||
showTopThreeArr[key][
|
: _.isEmpty(showDetails[index])
|
||||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
? t("myportal:case-address-not-entered")
|
||||||
]
|
: _.isEmpty(showDetails[index].value[0])
|
||||||
}
|
? t("myportal:case-address-not-entered")
|
||||||
</div>
|
: _.isEmpty(
|
||||||
{/* )} */}
|
showDetails[index].value[0]
|
||||||
{/* {topThreeType != "awaitingSubmission" ? ( */}
|
.pinswg_siteaddressline1
|
||||||
<div className="carModuleAddress">
|
)
|
||||||
<b>{t("myportal:case-address")}:</b>{" "}
|
? t("myportal:case-address-not-entered")
|
||||||
{_.isEmpty(showDetails)
|
: showDetails[index].value[0]
|
||||||
? t("myportal:case-address-not-entered")
|
.pinswg_siteaddressline1}
|
||||||
: _.isEmpty(showDetails[index])
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: _.isEmpty(showDetails[index].value[0])
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: _.isEmpty(
|
|
||||||
showDetails[index].value[0]
|
|
||||||
.pinswg_siteaddressline1
|
|
||||||
)
|
|
||||||
? t("myportal:case-address-not-entered")
|
|
||||||
: showDetails[index].value[0]
|
|
||||||
.pinswg_siteaddressline1 +
|
|
||||||
(!_.isEmpty(
|
|
||||||
showDetails[index].value[0]
|
|
||||||
.pinswg_siteaddressline2
|
|
||||||
)
|
|
||||||
? ", " +
|
|
||||||
showDetails[index].value[0]
|
|
||||||
.pinswg_siteaddressline2
|
|
||||||
: "") +
|
|
||||||
(!_.isEmpty(
|
|
||||||
showDetails[index].value[0]
|
|
||||||
.pinswg_siteaddresstown
|
|
||||||
)
|
|
||||||
? ", " +
|
|
||||||
showDetails[index].value[0]
|
|
||||||
.pinswg_siteaddresstown
|
|
||||||
: "")}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{showTopThreeArr[key].pinswg_appellantagent != null && (
|
|
||||||
<div>
|
|
||||||
{showTopThreeArr[key].pinswg_appellantagent !=
|
|
||||||
846040000 && (
|
|
||||||
<b>{t("myportal:raised-by-label")}</b>
|
|
||||||
)}
|
|
||||||
{showTopThreeArr[key].pinswg_appellantagent !=
|
|
||||||
846040000 &&
|
|
||||||
(showTopThreeArr[key].pinswg_agentcompanyname !=
|
|
||||||
null &&
|
|
||||||
showTopThreeArr[key]
|
|
||||||
.pinswg_agentcompanyname + ", ") +
|
|
||||||
showTopThreeArr[key].pinswg_agentfirstname +
|
|
||||||
" " +
|
|
||||||
showTopThreeArr[key].pinswg_agentlastname}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{showTopThreeArr[key].pinswg_appellantfirstname != null && (
|
|
||||||
<div>
|
|
||||||
<b>{t("myportal:on-behalf-of-label")}: </b>
|
|
||||||
{showTopThreeArr[key].pinswg_appellantfirstname +
|
|
||||||
" " +
|
|
||||||
showTopThreeArr[key].pinswg_appellantlastname}
|
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
showTopThreeArr[key][
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: showTopThreeArr[key][
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || ""}
|
|
||||||
{topThreeType == "awaitingSubmission" ? (
|
{topThreeType == "awaitingSubmission" ? (
|
||||||
<div className="carModuleAddress">
|
<div className="carModuleAddress">
|
||||||
Case Incomplete, not submitted
|
Make Representation on Case Incomplete, not
|
||||||
|
submitted
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{topThreeType == "watchedCases" && (
|
{topThreeType == "watchedCases" && (
|
||||||
<div className="">
|
<div className="">
|
||||||
<a
|
<a
|
||||||
@@ -324,27 +214,6 @@ const TopThree = (props) => {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{topThreeType == "awaitingSubmission" && (
|
|
||||||
<div className="">
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
|
||||||
onClick={() => {
|
|
||||||
event.preventDefault();
|
|
||||||
deleteItem(
|
|
||||||
showTopThreeArr[key].incidentid,
|
|
||||||
"awaitingSubmission"
|
|
||||||
);
|
|
||||||
alert(
|
|
||||||
"You have deleted case " +
|
|
||||||
showTopThreeArr[key].ticketnumber
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
—
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -386,12 +255,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setWatchedCasesDetails: (watchedCasesDetails) => {
|
setWatchedCasesDetails: (watchedCasesDetails) => {
|
||||||
dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||||
},
|
},
|
||||||
setAwaitingSubmission: (awaitingSubmission) => {
|
|
||||||
dispatch(setAwaitingSubmission(awaitingSubmission));
|
|
||||||
},
|
|
||||||
setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => {
|
|
||||||
dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,462 +0,0 @@
|
|||||||
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";
|
|
||||||
|
|
||||||
const required = (errorMsg) => (value) =>
|
|
||||||
value || typeof value === "number" ? undefined : errorMsg;
|
|
||||||
|
|
||||||
export const minLength = (errorMsg) => (value) =>
|
|
||||||
value && value.length < 4
|
|
||||||
? errorMsg //`Must be ${min} characters or more`
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const RenderTextfield = ({
|
|
||||||
id,
|
|
||||||
className,
|
|
||||||
rows,
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
input,
|
|
||||||
hint1,
|
|
||||||
hint2,
|
|
||||||
hint3,
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<div id="basicSearch-hint" className="govuk-hint ">
|
|
||||||
<label
|
|
||||||
className="govuk-label "
|
|
||||||
htmlFor={id}
|
|
||||||
id={id + "_label"}
|
|
||||||
>
|
|
||||||
<span className="govuk-body-s">{hint1}</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
{...input}
|
|
||||||
className={className}
|
|
||||||
name={name}
|
|
||||||
id={id}
|
|
||||||
/>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message govuk-form-group--error"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{error}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const baseStyle = {
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
padding: "20px",
|
|
||||||
borderWidth: 2,
|
|
||||||
borderRadius: 2,
|
|
||||||
borderColor: "#eeeeee",
|
|
||||||
borderStyle: "dashed",
|
|
||||||
backgroundColor: "#fafafa",
|
|
||||||
color: "#bdbdbd",
|
|
||||||
transition: "border .3s ease-in-out",
|
|
||||||
width: "80%",
|
|
||||||
margin: "20px auto 30px",
|
|
||||||
};
|
|
||||||
|
|
||||||
const activeStyle = {
|
|
||||||
borderColor: "#2196f3",
|
|
||||||
};
|
|
||||||
|
|
||||||
const acceptStyle = {
|
|
||||||
borderColor: "#00e676",
|
|
||||||
};
|
|
||||||
|
|
||||||
const rejectStyle = {
|
|
||||||
borderColor: "#ff1744",
|
|
||||||
};
|
|
||||||
const RenderFileUpload = (field) => {
|
|
||||||
const files = field.input.value;
|
|
||||||
const style = useMemo(
|
|
||||||
() => ({
|
|
||||||
...baseStyle,
|
|
||||||
// ...(isDragActive ? activeStyle : {}),
|
|
||||||
// ...(isDragAccept ? acceptStyle : {}),
|
|
||||||
// ...(isDragReject ? rejectStyle : {}),
|
|
||||||
}),
|
|
||||||
[]
|
|
||||||
// [isDragActive, isDragReject, isDragAccept]
|
|
||||||
);
|
|
||||||
const [filesList, setFilesList] = useState([]);
|
|
||||||
|
|
||||||
const thumbs = filesList.map((file) => (
|
|
||||||
<div key={file.name} className="govuk-!-margin-bottom-5 fileThumb">
|
|
||||||
<img src={file.preview} alt={file.name} width="50" /> -{" "}
|
|
||||||
<span className="govuk-body">
|
|
||||||
{file.name} ({file.size / 1024}kb)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
));
|
|
||||||
|
|
||||||
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":
|
|
||||||
return "/assets/images/documenttypes/html.png";
|
|
||||||
break;
|
|
||||||
case "text/plain":
|
|
||||||
return "/assets/images/documenttypes/txt.png";
|
|
||||||
break;
|
|
||||||
case "application/msword":
|
|
||||||
return "/assets/images/documenttypes/doc.png";
|
|
||||||
break;
|
|
||||||
case "application/pdf":
|
|
||||||
return "/assets/images/documenttypes/pdf.png";
|
|
||||||
break;
|
|
||||||
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
|
|
||||||
return "/assets/images/documenttypes/docx.png";
|
|
||||||
break;
|
|
||||||
case "text/csv":
|
|
||||||
return "/assets/images/documenttypes/csv.png";
|
|
||||||
break;
|
|
||||||
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
|
||||||
return "/assets/images/documenttypes/xlsx.png";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "application/zip":
|
|
||||||
return "/assets/images/documenttypes/zip.png";
|
|
||||||
break;
|
|
||||||
case "image/jpeg":
|
|
||||||
case "image/png":
|
|
||||||
return URL.createObjectURL(fileObj);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getDocumentType = (docCode) => {
|
|
||||||
switch (docCode) {
|
|
||||||
case "000001":
|
|
||||||
return "000001";
|
|
||||||
break;
|
|
||||||
case "000002":
|
|
||||||
return "000002";
|
|
||||||
break;
|
|
||||||
case "000003":
|
|
||||||
return "000003";
|
|
||||||
break;
|
|
||||||
case "000004":
|
|
||||||
return "000004";
|
|
||||||
break;
|
|
||||||
case "000005":
|
|
||||||
return "000005";
|
|
||||||
break;
|
|
||||||
case "000006":
|
|
||||||
return "000006";
|
|
||||||
break;
|
|
||||||
case "000007":
|
|
||||||
return "000007";
|
|
||||||
break;
|
|
||||||
case "000008":
|
|
||||||
return "000008";
|
|
||||||
break;
|
|
||||||
case "000009":
|
|
||||||
return "000009";
|
|
||||||
break;
|
|
||||||
case "000010":
|
|
||||||
return "000010";
|
|
||||||
break;
|
|
||||||
case "000011":
|
|
||||||
return "000011";
|
|
||||||
break;
|
|
||||||
case "000012":
|
|
||||||
return "000012";
|
|
||||||
break;
|
|
||||||
case "000013":
|
|
||||||
return "000013";
|
|
||||||
break;
|
|
||||||
case "000014":
|
|
||||||
return "000014";
|
|
||||||
break;
|
|
||||||
case "000015":
|
|
||||||
return "000015";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return "000000";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Dropzone
|
|
||||||
// onDrop={(filesToUpload, e) =>
|
|
||||||
// field.input.onChange(filesToUpload)
|
|
||||||
// }
|
|
||||||
|
|
||||||
onDrop={(filesToUpload, e) => {
|
|
||||||
console.log(field.ticketnumber, field.documentTypeCode);
|
|
||||||
const renamedAcceptedFiles = filesToUpload.map(
|
|
||||||
(file) =>
|
|
||||||
new File(
|
|
||||||
[file],
|
|
||||||
`${field.ticketnumber}_${getDocumentType(
|
|
||||||
field.documentTypeCode
|
|
||||||
)}_${file.name}`,
|
|
||||||
{
|
|
||||||
type: file.type,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
field.input.onChange(renamedAcceptedFiles);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{({ getRootProps, getInputProps }) => (
|
|
||||||
<div className="govuk-grid-row">
|
|
||||||
<div className="govuk-form-group"></div>
|
|
||||||
<section className="container">
|
|
||||||
<div {...getRootProps({ style })}>
|
|
||||||
{" "}
|
|
||||||
<input {...getInputProps()} />
|
|
||||||
<div>Drag and drop your files here.</div>
|
|
||||||
</div>
|
|
||||||
<aside>{thumbs}</aside>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Dropzone>
|
|
||||||
|
|
||||||
{field.meta.touched && field.meta.error && (
|
|
||||||
<span className="error">{field.meta.error}</span>
|
|
||||||
)}
|
|
||||||
{files && Array.isArray(files) && (
|
|
||||||
<ul>
|
|
||||||
{files.map((file, i) => (
|
|
||||||
<div
|
|
||||||
key={file.name}
|
|
||||||
className="govuk-!-margin-bottom-5 fileThumb"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={getThumbnailIcon(file, file.type)}
|
|
||||||
alt={file.name}
|
|
||||||
width="50"
|
|
||||||
/>{" "}
|
|
||||||
{" "}
|
|
||||||
<span className="govuk-body govuk-!-padding-left-5">
|
|
||||||
{file.name} ({bytesToSize(file.size)})
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
let UploadFile = (props) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
//const [showSpinnerState, setShowSpinnerState] = useState(false);
|
|
||||||
const { handleSubmit, pristine, reset, submitting, formContent } = props;
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
|
|
||||||
const onHandleSubmit = async (values) => {
|
|
||||||
//spinnerState();
|
|
||||||
console.log(values);
|
|
||||||
console.log(formContent);
|
|
||||||
// getContainers();
|
|
||||||
|
|
||||||
var dataObj = Object.assign(values, formContent);
|
|
||||||
var fileObj = dataObj.fileList;
|
|
||||||
|
|
||||||
delete dataObj.fileList;
|
|
||||||
|
|
||||||
const uploadAction = await uploadFiles(dataObj, fileObj).then(
|
|
||||||
(data) => {
|
|
||||||
console.log("hello", data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// router.push({
|
|
||||||
// pathname:
|
|
||||||
// router.locale == "cy"
|
|
||||||
// ? "/fymhorth/canlyniadauchwilio"
|
|
||||||
// : "/myportal/searchresults",
|
|
||||||
// query: { q: values.basicSearch },
|
|
||||||
// shallow: true,
|
|
||||||
// });
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="card" id="casesearch-card">
|
|
||||||
<div className="card-body">
|
|
||||||
<h3 className="heading-small card-heading">Upload a file</h3>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<p className="govuk-body-s">reqweqwe eqwe qwe qwe qwe</p>
|
|
||||||
</div>
|
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<Field
|
|
||||||
validate={[
|
|
||||||
required(
|
|
||||||
t(
|
|
||||||
"myportal:searchcases-validation-required"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
minLength(
|
|
||||||
t(
|
|
||||||
"myportal:searchcases-validation-minlength"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
]}
|
|
||||||
className="govuk-input"
|
|
||||||
component={RenderTextfield}
|
|
||||||
id="caseReference"
|
|
||||||
name="caseReference"
|
|
||||||
type="text"
|
|
||||||
aria-describedby="caseReference-hint"
|
|
||||||
hint1="Case Reference"
|
|
||||||
value="CAS-00764-L0Q9W2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-grid-row">
|
|
||||||
<Field
|
|
||||||
name="fileList"
|
|
||||||
id="fileList"
|
|
||||||
component={RenderFileUpload}
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
//validate={[required]}
|
|
||||||
label={props.label}
|
|
||||||
errorMsg="Is required"
|
|
||||||
ticketnumber="CAS-00764-L0Q9W2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<button type="submit" className="govuk-button">
|
|
||||||
Add Files
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
|
||||||
return {
|
|
||||||
currentView: state.currentView,
|
|
||||||
search: state.search,
|
|
||||||
searchResultsObj: state.searchResultsObj,
|
|
||||||
formData: state.formData,
|
|
||||||
appealType: state.appealType,
|
|
||||||
//form: state.form,
|
|
||||||
myCases: state.myCases,
|
|
||||||
watchedCases: state.watchedCases,
|
|
||||||
myRepresentations: state.myRepresentations,
|
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
|
||||||
formContent: {
|
|
||||||
"pinswg_caserecovered": "No",
|
|
||||||
"pinswg_siteaddresspostcode": "Site Address Postcode",
|
|
||||||
"pinswg_inspectorneededonsite": "Yes",
|
|
||||||
"pinswg_sitewithingreenbelt": "No",
|
|
||||||
"pinswg_siteaddressline2": "Site Address Line 2",
|
|
||||||
"pinswg_siteaddressline1": "Site Address Line 1",
|
|
||||||
"pinswg_s106unilateralsubmitted": "No",
|
|
||||||
"modifiedon": "2022-06-28T13:11:34Z",
|
|
||||||
"pinswg_developmentaffectsettingofalisted": "No",
|
|
||||||
"pinswg_planningappeals78id":
|
|
||||||
"57b533aa-43f1-ec11-aade-00224800be9c",
|
|
||||||
"pinswg_name": "CAS-00764-L0Q9W2",
|
|
||||||
"pinswg_whyisinspectorneededonsite": "to be nosey",
|
|
||||||
"pinswg_sitewithinsssi": "No",
|
|
||||||
"pinswg_healthandsafetyissuesonsite": "No",
|
|
||||||
"pinswg_developmentdescriptionchanged": "Yes",
|
|
||||||
"_stageid_value": "126e9c46-d51c-4623-aabf-aa30b34bfa54",
|
|
||||||
"traversedpath": "126e9c46-d51c-4623-aabf-aa30b34bfa54",
|
|
||||||
"createdon": "2022-06-21T09:22:29Z",
|
|
||||||
"timezoneruleversionnumber": 0,
|
|
||||||
"processid": "e4f065a6-157e-42f9-963a-9292d5041509",
|
|
||||||
"pinswg_priornotificationpriorapproval": "No",
|
|
||||||
"pinswg_predeterminedindicator": "No",
|
|
||||||
"pinswg_protectedspecies": "No",
|
|
||||||
"versionnumber": 912609,
|
|
||||||
"pinswg_siteaddresscounty": "Site Address County",
|
|
||||||
"pinswg_procedure": 846040000,
|
|
||||||
"pinswg_dateoflpadecision": "2022-06-22T23:00:00Z",
|
|
||||||
"pinswg_eiarequired": "No",
|
|
||||||
"pinswg_costappliedforindicator": "No",
|
|
||||||
"pinswg_areaofsiteinhectaresdec": 22,
|
|
||||||
"pinswg_detailedeiascreeningrequired": "No",
|
|
||||||
"pinswg_casepublishflag": "No",
|
|
||||||
"pinswg_siteaddresstown": "Site Address Town",
|
|
||||||
"utcconversiontimezonecode": 85,
|
|
||||||
"pinswg_caseworkreason": 846040005,
|
|
||||||
"pinswg_ownershipcertificate": 846040002,
|
|
||||||
"pinswg_lpadecisiononapplicationmade": "Yes",
|
|
||||||
"pinswg_floorspaceinsquaremeters": 111,
|
|
||||||
"_modifiedby_value": "149b3e11-5206-ec11-aac8-00224800be9c",
|
|
||||||
"pinswg_dateofapplication": "2022-06-20T23:00:00Z",
|
|
||||||
"pinswg_incarelatestoca": "No",
|
|
||||||
"_createdby_value": "149b3e11-5206-ec11-aac8-00224800be9c",
|
|
||||||
"pinswg_additionalappealsmade": "No",
|
|
||||||
"statuscode": 1,
|
|
||||||
"pinswg_siteviewablefromroad": "Yes",
|
|
||||||
"_pinswg_localplanningauthority_value":
|
|
||||||
"744c69f4-48da-eb11-aac5-00224800be9c",
|
|
||||||
"pinswg_lpaapplicationreference": "11111weweqweqwe",
|
|
||||||
"pinswg_recovered": "No",
|
|
||||||
"statecode": 0,
|
|
||||||
"pinswg_isfloodingandissue": "No",
|
|
||||||
"pinswg_isthesitewithinanaonb": "No",
|
|
||||||
"_organizationid_value": "01191a4d-105f-eb11-aaba-00224800be9c",
|
|
||||||
"pinswg_developmentdescription": "something to go here",
|
|
||||||
"pinswg_agriculturalholding": 846040000,
|
|
||||||
"_pinswg_planningappeals78ids_value":
|
|
||||||
"50b533aa-43f1-ec11-aade-00224800be9c",
|
|
||||||
},
|
|
||||||
initialValues: {
|
|
||||||
caseReference: "CAS-00764-L0Q9W2",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(
|
|
||||||
reduxForm({
|
|
||||||
form: "uploadFileForm",
|
|
||||||
destroyOnUnmount: false,
|
|
||||||
enableReinitialize: true, // this is needed!!
|
|
||||||
})(UploadFile)
|
|
||||||
);
|
|
||||||
+42
-288
@@ -3,9 +3,6 @@ import { useRouter } from "next/router";
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { setCurrentReference } from "../../store/currentView/action";
|
import { setCurrentReference } from "../../store/currentView/action";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import jsonpath from "jsonpath";
|
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
|
||||||
import { getFormCollectionByID } from "../../components/utils";
|
|
||||||
|
|
||||||
const ViewAllResults = (props) => {
|
const ViewAllResults = (props) => {
|
||||||
const {
|
const {
|
||||||
@@ -21,63 +18,17 @@ const ViewAllResults = (props) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
var resultsArr =
|
var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [
|
||||||
currentView.viewKey == "awaitingSubmissionDetails"
|
{},
|
||||||
? props["awaitingSubmission"].awaitingSubmissionDetails.case
|
];
|
||||||
: props[currentView.viewKey][currentView.viewKey].value || [];
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// currentView.viewKey,
|
|
||||||
// props[currentView.viewKey],
|
|
||||||
// props[currentView.viewKey][currentView.viewKey].value
|
|
||||||
// );
|
|
||||||
|
|
||||||
var searchDetailsObj =
|
|
||||||
currentView.viewKey == "awaitingSubmissionDetails"
|
|
||||||
? props["awaitingSubmission"].awaitingSubmissionDetails.value
|
|
||||||
: props[currentView.viewKey][currentView.viewKey + "Details"] || [];
|
|
||||||
|
|
||||||
let resultsRowArr = [];
|
let resultsRowArr = [];
|
||||||
resultsArr.map((item, key) => {
|
Object.keys(resultsArr).map((key, index) => {
|
||||||
let detailsObj = jsonpath.query(
|
|
||||||
searchDetailsObj,
|
|
||||||
'$..value[?(@.pinswg_name=="' + item.pinswg_title + '")]'
|
|
||||||
);
|
|
||||||
detailsObj = detailsObj[0];
|
|
||||||
|
|
||||||
resultsRowArr.push(
|
resultsRowArr.push(
|
||||||
<div className="govuk-summary-list__row" key={key}>
|
<div className="govuk-summary-list__row" key={key}>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
currentView.viewKey == "awaitingSubmissionDetails"
|
router.locale == "cy"
|
||||||
? router.locale == "cy"
|
|
||||||
? "/fymhorth/parhauigyflwyno"
|
|
||||||
: "/myportal" +
|
|
||||||
"/" +
|
|
||||||
getFormCollectionByID(
|
|
||||||
resultsArr[key].pinswg_appealcasetype
|
|
||||||
).UrlName +
|
|
||||||
"?lpa=" +
|
|
||||||
resultsArr[key][
|
|
||||||
"_pinswg_associatedlpa_value"
|
|
||||||
] +
|
|
||||||
"&apt=" +
|
|
||||||
resultsArr[key].pinswg_appealcasetype +
|
|
||||||
"&casereference=" +
|
|
||||||
resultsArr[key].title +
|
|
||||||
"&inid=" +
|
|
||||||
resultsArr[key].incidentid
|
|
||||||
: router.locale == "cy"
|
|
||||||
? myportal == true
|
? myportal == true
|
||||||
? "/fymhorth/achos"
|
? "/fymhorth/achos"
|
||||||
: "/achos"
|
: "/achos"
|
||||||
@@ -91,21 +42,21 @@ const ViewAllResults = (props) => {
|
|||||||
setCurrentReference({
|
setCurrentReference({
|
||||||
"currentReference":
|
"currentReference":
|
||||||
currentView.viewKey != "watchedCases"
|
currentView.viewKey != "watchedCases"
|
||||||
? resultsArr[key].ticketnumber
|
? resultsArr[index].ticketnumber
|
||||||
: resultsArr[key][
|
: resultsArr[index][
|
||||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
],
|
],
|
||||||
|
|
||||||
"currentType": currentView.viewKey,
|
"currentType": currentView.viewKey,
|
||||||
"incidentid":
|
"incidentid":
|
||||||
currentView.viewKey != "watchedCases"
|
currentView.viewKey != "watchedCases"
|
||||||
? resultsArr[key].incidentid
|
? resultsArr[index].incidentid
|
||||||
: resultsArr[key][
|
: resultsArr[index][
|
||||||
"_pinswg_watchedcase_value"
|
" _pinswg_watchedcase_value"
|
||||||
],
|
],
|
||||||
|
|
||||||
"appealType":
|
"appealType":
|
||||||
resultsArr[key].pinswg_appealcasetype,
|
resultsArr[index].pinswg_appealcasetype,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -114,8 +65,8 @@ const ViewAllResults = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
{currentView.viewKey != "watchedCases"
|
{currentView.viewKey != "watchedCases"
|
||||||
? resultsArr[key].ticketnumber
|
? resultsArr[index].ticketnumber
|
||||||
: resultsArr[key][
|
: resultsArr[index][
|
||||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
]}
|
]}
|
||||||
</a>
|
</a>
|
||||||
@@ -123,225 +74,42 @@ const ViewAllResults = (props) => {
|
|||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t("search:searchresults-site-address-label")}:
|
Site Address:{" "}
|
||||||
</span>
|
</span>
|
||||||
{/* {getFormCollectionByID(appealTypeID).PrimaryIdAttribute ==
|
{resultsArr[index].address1}
|
||||||
"pinswg_dnsid"
|
<br /> {resultsArr[index].town}
|
||||||
? detailsObj.pinswg_projectlocation != null
|
<br />
|
||||||
? detailsObj.pinswg_projectlocation.indexOf(";") < 0
|
{resultsArr[index].postcode}
|
||||||
? detailsObj.pinswg_projectlocation
|
|
||||||
: router.locale == "cy"
|
|
||||||
? detailsObj.pinswg_projectlocation.split(
|
|
||||||
";"
|
|
||||||
)[1]
|
|
||||||
: detailsObj.pinswg_projectlocation.split(
|
|
||||||
";"
|
|
||||||
)[0]
|
|
||||||
: ""
|
|
||||||
: ""} */}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
|
|
||||||
? searchDetailsObj[key].pinswg_siteaddressline1
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
|
||||||
? detailsObj.pinswg_siteaddressline1
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(
|
|
||||||
searchDetailsObj[key],
|
|
||||||
"pinswg_siteaddressline1"
|
|
||||||
) &&
|
|
||||||
searchDetailsObj[key].pinswg_siteaddressline1 !=
|
|
||||||
null && <br />}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddressline1") &&
|
|
||||||
detailsObj.pinswg_siteaddressline1 != null && <br />}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
|
|
||||||
? searchDetailsObj[key].pinswg_siteaddressline2
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
|
||||||
? detailsObj.pinswg_siteaddressline2
|
|
||||||
: ""}
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(
|
|
||||||
searchDetailsObj[key],
|
|
||||||
"pinswg_siteaddressline2"
|
|
||||||
) &&
|
|
||||||
searchDetailsObj[key].pinswg_siteaddressline2 !=
|
|
||||||
null && <br />}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddressline2") &&
|
|
||||||
detailsObj.pinswg_siteaddressline2 != null && <br />}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(searchDetailsObj[key], "pinswg_siteaddresstown")
|
|
||||||
? searchDetailsObj[key].pinswg_siteaddresstown
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddresstown")
|
|
||||||
? detailsObj.pinswg_siteaddresstown
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(
|
|
||||||
searchDetailsObj[key],
|
|
||||||
"pinswg_siteaddresstown"
|
|
||||||
) &&
|
|
||||||
searchDetailsObj[key].pinswg_siteaddresstown !=
|
|
||||||
null && <br />}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddresstown") &&
|
|
||||||
detailsObj.pinswg_siteaddresstown != null && <br />}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
|
|
||||||
? searchDetailsObj[key].pinswg_siteaddresscounty
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddresscounty")
|
|
||||||
? detailsObj.pinswg_siteaddresscounty
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(
|
|
||||||
searchDetailsObj[key],
|
|
||||||
"pinswg_siteaddresscounty"
|
|
||||||
) &&
|
|
||||||
searchDetailsObj[key].pinswg_siteaddresscounty !=
|
|
||||||
null && <br />}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddresscounty") &&
|
|
||||||
detailsObj.pinswg_siteaddresscounty != null && <br />}
|
|
||||||
|
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
|
||||||
_.has(searchDetailsObj[key], "pinswg_siteaddresspostcode")
|
|
||||||
? searchDetailsObj[key].pinswg_siteaddresspostcode
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{_.has(detailsObj, "pinswg_siteaddresspostcode")
|
|
||||||
? detailsObj.pinswg_siteaddresspostcode
|
|
||||||
: ""}
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
Appellant/Applicant:
|
||||||
? t("search:searchresults-created-on-label")
|
|
||||||
: t("search:searchresults-applicant-label")}
|
|
||||||
</span>
|
</span>
|
||||||
|
Mr smith
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
|
||||||
? formatDates(item.createdon)
|
|
||||||
: _.has(detailsObj, [
|
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
|
||||||
])
|
|
||||||
? detailsObj[
|
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
]
|
|
||||||
: resultsArr[key][
|
|
||||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
]}
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">Authority:</span>
|
||||||
{t("search:searchresults-authority-label")}:
|
{
|
||||||
</span>
|
resultsArr[index][
|
||||||
|
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
]
|
||||||
_.has(resultsArr[key], "pinswg_lpaname")
|
}
|
||||||
? router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
resultsArr[key].pinswg_lpaname +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: resultsArr[key].pinswg_lpaname || "N/A"
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{_.has(resultsArr[key], [
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
|
||||||
])
|
|
||||||
? router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
resultsArr[key][
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: resultsArr[key][
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || "N/A"
|
|
||||||
: ""}
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">Case Type:</span>
|
||||||
{t("search:searchresults-case-type-label")}:
|
{
|
||||||
</span>
|
resultsArr[index][
|
||||||
|
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
]
|
||||||
? router.locale == "cy"
|
}
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
getFormCollectionByID(
|
|
||||||
item.pinswg_appealcasetype
|
|
||||||
).value +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: getFormCollectionByID(item.pinswg_appealcasetype)
|
|
||||||
.value || "N/A"
|
|
||||||
: router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
item[
|
|
||||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: item[
|
|
||||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || "N/A"}
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">Status:</span>
|
||||||
{t("search:searchresults-status-label")}:
|
{
|
||||||
</span>
|
resultsArr[index][
|
||||||
|
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
]
|
||||||
? router.locale == "cy"
|
}
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.statuscode=="' +
|
|
||||||
item.statuscode +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.statuscode=="' +
|
|
||||||
item.statuscode +
|
|
||||||
'")].value'
|
|
||||||
) || "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"}
|
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -352,14 +120,7 @@ const ViewAllResults = (props) => {
|
|||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
|
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
|
||||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
{currentView.viewName}
|
||||||
t("myportal:awatitingsubmission-card-title")}
|
|
||||||
{currentView.viewKey == "watchedCases" &&
|
|
||||||
t("myportal:watchedcases-card-title")}
|
|
||||||
{currentView.viewKey == "myCases" &&
|
|
||||||
t("myportal:mycases-card-title")}
|
|
||||||
{currentView.viewKey == "myRepresentations" &&
|
|
||||||
t("myportal:myrepresentations-card-title")}
|
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||||
@@ -370,16 +131,9 @@ const ViewAllResults = (props) => {
|
|||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("search:searchresults-site-address-label")}
|
{t("search:searchresults-site-address-label")}
|
||||||
</dd>
|
</dd>
|
||||||
{currentView.viewKey ==
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
"awaitingSubmissionDetails" ? (
|
{t("search:searchresults-applicant-label")}
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
</dd>
|
||||||
{t("search:searchresults-created-on-label")}{" "}
|
|
||||||
</dd>
|
|
||||||
) : (
|
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
|
||||||
{t("search:searchresults-applicant-label")}
|
|
||||||
</dd>
|
|
||||||
)}
|
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("search:searchresults-authority-label")}
|
{t("search:searchresults-authority-label")}
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const WatchedCases = (props) => {
|
|||||||
const { setCurrentView } = props;
|
const { setCurrentView } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" id="casescomment-card">
|
<div className="card card-3" id="casescomment-card">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:watchedcases-card-title")}
|
{t("myportal:watchedcases-card-title")}
|
||||||
@@ -21,12 +21,11 @@ const WatchedCases = (props) => {
|
|||||||
<div className="cardModuleContainer">
|
<div className="cardModuleContainer">
|
||||||
<TopThree
|
<TopThree
|
||||||
showTopThree={props.watchedCases.watchedCases}
|
showTopThree={props.watchedCases.watchedCases}
|
||||||
showDetails={props.watchedCases.watchedCasesDetails}
|
|
||||||
topThreeType={"watchedCases"}
|
topThreeType={"watchedCases"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{props.watchedCases.watchedCases["@odata.count"] > 3 && (
|
{props.watchedCases.watchedCases["@odata.count"] != 0 && (
|
||||||
<div className="cardVieAll">
|
<div className="cardVieAll">
|
||||||
<Link href="/myportal/viewall" shallow>
|
<Link href="/myportal/viewall" shallow>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ export default function YourAccount() {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{/* <div className="card-body">
|
<div className="card" id="casescomment-card">
|
||||||
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:changepassword-card-title")}
|
{t("myportal:changepassword-card-title")}
|
||||||
</h3>
|
</h3>
|
||||||
@@ -43,7 +44,7 @@ export default function YourAccount() {
|
|||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div> */}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import { useContext } from "react";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import PlanningAppeal from "./newappeal/planningappeal";
|
||||||
|
import EnforcementNotice from "./newappeal/enforcementnotice";
|
||||||
|
import LDC from "./newappeal/ldc";
|
||||||
|
import AdvertApplication from "./newappeal/advertapplication";
|
||||||
|
|
||||||
|
export default function NewAppeal({ children, pages }) {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { locale } = router;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main
|
||||||
|
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||||
|
id="main-content"
|
||||||
|
role="main"
|
||||||
|
>
|
||||||
|
<div className="govuk-grid-row">
|
||||||
|
<div className="govuk-grid-column-full">
|
||||||
|
<div className="flex-container grid-row govuk-body ">
|
||||||
|
<PlanningAppeal />
|
||||||
|
<EnforcementNotice />
|
||||||
|
<LDC />
|
||||||
|
<AdvertApplication />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,812 +0,0 @@
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { Field, formValueSelector, reduxForm, change } from "redux-form";
|
|
||||||
import {
|
|
||||||
FieldsTranslations,
|
|
||||||
Radiofield,
|
|
||||||
Textfield,
|
|
||||||
MultiLinefield,
|
|
||||||
} from "../elements";
|
|
||||||
|
|
||||||
const RenderTextfield = ({
|
|
||||||
id,
|
|
||||||
className,
|
|
||||||
rows,
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
input,
|
|
||||||
type,
|
|
||||||
errorMsg,
|
|
||||||
disabled,
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
{touched && error && (
|
|
||||||
<span id={id + "-error"} className="govuk-error-message">
|
|
||||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
|
||||||
{touched &&
|
|
||||||
((error && (
|
|
||||||
<span>{errorMsg ? errorMsg : error}</span>
|
|
||||||
)) ||
|
|
||||||
(warning && <span>{warning}</span>))}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<input
|
|
||||||
{...input}
|
|
||||||
className={className}
|
|
||||||
name={id}
|
|
||||||
id={id}
|
|
||||||
type={type}
|
|
||||||
disabled={disabled ? true : false}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const RenderMultiline = ({
|
|
||||||
id,
|
|
||||||
className,
|
|
||||||
rows,
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
input,
|
|
||||||
errorMsg,
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
{touched && error && (
|
|
||||||
<span id={id + "-error"} className="govuk-error-message">
|
|
||||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
|
||||||
{touched &&
|
|
||||||
((error && (
|
|
||||||
<span>{errorMsg ? errorMsg : error}</span>
|
|
||||||
)) ||
|
|
||||||
(warning && <span>{warning}</span>))}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<textarea
|
|
||||||
{...input}
|
|
||||||
rows={rows}
|
|
||||||
className={className}
|
|
||||||
></textarea>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
let AboutYou = (props) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
|
|
||||||
const {
|
|
||||||
onSubmit,
|
|
||||||
handleSubmit,
|
|
||||||
appellantAgentValue,
|
|
||||||
setFormStep,
|
|
||||||
updateField,
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
|
||||||
const appellantAgent =
|
|
||||||
router.locale == "cy" ? ["Apelydd", "Asiant"] : ["Appellant", "Agent"];
|
|
||||||
const contactPref =
|
|
||||||
router.locale == "cy" ? ["Ebost", "Post"] : ["Email", "Post"];
|
|
||||||
|
|
||||||
const required = (value) => (value ? undefined : "Is required");
|
|
||||||
const emailRegex =
|
|
||||||
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
|
|
||||||
|
|
||||||
const email = (value) =>
|
|
||||||
value && !emailRegex.test(value) ? "Invalid email address" : undefined;
|
|
||||||
const phoneNumber = (value) =>
|
|
||||||
value &&
|
|
||||||
!/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test(
|
|
||||||
value
|
|
||||||
)
|
|
||||||
? "Invalid phone number"
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const RenderYesNo = ({
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
id,
|
|
||||||
errorMsg,
|
|
||||||
options,
|
|
||||||
input: { onChange, value },
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<fieldset
|
|
||||||
className="govuk-fieldset"
|
|
||||||
aria-describedby={name + "-hint"}
|
|
||||||
>
|
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
|
|
||||||
<label
|
|
||||||
className="govuk-fieldset__heading govuk-body-m"
|
|
||||||
id={id + "_label"}
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{errorMsg}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div className="govuk-radios govuk-radios--inline govuk-radios--small">
|
|
||||||
{Object.keys(options).map((key, index) => (
|
|
||||||
<div
|
|
||||||
className="govuk-radios__item"
|
|
||||||
data-children-count={key}
|
|
||||||
key={key}
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
id={id + "_" + index}
|
|
||||||
name={id}
|
|
||||||
component="input"
|
|
||||||
type="radio"
|
|
||||||
className="govuk-radios__input"
|
|
||||||
value={options[key]}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="govuk-label govuk-radios__label"
|
|
||||||
htmlFor={id + "_" + index}
|
|
||||||
>
|
|
||||||
{options[key]}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const RenderRadio = ({
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
id,
|
|
||||||
errorMsg,
|
|
||||||
options,
|
|
||||||
input: { onChange, value },
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
const required = (value) => (value ? undefined : "Required");
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<fieldset
|
|
||||||
className="govuk-fieldset"
|
|
||||||
aria-describedby={datafieldname + "-hint"}
|
|
||||||
>
|
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
|
|
||||||
<label
|
|
||||||
className="govuk-fieldset__heading govuk-body-m"
|
|
||||||
id={id + "_label"}
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{errorMsg}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
custom.inline == false
|
|
||||||
? "govuk-radios govuk-radios--small"
|
|
||||||
: "govuk-radios govuk-radios--inline govuk-radios--small"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
{custom.hint != false ||
|
|
||||||
(custom.hint != undefined && (
|
|
||||||
<div className="govuk-hint">
|
|
||||||
{t(custom.hint)}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
{Object.keys(options).map((key, index) => (
|
|
||||||
<div
|
|
||||||
className="govuk-radios__item"
|
|
||||||
data-children-count={key}
|
|
||||||
key={key}
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
id={id + "_" + index}
|
|
||||||
name={id}
|
|
||||||
component="input"
|
|
||||||
type="radio"
|
|
||||||
className="govuk-radios__input"
|
|
||||||
value={options[key].split("|")[0]}
|
|
||||||
validate={[required]}
|
|
||||||
// checked={
|
|
||||||
// value ==
|
|
||||||
// parseInt(options[key].split("|")[0])
|
|
||||||
// }
|
|
||||||
onChange={(e) => {
|
|
||||||
let docListObj =
|
|
||||||
custom.documentList;
|
|
||||||
if (
|
|
||||||
custom.requiredDocumentValue ==
|
|
||||||
"Yes"
|
|
||||||
) {
|
|
||||||
e.target.value != "846040000"
|
|
||||||
? (docListObj =
|
|
||||||
Object.assign(
|
|
||||||
docListObj,
|
|
||||||
{
|
|
||||||
["documentCheckList_" +
|
|
||||||
id]:
|
|
||||||
custom.requiredDocumentLabel,
|
|
||||||
}
|
|
||||||
))
|
|
||||||
: delete docListObj[
|
|
||||||
"documentCheckList_" +
|
|
||||||
id
|
|
||||||
];
|
|
||||||
custom.setDocumentsList(
|
|
||||||
docListObj
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="govuk-label govuk-radios__label"
|
|
||||||
htmlFor={id + "_" + index}
|
|
||||||
>
|
|
||||||
{t(options[key].split("|")[1])}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
function Radiofield(props) {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
datafieldname,
|
|
||||||
parentField,
|
|
||||||
form,
|
|
||||||
formProps,
|
|
||||||
parentFieldShowOnValue,
|
|
||||||
validation,
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const required = (value) => (value ? undefined : "Required");
|
|
||||||
// console.log(props.options);
|
|
||||||
|
|
||||||
const fieldOptions = props.options
|
|
||||||
.slice(1, props.options.length - 1)
|
|
||||||
.split(",");
|
|
||||||
|
|
||||||
//parentFieldShowOnValue
|
|
||||||
var showIfHasParentShowValue = parentField != false;
|
|
||||||
//debugger;
|
|
||||||
// parentField != false &&
|
|
||||||
// !_.isEmpty(formProps[form]) &&
|
|
||||||
// _.has(formProps[form].values, parentField) &&
|
|
||||||
// parentFieldShowOnValue.indexOf(
|
|
||||||
// formProps[form].values[parentField].toString()
|
|
||||||
// ) > -1;
|
|
||||||
|
|
||||||
(showIfHasParentShowValue == parentField) != false &&
|
|
||||||
showIfHasParentShowValue;
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// datafieldname,
|
|
||||||
// showIfHasParentShowValue,
|
|
||||||
// formProps[form].values[parentField]
|
|
||||||
// );
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{parentField != false ? (
|
|
||||||
showIfHasParentShowValue && (
|
|
||||||
<Field
|
|
||||||
name={name}
|
|
||||||
datafieldname={datafieldname}
|
|
||||||
label={label}
|
|
||||||
options={fieldOptions}
|
|
||||||
id={name}
|
|
||||||
validate={[required]}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
component={RenderRadio}
|
|
||||||
inline={props.inline}
|
|
||||||
hint={props.hint}
|
|
||||||
//validate={eval(validation)}
|
|
||||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
|
||||||
requiredDocumentValue={props.requiredDocumentValue}
|
|
||||||
setDocumentsList={props.setDocumentsList}
|
|
||||||
documentList={props.documentList}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
) : (
|
|
||||||
<Field
|
|
||||||
name={name}
|
|
||||||
datafieldname={datafieldname}
|
|
||||||
label={label}
|
|
||||||
options={fieldOptions}
|
|
||||||
id={name}
|
|
||||||
validate={[required]}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
component={RenderRadio}
|
|
||||||
inline={props.inline}
|
|
||||||
hint={props.hint}
|
|
||||||
//validate={eval(validation)}
|
|
||||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
|
||||||
requiredDocumentValue={props.requiredDocumentValue}
|
|
||||||
setDocumentsList={props.setDocumentsList}
|
|
||||||
documentList={props.documentList}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const onHandleSubmit = (values) => {
|
|
||||||
event.preventDefault();
|
|
||||||
console.log(JSON.stringify(values));
|
|
||||||
setFormStep(1);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlePartialUpdate = () => {
|
|
||||||
if (appellantAgentValue == "846040001") {
|
|
||||||
updateField("caseForm", "pinswg_appellantfirstname", "");
|
|
||||||
updateField("caseForm", "pinswg_appellantlastname", "");
|
|
||||||
updateField("caseForm", "pinswg_appellantemailaddress", "");
|
|
||||||
updateField("caseForm", "pinswg_appellantaddress", "");
|
|
||||||
updateField("caseForm", "pinswg_appellantphonenumber", "");
|
|
||||||
} else {
|
|
||||||
updateField(
|
|
||||||
"caseForm",
|
|
||||||
"pinswg_appellantfirstname",
|
|
||||||
props.initialValues.pinswg_appellantfirstname
|
|
||||||
);
|
|
||||||
updateField(
|
|
||||||
"caseForm",
|
|
||||||
"pinswg_appellantlastname",
|
|
||||||
props.initialValues.pinswg_appellantlastname
|
|
||||||
);
|
|
||||||
updateField(
|
|
||||||
"caseForm",
|
|
||||||
"pinswg_appellantemailaddress",
|
|
||||||
props.initialValues.pinswg_appellantemailaddress
|
|
||||||
);
|
|
||||||
updateField(
|
|
||||||
"caseForm",
|
|
||||||
"pinswg_appellantaddress",
|
|
||||||
props.initialValues.pinswg_appellantaddress
|
|
||||||
);
|
|
||||||
updateField(
|
|
||||||
"caseForm",
|
|
||||||
"pinswg_appellantphonenumber",
|
|
||||||
props.initialValues.pinswg_appellantphonenumber
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
handlePartialUpdate();
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_onbehalfof"}
|
|
||||||
id={"pinswg_onbehalfof"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t("newappeal:about-you-on-behalf-label")}
|
|
||||||
/>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<details className="govuk-details" data-module="govuk-details">
|
|
||||||
<summary className="govuk-details__summary">
|
|
||||||
<span className="govuk-details__summary-text">
|
|
||||||
{t("newappeal:about-you-who-can-appeal-label")}
|
|
||||||
</span>
|
|
||||||
</summary>
|
|
||||||
<div className="govuk-details__text">
|
|
||||||
{t("newappeal:about-you-who-can-appeal-paragraph")}
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Radiofield
|
|
||||||
name={"pinswg_appellantagent"}
|
|
||||||
datafieldname={"pinswg_appellantagent"}
|
|
||||||
label={t("newappeal:about-you-who-are-you-label")}
|
|
||||||
options="[846040000|newappeal:about-you-who-are-you-label-appellant,846040001|newappeal:about-you-who-are-you-label-agent]"
|
|
||||||
id={"pinswg_appellantagent"}
|
|
||||||
className="govuk-radios__input"
|
|
||||||
validate={"[required]"}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{appellantAgentValue == "846040000" && (
|
|
||||||
<>
|
|
||||||
<h2 className="govuk-heading-s">
|
|
||||||
{t("newappeal:about-you-appellant-contact-details")}
|
|
||||||
</h2>
|
|
||||||
<Field
|
|
||||||
name={"[pinswg_appellantfirstname"}
|
|
||||||
id={"pinswg_appellantfirstname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-firstname-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantlastname"}
|
|
||||||
id={"pinswg_appellantlastname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-lastname-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantaddress"}
|
|
||||||
id={"pinswg_appellantaddress"}
|
|
||||||
component={RenderMultiline}
|
|
||||||
type="textarea"
|
|
||||||
className="govuk-textarea govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-address-label"
|
|
||||||
)}
|
|
||||||
rows={4}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantemailaddress"}
|
|
||||||
id={"pinswg_appellantemailaddress"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="email"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required, email]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-email-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantphonenumber"}
|
|
||||||
id={"pinswg_appellantphonenumber"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="number"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required, phoneNumber]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-phone-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Radiofield
|
|
||||||
name={"pinswg_contactprefs"}
|
|
||||||
datafieldname={"pinswg_contactprefs"}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-preferences-label"
|
|
||||||
)}
|
|
||||||
options="[846040000|newappeal:about-you-agent-contact-preferences-value-email,846040001|newappeal:about-you-agent-contact-preferences-value-post]"
|
|
||||||
id={"pinswg_contactprefs"}
|
|
||||||
className="govuk-radios__input"
|
|
||||||
validate={"[required]"}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
/>
|
|
||||||
<Radiofield
|
|
||||||
name={"pinswg_languagepreference"}
|
|
||||||
datafieldname={"pinswg_languagepreference"}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-language-preferences-label"
|
|
||||||
)}
|
|
||||||
options="[846040000|newappeal:about-you-agent-language-preferences-value-english,846040001|newappeal:about-you-agent-language-preferences-value-welsh]"
|
|
||||||
id={"pinswg_languagepreference"}
|
|
||||||
className="govuk-radios__input"
|
|
||||||
validate={"[required]"}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{appellantAgentValue == "846040001" && (
|
|
||||||
<>
|
|
||||||
<h2 className="govuk-heading-s">
|
|
||||||
{t("newappeal:about-you-appellant-contact-details")}
|
|
||||||
</h2>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantfirstname"}
|
|
||||||
id={"appellantfirstname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-firstname-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantlastname"}
|
|
||||||
id={"pinswg_appellantlastname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-lastname-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantaddress"}
|
|
||||||
id={"pinswg_appellantaddress"}
|
|
||||||
component={RenderMultiline}
|
|
||||||
type="textarea"
|
|
||||||
className="govuk-textarea govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-address-label"
|
|
||||||
)}
|
|
||||||
rows={4}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantemailaddress"}
|
|
||||||
id={"pinswg_appellantemailaddress"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="email"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-email-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_appellantphonenumber"}
|
|
||||||
id={"pinswg_appellantphonenumber"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required, phoneNumber]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-appellant-contact-details-phone-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<h2 className="govuk-heading-s">
|
|
||||||
{t("newappeal:about-you-agent-contact-details")}
|
|
||||||
</h2>{" "}
|
|
||||||
<Field
|
|
||||||
name={"pinswg_agentcompanyname"}
|
|
||||||
id={"pinswg_agentcompanyname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-details-companyname-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_agentfirstname"}
|
|
||||||
id={"pinswg_agentfirstname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-details-firstname-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_agentlastname"}
|
|
||||||
id={"pinswg_agentlastname"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-details-lastname-label"
|
|
||||||
)}
|
|
||||||
/>{" "}
|
|
||||||
<Field
|
|
||||||
name={"pinswg_agentaddress"}
|
|
||||||
id={"pinswg_agentaddress"}
|
|
||||||
component={RenderMultiline}
|
|
||||||
type="textarea"
|
|
||||||
className="govuk-textarea govuk-input--width-20"
|
|
||||||
validate={[required]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-details-address-label"
|
|
||||||
)}
|
|
||||||
rows={4}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_agentemailaddress"}
|
|
||||||
id={"pinswg_agentemailaddress"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="text"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required, email]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-details-email-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name={"pinswg_agentphonenumber"}
|
|
||||||
id={"pinswg_agentphonenumber"}
|
|
||||||
component={RenderTextfield}
|
|
||||||
type="number"
|
|
||||||
className="govuk-input govuk-input--width-20"
|
|
||||||
validate={[required, phoneNumber]}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-details-phone-label"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Radiofield
|
|
||||||
name={"pinswg_contactprefs"}
|
|
||||||
datafieldname={"pinswg_contactprefs"}
|
|
||||||
label={t(
|
|
||||||
"newappeal:about-you-agent-contact-preferences-label"
|
|
||||||
)}
|
|
||||||
options="[846040000|newappeal:about-you-agent-contact-preferences-value-email,846040001|newappeal:about-you-agent-contact-preferences-value-post]"
|
|
||||||
id={"pinswg_contactprefs"}
|
|
||||||
className="govuk-radios__input"
|
|
||||||
validate={[required]}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
/>
|
|
||||||
<Radiofield
|
|
||||||
name={"pinswg_languagepreference"}
|
|
||||||
datafieldname={"pinswg_languagepreference"}
|
|
||||||
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]"
|
|
||||||
id={"pinswg_languagepreference"}
|
|
||||||
className="govuk-radios__input"
|
|
||||||
validate={[required]}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
className="govuk-button"
|
|
||||||
data-module="govuk-button"
|
|
||||||
>
|
|
||||||
{t("common:continue-button")}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
|
||||||
return {
|
|
||||||
search: state.search,
|
|
||||||
searchResultsObj: state.searchResultsObj,
|
|
||||||
formData: state.formData,
|
|
||||||
appealType: state.appealType,
|
|
||||||
//form: state.form,
|
|
||||||
|
|
||||||
initialValues: {
|
|
||||||
pinswg_appellantfirstname:
|
|
||||||
state.accountDetails.accountDetails.firstname,
|
|
||||||
pinswg_appellantlastname:
|
|
||||||
state.accountDetails.accountDetails.lastname,
|
|
||||||
pinswg_appellantemailaddress:
|
|
||||||
state.accountDetails.accountDetails.emailaddress1,
|
|
||||||
pinswg_appellantaddress:
|
|
||||||
state.accountDetails.accountDetails.address1_composite,
|
|
||||||
pinswg_appellantphonenumber:
|
|
||||||
state.accountDetails.accountDetails.telephone1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {
|
|
||||||
updateField: (form, field, newValue) =>
|
|
||||||
dispatch(change(form, field, newValue)),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// AboutYou = reduxForm({
|
|
||||||
// form: "caseForm", // a unique identifier for this form
|
|
||||||
// destroyOnUnmount: false,
|
|
||||||
// })(AboutYou);
|
|
||||||
|
|
||||||
const selector = formValueSelector("caseForm"); // <-- same as form name
|
|
||||||
|
|
||||||
AboutYou = connect((state) => {
|
|
||||||
// can select values individually
|
|
||||||
const appellantAgentValue = selector(state, "pinswg_appellantagent");
|
|
||||||
|
|
||||||
return {
|
|
||||||
appellantAgentValue,
|
|
||||||
};
|
|
||||||
})(AboutYou);
|
|
||||||
|
|
||||||
//export default AboutYou;
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(
|
|
||||||
reduxForm({
|
|
||||||
form: "caseForm",
|
|
||||||
enableReinitialize: true, // this is needed!!
|
|
||||||
|
|
||||||
destroyOnUnmount: false,
|
|
||||||
})(AboutYou)
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
|
||||||
|
export default function MakeAdvertApplication() {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { locale } = router;
|
||||||
|
return (
|
||||||
|
<div className="card" id="casescomment-card">
|
||||||
|
<div className="card-body appealModule">
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
An appeal relating to an advertisement application or a
|
||||||
|
discontinuance notice.
|
||||||
|
</p>
|
||||||
|
<div className="appealCTA">
|
||||||
|
<Link href="/newappeal/selectappeal">
|
||||||
|
<a className="govuk-button">
|
||||||
|
An advert application/Discontinuance Notice (DN)
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -36,10 +36,7 @@ export default function BuildField(props) {
|
|||||||
case "{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
case "{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
||||||
return <>{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
break;
|
break;
|
||||||
case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
case "{ 4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
||||||
return <>{fieldValue}</>;
|
|
||||||
break;
|
|
||||||
case "{4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
|
||||||
return <>{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
break;
|
break;
|
||||||
case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}":
|
case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}":
|
||||||
@@ -58,12 +55,8 @@ export default function BuildField(props) {
|
|||||||
case "{C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E}":
|
case "{C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E}":
|
||||||
return <>{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
break;
|
break;
|
||||||
case "{16D63FD6-119B-4353-BDCA-18358721C3FE}":
|
|
||||||
return <> docs {fieldValue}</>;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return <>ss{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ import jsonpath from "jsonpath";
|
|||||||
import BuildCheckField from "./buildCheckfield";
|
import BuildCheckField from "./buildCheckfield";
|
||||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||||
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
|
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
|
||||||
import {
|
|
||||||
getFormCollectionByID,
|
|
||||||
getPickListLabel,
|
|
||||||
getRadioLabel,
|
|
||||||
} from "../../components/utils";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
setCaseReference,
|
setCaseReference,
|
||||||
@@ -95,118 +90,42 @@ let BuildCheckRow = (props) => {
|
|||||||
"')]"
|
"')]"
|
||||||
);
|
);
|
||||||
|
|
||||||
// if (datafieldname[0].value.indexOf("fileUpload") > 0) {
|
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||||
// isRequiredField.push({
|
return (
|
||||||
// "LogicalName": datafieldname[0].value,
|
<div className="govuk-summary-list__row" key={key}>
|
||||||
// "RequiredLevel": {
|
<dt className="govuk-summary-list__key">
|
||||||
// "Value": "Recommended",
|
{FieldsTranslations(rows[0].value)}
|
||||||
// "CanBeChanged": true,
|
</dt>
|
||||||
// "ManagedPropertyLogicalName":
|
<dd className="govuk-summary-list__value">
|
||||||
// "canmodifyrequirementlevelsettings",
|
{fieldtype[0].value ==
|
||||||
// },
|
"{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}"
|
||||||
// "MetadataId":
|
? formatDate(
|
||||||
// "32a7e6fc-4283-eb11-aac0-00224800be9c",
|
props.props.form["appealForm"]
|
||||||
// });
|
.values[
|
||||||
// }
|
datafieldname[0].value
|
||||||
|
]
|
||||||
// console.log(
|
)
|
||||||
// datafieldname[0].value.indexOf("fileUpload") > 0,
|
: props.props.form["appealForm"].values[
|
||||||
// isRequiredField,
|
datafieldname[0].value
|
||||||
// props.props.form["appealForm"].values[
|
]}
|
||||||
// datafieldname[0].value
|
</dd>
|
||||||
// ]
|
<dd className="govuk-summary-list__actions">
|
||||||
// );
|
<a
|
||||||
|
className="govuk-link"
|
||||||
if (
|
href="#"
|
||||||
typeof props.props.form["appealForm"].values[
|
onClick={() => {
|
||||||
datafieldname[0].value
|
updateCurrentSection(whichSection);
|
||||||
] != "undefined"
|
}}
|
||||||
) {
|
|
||||||
if (typeof isRequiredField[0] != "undefined") {
|
|
||||||
if (
|
|
||||||
isRequiredField[0].RequiredLevel.Value != "None"
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="govuk-summary-list__row"
|
|
||||||
key={key}
|
|
||||||
>
|
>
|
||||||
<dt className="govuk-summary-list__key">
|
{t("newappeal:change-link-label")}
|
||||||
|
<span className="govuk-visually-hidden">
|
||||||
|
{" "}
|
||||||
{FieldsTranslations(rows[0].value)}
|
{FieldsTranslations(rows[0].value)}
|
||||||
</dt>
|
</span>
|
||||||
|
</a>
|
||||||
<dd className="govuk-summary-list__value">
|
</dd>
|
||||||
{fieldtype[0].value ==
|
</div>
|
||||||
"{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}"
|
);
|
||||||
? formatDate(
|
|
||||||
props.props.form[
|
|
||||||
"appealForm"
|
|
||||||
].values[
|
|
||||||
datafieldname[0].value
|
|
||||||
]
|
|
||||||
)
|
|
||||||
: fieldtype[0].value ==
|
|
||||||
"{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}"
|
|
||||||
? getPickListLabel(
|
|
||||||
props.props.formData
|
|
||||||
.pickListData,
|
|
||||||
datafieldname[0].value,
|
|
||||||
props.props.form[
|
|
||||||
"appealForm"
|
|
||||||
].values[
|
|
||||||
datafieldname[0].value
|
|
||||||
]
|
|
||||||
)
|
|
||||||
: fieldtype[0].value ==
|
|
||||||
"{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}"
|
|
||||||
? getRadioLabel(
|
|
||||||
props.props.formData
|
|
||||||
.pickListData,
|
|
||||||
datafieldname[0].value,
|
|
||||||
props.props.form[
|
|
||||||
"appealForm"
|
|
||||||
].values[
|
|
||||||
datafieldname[0].value
|
|
||||||
]
|
|
||||||
)
|
|
||||||
: fieldtype[0].value ==
|
|
||||||
"{16D63FD6-119B-4353-BDCA-18358721C3FE}"
|
|
||||||
? "ssss"
|
|
||||||
: props.props.form["appealForm"]
|
|
||||||
.values[
|
|
||||||
datafieldname[0].value
|
|
||||||
]}
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dd className="govuk-summary-list__actions">
|
|
||||||
<a
|
|
||||||
className="govuk-link"
|
|
||||||
href="#"
|
|
||||||
onClick={() => {
|
|
||||||
updateCurrentSection(
|
|
||||||
whichSection
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t(
|
|
||||||
"newappeal:change-link-label"
|
|
||||||
)}
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
{" "}
|
|
||||||
{FieldsTranslations(
|
|
||||||
rows[0].value
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ let BuildCheckSection = (props) => {
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
formTitle,
|
formTitle,
|
||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
updateCurrentSection,
|
|
||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -56,64 +55,8 @@ let BuildCheckSection = (props) => {
|
|||||||
// /searchresults
|
// /searchresults
|
||||||
};
|
};
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
|
||||||
//alert(1);
|
|
||||||
//updateCaseProgress(values);
|
|
||||||
// setCurrentSection(9999);
|
|
||||||
|
|
||||||
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 (
|
return (
|
||||||
<div className="govuk-grid-row" key={1222}>
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="govuk-heading-m">
|
<h1 className="govuk-heading-m">
|
||||||
@@ -121,10 +64,10 @@ let BuildCheckSection = (props) => {
|
|||||||
</h1>
|
</h1>
|
||||||
<dl className="govuk-summary-list ">
|
<dl className="govuk-summary-list ">
|
||||||
{Object.keys(titles).map((key) => (
|
{Object.keys(titles).map((key) => (
|
||||||
<div key={key}>
|
<>
|
||||||
<h2 className="govuk-heading-m govuk-!-margin-top-9">
|
{/* <h2 className="govuk-heading-m">
|
||||||
{titles[key].value}
|
{titles[key].value}
|
||||||
</h2>
|
</h2> */}
|
||||||
|
|
||||||
<BuildCheckRow
|
<BuildCheckRow
|
||||||
formXML={formXML}
|
formXML={formXML}
|
||||||
@@ -134,62 +77,10 @@ let BuildCheckSection = (props) => {
|
|||||||
key={key}
|
key={key}
|
||||||
mandatoryFieldsData={mandatoryFieldsData}
|
mandatoryFieldsData={mandatoryFieldsData}
|
||||||
/>
|
/>
|
||||||
</div>
|
</>
|
||||||
))}
|
))}
|
||||||
</dl>
|
</dl>
|
||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list">
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list"></dl>
|
||||||
<div className="govuk-summary-list__row" key={"9999"}>
|
|
||||||
<dt className="govuk-summary-list__key">
|
|
||||||
{props.props.appealType.fileList.files.length >
|
|
||||||
0
|
|
||||||
? props.props.appealType.fileList.files.map(
|
|
||||||
(blob, i) => (
|
|
||||||
<div
|
|
||||||
key={blob.name + "_" + i}
|
|
||||||
className="govuk-!-margin-bottom-5 fileThumb "
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={getThumbnailIconByExtension(
|
|
||||||
blob.name
|
|
||||||
)}
|
|
||||||
alt={blob.name.slice(
|
|
||||||
blob.name.indexOf(
|
|
||||||
"_"
|
|
||||||
) + 1
|
|
||||||
)}
|
|
||||||
width="50"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
|
|
||||||
{blob.name.slice(
|
|
||||||
blob.name.indexOf(
|
|
||||||
"_"
|
|
||||||
) + 1
|
|
||||||
)}
|
|
||||||
(
|
|
||||||
{bytesToSize(
|
|
||||||
blob.contentLength
|
|
||||||
)}
|
|
||||||
)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
)
|
|
||||||
: ""}
|
|
||||||
</dt>
|
|
||||||
<dd className="govuk-summary-list__actions">
|
|
||||||
<a
|
|
||||||
className="govuk-link"
|
|
||||||
href="#"
|
|
||||||
onClick={() => {
|
|
||||||
updateCurrentSection(sectionCount);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("newappeal:change-link-label")}
|
|
||||||
</a>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
<a
|
<a
|
||||||
@@ -220,10 +111,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setCurrentSection: (currentSection) => {
|
setCurrentSection: (currentSection) => {
|
||||||
dispatch(setCurrentSection(currentSection));
|
dispatch(setCurrentSection(currentSection));
|
||||||
},
|
},
|
||||||
updateCurrentSection: (whichSection) => {
|
|
||||||
dispatch(setCurrentSection(whichSection));
|
|
||||||
dispatch(setFormComplete("true"));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import xpath from "xpath";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CheckBoxfield,
|
Textfield,
|
||||||
|
DateField,
|
||||||
DateFieldPicker,
|
DateFieldPicker,
|
||||||
DecimalField,
|
YesNofield,
|
||||||
FileUploadField,
|
PickList,
|
||||||
MultiLinefield,
|
MultiLinefield,
|
||||||
NumericField,
|
NumericField,
|
||||||
PickList,
|
|
||||||
Radiofield,
|
|
||||||
ReadOnlyfield,
|
ReadOnlyfield,
|
||||||
Textfield,
|
DecimalField,
|
||||||
YesNofield,
|
|
||||||
} from "../elements";
|
} from "../elements";
|
||||||
|
|
||||||
export default function BuildField(props) {
|
export default function BuildField(props) {
|
||||||
@@ -24,11 +25,7 @@ export default function BuildField(props) {
|
|||||||
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
|
|
||||||
//console.log(props);
|
|
||||||
|
|
||||||
const whichFieldType = (classid) => {
|
const whichFieldType = (classid) => {
|
||||||
//console.log(props.datafieldname, classid);
|
|
||||||
|
|
||||||
switch (classid) {
|
switch (classid) {
|
||||||
case "{270BD3DB-D9AF-4782-9025-509E298DEC0A}":
|
case "{270BD3DB-D9AF-4782-9025-509E298DEC0A}":
|
||||||
return (
|
return (
|
||||||
@@ -54,7 +51,6 @@ export default function BuildField(props) {
|
|||||||
label={props.label}
|
label={props.label}
|
||||||
datafieldname={props.datafieldname}
|
datafieldname={props.datafieldname}
|
||||||
picklistData={props.picklistData}
|
picklistData={props.picklistData}
|
||||||
validation={props.validation}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -63,42 +59,10 @@ export default function BuildField(props) {
|
|||||||
<YesNofield
|
<YesNofield
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
requiredDocumentValue={props.requiredDocumentValue}
|
|
||||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
|
||||||
validation={props.validation}
|
|
||||||
setDocumentsList={props.setDocumentsList}
|
|
||||||
documentList={props.documentList}
|
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
|
||||||
return (
|
|
||||||
<Radiofield
|
|
||||||
name={props.datafieldname}
|
|
||||||
label={props.label}
|
|
||||||
datafieldname={props.datafieldname}
|
|
||||||
options={props.datafieldcontent}
|
|
||||||
inline={false}
|
|
||||||
hint={props.hint}
|
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
validation={props.validation}
|
|
||||||
setDocumentsList={props.setDocumentsList}
|
|
||||||
documentList={props.documentList}
|
|
||||||
requiredDocumentValue={props.requiredDocumentValue}
|
|
||||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "{4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
case "{4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
||||||
const required = (value) => (value ? undefined : "Is required");
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Textfield
|
<Textfield
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
@@ -108,12 +72,6 @@ export default function BuildField(props) {
|
|||||||
props.props.props.appealType.caseReference
|
props.props.props.appealType.caseReference
|
||||||
.ticketnumber
|
.ticketnumber
|
||||||
}
|
}
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
validation={props.validation}
|
|
||||||
hint={props.hint}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -122,13 +80,6 @@ export default function BuildField(props) {
|
|||||||
<DateFieldPicker
|
<DateFieldPicker
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
validation={props.validation}
|
|
||||||
dateStart={props.dateStart}
|
|
||||||
dateEnd={props.dateEnd}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -137,11 +88,6 @@ export default function BuildField(props) {
|
|||||||
<MultiLinefield
|
<MultiLinefield
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
validation={props.validation}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -150,11 +96,6 @@ export default function BuildField(props) {
|
|||||||
<NumericField
|
<NumericField
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
validation={props.validation}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -163,52 +104,6 @@ export default function BuildField(props) {
|
|||||||
<DecimalField
|
<DecimalField
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
validation={props.validation}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "{16D63FD6-119B-4353-BDCA-18358721C3FE}":
|
|
||||||
return (
|
|
||||||
<div className="govuk-!-margin-bottom-9">
|
|
||||||
<FileUploadField
|
|
||||||
name={props.datafieldname}
|
|
||||||
label={props.label}
|
|
||||||
ticketnumber={
|
|
||||||
props.props.props.props.appealType.caseReference
|
|
||||||
.ticketnumber
|
|
||||||
}
|
|
||||||
documentTypeCode={props.documentTypeCode}
|
|
||||||
hint={props.hint}
|
|
||||||
fileList={
|
|
||||||
props.props.props.props.appealType.fileList
|
|
||||||
}
|
|
||||||
setFilesForAppeal={
|
|
||||||
props.props.props.setFilesForAppeal
|
|
||||||
}
|
|
||||||
containerID={
|
|
||||||
props.props.props.props.accountDetails
|
|
||||||
.containerID
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "{9EF39988-22BB-4f0b-BBBE-64B5A3748AEE}":
|
|
||||||
return (
|
|
||||||
<CheckBoxfield
|
|
||||||
name={props.datafieldname}
|
|
||||||
label={props.label}
|
|
||||||
props={props}
|
|
||||||
form={props.props.props.form}
|
|
||||||
formProps={props.props.props.props.form}
|
|
||||||
parentField={props.parentField}
|
|
||||||
parentFieldShowOnValue={props.parentFieldShowOnValue}
|
|
||||||
validation={props.validation}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,219 +0,0 @@
|
|||||||
import jsonpath from "jsonpath";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import xpath from "xpath";
|
|
||||||
import { setCurrentSection } from "../../store/appealType/action";
|
|
||||||
import { FieldsTranslations } from "../elements";
|
|
||||||
import { getProgressObj } from "../utils";
|
|
||||||
|
|
||||||
const BuildProgress = (props) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
|
|
||||||
const {
|
|
||||||
progObj,
|
|
||||||
titleList,
|
|
||||||
currentSection,
|
|
||||||
documentListObj,
|
|
||||||
formObjXML,
|
|
||||||
mandatoryFieldsData,
|
|
||||||
gotoSection,
|
|
||||||
setCurrentSection,
|
|
||||||
} = props;
|
|
||||||
const parser = new DOMParser();
|
|
||||||
|
|
||||||
// const progObj = getProgressObj(
|
|
||||||
// formObjXML,
|
|
||||||
// titleList,
|
|
||||||
// mandatoryFieldsData,
|
|
||||||
// props
|
|
||||||
// );
|
|
||||||
|
|
||||||
//console.log(progObj);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<nav
|
|
||||||
role="navigation"
|
|
||||||
aria-labelledby="progress-list"
|
|
||||||
className="at-nav"
|
|
||||||
>
|
|
||||||
<h2 className="govuk-heading-s govuk-!-font-weight-bold gov-font-dark-grey progress-heading">
|
|
||||||
{t("newappeal:new-appeal-progress-nav-label")}:{" "}
|
|
||||||
<span className="progress-case-reference">
|
|
||||||
{props.props.appealType.caseReference.ticketnumber}
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
{/* <hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" /> */}
|
|
||||||
|
|
||||||
<div
|
|
||||||
id="step-by-step-navigation"
|
|
||||||
data-module="gemstepnav"
|
|
||||||
className="app-step-nav app-step-nav--active"
|
|
||||||
data-id="e01e924b-9c7c-4c71-8241-66a575c2f61f"
|
|
||||||
data-show-text="show"
|
|
||||||
data-hide-text="hide"
|
|
||||||
data-show-all-text="Show all"
|
|
||||||
data-hide-all-text="Hide all"
|
|
||||||
>
|
|
||||||
<ol className="app-step-nav__steps">
|
|
||||||
{Object.keys(progObj).map((key, index) => (
|
|
||||||
<li
|
|
||||||
key={key}
|
|
||||||
className={
|
|
||||||
"app-step-nav__step js-step app-step-nav__step--active" +
|
|
||||||
(progObj[index].allFieldsComplete
|
|
||||||
? " sectionComplete"
|
|
||||||
: " sectionIncomplete")
|
|
||||||
}
|
|
||||||
aria-current="step"
|
|
||||||
data-show=""
|
|
||||||
id="check-youre-allowed-to-drive"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="app-step-nav__header js-toggle-panel "
|
|
||||||
data-position={index}
|
|
||||||
>
|
|
||||||
<h3 className="app-step-nav__title ">
|
|
||||||
<span className="app-step-nav__circle app-step-nav__circle--number">
|
|
||||||
<span className="app-step-nav__circle-inner">
|
|
||||||
<span className="app-step-nav__circle-background">
|
|
||||||
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
|
||||||
Step
|
|
||||||
</span>{" "}
|
|
||||||
{index + 1}
|
|
||||||
<span
|
|
||||||
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span className="js-step-title">
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
onClick={() => {
|
|
||||||
gotoSection(
|
|
||||||
parseInt(key) + 1
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
|
||||||
>
|
|
||||||
<span className="js-step-title-text govuk-!-font-size-16">
|
|
||||||
{FieldsTranslations(
|
|
||||||
progObj[index].title
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* <ol className="govuk-list" id="progress-list">
|
|
||||||
<ul className="govuk-list ">
|
|
||||||
<li className="at-nav__page">
|
|
||||||
<ol className="govuk-list">
|
|
||||||
{Object.keys(progObj).map((key, index) =>
|
|
||||||
parseInt(key) + 1 == currentSection ? (
|
|
||||||
<li key={key}>
|
|
||||||
<b>
|
|
||||||
{FieldsTranslations(
|
|
||||||
progObj[index].title
|
|
||||||
)}
|
|
||||||
</b>
|
|
||||||
</li>
|
|
||||||
) : (
|
|
||||||
<li key={key}>
|
|
||||||
{" "}
|
|
||||||
<span
|
|
||||||
title={
|
|
||||||
progObj[index].title +
|
|
||||||
` complete`
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
progObj[index]
|
|
||||||
.allFieldsComplete ==
|
|
||||||
true
|
|
||||||
? `sectionCompleteTick`
|
|
||||||
: `sectionIncomplete`
|
|
||||||
}
|
|
||||||
></span>
|
|
||||||
<a
|
|
||||||
className="govuk-link"
|
|
||||||
href="#"
|
|
||||||
onClick={() => {
|
|
||||||
gotoSection(
|
|
||||||
parseInt(key) + 1
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{FieldsTranslations(
|
|
||||||
progObj[index].title
|
|
||||||
)}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ol> */}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
{Object.keys(documentListObj).length > 0 && (
|
|
||||||
<div>
|
|
||||||
<h3 className="govuk-heading-s govuk-!-font-weight-bold gov-font-dark-grey">
|
|
||||||
{t("newappeal:new-appeal-documentlist-nav")}:
|
|
||||||
</h3>
|
|
||||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
|
||||||
<ol className="govuk-list document-list">
|
|
||||||
<ul className="govuk-list ">
|
|
||||||
<li className="at-nav__page">
|
|
||||||
<ol className="govuk-list govuk-list--bullet">
|
|
||||||
{Object.entries(documentListObj).map(
|
|
||||||
([key, value]) => {
|
|
||||||
return <li key={key}>{value}</li>;
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
|
||||||
return {
|
|
||||||
search: state.search,
|
|
||||||
searchResultsObj: state.searchResultsObj,
|
|
||||||
formData: state.formData,
|
|
||||||
appealType: state.appealType,
|
|
||||||
initialValues: state.appealType.caseReference.caseDetails,
|
|
||||||
//form: state.form,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {
|
|
||||||
gotoSection: (thisSection) => {
|
|
||||||
dispatch(setCurrentSection(thisSection));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(BuildProgress);
|
|
||||||
@@ -5,7 +5,6 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
import xpath from "xpath";
|
import xpath from "xpath";
|
||||||
import BuildField from "./buildfield";
|
import BuildField from "./buildfield";
|
||||||
import jsonpath from "jsonpath";
|
import jsonpath from "jsonpath";
|
||||||
import FileUpload from "./fileupload";
|
|
||||||
|
|
||||||
export default function BuildRow(props) {
|
export default function BuildRow(props) {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -35,70 +34,7 @@ export default function BuildRow(props) {
|
|||||||
} else {
|
} else {
|
||||||
var rows = xpath.select("//label/@description", doc);
|
var rows = xpath.select("//label/@description", doc);
|
||||||
var fieldtype = xpath.select("//@classid", doc);
|
var fieldtype = xpath.select("//@classid", doc);
|
||||||
var validation = xpath.select("//@validation", doc);
|
|
||||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||||
var datafieldcontent = xpath.select(
|
|
||||||
"//@datafieldcontent",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
var parentField = xpath.select("//@parentField", doc);
|
|
||||||
|
|
||||||
var parentFieldShowOnValue = xpath.select(
|
|
||||||
"//@parentFieldShowOnValue",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var requiredDocumentValue = xpath.select(
|
|
||||||
"//@requiredDocumentValue",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var requiredDocumentLabel = xpath.select(
|
|
||||||
"//@requiredDocumentLabel",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var documentTypeCode = xpath.select(
|
|
||||||
"//@ishareDocumentCode",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var hint = xpath.select("//label/@hint", doc);
|
|
||||||
var dateStart = xpath.select("//@dateStart", doc);
|
|
||||||
var dateEnd = xpath.select("//@dateEnd", doc);
|
|
||||||
|
|
||||||
hint = !_.isEmpty(hint) && hint[0].value;
|
|
||||||
|
|
||||||
validation = !_.isEmpty(validation)
|
|
||||||
? validation[0].value
|
|
||||||
: [];
|
|
||||||
|
|
||||||
parentField =
|
|
||||||
!_.isEmpty(parentField) && parentField[0].value;
|
|
||||||
|
|
||||||
parentFieldShowOnValue =
|
|
||||||
!_.isEmpty(parentFieldShowOnValue) &&
|
|
||||||
parentFieldShowOnValue[0].value;
|
|
||||||
|
|
||||||
datafieldcontent =
|
|
||||||
!_.isEmpty(datafieldcontent) &&
|
|
||||||
datafieldcontent[0].value;
|
|
||||||
|
|
||||||
requiredDocumentValue =
|
|
||||||
!_.isEmpty(requiredDocumentValue) &&
|
|
||||||
requiredDocumentValue[0].value;
|
|
||||||
|
|
||||||
requiredDocumentLabel =
|
|
||||||
!_.isEmpty(requiredDocumentLabel) &&
|
|
||||||
requiredDocumentLabel[0].value;
|
|
||||||
|
|
||||||
documentTypeCode =
|
|
||||||
!_.isEmpty(documentTypeCode) &&
|
|
||||||
documentTypeCode[0].value;
|
|
||||||
|
|
||||||
dateStart = !_.isEmpty(dateStart) && dateStart[0].value;
|
|
||||||
|
|
||||||
dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value;
|
|
||||||
|
|
||||||
const isRequiredField = jsonpath.query(
|
const isRequiredField = jsonpath.query(
|
||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
@@ -107,7 +43,7 @@ export default function BuildRow(props) {
|
|||||||
"')]"
|
"')]"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (datafieldname[0].value == "pinswg_fileUpload") {
|
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||||
return (
|
return (
|
||||||
<BuildField
|
<BuildField
|
||||||
fieldType={fieldtype[0].value}
|
fieldType={fieldtype[0].value}
|
||||||
@@ -119,55 +55,10 @@ export default function BuildRow(props) {
|
|||||||
props.props.props.formData.pickListData
|
props.props.props.formData.pickListData
|
||||||
}
|
}
|
||||||
mandatoryFieldsData={mandatoryFieldsData}
|
mandatoryFieldsData={mandatoryFieldsData}
|
||||||
documentTypeCode={documentTypeCode}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// console.log(
|
return null;
|
||||||
// datafieldname[0].value,
|
|
||||||
// isRequiredField[0].RequiredLevel.Value
|
|
||||||
// );
|
|
||||||
// if (typeof isRequiredField[0] != "undefined") {
|
|
||||||
// if (
|
|
||||||
// isRequiredField[0].RequiredLevel.Value != "None"
|
|
||||||
// ) {
|
|
||||||
//console.log(datafieldname[0].value, validation);
|
|
||||||
return (
|
|
||||||
<BuildField
|
|
||||||
fieldType={fieldtype[0].value}
|
|
||||||
label={rows[0].value}
|
|
||||||
datafieldname={datafieldname[0].value}
|
|
||||||
datafieldcontent={datafieldcontent}
|
|
||||||
parentField={parentField}
|
|
||||||
parentFieldShowOnValue={parentFieldShowOnValue}
|
|
||||||
key={key}
|
|
||||||
props={props}
|
|
||||||
picklistData={
|
|
||||||
props.props.props.formData.pickListData
|
|
||||||
}
|
|
||||||
mandatoryFieldsData={mandatoryFieldsData}
|
|
||||||
hint={hint}
|
|
||||||
requiredDocumentLabel={requiredDocumentLabel}
|
|
||||||
requiredDocumentValue={requiredDocumentValue}
|
|
||||||
validation={validation}
|
|
||||||
dateStart={dateStart}
|
|
||||||
dateEnd={dateEnd}
|
|
||||||
setDocumentsList={props.props.setDocumentsList}
|
|
||||||
documentList={
|
|
||||||
props.props.appealType.documentList
|
|
||||||
}
|
|
||||||
documentTypeCode={documentTypeCode}
|
|
||||||
setFilesForAppeal={
|
|
||||||
props.props.setFilesForAppeal
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
// } else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import _, { has, last } from "lodash";
|
import _, { has } from "lodash";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
@@ -10,22 +10,13 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
|||||||
import {
|
import {
|
||||||
setCaseReference,
|
setCaseReference,
|
||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
setDocumentsList,
|
|
||||||
setFilesForAppeal,
|
|
||||||
setNewAppealProgress,
|
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
import { getFormCollectionByID, getProgressObj } from "../utils";
|
import { query } from "jsonpath";
|
||||||
import { updateCase, patchCase, uploadFiles, sendEmail } from "../../actions";
|
|
||||||
|
|
||||||
import { FieldsTranslations } from "../elements";
|
|
||||||
import jsonpath from "jsonpath";
|
|
||||||
import BuildProgress from "./buildprogress";
|
|
||||||
|
|
||||||
let BuildSection = (props) => {
|
let BuildSection = (props) => {
|
||||||
const [currentSectionSelected, setCurrentSectionSelected] = useState(1);
|
// useEffect(() => {
|
||||||
const [pickupWhereLeftOff, setPickupWhereLeftOff] = useState(true);
|
// window.scrollTo(0, 0);
|
||||||
|
// });
|
||||||
const [savingStatus, setSavingStatus] = useState(false);
|
|
||||||
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
@@ -37,9 +28,6 @@ let BuildSection = (props) => {
|
|||||||
sectionCount,
|
sectionCount,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
load,
|
|
||||||
pristine,
|
|
||||||
reset,
|
|
||||||
formTitle,
|
formTitle,
|
||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
refno,
|
refno,
|
||||||
@@ -47,172 +35,29 @@ let BuildSection = (props) => {
|
|||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const documentListObj = props.appealType.documentList;
|
|
||||||
const currentSection = props.appealType.currentSection;
|
const currentSection = props.appealType.currentSection;
|
||||||
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||||
var titles = xpath.select(
|
// var titles = xpath.select(
|
||||||
"//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
// "//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
||||||
doc
|
// doc
|
||||||
);
|
// );
|
||||||
var rowXML = xpath.select(
|
var rowXML = xpath.select(
|
||||||
"/form/tabs/tab[" +
|
// "/form/tabs/tab[" +
|
||||||
currentSection +
|
// currentSection +
|
||||||
"]/columns//sections/section/rows/row",
|
// "]/columns//sections/section/rows/row",
|
||||||
//"/form/tabs/tab/columns//sections/section/rows/row",
|
"/form/tabs/tab/columns//sections/section/rows/row",
|
||||||
doc
|
doc
|
||||||
);
|
);
|
||||||
|
|
||||||
var formObjXML = xpath.select("/form/tabs", doc);
|
|
||||||
|
|
||||||
var titleList = xpath.select(
|
var titleList = xpath.select(
|
||||||
"//form/tabs/tab[*]/labels/label/@description",
|
"//form/tabs/tab[*]/labels/label/@description",
|
||||||
doc
|
doc
|
||||||
);
|
);
|
||||||
|
|
||||||
const progObj = getProgressObj(
|
|
||||||
formXML,
|
|
||||||
titleList,
|
|
||||||
mandatoryFieldsData,
|
|
||||||
props
|
|
||||||
);
|
|
||||||
|
|
||||||
const isProgressComplete = (progObj) => {
|
|
||||||
const progressCount = 0;
|
|
||||||
|
|
||||||
for (let key in progObj) {
|
|
||||||
progObj[key].allFieldsComplete === true && progressCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return progObj.length == progressCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
const lastIndex = progObj
|
|
||||||
.map((whichIsLast) => whichIsLast.allFieldsComplete == true)
|
|
||||||
.lastIndexOf(true);
|
|
||||||
|
|
||||||
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
||||||
|
|
||||||
const uploadAppealFiles = (values) => {
|
|
||||||
// get filelists from values object
|
|
||||||
let fileListObj = _.filter(values, function (v, key) {
|
|
||||||
return _.includes(key, "pinswg_fileUpload");
|
|
||||||
});
|
|
||||||
|
|
||||||
//console.log(fileListObj);
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
"\n////////////////////////\n upload files:",
|
|
||||||
props.props.accountDetails.containerID
|
|
||||||
);
|
|
||||||
|
|
||||||
var dataObj = values;
|
|
||||||
|
|
||||||
for (let key in dataObj) {
|
|
||||||
_.includes(key, "pinswg_fileUpload") == true && delete dataObj[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
uploadFiles(
|
|
||||||
dataObj,
|
|
||||||
fileListObj,
|
|
||||||
props.props.accountDetails.containerID,
|
|
||||||
props.props.appealType.caseReference.ticketnumber
|
|
||||||
).then((data) => {
|
|
||||||
//console.log("hello", data);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateCaseProgress = async (
|
|
||||||
values,
|
|
||||||
sendSavedEmail,
|
|
||||||
useSaveStatus
|
|
||||||
) => {
|
|
||||||
let incidentId = props.appealType.caseReference.incidentid;
|
|
||||||
let updateBody = values || {};
|
|
||||||
|
|
||||||
setSavingStatus(useSaveStatus);
|
|
||||||
uploadAppealFiles(values);
|
|
||||||
props.setNewAppealProgress(
|
|
||||||
getProgressObj(formXML, titleList, mandatoryFieldsData, props)
|
|
||||||
);
|
|
||||||
|
|
||||||
let appTypeCollection = getFormCollectionByID(
|
|
||||||
props.appealType.appealTypeID
|
|
||||||
);
|
|
||||||
let updateBindAppealTypeToIncident =
|
|
||||||
appTypeCollection.NavigationProperty;
|
|
||||||
|
|
||||||
Object.assign(updateBody, {
|
|
||||||
"pinswg_appealcasetype": props.appealType.appealTypeID,
|
|
||||||
"pinswg_Appellant@odata.bind":
|
|
||||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
|
||||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
|
||||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
|
||||||
"/incidents(" + incidentId + ")",
|
|
||||||
});
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
let updateFormCollection = appTypeCollection.LogicalCollectionName;
|
|
||||||
let primaryAttribute = appTypeCollection.PrimaryIdAttribute;
|
|
||||||
|
|
||||||
const reference = "PEDW-PARTIAL";
|
|
||||||
const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75";
|
|
||||||
const emailAddress = props.props.accountDetails.loggedinUserEmail;
|
|
||||||
const personalisation = {
|
|
||||||
"caseReference": props.appealType.caseReference.ticketnumber,
|
|
||||||
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
|
||||||
"returnLink":
|
|
||||||
props.props.url +
|
|
||||||
"/myportal/" +
|
|
||||||
appTypeCollection.UrlName +
|
|
||||||
"?lpa=" +
|
|
||||||
props.appealType.appealLPA +
|
|
||||||
"&apt=" +
|
|
||||||
appTypeCollection.appealTypeID +
|
|
||||||
"&casereference=" +
|
|
||||||
props.appealType.caseReference.ticketnumber +
|
|
||||||
"&inid=" +
|
|
||||||
props.appealType.caseReference.incidentid,
|
|
||||||
"linkExpiry": 10 * 60,
|
|
||||||
};
|
|
||||||
|
|
||||||
sendSavedEmail == true &&
|
|
||||||
sendEmail(templateId, emailAddress, personalisation, reference);
|
|
||||||
|
|
||||||
useSaveStatus &&
|
|
||||||
router.replace(
|
|
||||||
router.locale != "en"
|
|
||||||
? router.locale + "/myportal"
|
|
||||||
: "/myportal"
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
//if (currentSection == sectionCount) {
|
|
||||||
let valuesObj = values || {};
|
|
||||||
|
|
||||||
delete valuesObj["_pinswg_appellant_value"];
|
|
||||||
console.log("has errors:", props.invalid);
|
|
||||||
props.invalid == false && updateCaseProgress(valuesObj, false, false);
|
|
||||||
|
|
||||||
setCurrentSection(currentSection + 1);
|
setCurrentSection(currentSection + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,7 +65,7 @@ let BuildSection = (props) => {
|
|||||||
|
|
||||||
const getErrors = () => {
|
const getErrors = () => {
|
||||||
let errorsobj = props.props.form["appealForm"];
|
let errorsobj = props.props.form["appealForm"];
|
||||||
//setHasErrors(errorsobj.hasOwnProperty("syncErrors"));
|
setHasErrors(errorsobj.hasOwnProperty("syncErrors"));
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -286,7 +131,8 @@ let BuildSection = (props) => {
|
|||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-two-thirds">
|
<div className="govuk-grid-column-two-thirds">
|
||||||
<h1 className="govuk-heading-m govuk-!-margin-top-5">
|
<h1 className="govuk-heading-m govuk-!-margin-top-5">
|
||||||
{FieldsTranslations(titles[0].value)}
|
{/* {titles[0].value}{" "} */}
|
||||||
|
Enter your appeal information
|
||||||
</h1>
|
</h1>
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
{hasErrors == true ? (
|
{hasErrors == true ? (
|
||||||
@@ -306,45 +152,29 @@ let BuildSection = (props) => {
|
|||||||
mandatoryFieldsData={mandatoryFieldsData}
|
mandatoryFieldsData={mandatoryFieldsData}
|
||||||
props={props}
|
props={props}
|
||||||
/>
|
/>
|
||||||
|
{}
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
{props.sectionCount != currentSection ? (
|
{/* {props.sectionCount != currentSection ? (
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
data-module="govuk-button"
|
data-module="govuk-button"
|
||||||
onClick={() => {
|
onClick={() => getErrors()}
|
||||||
getErrors();
|
|
||||||
let valuesObj = _.has(
|
|
||||||
props.props.form[props.form],
|
|
||||||
"values"
|
|
||||||
)
|
|
||||||
? props.props.form[props.form].values
|
|
||||||
: {};
|
|
||||||
|
|
||||||
//console.log("valuesobj:", valuesObj);
|
|
||||||
|
|
||||||
delete valuesObj["_pinswg_appellant_value"];
|
|
||||||
|
|
||||||
//console.log("on save:", valuesObj);
|
|
||||||
updateCaseProgress(valuesObj, false, false);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{t("common:continue-button")}
|
Continue
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
{props.sectionCount == currentSection ? (
|
{props.sectionCount == currentSection ? ( */}
|
||||||
<button
|
<button
|
||||||
disabled={!isProgressComplete(progObj)}
|
type="submit"
|
||||||
type="submit"
|
className="govuk-button"
|
||||||
className="govuk-button"
|
data-module="govuk-button"
|
||||||
data-module="govuk-button"
|
>
|
||||||
>
|
Submit
|
||||||
{t("common:submit-button")}
|
</button>
|
||||||
</button>
|
{/* ) : (
|
||||||
) : (
|
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
{currentSection > 1 ? (
|
{currentSection > 1 ? (
|
||||||
@@ -355,66 +185,64 @@ let BuildSection = (props) => {
|
|||||||
setCurrentSection(currentSection - 1)
|
setCurrentSection(currentSection - 1)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{t("common:back-link")}
|
Back
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)} */}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-column-one-third">
|
{/* <div className="govuk-grid-column-one-third">
|
||||||
<div className="at-nav-container">
|
<nav
|
||||||
{/* <span>
|
role="navigation"
|
||||||
Last section is {lastIndex} - {currentSection}
|
aria-labelledby="progress-list"
|
||||||
</span> */}
|
className="at-nav"
|
||||||
<BuildProgress
|
>
|
||||||
progObj={progObj}
|
<h3 className="govuk-heading-s govuk-!-font-weight-bold gov-font-dark-grey">
|
||||||
props={props}
|
Progress:
|
||||||
titleList={titleList}
|
</h3>
|
||||||
documentListObj={documentListObj}
|
|
||||||
formObjXML={formXML}
|
|
||||||
mandatoryFieldsData={mandatoryFieldsData}
|
|
||||||
currentSection={currentSection}
|
|
||||||
initialValues={props.initialValues}
|
|
||||||
setCurrentSection={setCurrentSection}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
||||||
|
|
||||||
{savingStatus ? (
|
<ol className="govuk-list">
|
||||||
<span className=" progress-save-active">
|
<ul className="govuk-list ">
|
||||||
Saving data
|
<li className="at-nav__page">
|
||||||
<img
|
<ol className="govuk-list">
|
||||||
className="data-loading-icon"
|
{Object.keys(titleList).map((key) =>
|
||||||
src="/assets/images/loading.gif"
|
parseInt(key) + 1 == currentSection ? (
|
||||||
alt={
|
<li key={key}>
|
||||||
router.locale == "cy"
|
<b>{titleList[key].value} </b>
|
||||||
? "Nôl data"
|
</li>
|
||||||
: "Saving data"
|
) : (
|
||||||
}
|
<li key={key}>
|
||||||
/>
|
{props.appealType
|
||||||
</span>
|
.formComplete == "true" ||
|
||||||
) : (
|
parseInt(key) + 1 <
|
||||||
<button
|
currentSection ? (
|
||||||
className="govuk-button govuk-button--secondary progress-save "
|
<a
|
||||||
onClick={() => {
|
className="govuk-link"
|
||||||
let valuesObj =
|
href="#"
|
||||||
props.props.form[props.form].values || {};
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
console.log("valuesobj:", valuesObj);
|
parseInt(key) +
|
||||||
|
1
|
||||||
delete valuesObj["_pinswg_appellant_value"];
|
);
|
||||||
|
}}
|
||||||
console.log("on save:", valuesObj);
|
>
|
||||||
updateCaseProgress(valuesObj, true, true);
|
{titleList[key].value}
|
||||||
}}
|
</a>
|
||||||
>
|
) : (
|
||||||
{t("common:save-exit-button")}
|
titleList[key].value
|
||||||
</button>
|
)}
|
||||||
)}
|
</li>
|
||||||
</div>
|
)
|
||||||
</div>
|
)}
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -425,7 +253,6 @@ const mapStateToProps = (state) => {
|
|||||||
searchResultsObj: state.searchResultsObj,
|
searchResultsObj: state.searchResultsObj,
|
||||||
formData: state.formData,
|
formData: state.formData,
|
||||||
appealType: state.appealType,
|
appealType: state.appealType,
|
||||||
initialValues: state.appealType.caseReference.caseDetails,
|
|
||||||
//form: state.form,
|
//form: state.form,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -438,15 +265,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
gotoSection: (thisSection) => {
|
gotoSection: (thisSection) => {
|
||||||
dispatch(setCurrentSection(thisSection));
|
dispatch(setCurrentSection(thisSection));
|
||||||
},
|
},
|
||||||
setDocumentsList: (documentList) => {
|
|
||||||
dispatch(setDocumentsList(documentList));
|
|
||||||
},
|
|
||||||
setFilesForAppeal: (blobList) => {
|
|
||||||
dispatch(setFilesForAppeal(blobList));
|
|
||||||
},
|
|
||||||
setNewAppealProgress: (progressObj) => {
|
|
||||||
dispatch(setNewAppealProgress(progressObj));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -459,6 +277,5 @@ export default connect(
|
|||||||
reduxForm({
|
reduxForm({
|
||||||
form: "appealForm",
|
form: "appealForm",
|
||||||
destroyOnUnmount: false,
|
destroyOnUnmount: false,
|
||||||
enableReinitialize: true, // this is needed!!
|
|
||||||
})(BuildSection)
|
})(BuildSection)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
import jsonpath from "jsonpath";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useEffect } from "react";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { connect } from "react-redux";
|
import { useState, useEffect } from "react";
|
||||||
import { formValueSelector } from "redux-form";
|
|
||||||
import xpath from "xpath";
|
import xpath from "xpath";
|
||||||
import { updateCase, patchCase, sendEmail } from "../../actions";
|
import BuildRow from "./buildrow";
|
||||||
import data from "../../data/collections.json";
|
import { reduxForm, formValueSelector } from "redux-form";
|
||||||
|
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||||
import { setCurrentSection } from "../../store/appealType/action";
|
import { setCurrentSection } from "../../store/appealType/action";
|
||||||
|
import { updateCase } from "../../actions";
|
||||||
|
import jsonpath from "jsonpath";
|
||||||
import { getFormCollectionByID } from "../utils";
|
import { getFormCollectionByID } from "../utils";
|
||||||
|
|
||||||
|
import data from "../../data/collections.json";
|
||||||
|
|
||||||
let CompleteAppeal = (props) => {
|
let CompleteAppeal = (props) => {
|
||||||
|
// un comment to update incident with an appealtype id
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let incidentId = props.appealType.caseReference.incidentid;
|
let incidentId = props.appealType.caseReference.incidentid;
|
||||||
let updateBody = props.props.form.appealForm.values;
|
let updateBody = props.props.form.appealForm.values;
|
||||||
@@ -20,14 +23,12 @@ let CompleteAppeal = (props) => {
|
|||||||
props.appealType.appealTypeID
|
props.appealType.appealTypeID
|
||||||
);
|
);
|
||||||
let updateBindAppealTypeToIncident =
|
let updateBindAppealTypeToIncident =
|
||||||
appTypeCollection.NavigationProperty;
|
appTypeCollection.LogicalName + "Ids";
|
||||||
|
|
||||||
console.log(props.appealType.appealTypeID, appTypeCollection);
|
|
||||||
|
|
||||||
Object.assign(updateBody, {
|
Object.assign(updateBody, {
|
||||||
"pinswg_Appellant@odata.bind":
|
"pinswg_Appellant@odata.bind":
|
||||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
||||||
"pinswg_LocalPlanningAuthority@odata.bind":
|
"pinswg_AssociatedLPA@odata.bind":
|
||||||
"/accounts(" + props.appealType.appealLPA + ")",
|
"/accounts(" + props.appealType.appealLPA + ")",
|
||||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
||||||
@@ -35,6 +36,7 @@ let CompleteAppeal = (props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
updateBody = JSON.stringify(updateBody);
|
updateBody = JSON.stringify(updateBody);
|
||||||
|
|
||||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||||
updateBody = updateBody.replace(/:"No"/gm, `:false`);
|
updateBody = updateBody.replace(/:"No"/gm, `:false`);
|
||||||
updateBody = JSON.parse(updateBody);
|
updateBody = JSON.parse(updateBody);
|
||||||
@@ -49,28 +51,31 @@ let CompleteAppeal = (props) => {
|
|||||||
primaryAttribute,
|
primaryAttribute,
|
||||||
props.appealType.caseReference.ticketnumber
|
props.appealType.caseReference.ticketnumber
|
||||||
);
|
);
|
||||||
|
|
||||||
const reference = "PEDW-COMPLETE";
|
|
||||||
const templateId = "618e0463-b092-4733-a024-bf8a3bbde808";
|
|
||||||
const emailAddress = props.props.accountDetails.loggedinUserEmail;
|
|
||||||
const personalisation = {
|
|
||||||
"caseReference": props.appealType.caseReference.ticketnumber,
|
|
||||||
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
|
||||||
"linkExpiry": 10 * 60,
|
|
||||||
};
|
|
||||||
sendEmail(templateId, emailAddress, personalisation, reference);
|
|
||||||
|
|
||||||
console.log("patching////////");
|
|
||||||
patchCase(incidentId);
|
|
||||||
}, [
|
}, [
|
||||||
props.appealType.caseReference,
|
props.appealType.caseReference,
|
||||||
props.props.form.appealForm.values,
|
props.props.form.appealForm.values,
|
||||||
props.appealType.appealLPA,
|
props.appealType.appealLPA,
|
||||||
props.props.accountDetails.loggedinUserId,
|
props.props.accountDetails.loggedinUserId,
|
||||||
props.appealType.appealTypeID,
|
props.appealType.appealTypeID,
|
||||||
props.props.accountDetails.loggedinUserEmail,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const getFormCollection = (formtype) => {
|
||||||
|
const collectionName = jsonpath.query(
|
||||||
|
data,
|
||||||
|
"$..[?(@.LogicalName=='" + formtype + "')]"
|
||||||
|
);
|
||||||
|
//console.log(collectionName[0]);
|
||||||
|
return collectionName[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
const getPrimaryAttr = (formtype) => {
|
||||||
|
const attrName = jsonpath.query(
|
||||||
|
data,
|
||||||
|
"$..[?(@.LogicalName=='" + formtype + "')].PrimaryIdAttribute"
|
||||||
|
);
|
||||||
|
return attrName[0];
|
||||||
|
};
|
||||||
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -86,6 +91,23 @@ let CompleteAppeal = (props) => {
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const currentSection = props.appealType.currentSection;
|
const currentSection = props.appealType.currentSection;
|
||||||
|
const parser = new DOMParser();
|
||||||
|
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||||
|
var titles = xpath.select(
|
||||||
|
"//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
var rowXML = xpath.select(
|
||||||
|
"/form/tabs/tab[" +
|
||||||
|
currentSection +
|
||||||
|
"]/columns//sections/section/rows/row",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
|
||||||
|
var titleList = xpath.select(
|
||||||
|
"//form/tabs/tab[*]/labels/label/@description",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
|
||||||
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
import jsonpath from "jsonpath";
|
import Link from "next/link";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { connect } from "react-redux";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { Field, formValueSelector, reduxForm } from "redux-form";
|
import { useState, useEffect } from "react";
|
||||||
import { useState } from "react";
|
import xpath from "xpath";
|
||||||
|
import BuildRow from "./buildrow";
|
||||||
|
import { reduxForm, formValueSelector, Field } from "redux-form";
|
||||||
|
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||||
|
import jsonpath from "jsonpath";
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
import transLookup from "../../data/lookuptranslations.json";
|
||||||
import {
|
|
||||||
setAppealLPA,
|
|
||||||
setAppealTypeID,
|
|
||||||
setAppealTypeTitle,
|
|
||||||
} from "../../store/appealType/action";
|
|
||||||
import { getFormCollectionByID } from "../utils";
|
import { getFormCollectionByID } from "../utils";
|
||||||
import FileUpload from "./fileupload";
|
|
||||||
import Aboutyou from "./aboutyou";
|
import data from "../../data/collections.json";
|
||||||
import { createNewCase, createNewCaseBlob, consoleLogger } from "../../actions";
|
import {
|
||||||
import { FieldsTranslations } from "../elements";
|
setAppealType,
|
||||||
|
setAppealTypeTitle,
|
||||||
|
setAppealTypeID,
|
||||||
|
setAppealLPA,
|
||||||
|
getAppealTypeObj,
|
||||||
|
} from "../../store/appealType/action";
|
||||||
|
|
||||||
let CreateCase = (props) => {
|
let CreateCase = (props) => {
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
@@ -27,7 +29,7 @@ let CreateCase = (props) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const { LPAData, onSubmit, handleSubmit, formData } = props;
|
const { LPAData, onSubmit, handleSubmit } = props;
|
||||||
|
|
||||||
const appealOptionsObj = _.isEmpty(props)
|
const appealOptionsObj = _.isEmpty(props)
|
||||||
? [{}]
|
? [{}]
|
||||||
@@ -210,359 +212,58 @@ let CreateCase = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const RenderRadio = ({
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
id,
|
|
||||||
errorMsg,
|
|
||||||
options,
|
|
||||||
input: { onChange, value },
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
const required = (value) => (value ? undefined : "Required");
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<fieldset
|
|
||||||
className="govuk-fieldset"
|
|
||||||
aria-describedby={datafieldname + "-hint"}
|
|
||||||
>
|
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
|
|
||||||
<label
|
|
||||||
className="govuk-fieldset__heading govuk-body-m"
|
|
||||||
id={id + "_label"}
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{errorMsg}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
custom.inline == false
|
|
||||||
? "govuk-radios govuk-radios--small"
|
|
||||||
: "govuk-radios govuk-radios--inline govuk-radios--small"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
{custom.hint != undefined && (
|
|
||||||
<div className="govuk-hint">{custom.hint}</div>
|
|
||||||
)}
|
|
||||||
{Object.keys(options).map((key, index) => (
|
|
||||||
<div
|
|
||||||
className="govuk-radios__item"
|
|
||||||
data-children-count={key}
|
|
||||||
key={key}
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
id={id + "_" + index}
|
|
||||||
name={id}
|
|
||||||
component="input"
|
|
||||||
type="radio"
|
|
||||||
hint={custom.hint}
|
|
||||||
className="govuk-radios__input"
|
|
||||||
value={options[key].split("|")[0]}
|
|
||||||
validate={[required]}
|
|
||||||
// checked={
|
|
||||||
// value ==
|
|
||||||
// parseInt(options[key].split("|")[0])
|
|
||||||
// }
|
|
||||||
onChange={(e) => {
|
|
||||||
let docListObj =
|
|
||||||
custom.documentList;
|
|
||||||
if (
|
|
||||||
custom.requiredDocumentValue ==
|
|
||||||
"Yes"
|
|
||||||
) {
|
|
||||||
e.target.value != "846040000"
|
|
||||||
? (docListObj =
|
|
||||||
Object.assign(
|
|
||||||
docListObj,
|
|
||||||
{
|
|
||||||
["documentCheckList_" +
|
|
||||||
id]:
|
|
||||||
custom.requiredDocumentLabel,
|
|
||||||
}
|
|
||||||
))
|
|
||||||
: delete docListObj[
|
|
||||||
"documentCheckList_" +
|
|
||||||
id
|
|
||||||
];
|
|
||||||
custom.setDocumentsList(
|
|
||||||
docListObj
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="govuk-label govuk-radios__label"
|
|
||||||
htmlFor={id + "_" + index}
|
|
||||||
>
|
|
||||||
{t(options[key].split("|")[1])}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
function Radiofield(props) {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
datafieldname,
|
|
||||||
parentField,
|
|
||||||
form,
|
|
||||||
formProps,
|
|
||||||
parentFieldShowOnValue,
|
|
||||||
validation,
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const required = (value) => (value ? undefined : "Required");
|
|
||||||
// console.log(props.options);
|
|
||||||
|
|
||||||
const fieldOptions = props.options
|
|
||||||
.slice(1, props.options.length - 1)
|
|
||||||
.split(",");
|
|
||||||
|
|
||||||
//parentFieldShowOnValue
|
|
||||||
var showIfHasParentShowValue = parentField != false;
|
|
||||||
//debugger;
|
|
||||||
// parentField != false &&
|
|
||||||
// !_.isEmpty(formProps[form]) &&
|
|
||||||
// _.has(formProps[form].values, parentField) &&
|
|
||||||
// parentFieldShowOnValue.indexOf(
|
|
||||||
// formProps[form].values[parentField].toString()
|
|
||||||
// ) > -1;
|
|
||||||
|
|
||||||
(showIfHasParentShowValue == parentField) != false &&
|
|
||||||
showIfHasParentShowValue;
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// datafieldname,
|
|
||||||
// showIfHasParentShowValue,
|
|
||||||
// formProps[form].values[parentField]
|
|
||||||
// );
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{parentField != false ? (
|
|
||||||
showIfHasParentShowValue && (
|
|
||||||
<Field
|
|
||||||
name={name}
|
|
||||||
datafieldname={datafieldname}
|
|
||||||
label={label}
|
|
||||||
options={fieldOptions}
|
|
||||||
id={name}
|
|
||||||
validate={[required]}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
component={RenderRadio}
|
|
||||||
inline={props.inline}
|
|
||||||
hint={props.hint}
|
|
||||||
//validate={eval(validation)}
|
|
||||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
|
||||||
requiredDocumentValue={props.requiredDocumentValue}
|
|
||||||
setDocumentsList={props.setDocumentsList}
|
|
||||||
documentList={props.documentList}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
) : (
|
|
||||||
<Field
|
|
||||||
name={name}
|
|
||||||
datafieldname={datafieldname}
|
|
||||||
label={label}
|
|
||||||
options={fieldOptions}
|
|
||||||
id={name}
|
|
||||||
validate={[required]}
|
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
|
||||||
component={RenderRadio}
|
|
||||||
inline={props.inline}
|
|
||||||
hint={props.hint}
|
|
||||||
//validate={eval(validation)}
|
|
||||||
requiredDocumentLabel={props.requiredDocumentLabel}
|
|
||||||
requiredDocumentValue={props.requiredDocumentValue}
|
|
||||||
setDocumentsList={props.setDocumentsList}
|
|
||||||
documentList={props.documentList}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const required = (value) => (value ? undefined : "Required");
|
const required = (value) => (value ? undefined : "Required");
|
||||||
|
|
||||||
const [formStep, setFormStep] = useState(0);
|
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var appTypeCollection = values.appealTypes;
|
var appTypeCollection = values.appealTypes;
|
||||||
|
|
||||||
formStep == 0 && setFormStep(1);
|
appTypeCollection = getFormCollectionByID(appTypeCollection);
|
||||||
|
|
||||||
whichAppealType =
|
router.replace(
|
||||||
values.appealTypes == "846040004" && values.confirmHASCAS == "true"
|
(router.locale = "cy" ? "/apelnewydd" : "/newappeal") +
|
||||||
? "846040004"
|
"/" +
|
||||||
: values.appealTypes == "846040004" &&
|
appTypeCollection.UrlName +
|
||||||
values.confirmHASCAS == "false"
|
"?lpa=" +
|
||||||
? "846040000"
|
values.lpaTypes +
|
||||||
: values.appealTypes;
|
"&apt=" +
|
||||||
|
values.appealTypes.split(",")[0],
|
||||||
var whichAppealType = whichAppealType;
|
null,
|
||||||
|
{
|
||||||
appTypeCollection = getFormCollectionByID(whichAppealType);
|
shallow: true,
|
||||||
|
}
|
||||||
// console.log(
|
);
|
||||||
// "/newappeal" +
|
|
||||||
// "/" +
|
|
||||||
// appTypeCollection.UrlName +
|
|
||||||
// "?lpa=" +
|
|
||||||
// values.lpaTypes +
|
|
||||||
// "&apt=" +
|
|
||||||
// whichAppealType +
|
|
||||||
// "&id=" //+
|
|
||||||
// // data.incidentid
|
|
||||||
// );
|
|
||||||
|
|
||||||
delete values.confirmHASCAS;
|
|
||||||
|
|
||||||
// createNewCase(
|
|
||||||
// appTypeCollection.appealTypeID,
|
|
||||||
// values.lpaTypes,
|
|
||||||
// props.loggedInUser,
|
|
||||||
// values,
|
|
||||||
// props.containerID
|
|
||||||
// )
|
|
||||||
createNewCaseBlob(
|
|
||||||
appTypeCollection.appealTypeID,
|
|
||||||
values.lpaTypes,
|
|
||||||
props.loggedInUser,
|
|
||||||
values,
|
|
||||||
props.containerID,
|
|
||||||
props.LPAData.LPAData.value.filter((obj) => {
|
|
||||||
return obj.accountid === values.lpaTypes;
|
|
||||||
})[0].name
|
|
||||||
)
|
|
||||||
.then((data) => {
|
|
||||||
router.replace(
|
|
||||||
"/newappeal" +
|
|
||||||
"/" +
|
|
||||||
appTypeCollection.UrlName +
|
|
||||||
"?lpa=" +
|
|
||||||
values.lpaTypes +
|
|
||||||
"&apt=" +
|
|
||||||
whichAppealType +
|
|
||||||
"&id=" +
|
|
||||||
data.ticketnumber
|
|
||||||
);
|
|
||||||
return data;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(consoleLogger(err));
|
|
||||||
});
|
|
||||||
|
|
||||||
// router.replace(
|
|
||||||
// "/newappeal" +
|
|
||||||
// "/" +
|
|
||||||
// appTypeCollection.UrlName +
|
|
||||||
// "?lpa=" +
|
|
||||||
// values.lpaTypes +
|
|
||||||
// "&apt=" +
|
|
||||||
// values.appealTypes.split(",")[0],
|
|
||||||
// null,
|
|
||||||
// {
|
|
||||||
// shallow: true,
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
};
|
};
|
||||||
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
|
|
||||||
|
|
||||||
var parentField = "appealTypes",
|
|
||||||
formProps = props.whichForm,
|
|
||||||
form = "caseForm",
|
|
||||||
parentFieldShowOnValue = "846040004";
|
|
||||||
|
|
||||||
var showIfHasParentShowValue =
|
|
||||||
parentField != false &&
|
|
||||||
!_.isEmpty(formProps[form]) &&
|
|
||||||
_.has(formProps[form].values, parentField) &&
|
|
||||||
parentFieldShowOnValue.indexOf(
|
|
||||||
formProps[form].values[parentField].toString()
|
|
||||||
) > -1;
|
|
||||||
|
|
||||||
(showIfHasParentShowValue == parentField) != false &&
|
|
||||||
showIfHasParentShowValue;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
{formStep == 0 ? (
|
<Field
|
||||||
<Aboutyou setFormStep={setFormStep} />
|
name="lpaTypes"
|
||||||
) : (
|
component={RenderLPAList}
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
optionsObj={lpaOptionsObj}
|
||||||
<Field
|
validate={[required]}
|
||||||
name="lpaTypes"
|
label={t("newappeal:select-lpa-label")}
|
||||||
component={RenderLPAList}
|
errorMsg={t("newappeal:select-lpa-label-error-msg")}
|
||||||
optionsObj={lpaOptionsObj}
|
/>
|
||||||
validate={[required]}
|
|
||||||
label={t("newappeal:select-lpa-label")}
|
|
||||||
errorMsg={t("newappeal:select-lpa-label-error-msg")}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
name="appealTypes"
|
|
||||||
component={RenderAppealTypeList}
|
|
||||||
optionsObj={appealOptionsObj}
|
|
||||||
validate={[required]}
|
|
||||||
label={t("newappeal:select-appeal-type-label")}
|
|
||||||
errorMsg={t(
|
|
||||||
"newappeal:select-appeal-type-label-error-msg"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{showIfHasParentShowValue && (
|
<Field
|
||||||
<Radiofield
|
name="appealTypes"
|
||||||
name={"confirmHASCAS"}
|
component={RenderAppealTypeList}
|
||||||
datafieldname={"confirmHASCAS"}
|
optionsObj={appealOptionsObj}
|
||||||
label={t("newappeal:hascas-confirmation-label")}
|
validate={[required]}
|
||||||
hint={t("newappeal:hascas-confirmation-hint")}
|
label={t("newappeal:select-appeal-type-label")}
|
||||||
options="[true|newappeal:yes-option-label,false|newappeal:no-option-label]"
|
errorMsg={t("newappeal:select-appeal-type-label-error-msg")}
|
||||||
id={"confirmHASCAS"}
|
/>
|
||||||
className="govuk-radios__input"
|
|
||||||
validate={"[required]"}
|
<button
|
||||||
errorMsg={t("newappeal:select-an-option-label")}
|
type="submit"
|
||||||
/>
|
className="govuk-button"
|
||||||
)}
|
data-module="govuk-button"
|
||||||
<button
|
>
|
||||||
type="submit"
|
{t("common:continue-button")}
|
||||||
className="govuk-button"
|
</button>
|
||||||
data-module="govuk-button"
|
</form>
|
||||||
>
|
|
||||||
{t("common:continue-button")}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
|
||||||
|
export default function MakeEnforcementNotice() {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { locale } = router;
|
||||||
|
return (
|
||||||
|
<div className="card" id="casescomment-card">
|
||||||
|
<div className="card-body appealModule">
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
Including an enforcement listed building notice.
|
||||||
|
</p>
|
||||||
|
<div className="appealCTA">
|
||||||
|
<Link href="/newappeal/selectappeal">
|
||||||
|
<a className="govuk-button">A enforcement notice</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
// import { useDropzone } from "react-dropzone";
|
|
||||||
// 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";
|
|
||||||
|
|
||||||
// const FileUpload = () => {
|
|
||||||
// const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
|
||||||
// const files = acceptedFiles.map((file) => (
|
|
||||||
// <li key={file.path}>
|
|
||||||
// {file.path} - {file.size} bytes
|
|
||||||
// </li>
|
|
||||||
// ));
|
|
||||||
// return (
|
|
||||||
// <div className="govuk-grid-column-full">
|
|
||||||
// <div className="govuk-grid-row">
|
|
||||||
// <div className="govuk-form-group">
|
|
||||||
// <section className="container">
|
|
||||||
// <div
|
|
||||||
// {...getRootProps({
|
|
||||||
// className: "dropzone",
|
|
||||||
// })}
|
|
||||||
// >
|
|
||||||
// <input {...getInputProps()} />
|
|
||||||
// <p>
|
|
||||||
// Drag and drop files here or click to select
|
|
||||||
// files
|
|
||||||
// </p>
|
|
||||||
// </div>
|
|
||||||
// <aside>
|
|
||||||
// <h4>Files</h4>
|
|
||||||
// <ul>{files}</ul>
|
|
||||||
// </aside>
|
|
||||||
// </section>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
// export default FileUpload;
|
|
||||||
|
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
||||||
import { useDropzone } from "react-dropzone";
|
|
||||||
|
|
||||||
const baseStyle = {
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
padding: "20px",
|
|
||||||
borderWidth: 2,
|
|
||||||
borderRadius: 2,
|
|
||||||
borderColor: "#eeeeee",
|
|
||||||
borderStyle: "dashed",
|
|
||||||
backgroundColor: "#fafafa",
|
|
||||||
color: "#bdbdbd",
|
|
||||||
transition: "border .3s ease-in-out",
|
|
||||||
};
|
|
||||||
|
|
||||||
const activeStyle = {
|
|
||||||
borderColor: "#2196f3",
|
|
||||||
};
|
|
||||||
|
|
||||||
const acceptStyle = {
|
|
||||||
borderColor: "#00e676",
|
|
||||||
};
|
|
||||||
|
|
||||||
const rejectStyle = {
|
|
||||||
borderColor: "#ff1744",
|
|
||||||
};
|
|
||||||
|
|
||||||
function DropzoneComponent(props) {
|
|
||||||
const [files, setFiles] = useState([]);
|
|
||||||
|
|
||||||
const onDrop = useCallback((acceptedFiles) => {
|
|
||||||
setFiles(
|
|
||||||
acceptedFiles.map((file) =>
|
|
||||||
Object.assign(file, {
|
|
||||||
preview: URL.createObjectURL(file),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const {
|
|
||||||
getRootProps,
|
|
||||||
getInputProps,
|
|
||||||
isDragActive,
|
|
||||||
isDragAccept,
|
|
||||||
isDragReject,
|
|
||||||
} = useDropzone({
|
|
||||||
onDrop,
|
|
||||||
});
|
|
||||||
|
|
||||||
const style = useMemo(
|
|
||||||
() => ({
|
|
||||||
...baseStyle,
|
|
||||||
...(isDragActive ? activeStyle : {}),
|
|
||||||
...(isDragAccept ? acceptStyle : {}),
|
|
||||||
...(isDragReject ? rejectStyle : {}),
|
|
||||||
}),
|
|
||||||
[isDragActive, isDragReject, isDragAccept]
|
|
||||||
);
|
|
||||||
|
|
||||||
const thumbs = files.map((file) => (
|
|
||||||
<div key={file.name} className="govuk-!-margin-bottom-5 fileThumb">
|
|
||||||
<img src={file.preview} alt={file.name} width="50" /> -{" "}
|
|
||||||
<span className="govuk-body">
|
|
||||||
{file.name} ({file.size / 1024}kb)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
));
|
|
||||||
|
|
||||||
// clean up
|
|
||||||
useEffect(
|
|
||||||
() => () => {
|
|
||||||
files.forEach((file) => URL.revokeObjectURL(file.preview));
|
|
||||||
},
|
|
||||||
[files]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="govuk-grid-row ">
|
|
||||||
<div className="govuk-form-group"></div>
|
|
||||||
<section className="container">
|
|
||||||
<div {...getRootProps({ style, className: "dropzone" })}>
|
|
||||||
<input {...getInputProps()} />
|
|
||||||
<p>Drag and drop files here or click to select files</p>
|
|
||||||
</div>
|
|
||||||
</section>{" "}
|
|
||||||
<aside>{thumbs}</aside>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default DropzoneComponent;
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
|
||||||
|
export default function MakeLDC() {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { locale } = router;
|
||||||
|
return (
|
||||||
|
<div className="card" id="casescomment-card">
|
||||||
|
<div className="card-body appealModule">
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
An appeal relating to an application for a certificate of
|
||||||
|
lawful use or development.
|
||||||
|
</p>
|
||||||
|
<div className="appealCTA">
|
||||||
|
<Link href="/newappeal/selectappeal">
|
||||||
|
<a className="govuk-button">
|
||||||
|
A Lawful Development Certificate (LDC)
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
|
||||||
|
export default function MakeNewAppeal() {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { locale } = router;
|
||||||
|
return (
|
||||||
|
<div className="card" id="casescomment-card">
|
||||||
|
<div className="card-body appealModule">
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
This includes all householder applications, full planning
|
||||||
|
applications, outline planning applications, planning listed
|
||||||
|
building (LB) applications.
|
||||||
|
</p>
|
||||||
|
<div className="appealCTA">
|
||||||
|
<Link href="./newappeal/selectappeal">
|
||||||
|
<a className="govuk-button">A planning application</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
import Link from "next/link";
|
|
||||||
import Image from "next/image";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { useState } from "react";
|
|
||||||
import cookie from "cookie-cutter";
|
|
||||||
|
|
||||||
export default function NoticeBanner(props) {
|
|
||||||
let { t, lang } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const [bannerOpen, setBannerOpen] = useState(true);
|
|
||||||
|
|
||||||
const { noticeContent } = props;
|
|
||||||
const hideNotice = () => {
|
|
||||||
let now = new Date();
|
|
||||||
let expDate = new Date(now);
|
|
||||||
|
|
||||||
expDate.setDate(now.getDate() + 365);
|
|
||||||
cookie.set("pedwNotice", "true", {
|
|
||||||
expires: expDate,
|
|
||||||
path: "/",
|
|
||||||
});
|
|
||||||
|
|
||||||
setBannerOpen(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const bannerOpenCookie = typeof cookie.get("pedwNotice") == "undefined";
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{bannerOpenCookie ? (
|
|
||||||
<div className="govuk-warning-text noticebanner">
|
|
||||||
{/* <span
|
|
||||||
className="govuk-warning-text__icon"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src="/assets/images/information.svg"
|
|
||||||
width="30px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</span> */}
|
|
||||||
<strong className="govuk-warning-text__text">
|
|
||||||
<span className="govuk-warning-text__assistive">
|
|
||||||
Warning
|
|
||||||
</span>
|
|
||||||
{router.locale != "en"
|
|
||||||
? noticeContent.value[0].notice_cy
|
|
||||||
: noticeContent.value[0].notice_en}
|
|
||||||
</strong>
|
|
||||||
<div className="hideNotice">
|
|
||||||
<span
|
|
||||||
className="govuk-link"
|
|
||||||
onClick={() => {
|
|
||||||
hideNotice();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("common:hide-banner-label")}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
""
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ import { useContext } from "react";
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import Summary from "./case/representation";
|
import Summary from "./case/representation";
|
||||||
|
|
||||||
const CaseRepresentation = (props) => {
|
const CaseSummary = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -35,4 +35,4 @@ const CaseRepresentation = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CaseRepresentation;
|
export default CaseSummary;
|
||||||
|
|||||||
@@ -5,12 +5,11 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
import SearchForCase from "./search/searchforcase";
|
import SearchForCase from "./search/searchforcase";
|
||||||
import AdvancedSearch from "./search/advancedsearch";
|
import AdvancedSearch from "./search/advancedsearch";
|
||||||
|
|
||||||
export default function Search(props) {
|
export default function Search({ children, pages }) {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
console.log("props here:", props.myportal || false);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main
|
<main
|
||||||
@@ -18,7 +17,7 @@ export default function Search(props) {
|
|||||||
id="main-content"
|
id="main-content"
|
||||||
role="main"
|
role="main"
|
||||||
>
|
>
|
||||||
<AdvancedSearch myportal={props.myportal || false} />
|
<AdvancedSearch />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,158 +17,13 @@ export const minLength = (errorMsg) => (value) =>
|
|||||||
? errorMsg //`Must be ${min} characters or more`
|
? errorMsg //`Must be ${min} characters or more`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
export const leastOneValue = (errorMsg) => {};
|
|
||||||
|
|
||||||
const RenderTextfield = ({
|
|
||||||
id,
|
|
||||||
className,
|
|
||||||
rows,
|
|
||||||
datafieldname,
|
|
||||||
name,
|
|
||||||
label,
|
|
||||||
input,
|
|
||||||
hint1,
|
|
||||||
hint2,
|
|
||||||
hint3,
|
|
||||||
meta: { touched, error },
|
|
||||||
...custom
|
|
||||||
}) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<div id="basicSearch-hint" className="govuk-hint ">
|
|
||||||
<label className="govuk-label" htmlFor="caseRef">
|
|
||||||
{t("search:casereference-label")}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
{...input}
|
|
||||||
className={className}
|
|
||||||
name={name}
|
|
||||||
id={id}
|
|
||||||
/>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id={id + "-error"}
|
|
||||||
className="govuk-error-message govuk-form-group--error"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">
|
|
||||||
Error:
|
|
||||||
</span>{" "}
|
|
||||||
{error}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const RenderCaseStatusList = ({
|
|
||||||
name,
|
|
||||||
id,
|
|
||||||
input,
|
|
||||||
optionsObj,
|
|
||||||
meta: { touched, error },
|
|
||||||
label,
|
|
||||||
errormsg,
|
|
||||||
}) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
touched && error
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<label className="govuk-label" htmlFor={id}>
|
|
||||||
{label}
|
|
||||||
{name}
|
|
||||||
</label>
|
|
||||||
{touched && error && (
|
|
||||||
<span
|
|
||||||
id="passport-issued-error"
|
|
||||||
className="govuk-error-message"
|
|
||||||
>
|
|
||||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
|
||||||
{errormsg}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<div>
|
|
||||||
<select
|
|
||||||
{...input}
|
|
||||||
className="govuk-select"
|
|
||||||
id={id}
|
|
||||||
name={name}
|
|
||||||
//onChange={(e) => props.onChangeSelectAppealType(e)}
|
|
||||||
>
|
|
||||||
<option value="" disabled defaultValue>
|
|
||||||
{t("common:drop-down-select")}
|
|
||||||
</option>
|
|
||||||
{_.isEmpty(optionsObj)
|
|
||||||
? ""
|
|
||||||
: Object.keys(optionsObj).map((key, index) => {
|
|
||||||
return (
|
|
||||||
<option
|
|
||||||
key={key}
|
|
||||||
value={
|
|
||||||
_.isEmpty(optionsObj[key])
|
|
||||||
? ""
|
|
||||||
: optionsObj[key].statuscode
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{_.isEmpty(optionsObj[key])
|
|
||||||
? ""
|
|
||||||
: _.isEmpty(optionsObj[key])
|
|
||||||
? ""
|
|
||||||
: _.isEmpty(optionsObj[key].value)
|
|
||||||
? ""
|
|
||||||
: router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
optionsObj,
|
|
||||||
'$..[?(@.statuscode=="' +
|
|
||||||
optionsObj[key]
|
|
||||||
.statuscode +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: optionsObj[key].value ||
|
|
||||||
t(
|
|
||||||
"case:summary-no-date-entered-label"
|
|
||||||
)}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
let AdvancedSearch = (props) => {
|
let AdvancedSearch = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const {
|
const { LPAData, onSubmit, handleSubmit } = props;
|
||||||
LPAData,
|
|
||||||
onSubmit,
|
|
||||||
handleSubmit,
|
|
||||||
myportal,
|
|
||||||
error,
|
|
||||||
pristine,
|
|
||||||
reset,
|
|
||||||
submitting,
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const appealOptionsObj = _.isEmpty(props)
|
const appealOptionsObj = _.isEmpty(props)
|
||||||
? [{}]
|
? [{}]
|
||||||
@@ -190,6 +45,53 @@ let AdvancedSearch = (props) => {
|
|||||||
? [{}]
|
? [{}]
|
||||||
: props.LPAData.LPAData.value;
|
: props.LPAData.LPAData.value;
|
||||||
|
|
||||||
|
const RenderTextfield = ({
|
||||||
|
id,
|
||||||
|
className,
|
||||||
|
rows,
|
||||||
|
datafieldname,
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
input,
|
||||||
|
hint1,
|
||||||
|
hint2,
|
||||||
|
hint3,
|
||||||
|
meta: { touched, error },
|
||||||
|
...custom
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="govuk-form-group">
|
||||||
|
<div id="basicSearch-hint" className="govuk-hint ">
|
||||||
|
<label className="govuk-label" htmlFor="caseRef">
|
||||||
|
{t("search:casereference-label")}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
{...input}
|
||||||
|
className={className}
|
||||||
|
name={name}
|
||||||
|
id={id}
|
||||||
|
/>
|
||||||
|
{touched && error && (
|
||||||
|
<span
|
||||||
|
id={id + "-error"}
|
||||||
|
className="govuk-error-message govuk-form-group--error"
|
||||||
|
>
|
||||||
|
<span className="govuk-visually-hidden">
|
||||||
|
Error:
|
||||||
|
</span>{" "}
|
||||||
|
{error}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const RenderLPAList = ({
|
const RenderLPAList = ({
|
||||||
name,
|
name,
|
||||||
id,
|
id,
|
||||||
@@ -384,33 +286,31 @@ let AdvancedSearch = (props) => {
|
|||||||
var searchString = "";
|
var searchString = "";
|
||||||
|
|
||||||
searchString +=
|
searchString +=
|
||||||
values.caseRef != null ? "q=" + values.caseRef.trim() + "&" : "";
|
values.caseRef != null ? "?q=" + values.caseRef.trim() : "";
|
||||||
|
|
||||||
searchString +=
|
searchString +=
|
||||||
values.lpaTypes != null ? "lpa=" + values.lpaTypes + "&" : "";
|
values.lpaTypes != null
|
||||||
|
? (typeof values.caseRef == "undefined" ? "?" : "&") +
|
||||||
|
"lpa=" +
|
||||||
|
values.lpaTypes
|
||||||
|
: "";
|
||||||
|
|
||||||
searchString +=
|
searchString +=
|
||||||
values.appealTypes != null
|
values.appealTypes != null
|
||||||
? "apt=" + values.appealTypes.split(",")[0] + "&"
|
? (typeof values.caseRef == "undefined" &&
|
||||||
|
typeof values.lpaTypes == "undefined"
|
||||||
|
? "?"
|
||||||
|
: "&") +
|
||||||
|
("apt=" + values.appealTypes.split(",")[0])
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
searchString +=
|
|
||||||
values.statusCode != null
|
|
||||||
? "statuscode=" + values.statusCode + "&"
|
|
||||||
: "";
|
|
||||||
|
|
||||||
searchString = "?" + searchString.slice(0, -1);
|
|
||||||
|
|
||||||
console.log(searchString);
|
|
||||||
|
|
||||||
router.replace(
|
router.replace(
|
||||||
router.locale == "cy"
|
(router.locale == "cy"
|
||||||
? (myportal == true ? "/fymhorth" : "") +
|
? "/fymhorth/canlyniadauchwiliouwch"
|
||||||
"/canlyniadauchwiliouwch" +
|
: "/myportal/advancedsearchresults") + searchString,
|
||||||
searchString
|
null,
|
||||||
: (myportal == true ? "/myportal" : "") +
|
{
|
||||||
"/advancedsearchresults" +
|
shallow: true,
|
||||||
searchString
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -472,49 +372,6 @@ let AdvancedSearch = (props) => {
|
|||||||
label={t("search:lpa-label")}
|
label={t("search:lpa-label")}
|
||||||
errormsg="Local authority is required"
|
errormsg="Local authority is required"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field
|
|
||||||
name="statusCode"
|
|
||||||
id="statusCode"
|
|
||||||
component={RenderCaseStatusList}
|
|
||||||
optionsObj={[
|
|
||||||
{
|
|
||||||
"value": "In Progress",
|
|
||||||
"value_cy": "Ar y gweill",
|
|
||||||
"statuscode": 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "On Hold",
|
|
||||||
"value_cy": "Ar Dal",
|
|
||||||
"statuscode": 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value":
|
|
||||||
"Waiting for details",
|
|
||||||
"value_cy":
|
|
||||||
"Aros am fanylion",
|
|
||||||
"statuscode": 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "Researching",
|
|
||||||
"value_cy": "Ymchwilio",
|
|
||||||
"statuscode": 4,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "Case Closed",
|
|
||||||
"value_cy": "Achos ar Gau",
|
|
||||||
"statuscode": 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "Canceled",
|
|
||||||
"value_cy": "Wedi'i ganslo",
|
|
||||||
"statuscode": 6,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
//validate={[required]}
|
|
||||||
label={"Case Status"}
|
|
||||||
errormsg="Local authority is required"
|
|
||||||
/>
|
|
||||||
{/* <fieldset className="govuk-fieldset">
|
{/* <fieldset className="govuk-fieldset">
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
|
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
|
||||||
<h3 className="govuk-heading-m">
|
<h3 className="govuk-heading-m">
|
||||||
@@ -604,7 +461,6 @@ let AdvancedSearch = (props) => {
|
|||||||
type="submit"
|
type="submit"
|
||||||
name="search"
|
name="search"
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
disabled={pristine}
|
|
||||||
>
|
>
|
||||||
{t("common:search-button")}
|
{t("common:search-button")}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import { setCurrentReference } from "../../store/currentView/action";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import jsonpath from "jsonpath";
|
import jsonpath from "jsonpath";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
import transLookup from "../../data/lookuptranslations.json";
|
||||||
import PaginationControl from "./pagination";
|
import PaginationControl from "./pagination";
|
||||||
import { useState, useEffect, useCallback } from "react";
|
import { useState } from "react";
|
||||||
import LoadingOverlay from "react-loading-overlay";
|
import LoadingOverlay from "react-loading-overlay";
|
||||||
import {
|
import {
|
||||||
getBasicDNSSearchPaged,
|
getBasicDNSSearchPaged,
|
||||||
@@ -18,25 +19,7 @@ import {
|
|||||||
setSearchResults,
|
setSearchResults,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
} from "../../store/searchOutput/action";
|
} from "../../store/searchOutput/action";
|
||||||
import { getSearchDetailsPaged, getFormCollectionByID } from "../utils";
|
import { getSearchDetailsPaged } from "../utils";
|
||||||
import {
|
|
||||||
currentViewActionTypes,
|
|
||||||
setCurrentReference,
|
|
||||||
setCurrentPage,
|
|
||||||
} from "../../store/currentView/action";
|
|
||||||
import GoogleMapReact from "google-map-react";
|
|
||||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
|
||||||
import {
|
|
||||||
setWatchedCases,
|
|
||||||
setWatchedCasesDetails,
|
|
||||||
} from "../../store/watchedCases/action";
|
|
||||||
import {
|
|
||||||
createWatchedCases,
|
|
||||||
getWatchedCasesProxy,
|
|
||||||
getPortalModuleDetailsProxy,
|
|
||||||
deleteWatchedCases,
|
|
||||||
} from "../../actions";
|
|
||||||
import OSPoint from "ospoint";
|
|
||||||
|
|
||||||
const DNSSearchResults = (props) => {
|
const DNSSearchResults = (props) => {
|
||||||
const {
|
const {
|
||||||
@@ -47,13 +30,6 @@ const DNSSearchResults = (props) => {
|
|||||||
setSearchResults,
|
setSearchResults,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
advancedSearch,
|
advancedSearch,
|
||||||
setCurrentPage,
|
|
||||||
dnsCoords,
|
|
||||||
myportal,
|
|
||||||
watchedCases,
|
|
||||||
setWatchedCases,
|
|
||||||
setWatchedCasesDetails,
|
|
||||||
showMap,
|
|
||||||
} = props;
|
} = props;
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
@@ -62,172 +38,13 @@ const DNSSearchResults = (props) => {
|
|||||||
|
|
||||||
var resultsArr = searchResultsObj.value || [];
|
var resultsArr = searchResultsObj.value || [];
|
||||||
|
|
||||||
const [searchLoaded, setSearchLoaded] = useState(false);
|
//const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
|
||||||
|
|
||||||
let dataArray = [];
|
// let spinnerState = () => {
|
||||||
//push your Json Data in the array
|
// showSpinnerState == true
|
||||||
if (showMap == "true") {
|
// ? setShowSpinnerState(false)
|
||||||
dnsCoords.map((item) => {
|
// : setShowSpinnerState(true);
|
||||||
let point = new OSPoint(
|
// };
|
||||||
item.pinswg_anticipatedgridreferencenorthingtext || 0,
|
|
||||||
item.pinswg_anticipatedgridreferenceeastingtext || 0
|
|
||||||
);
|
|
||||||
let siteCoords = point.toOSGB36();
|
|
||||||
//console.log(siteCoords);
|
|
||||||
//console.log(item);
|
|
||||||
dataArray.push({
|
|
||||||
appellant:
|
|
||||||
item[
|
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
],
|
|
||||||
name: item.pinswg_projectname,
|
|
||||||
lat: parseFloat(siteCoords.latitude),
|
|
||||||
lng: parseFloat(siteCoords.longitude),
|
|
||||||
title: item.pinswg_name,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//console.log(dataArray);
|
|
||||||
|
|
||||||
const ModelsMap = (map, maps) => {
|
|
||||||
//instantiate array that will hold your Json Data
|
|
||||||
//console.log("here");
|
|
||||||
var prev_infowindow = false;
|
|
||||||
//Loop through the dataArray to create a marker per data using the coordinates in the json
|
|
||||||
console.log(dataArray.length);
|
|
||||||
for (let i = 0; i < dataArray.length; i++) {
|
|
||||||
const infowindow = new google.maps.InfoWindow({
|
|
||||||
content:
|
|
||||||
"<div>" +
|
|
||||||
(_.isEmpty(dataArray[i].name)
|
|
||||||
? ""
|
|
||||||
: dataArray[i].name.indexOf(";") > 0
|
|
||||||
? router.locale == "cy"
|
|
||||||
? dataArray[i].name.split(";")[1]
|
|
||||||
: dataArray[i].name.split(";")[0]
|
|
||||||
: dataArray[i].name) +
|
|
||||||
"</div>" +
|
|
||||||
(dataArray[i].appellant != null
|
|
||||||
? "<div>" + dataArray[i].appellant + "</div>"
|
|
||||||
: "") +
|
|
||||||
"<div>" +
|
|
||||||
dataArray[i].title +
|
|
||||||
"</div>",
|
|
||||||
});
|
|
||||||
let marker = new maps.Marker({
|
|
||||||
position: { lat: dataArray[i].lat, lng: dataArray[i].lng },
|
|
||||||
title: _.isEmpty(dataArray[i].name)
|
|
||||||
? ""
|
|
||||||
: dataArray[i].name.indexOf(";") > 0
|
|
||||||
? router.locale == "cy"
|
|
||||||
? dataArray[i].name.split(";")[1]
|
|
||||||
: dataArray[i].name.split(";")[0]
|
|
||||||
: dataArray[i].name,
|
|
||||||
map,
|
|
||||||
});
|
|
||||||
marker.addListener("click", () => {
|
|
||||||
if (prev_infowindow) {
|
|
||||||
prev_infowindow.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
prev_infowindow = infowindow;
|
|
||||||
infowindow.open({
|
|
||||||
anchor: marker,
|
|
||||||
map,
|
|
||||||
shouldFocus: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let spinnerState = () => {
|
|
||||||
showSpinnerState == true
|
|
||||||
? setShowSpinnerState(false)
|
|
||||||
: setShowSpinnerState(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const [orderByState, setOrderbyState] = useState("createdon");
|
|
||||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
|
||||||
const [selectedOption, setSelectedOption] = useState(10);
|
|
||||||
|
|
||||||
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(cookies.pinsUser).then((data) => {
|
|
||||||
setWatchedCases(data),
|
|
||||||
getDetails(data, "myWatchedCases").then((data) => {
|
|
||||||
setWatchedCasesDetails(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
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 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 ResultsView = (resultsArr) => {
|
const ResultsView = (resultsArr) => {
|
||||||
return (
|
return (
|
||||||
@@ -236,353 +53,180 @@ const DNSSearchResults = (props) => {
|
|||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||||
<div className="govuk-summary-list__row results-headings">
|
<div className="govuk-summary-list__row results-headings">
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 results_wider ">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16 results_wider ">
|
||||||
<button
|
{t("search:searchresults-case-reference-label")}
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("title")}
|
|
||||||
className={
|
|
||||||
orderByState == "title"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t(
|
|
||||||
"search:searchresults-case-reference-label"
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("search:searchresults-site-address-label")}
|
{t("search:searchresults-site-address-label")}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
<button
|
{t("search:searchresults-applicant-label")}
|
||||||
type="button"
|
|
||||||
onClick={() =>
|
|
||||||
sortDataBy("_customerid_value")
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
orderByState == "_customerid_value"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-applicant-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
<button
|
{t("search:searchresults-authority-label")}
|
||||||
type="button"
|
|
||||||
onClick={() =>
|
|
||||||
sortDataBy(
|
|
||||||
"_pinswg_associatedlpa_value"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
orderByState ==
|
|
||||||
"_pinswg_associatedlpa_value"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-authority-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
<button
|
{t("search:searchresults-status-label")}
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("statuscode")}
|
|
||||||
className={
|
|
||||||
orderByState == "statuscode"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-status-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
{myportal == true && (
|
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showSpinnerState == true ? (
|
{resultsArr.map((item, key) => {
|
||||||
<div className="govuk-summary-list__row">
|
let detailsObj = jsonpath.query(
|
||||||
<div className="govuk-!-margin-top-9 govuk-!-margin-bottom-9 govuk-!-font-weight-bold govuk-!-font-size-20 ">
|
searchDetailsObj,
|
||||||
{t("common:spinner-fetching-data")}
|
"$..value[?(@.pinswg_name=='" +
|
||||||
<img
|
item.title +
|
||||||
className="data-loading-icon"
|
"')]"
|
||||||
src="/assets/images/loading.gif"
|
);
|
||||||
alt={
|
detailsObj = detailsObj[0];
|
||||||
router.locale == "cy"
|
|
||||||
? "Nôl data"
|
|
||||||
: "Fetching data"
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
resultsArr.map((item, key) => {
|
|
||||||
let detailsObj = jsonpath.query(
|
|
||||||
searchDetailsObj,
|
|
||||||
'$..value[?(@.pinswg_name=="' +
|
|
||||||
item.title +
|
|
||||||
'")]'
|
|
||||||
);
|
|
||||||
detailsObj = detailsObj[0];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="govuk-summary-list__row"
|
className="govuk-summary-list__row"
|
||||||
key={key}
|
key={key}
|
||||||
>
|
>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
router.locale == "cy"
|
router.locale == "cy"
|
||||||
? (myportal == true
|
? "/manyliondns"
|
||||||
? "/fymhorth"
|
: "/dnsdetails"
|
||||||
: "") +
|
}
|
||||||
"/manyliondns"
|
>
|
||||||
: (myportal == true
|
<a
|
||||||
? "/myportal"
|
className="govuk-link--no-underline"
|
||||||
: "") +
|
onClick={() => {
|
||||||
"/dnsdetails"
|
setCurrentReference({
|
||||||
}
|
"currentReference":
|
||||||
|
item.title,
|
||||||
|
"currentType":
|
||||||
|
"searchResultsObj",
|
||||||
|
"incidentid":
|
||||||
|
item.incidentid,
|
||||||
|
"appealType":
|
||||||
|
item.pinswg_appealcasetype,
|
||||||
|
});
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<a
|
<span className="results-visually-hidden">
|
||||||
className="govuk-link--no-underline"
|
{t(
|
||||||
onClick={() => {
|
"search:searchresults-case-reference-label"
|
||||||
setCurrentReference({
|
)}
|
||||||
"currentReference":
|
:
|
||||||
item.title,
|
</span>
|
||||||
"currentType":
|
{item.title}
|
||||||
"searchResultsObj",
|
</a>
|
||||||
"incidentid":
|
</Link>
|
||||||
item.incidentid,
|
</dd>
|
||||||
"appealType":
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
item.pinswg_appealcasetype,
|
<span className="results-visually-hidden">
|
||||||
"showMap": showMap,
|
{t(
|
||||||
});
|
"search:searchresults-site-address-label"
|
||||||
}}
|
)}
|
||||||
>
|
:
|
||||||
<span className="results-visually-hidden">
|
</span>
|
||||||
{t(
|
{_.has(
|
||||||
"search:searchresults-case-reference-label"
|
detailsObj,
|
||||||
)}
|
"pinswg_siteaddressline1"
|
||||||
:
|
)
|
||||||
</span>
|
? detailsObj.pinswg_siteaddressline1
|
||||||
{item.title}
|
: ""}
|
||||||
</a>
|
<br />
|
||||||
</Link>
|
{_.has(
|
||||||
</dd>
|
detailsObj,
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
"pinswg_siteaddressline1"
|
||||||
<span className="results-visually-hidden">
|
)
|
||||||
{t(
|
? detailsObj.pinswg_siteaddressline2
|
||||||
"search:searchresults-site-address-label"
|
: ""}
|
||||||
)}
|
<br />
|
||||||
:
|
{_.has(
|
||||||
</span>
|
detailsObj,
|
||||||
{_.has(
|
"pinswg_siteaddressline1"
|
||||||
detailsObj,
|
)
|
||||||
"pinswg_projectlocation"
|
? detailsObj.pinswg_siteaddresstown
|
||||||
)
|
: ""}
|
||||||
? detailsObj.pinswg_projectlocation !=
|
<br />
|
||||||
null
|
{_.has(
|
||||||
? detailsObj.pinswg_projectlocation.indexOf(
|
detailsObj,
|
||||||
";"
|
"pinswg_siteaddressline1"
|
||||||
) < 0
|
)
|
||||||
? detailsObj.pinswg_projectlocation
|
? detailsObj.pinswg_siteaddresscounty
|
||||||
: router.locale == "cy"
|
: ""}
|
||||||
? detailsObj.pinswg_projectlocation.split(
|
<br />
|
||||||
";"
|
{_.has(
|
||||||
)[1]
|
detailsObj,
|
||||||
: detailsObj.pinswg_projectlocation.split(
|
"pinswg_siteaddressline1"
|
||||||
";"
|
)
|
||||||
)[0]
|
? detailsObj.pinswg_siteaddresspostcode
|
||||||
: ""
|
: ""}
|
||||||
: ""}
|
</dd>
|
||||||
{_.has(
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
detailsObj,
|
<span className="results-visually-hidden">
|
||||||
"pinswg_siteaddressline1"
|
{t(
|
||||||
)
|
"search:searchresults-applicant-label"
|
||||||
? detailsObj.pinswg_siteaddressline1
|
)}
|
||||||
: ""}
|
:
|
||||||
{_.has(
|
</span>
|
||||||
detailsObj,
|
{_.has(detailsObj, [
|
||||||
"pinswg_siteaddressline1"
|
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||||
) &&
|
])
|
||||||
detailsObj.pinswg_siteaddressline1 !=
|
? detailsObj[
|
||||||
null && <br />}
|
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||||
{_.has(
|
]
|
||||||
detailsObj,
|
: ""}
|
||||||
"pinswg_siteaddressline2"
|
</dd>
|
||||||
)
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
? detailsObj.pinswg_siteaddressline2
|
<span className="results-visually-hidden">
|
||||||
: ""}
|
{t(
|
||||||
{_.has(
|
"search:searchresults-authority-label"
|
||||||
detailsObj,
|
)}
|
||||||
"pinswg_siteaddressline2"
|
:
|
||||||
) &&
|
</span>
|
||||||
detailsObj.pinswg_siteaddressline2 !=
|
{_.has(detailsObj, [
|
||||||
null && <br />}
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||||
{_.has(
|
])
|
||||||
detailsObj,
|
? router.locale == "cy"
|
||||||
"pinswg_siteaddressline1"
|
|
||||||
)
|
|
||||||
? detailsObj.pinswg_siteaddresstown
|
|
||||||
: ""}
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_siteaddresstown"
|
|
||||||
) &&
|
|
||||||
detailsObj.pinswg_siteaddresstown !=
|
|
||||||
null && <br />}
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_siteaddressline1"
|
|
||||||
)
|
|
||||||
? detailsObj.pinswg_siteaddresscounty
|
|
||||||
: ""}
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_siteaddresscounty"
|
|
||||||
) &&
|
|
||||||
detailsObj.pinswg_siteaddresscounty !=
|
|
||||||
null && <br />}
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_siteaddressline1"
|
|
||||||
)
|
|
||||||
? detailsObj.pinswg_siteaddresspostcode
|
|
||||||
: ""}
|
|
||||||
</dd>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t(
|
|
||||||
"search:searchresults-applicant-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
{_.has(detailsObj, [
|
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
|
||||||
])
|
|
||||||
? detailsObj[
|
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
]
|
|
||||||
: ""}
|
|
||||||
</dd>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t(
|
|
||||||
"search:searchresults-authority-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
{_.has(detailsObj, [
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
|
||||||
])
|
|
||||||
? router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
detailsObj[
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: detailsObj[
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || "N/A"
|
|
||||||
: ""}
|
|
||||||
</dd>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t(
|
|
||||||
"search:searchresults-status-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.value=="' +
|
'$..[?(@.value=="' +
|
||||||
item[
|
detailsObj[
|
||||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||||
] +
|
] +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: item[
|
: detailsObj[
|
||||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||||
] || "N/A"}
|
] || "N/A"
|
||||||
</dd>
|
: ""}
|
||||||
{myportal == true && (
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-summary-list__action">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
{isWatchedCase(item.incidentid)
|
<span className="results-visually-hidden">
|
||||||
.length >
|
{t(
|
||||||
0 ==
|
"search:searchresults-status-label"
|
||||||
true ? (
|
)}
|
||||||
<span
|
:
|
||||||
className="govuk-summary-list__actionLink watched_link"
|
</span>
|
||||||
onClick={() => {
|
|
||||||
deleteItem(
|
|
||||||
isWatchedCase(
|
|
||||||
item.incidentid
|
|
||||||
)[0]
|
|
||||||
.pinswg_watchlistid,
|
|
||||||
|
|
||||||
"watchedCases"
|
{router.locale == "cy"
|
||||||
);
|
? jsonpath.query(
|
||||||
alert(
|
transLookup,
|
||||||
"You have stopped watching case " +
|
'$..[?(@.value=="' +
|
||||||
item.title
|
item[
|
||||||
);
|
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||||
}}
|
] +
|
||||||
title="Stop watching this case"
|
'")].value_cy'
|
||||||
>
|
)
|
||||||
<span className="eye"></span>
|
: item[
|
||||||
</span>
|
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||||
) : (
|
] || "N/A"}
|
||||||
<span
|
</dd>
|
||||||
className="govuk-summary-list__actionLink watchLink"
|
</div>
|
||||||
onClick={() => {
|
);
|
||||||
selectWatchedCase(
|
})}
|
||||||
cookies.pinsUser,
|
|
||||||
item.incidentid,
|
|
||||||
item.pinswg_appealcasetype
|
|
||||||
);
|
|
||||||
alert(
|
|
||||||
"You are watching case " +
|
|
||||||
item.title
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
title="Watch this case"
|
|
||||||
>
|
|
||||||
<span className="eye"></span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
</dl>
|
</dl>
|
||||||
<PaginationControl
|
<PaginationControl
|
||||||
showNoOfRecords={selectedOption}
|
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
searchResultsObj={searchResultsObj}
|
searchResultsObj={searchResultsObj}
|
||||||
orderBy={orderByState}
|
// spinnerState={spinnerState}
|
||||||
fieldSort={fieldSortState}
|
|
||||||
spinnerState={spinnerState}
|
|
||||||
getSearchPageResults={getSearchPageResults}
|
getSearchPageResults={getSearchPageResults}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -611,154 +255,42 @@ const DNSSearchResults = (props) => {
|
|||||||
)
|
)
|
||||||
: pagesCount;
|
: pagesCount;
|
||||||
|
|
||||||
const getSearchPageResults = useCallback(
|
const getSearchPageResults = (pageNumber) => {
|
||||||
(pageNumber, orderBy, fieldSort) => {
|
//console.log(advancedSearch, searchString, pageNumber);
|
||||||
//console.log(advancedSearch, searchString, pageNumber);
|
|
||||||
|
|
||||||
getBasicDNSSearchPaged(
|
getBasicDNSSearchPaged(pageNumber)
|
||||||
pageNumber,
|
.then((data) => {
|
||||||
orderBy,
|
setSearchResults(data);
|
||||||
fieldSort,
|
return data;
|
||||||
selectedOption
|
})
|
||||||
)
|
.then((data) => {
|
||||||
.then((data) => {
|
//console.log("getting details", data);
|
||||||
return data;
|
return getSearchDetailsPaged(data).then((data) => {
|
||||||
})
|
setSearchDetails(data);
|
||||||
.then((data) => {
|
//setShowSpinnerState(false);
|
||||||
setSearchResults(data);
|
|
||||||
return getSearchDetailsPaged(data).then((data) => {
|
|
||||||
setSearchDetails(data);
|
|
||||||
setShowSpinnerState(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
[selectedOption, setSearchDetails, setSearchResults]
|
|
||||||
);
|
|
||||||
|
|
||||||
const sortDataBy = (whichField) => {
|
|
||||||
setOrderbyState(whichField);
|
|
||||||
setfieldSortState("asc");
|
|
||||||
|
|
||||||
getSearchPageResults(1, whichField, fieldSortState);
|
|
||||||
whichField == orderByState
|
|
||||||
? fieldSortState == "desc"
|
|
||||||
? setfieldSortState("asc")
|
|
||||||
: setfieldSortState("desc")
|
|
||||||
: setfieldSortState("asc");
|
|
||||||
setCurrentPage(1);
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (searchLoaded) {
|
|
||||||
if (selectedOption) {
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
getSearchPageResults(1, orderByState, fieldSortState);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setSearchLoaded(true);
|
|
||||||
}
|
|
||||||
}, [
|
|
||||||
selectedOption,
|
|
||||||
fieldSortState,
|
|
||||||
orderByState,
|
|
||||||
searchLoaded,
|
|
||||||
getSearchPageResults,
|
|
||||||
]);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="flex-container grid-row govuk-body case">
|
<div className="govuk-grid-column-two-thirds">
|
||||||
<div
|
<h1 className="govuk-heading-l">
|
||||||
className={
|
{t("dnsApplications:page-title")}
|
||||||
showMap == "true"
|
</h1>
|
||||||
? "govuk-grid-column-one-half"
|
<p className="govuk-body">
|
||||||
: "govuk-grid-column-two-thirds"
|
{t("dnsApplications:page-intro-paragraph-1")}
|
||||||
}
|
</p>
|
||||||
>
|
<ul className="govuk-list govuk-list--bullet">
|
||||||
<h1 className="govuk-heading-l">
|
<li> {t("dnsApplications:page-intro-list-item-1")}</li>
|
||||||
{t("dnsApplications:page-title")}
|
|
||||||
</h1>
|
|
||||||
<p className="govuk-body">
|
|
||||||
{t("dnsApplications:page-intro-paragraph-1")}
|
|
||||||
</p>
|
|
||||||
<ul className="govuk-list govuk-list--bullet">
|
|
||||||
<li>
|
|
||||||
{" "}
|
|
||||||
{t("dnsApplications:page-intro-list-item-1")}
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
<li> {t("dnsApplications:page-intro-list-item-2")}</li>
|
||||||
{" "}
|
|
||||||
{t("dnsApplications:page-intro-list-item-2")}
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
<li> {t("dnsApplications:page-intro-list-item-3")}</li>
|
||||||
{" "}
|
</ul>
|
||||||
{t("dnsApplications:page-intro-list-item-3")}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{showMap == "true" && (
|
|
||||||
<div className="govuk-grid-column-one-half">
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
height: "45vh",
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<GoogleMapReact
|
|
||||||
options={function (maps) {
|
|
||||||
return {
|
|
||||||
overviewMapControl: true,
|
|
||||||
mapTypeControl: true,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
bootstrapURLKeys={{
|
|
||||||
key: "AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo",
|
|
||||||
}}
|
|
||||||
defaultCenter={{
|
|
||||||
id: "",
|
|
||||||
lat: 52.412272,
|
|
||||||
lng: -3.437989,
|
|
||||||
}}
|
|
||||||
defaultZoom={7}
|
|
||||||
onGoogleApiLoaded={({ map, maps }) =>
|
|
||||||
ModelsMap(map, maps)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{searchResultsObj["@odata.count"] > 5 && (
|
|
||||||
<div id="recordCountSelect" className="govuk-grid-row">
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label className="govuk-label-s " htmlFor="sort">
|
|
||||||
{t("search:searchresults-show-records-label-a")}
|
|
||||||
<select
|
|
||||||
onChange={(e) => {
|
|
||||||
setSelectedOption(e.target.value);
|
|
||||||
setCurrentPage(1);
|
|
||||||
}}
|
|
||||||
value={selectedOption}
|
|
||||||
className="govuk-select"
|
|
||||||
id="showNumberOfRecords"
|
|
||||||
name="showNumberOfRecords"
|
|
||||||
>
|
|
||||||
<option value="5">5</option>
|
|
||||||
<option value="10">10</option>
|
|
||||||
<option value="20">20</option>
|
|
||||||
<option value="30">30</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
</select>{" "}
|
|
||||||
{t("search:searchresults-show-records-label-b")}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{resultsArr.length > 0 ? (
|
{resultsArr.length > 0 ? (
|
||||||
ResultsView(resultsArr)
|
ResultsView(resultsArr)
|
||||||
) : (
|
) : (
|
||||||
@@ -788,15 +320,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setSearchDetails: (searchDetailsObj) => {
|
setSearchDetails: (searchDetailsObj) => {
|
||||||
dispatch(setSearchDetails(searchDetailsObj));
|
dispatch(setSearchDetails(searchDetailsObj));
|
||||||
},
|
},
|
||||||
setWatchedCases: (watchedCases) => {
|
|
||||||
dispatch(setWatchedCases(watchedCases));
|
|
||||||
},
|
|
||||||
setWatchedCasesDetails: (watchedCasesDetails) => {
|
|
||||||
dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
|
||||||
},
|
|
||||||
setCurrentPage: (currentPage) => {
|
|
||||||
dispatch(setCurrentPage(currentPage));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+80
-130
@@ -1,30 +1,21 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { useState } from "react";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { setCurrentPage } from "../../store/currentView/action";
|
|
||||||
|
|
||||||
const PaginationControl = (props) => {
|
const PaginationControl = (props) => {
|
||||||
const {
|
const {
|
||||||
showNoOfRecords,
|
|
||||||
orderBy,
|
|
||||||
fieldSort,
|
|
||||||
searchString,
|
searchString,
|
||||||
searchResultsObj,
|
searchResultsObj,
|
||||||
currentPage,
|
currentPage,
|
||||||
spinnerState,
|
// spinnerState,
|
||||||
getSearchPageResults,
|
getSearchPageResults,
|
||||||
setCurrentPage,
|
|
||||||
} = props;
|
} = props;
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const pagesCount = Math.ceil(
|
const pagesCount = Math.ceil(searchResultsObj["@odata.count"] / 10);
|
||||||
searchResultsObj["@odata.count"] / showNoOfRecords
|
|
||||||
);
|
|
||||||
|
|
||||||
const getRange = (start, end) => {
|
const getRange = (start, end) => {
|
||||||
//console.log(start, end);
|
//console.log(start, end);
|
||||||
@@ -36,15 +27,13 @@ const PaginationControl = (props) => {
|
|||||||
const paginationNumbers = (currentPage, pageCount) => {
|
const paginationNumbers = (currentPage, pageCount) => {
|
||||||
//console.log(currentPage);
|
//console.log(currentPage);
|
||||||
let delta;
|
let delta;
|
||||||
|
if (pageCount <= 10) {
|
||||||
if (pageCount <= 7) {
|
|
||||||
// delta === 7: [1 2 3 4 5 6 7]
|
// delta === 7: [1 2 3 4 5 6 7]
|
||||||
delta = 7;
|
delta = 10;
|
||||||
} else {
|
} else {
|
||||||
// delta === 2: [1 ... 4 5 6 ... 10]
|
// delta === 2: [1 ... 4 5 6 ... 10]
|
||||||
// delta === 4: [1 2 3 4 5 ... 10]
|
// delta === 4: [1 2 3 4 5 ... 10]
|
||||||
//delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4;
|
delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 6;
|
||||||
delta = currentPage > 4 && currentPage < pageCount - 3 ? 4 : 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const range = {
|
const range = {
|
||||||
@@ -80,126 +69,87 @@ const PaginationControl = (props) => {
|
|||||||
return pages;
|
return pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
const paginationArray = paginationNumbers(
|
const paginationArray = paginationNumbers(currentPage, pagesCount);
|
||||||
props.currentView.currentPage,
|
|
||||||
pagesCount
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{pagesCount > 1 && (
|
{" "}
|
||||||
<div className="govuk-!-margin-bottom-7 ">
|
<div className="govuk-!-margin-bottom-7 ">
|
||||||
<div className="govuk-grid-row paginationWrapper">
|
<div className="govuk-grid-row paginationWrapper">
|
||||||
<div className="govuk-grid-column-one-quarter paginationPrevious">
|
<div className="govuk-grid-column-one-quarter paginationPrevious">
|
||||||
{props.currentView.currentPage != 1 ? (
|
{currentPage != 1 ? (
|
||||||
<span
|
<span
|
||||||
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
|
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem leftTextButton"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
spinnerState(),
|
// spinnerState(),
|
||||||
setCurrentPage(
|
getSearchPageResults(currentPage - 1);
|
||||||
props.currentView.currentPage -
|
}}
|
||||||
1
|
>
|
||||||
),
|
{t("common:previous-link-button")}
|
||||||
getSearchPageResults(
|
</span>
|
||||||
props.currentView.currentPage -
|
) : (
|
||||||
1,
|
<span className="govuk-body leftTextButton govuk-!-font-weight-bold">
|
||||||
orderBy,
|
{t("common:previous-link-button")}
|
||||||
fieldSort
|
</span>
|
||||||
);
|
)}
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("common:previous-link-button")}
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span className="govuk-body leftTextButton govuk-!-font-weight-bold">
|
|
||||||
{t("common:previous-link-button")}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="govuk-grid-column-one-half paginationContainer">
|
|
||||||
{paginationArray.map((e, i) =>
|
|
||||||
props.currentView.currentPage == e ? (
|
|
||||||
<span
|
|
||||||
key={i}
|
|
||||||
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold "
|
|
||||||
>
|
|
||||||
{e}
|
|
||||||
</span>
|
|
||||||
) : e == "..." ? (
|
|
||||||
<span
|
|
||||||
key={i}
|
|
||||||
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
|
||||||
>
|
|
||||||
{e}
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span
|
|
||||||
className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
|
||||||
key={i}
|
|
||||||
onClick={() => {
|
|
||||||
spinnerState(),
|
|
||||||
setCurrentPage(e),
|
|
||||||
getSearchPageResults(
|
|
||||||
e,
|
|
||||||
orderBy,
|
|
||||||
fieldSort
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{e}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="govuk-grid-column-one-quarter paginationNext">
|
|
||||||
{props.currentView.currentPage < pagesCount ? (
|
|
||||||
<span
|
|
||||||
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
|
|
||||||
onClick={() => {
|
|
||||||
spinnerState(),
|
|
||||||
setCurrentPage(
|
|
||||||
props.currentView.currentPage +
|
|
||||||
1
|
|
||||||
),
|
|
||||||
getSearchPageResults(
|
|
||||||
props.currentView.currentPage +
|
|
||||||
1,
|
|
||||||
orderBy,
|
|
||||||
fieldSort
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("common:next-link-button")}
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span className="govuk-body rightTextButton govuk-!-font-weight-bold">
|
|
||||||
{" "}
|
|
||||||
{t("common:next-link-button")}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-body-s mobilePageCount">
|
<div className="govuk-grid-column-one-half paginationContainer">
|
||||||
{t("common:pages-label")} {currentPage}{" "}
|
{paginationArray.map((e, i) =>
|
||||||
{t("common:of-label")} {pagesCount}
|
currentPage == i + 1 ? (
|
||||||
|
<span
|
||||||
|
key={i}
|
||||||
|
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold "
|
||||||
|
>
|
||||||
|
{e}
|
||||||
|
</span>
|
||||||
|
) : e == "..." ? (
|
||||||
|
<span
|
||||||
|
key={i}
|
||||||
|
className=" govuk-body govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
||||||
|
>
|
||||||
|
{e}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span
|
||||||
|
className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem"
|
||||||
|
key={i}
|
||||||
|
onClick={() => {
|
||||||
|
// spinnerState();
|
||||||
|
console.log(i + 1);
|
||||||
|
getSearchPageResults(i + 1);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{e}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="govuk-grid-column-one-quarter paginationNext">
|
||||||
|
{currentPage != pagesCount ? (
|
||||||
|
<span
|
||||||
|
className="govuk-body govuk-link govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem rightTextButton"
|
||||||
|
onClick={() => {
|
||||||
|
// spinnerState(),
|
||||||
|
getSearchPageResults(currentPage + 1);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("common:next-link-button")}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="govuk-body rightTextButton govuk-!-font-weight-bold">
|
||||||
|
{" "}
|
||||||
|
{t("common:next-link-button")}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
<div className="govuk-body-s mobilePageCount">
|
||||||
|
{t("common:pages-label")} {currentPage}{" "}
|
||||||
|
{t("common:of-label")} {pagesCount}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
export default PaginationControl;
|
||||||
return {
|
|
||||||
currentView: state.currentView,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return {
|
|
||||||
setCurrentPage: (currentPage) => {
|
|
||||||
dispatch(setCurrentPage(currentPage));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(PaginationControl);
|
|
||||||
|
|||||||
+259
-496
@@ -4,7 +4,6 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
import {
|
import {
|
||||||
currentViewActionTypes,
|
currentViewActionTypes,
|
||||||
setCurrentReference,
|
setCurrentReference,
|
||||||
setCurrentPage,
|
|
||||||
} from "../../store/currentView/action";
|
} from "../../store/currentView/action";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import jsonpath from "jsonpath";
|
import jsonpath from "jsonpath";
|
||||||
@@ -17,7 +16,7 @@ import {
|
|||||||
getAdvancedSearchPaged,
|
getAdvancedSearchPaged,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import data from "../../data/collections.json";
|
import data from "../../data/collections.json";
|
||||||
import { useCallback, useState } from "react";
|
import { useState } from "react";
|
||||||
import LoadingOverlay from "react-loading-overlay";
|
import LoadingOverlay from "react-loading-overlay";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -44,7 +43,6 @@ import {
|
|||||||
getPortalModuleDetailsProxy,
|
getPortalModuleDetailsProxy,
|
||||||
deleteWatchedCases,
|
deleteWatchedCases,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import { useSession, signIn, signOut } from "next-auth/react";
|
|
||||||
|
|
||||||
const SearchResults = (props) => {
|
const SearchResults = (props) => {
|
||||||
const {
|
const {
|
||||||
@@ -60,28 +58,21 @@ const SearchResults = (props) => {
|
|||||||
setWatchedCases,
|
setWatchedCases,
|
||||||
setWatchedCasesDetails,
|
setWatchedCasesDetails,
|
||||||
isLinkedCase,
|
isLinkedCase,
|
||||||
setCurrentPage,
|
|
||||||
showLoginCheck,
|
|
||||||
} = props;
|
} = props;
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
const { data: session } = useSession();
|
|
||||||
|
|
||||||
var resultsArr = searchResultsObj.value || [];
|
var resultsArr = searchResultsObj.value || [];
|
||||||
|
|
||||||
const [searchLoaded, setSearchLoaded] = useState(false);
|
// const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
|
||||||
const [selectedOption, setSelectedOption] = useState(10);
|
|
||||||
const [orderByState, setOrderbyState] = useState("createdon");
|
|
||||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
|
||||||
|
|
||||||
let spinnerState = () => {
|
// let spinnerState = () => {
|
||||||
showSpinnerState == true
|
// showSpinnerState == true
|
||||||
? setShowSpinnerState(false)
|
// ? setShowSpinnerState(false)
|
||||||
: setShowSpinnerState(true);
|
// : setShowSpinnerState(true);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const cookies = parseCookies();
|
const cookies = parseCookies();
|
||||||
|
|
||||||
@@ -166,411 +157,270 @@ const SearchResults = (props) => {
|
|||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||||
<div className="govuk-summary-list__row results-headings">
|
<div className="govuk-summary-list__row results-headings">
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 results_wider ">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16 results_wider ">
|
||||||
<button
|
{t("search:searchresults-case-reference-label")}
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("title")}
|
|
||||||
className={
|
|
||||||
orderByState == "title"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-case-reference-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("search:searchresults-site-address-label")}
|
{t("search:searchresults-site-address-label")}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
<button
|
{t("search:searchresults-applicant-label")}
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("_customerid_value")}
|
|
||||||
className={
|
|
||||||
orderByState == "_customerid_value"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-applicant-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
<button
|
{t("search:searchresults-authority-label")}
|
||||||
type="button"
|
|
||||||
onClick={() =>
|
|
||||||
sortDataBy("_pinswg_associatedlpa_value")
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
orderByState ==
|
|
||||||
"_pinswg_associatedlpa_value"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-authority-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
<button
|
{t("search:searchresults-case-type-label")}
|
||||||
type="button"
|
|
||||||
onClick={() =>
|
|
||||||
sortDataBy("pinswg_appealcasetype")
|
|
||||||
}
|
|
||||||
className={
|
|
||||||
orderByState == "pinswg_appealcasetype"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-case-type-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{/* {t("search:searchresults-status-label")} */}
|
{t("search:searchresults-status-label")}
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => sortDataBy("statuscode")}
|
|
||||||
className={
|
|
||||||
orderByState == "statuscode"
|
|
||||||
? fieldSortState == "asc"
|
|
||||||
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
|
|
||||||
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("search:searchresults-status-label")}
|
|
||||||
</button>
|
|
||||||
</dd>
|
</dd>
|
||||||
{myportal == true && (
|
{myportal == true && (
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
|
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{showSpinnerState == true ? (
|
|
||||||
<div className="govuk-summary-list__row">
|
|
||||||
<div className="govuk-!-margin-top-9 govuk-!-margin-bottom-9 govuk-!-font-weight-bold govuk-!-font-size-20 ">
|
|
||||||
{t("common:spinner-fetching-data")}
|
|
||||||
<img
|
|
||||||
className="data-loading-icon"
|
|
||||||
src="/assets/images/loading.gif"
|
|
||||||
alt={
|
|
||||||
router.locale == "cy"
|
|
||||||
? "Nôl data"
|
|
||||||
: "Fetching data"
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
resultsArr.map((item, key) => {
|
|
||||||
let detailsObj = jsonpath.query(
|
|
||||||
searchDetailsObj,
|
|
||||||
'$..value[?(@.pinswg_name=="' +
|
|
||||||
item.title +
|
|
||||||
'")]'
|
|
||||||
);
|
|
||||||
detailsObj = detailsObj[0];
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="govuk-summary-list__row"
|
|
||||||
key={key}
|
|
||||||
>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
router.locale == "cy"
|
|
||||||
? myportal == true
|
|
||||||
? "/fymhorth/achos"
|
|
||||||
: "/achos"
|
|
||||||
: myportal == true
|
|
||||||
? "/myportal/case"
|
|
||||||
: "/case"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
className="govuk-link--no-underline"
|
|
||||||
onClick={() => {
|
|
||||||
setCurrentReference({
|
|
||||||
"currentReference":
|
|
||||||
item.title,
|
|
||||||
"currentType":
|
|
||||||
"searchResultsObj",
|
|
||||||
"incidentid":
|
|
||||||
item.incidentid,
|
|
||||||
"appealType":
|
|
||||||
item.pinswg_appealcasetype,
|
|
||||||
"showreps":
|
|
||||||
props.showLoginCheck,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t(
|
|
||||||
"search:searchresults-case-reference-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
{item.title}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</dd>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t(
|
|
||||||
"search:searchresults-site-address-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_projectlocation"
|
|
||||||
)
|
|
||||||
? detailsObj.pinswg_projectlocation !=
|
|
||||||
null
|
|
||||||
? detailsObj.pinswg_projectlocation.indexOf(
|
|
||||||
";"
|
|
||||||
) < 0
|
|
||||||
? detailsObj.pinswg_projectlocation
|
|
||||||
: router.locale == "cy"
|
|
||||||
? detailsObj.pinswg_projectlocation.split(
|
|
||||||
";"
|
|
||||||
)[1]
|
|
||||||
: detailsObj.pinswg_projectlocation.split(
|
|
||||||
";"
|
|
||||||
)[0]
|
|
||||||
: ""
|
|
||||||
: ""}
|
|
||||||
{_.has(
|
|
||||||
detailsObj,
|
|
||||||
"pinswg_siteaddressline1"
|
|
||||||
)
|
|
||||||
? detailsObj.pinswg_siteaddressline1
|
|
||||||
: ""}
|
|
||||||
|
|
||||||
{/* {detailsObj.pinswg_siteaddressline1 !=
|
{resultsArr.map((item, key) => {
|
||||||
|
let detailsObj = jsonpath.query(
|
||||||
|
searchDetailsObj,
|
||||||
|
"$..value[?(@.pinswg_name=='" + item.title + "')]"
|
||||||
|
);
|
||||||
|
detailsObj = detailsObj[0];
|
||||||
|
return (
|
||||||
|
<div className="govuk-summary-list__row" key={key}>
|
||||||
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
|
<Link
|
||||||
|
href={
|
||||||
|
router.locale == "cy"
|
||||||
|
? myportal == true
|
||||||
|
? "/fymhorth/achos"
|
||||||
|
: "/achos"
|
||||||
|
: myportal == true
|
||||||
|
? "/myportal/case"
|
||||||
|
: "/case"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="govuk-link--no-underline"
|
||||||
|
onClick={() => {
|
||||||
|
setCurrentReference({
|
||||||
|
"currentReference":
|
||||||
|
item.title,
|
||||||
|
"currentType":
|
||||||
|
"searchResultsObj",
|
||||||
|
"incidentid":
|
||||||
|
item.incidentid,
|
||||||
|
"appealType":
|
||||||
|
item.pinswg_appealcasetype,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="results-visually-hidden">
|
||||||
|
{t(
|
||||||
|
"search:searchresults-case-reference-label"
|
||||||
|
)}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
{item.title}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</dd>
|
||||||
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
|
<span className="results-visually-hidden">
|
||||||
|
{t(
|
||||||
|
"search:searchresults-site-address-label"
|
||||||
|
)}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
{_.has(
|
||||||
|
detailsObj,
|
||||||
|
"pinswg_siteaddressline1"
|
||||||
|
)
|
||||||
|
? detailsObj.pinswg_siteaddressline1
|
||||||
|
: ""}
|
||||||
|
|
||||||
|
{/* {detailsObj.pinswg_siteaddressline1 !=
|
||||||
null && <br />} */}
|
null && <br />} */}
|
||||||
|
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddressline1"
|
"pinswg_siteaddressline1"
|
||||||
) &&
|
) &&
|
||||||
detailsObj.pinswg_siteaddressline1 !=
|
detailsObj.pinswg_siteaddressline1 !=
|
||||||
null && <br />}
|
null && <br />}
|
||||||
|
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddressline1"
|
"pinswg_siteaddressline1"
|
||||||
)
|
)
|
||||||
? detailsObj.pinswg_siteaddressline2
|
? detailsObj.pinswg_siteaddressline2
|
||||||
: ""}
|
: ""}
|
||||||
|
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddressline2"
|
"pinswg_siteaddressline2"
|
||||||
) &&
|
) &&
|
||||||
detailsObj.pinswg_siteaddressline2 !=
|
detailsObj.pinswg_siteaddressline2 !=
|
||||||
null && <br />}
|
null && <br />}
|
||||||
{_.has(
|
{_.has(detailsObj, "pinswg_siteaddresstown")
|
||||||
detailsObj,
|
? detailsObj.pinswg_siteaddresstown
|
||||||
"pinswg_siteaddresstown"
|
: ""}
|
||||||
)
|
{_.has(
|
||||||
? detailsObj.pinswg_siteaddresstown
|
detailsObj,
|
||||||
: ""}
|
"pinswg_siteaddresstown"
|
||||||
{_.has(
|
) &&
|
||||||
detailsObj,
|
detailsObj.pinswg_siteaddresstown !=
|
||||||
"pinswg_siteaddresstown"
|
null && <br />}
|
||||||
) &&
|
|
||||||
detailsObj.pinswg_siteaddresstown !=
|
|
||||||
null && <br />}
|
|
||||||
|
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddresscounty"
|
"pinswg_siteaddresscounty"
|
||||||
)
|
)
|
||||||
? detailsObj.pinswg_siteaddresscounty
|
? detailsObj.pinswg_siteaddresscounty
|
||||||
: ""}
|
: ""}
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddresscounty"
|
"pinswg_siteaddresscounty"
|
||||||
) &&
|
) &&
|
||||||
detailsObj.pinswg_siteaddresscounty !=
|
detailsObj.pinswg_siteaddresscounty !=
|
||||||
null && <br />}
|
null && <br />}
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_siteaddresspostcode"
|
"pinswg_siteaddresspostcode"
|
||||||
)
|
)
|
||||||
? detailsObj.pinswg_siteaddresspostcode
|
? detailsObj.pinswg_siteaddresspostcode
|
||||||
: ""}
|
: ""}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t(
|
{t(
|
||||||
"search:searchresults-applicant-label"
|
"search:searchresults-applicant-label"
|
||||||
)}
|
)}
|
||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
{_.has(detailsObj, [
|
{_.has(detailsObj, [
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||||
])
|
])
|
||||||
? detailsObj[
|
? detailsObj[
|
||||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||||
]
|
]
|
||||||
: ""}
|
: ""}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t(
|
{t(
|
||||||
"search:searchresults-authority-label"
|
"search:searchresults-authority-label"
|
||||||
)}
|
)}
|
||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
{_.has(item, [
|
{_.has(item, [
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||||
])
|
])
|
||||||
? router.locale == "cy"
|
? router.locale == "cy"
|
||||||
? jsonpath.query(
|
|
||||||
transLookup,
|
|
||||||
'$..[?(@.value=="' +
|
|
||||||
item[
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] +
|
|
||||||
'")].value_cy'
|
|
||||||
)
|
|
||||||
: item[
|
|
||||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] || "N/A"
|
|
||||||
: ""}
|
|
||||||
</dd>
|
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
|
||||||
{t(
|
|
||||||
"search:searchresults-case-type-label"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
{router.locale == "cy"
|
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.value=="' +
|
'$..[?(@.value=="' +
|
||||||
item[
|
item[
|
||||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||||
] +
|
] +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: item[
|
: item[
|
||||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||||
] || "N/A"}
|
] || "N/A"
|
||||||
</dd>
|
: ""}
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
</dd>
|
||||||
<span className="results-visually-hidden">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
{t(
|
<span className="results-visually-hidden">
|
||||||
"search:searchresults-status-label"
|
{t(
|
||||||
)}
|
"search:searchresults-case-type-label"
|
||||||
:
|
)}
|
||||||
</span>
|
:
|
||||||
|
</span>
|
||||||
|
{router.locale == "cy"
|
||||||
|
? jsonpath.query(
|
||||||
|
transLookup,
|
||||||
|
'$..[?(@.value=="' +
|
||||||
|
item[
|
||||||
|
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
|
] +
|
||||||
|
'")].value_cy'
|
||||||
|
)
|
||||||
|
: item[
|
||||||
|
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
|
] || "N/A"}
|
||||||
|
</dd>
|
||||||
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
|
<span className="results-visually-hidden">
|
||||||
|
{t("search:searchresults-status-label")}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
|
||||||
{router.locale == "cy"
|
{router.locale == "cy"
|
||||||
? jsonpath.query(
|
? jsonpath.query(
|
||||||
transLookup,
|
transLookup,
|
||||||
'$..[?(@.value=="' +
|
'$..[?(@.value=="' +
|
||||||
item[
|
item[
|
||||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||||
] +
|
] +
|
||||||
'")].value_cy'
|
'")].value_cy'
|
||||||
)
|
)
|
||||||
: item[
|
: item[
|
||||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||||
] || "N/A"}
|
] || "N/A"}
|
||||||
</dd>
|
</dd>
|
||||||
{myportal == true && (
|
{myportal == true && (
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-summary-list__action">
|
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-summary-list__action">
|
||||||
{isWatchedCase(item.incidentid)
|
{isWatchedCase(item.incidentid).length >
|
||||||
.length >
|
0 ==
|
||||||
0 ==
|
true ? (
|
||||||
true ? (
|
|
||||||
<span
|
|
||||||
className="govuk-summary-list__actionLink watched_link"
|
|
||||||
onClick={() => {
|
|
||||||
deleteItem(
|
|
||||||
isWatchedCase(
|
|
||||||
item.incidentid
|
|
||||||
)[0]
|
|
||||||
.pinswg_watchlistid,
|
|
||||||
|
|
||||||
"watchedCases"
|
|
||||||
);
|
|
||||||
alert(
|
|
||||||
"You have stopped watching case " +
|
|
||||||
item.title
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
title="Stop watching this case"
|
|
||||||
>
|
|
||||||
<span className="eye"></span>
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span
|
|
||||||
className="govuk-summary-list__actionLink watchLink"
|
|
||||||
onClick={() => {
|
|
||||||
selectWatchedCase(
|
|
||||||
cookies.pinsUser,
|
|
||||||
item.incidentid,
|
|
||||||
item.pinswg_appealcasetype
|
|
||||||
);
|
|
||||||
alert(
|
|
||||||
"You are watching case " +
|
|
||||||
item.title
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
title="Watch this case"
|
|
||||||
>
|
|
||||||
<span className="eye"></span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
)}
|
|
||||||
{showLoginCheck == "true" && !session && (
|
|
||||||
<dd>
|
|
||||||
<span
|
<span
|
||||||
className="govuk-summary-list__actionLink watchLink"
|
className="govuk-summary-list__actionLink watched_link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
signIn("email");
|
deleteItem(
|
||||||
// selectWatchedCase(
|
isWatchedCase(
|
||||||
// cookies.pinsUser,
|
item.incidentid
|
||||||
// item.incidentid,
|
)[0].pinswg_watchlistid,
|
||||||
// item.pinswg_appealcasetype
|
|
||||||
// );
|
"watchedCases"
|
||||||
|
);
|
||||||
alert(
|
alert(
|
||||||
"Trying to watch case " +
|
"You have stopped watching case " +
|
||||||
|
item.title
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
title="Stop watching this case"
|
||||||
|
>
|
||||||
|
−
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span
|
||||||
|
className="govuk-summary-list__actionLink"
|
||||||
|
onClick={() => {
|
||||||
|
selectWatchedCase(
|
||||||
|
cookies.pinsUser,
|
||||||
|
item.incidentid,
|
||||||
|
item.pinswg_appealcasetype
|
||||||
|
);
|
||||||
|
alert(
|
||||||
|
"You are watching case " +
|
||||||
item.title
|
item.title
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
title="Watch this case"
|
title="Watch this case"
|
||||||
>
|
>
|
||||||
<span className="eye"></span>
|
+
|
||||||
</span>
|
</span>
|
||||||
</dd>
|
)}
|
||||||
)}
|
</dd>
|
||||||
</div>
|
)}
|
||||||
);
|
</div>
|
||||||
})
|
);
|
||||||
)}
|
})}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<PaginationControl
|
<PaginationControl
|
||||||
showNoOfRecords={selectedOption}
|
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
searchResultsObj={searchResultsObj}
|
searchResultsObj={searchResultsObj}
|
||||||
orderBy={orderByState}
|
// spinnerState={spinnerState}
|
||||||
fieldSort={fieldSortState}
|
|
||||||
spinnerState={spinnerState}
|
|
||||||
getSearchPageResults={getSearchPageResults}
|
getSearchPageResults={getSearchPageResults}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -598,94 +448,43 @@ const SearchResults = (props) => {
|
|||||||
)
|
)
|
||||||
: pagesCount;
|
: pagesCount;
|
||||||
|
|
||||||
const getSearchPageResults = useCallback(
|
const getSearchPageResults = (pageNumber) => {
|
||||||
(pageNumber, orderBy, fieldSort) => {
|
//console.log(advancedSearch, searchString, pageNumber);
|
||||||
//console.log(advancedSearch, searchString, pageNumber);
|
|
||||||
|
|
||||||
if (advancedSearch) {
|
if (advancedSearch) {
|
||||||
var searchoObj = Object.assign(
|
var searchoObj = Object.assign(
|
||||||
...searchString.map(([key, val]) => ({ [key]: val }))
|
...searchString.map(([key, val]) => ({ [key]: val }))
|
||||||
);
|
);
|
||||||
|
|
||||||
getAdvancedSearchPaged(
|
getAdvancedSearchPaged(searchoObj, pageNumber)
|
||||||
searchoObj,
|
.then((data) => {
|
||||||
pageNumber,
|
//console.log(data);
|
||||||
orderBy,
|
setSearchResults(data);
|
||||||
fieldSort,
|
return data;
|
||||||
selectedOption
|
})
|
||||||
)
|
.then((data) => {
|
||||||
.then((data) => data)
|
//console.log("getting details", data);
|
||||||
.then((data) => {
|
return getSearchDetailsPaged(data).then((data) => {
|
||||||
//console.log("getting details", data);
|
setSearchDetails(data);
|
||||||
setSearchResults(data);
|
//setShowSpinnerState(false);
|
||||||
return getSearchDetailsPaged(data).then((data) => {
|
|
||||||
setSearchDetails(data);
|
|
||||||
setShowSpinnerState(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
});
|
||||||
getBasicSearchPaged(
|
|
||||||
searchString,
|
|
||||||
pageNumber,
|
|
||||||
orderBy,
|
|
||||||
fieldSort,
|
|
||||||
selectedOption
|
|
||||||
)
|
|
||||||
.then((data) => data)
|
|
||||||
.then((data) => {
|
|
||||||
//console.log("getting details", data);
|
|
||||||
setSearchResults(data);
|
|
||||||
return getSearchDetailsPaged(data).then((data) => {
|
|
||||||
setSearchDetails(data);
|
|
||||||
setShowSpinnerState(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[
|
|
||||||
advancedSearch,
|
|
||||||
searchString,
|
|
||||||
selectedOption,
|
|
||||||
setSearchDetails,
|
|
||||||
setSearchResults,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
const sortDataBy = (whichField) => {
|
|
||||||
setOrderbyState(whichField);
|
|
||||||
setfieldSortState("asc");
|
|
||||||
|
|
||||||
getSearchPageResults(1, whichField, fieldSortState);
|
|
||||||
whichField == orderByState
|
|
||||||
? fieldSortState == "desc"
|
|
||||||
? setfieldSortState("asc")
|
|
||||||
: setfieldSortState("desc")
|
|
||||||
: setfieldSortState("asc");
|
|
||||||
setCurrentPage(1);
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (searchLoaded) {
|
|
||||||
if (selectedOption) {
|
|
||||||
setShowSpinnerState(true);
|
|
||||||
getSearchPageResults(1, orderByState, fieldSortState);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setSearchLoaded(true);
|
getBasicSearchPaged(searchString, pageNumber)
|
||||||
|
.then((data) => {
|
||||||
|
//console.log(data);
|
||||||
|
setSearchResults(data);
|
||||||
|
return data;
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
//console.log("getting details", data);
|
||||||
|
return getSearchDetailsPaged(data).then((data) => {
|
||||||
|
setSearchDetails(data);
|
||||||
|
//setShowSpinnerState(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [
|
};
|
||||||
selectedOption,
|
|
||||||
fieldSortState,
|
|
||||||
orderByState,
|
|
||||||
searchLoaded,
|
|
||||||
getSearchPageResults,
|
|
||||||
]);
|
|
||||||
// console.log(
|
|
||||||
// "page is here ",
|
|
||||||
// currentPage,
|
|
||||||
// orderByState + " " + fieldSortState
|
|
||||||
// );
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -720,39 +519,6 @@ const SearchResults = (props) => {
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{searchResultsObj["@odata.count"] > 5 && (
|
|
||||||
<div id="recordCountSelect" className="">
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
<label
|
|
||||||
className="govuk-label-s "
|
|
||||||
htmlFor="sort"
|
|
||||||
>
|
|
||||||
{t(
|
|
||||||
"search:searchresults-show-records-label-a"
|
|
||||||
)}
|
|
||||||
<select
|
|
||||||
onChange={(e) => {
|
|
||||||
setSelectedOption(e.target.value);
|
|
||||||
setCurrentPage(1);
|
|
||||||
}}
|
|
||||||
value={selectedOption}
|
|
||||||
className="govuk-select"
|
|
||||||
id="showNumberOfRecords"
|
|
||||||
name="showNumberOfRecords"
|
|
||||||
>
|
|
||||||
<option value="5">5</option>
|
|
||||||
<option value="10">10</option>
|
|
||||||
<option value="20">20</option>
|
|
||||||
<option value="30">30</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
</select>{" "}
|
|
||||||
{t(
|
|
||||||
"search:searchresults-show-records-label-b"
|
|
||||||
)}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{resultsArr.length > 0 ? (
|
{resultsArr.length > 0 ? (
|
||||||
ResultsView(resultsArr)
|
ResultsView(resultsArr)
|
||||||
) : (
|
) : (
|
||||||
@@ -792,9 +558,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setWatchedCasesDetails: (watchedCasesDetails) => {
|
setWatchedCasesDetails: (watchedCasesDetails) => {
|
||||||
dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||||
},
|
},
|
||||||
setCurrentPage: (currentPage) => {
|
|
||||||
dispatch(setCurrentPage(currentPage));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ export default function Search(props) {
|
|||||||
myportal,
|
myportal,
|
||||||
watchedCases,
|
watchedCases,
|
||||||
isLinkedCase,
|
isLinkedCase,
|
||||||
showLoginCheck,
|
|
||||||
} = props;
|
} = props;
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
@@ -51,7 +50,6 @@ export default function Search(props) {
|
|||||||
myportal={myportal}
|
myportal={myportal}
|
||||||
watchedCases={watchedCases}
|
watchedCases={watchedCases}
|
||||||
isLinkedCase={isLinkedCase}
|
isLinkedCase={isLinkedCase}
|
||||||
showLoginCheck={showLoginCheck}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { destroyCookie } from "nookies";
|
|
||||||
import { useState } from "react";
|
|
||||||
import IdleTimer from "react-idle-timer";
|
|
||||||
import TimeoutModal from "./timeoutmodal";
|
|
||||||
import { useSession, signIn, signOut } from "next-auth/react";
|
|
||||||
|
|
||||||
const TimeOut = (props) => {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
const [showModal, setShowModal] = useState(false);
|
|
||||||
const inactiveTimeOut = 1200; // in seconds
|
|
||||||
const reminderTimeout = 60; // in seconds
|
|
||||||
|
|
||||||
let idleTimer = null;
|
|
||||||
let logoutTimer = null;
|
|
||||||
|
|
||||||
let onIdle = () => {
|
|
||||||
togglePopup();
|
|
||||||
logoutTimer = setTimeout(() => {
|
|
||||||
handleLogout();
|
|
||||||
}, 1000 * reminderTimeout * 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
let togglePopup = () => {
|
|
||||||
showModal == true ? setShowModal(false) : setShowModal(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
let handleStayLoggedIn = () => {
|
|
||||||
if (logoutTimer) {
|
|
||||||
clearTimeout(logoutTimer);
|
|
||||||
logoutTimer = null;
|
|
||||||
}
|
|
||||||
idleTimer.reset();
|
|
||||||
togglePopup();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLogout = () => {
|
|
||||||
console.info("////////////\n" + "logout" + "\n////////////");
|
|
||||||
window.localStorage.clear(),
|
|
||||||
destroyCookie({}, "pinsUser"),
|
|
||||||
signOut({ callbackUrl: "/logout" });
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<IdleTimer
|
|
||||||
ref={(ref) => {
|
|
||||||
idleTimer = ref;
|
|
||||||
}}
|
|
||||||
element={document}
|
|
||||||
stopOnIdle={true}
|
|
||||||
//onActive={console.log(" bbis active", idleTimer)}
|
|
||||||
onIdle={onIdle}
|
|
||||||
timeout={1000 * inactiveTimeOut * 1}
|
|
||||||
/>
|
|
||||||
<TimeoutModal
|
|
||||||
remainingCountdown={reminderTimeout}
|
|
||||||
showModal={showModal}
|
|
||||||
togglePopup={togglePopup}
|
|
||||||
handleStayLoggedIn={handleStayLoggedIn}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TimeOut;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user