Compare commits
111
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cbc674788 | ||
|
|
46bc5d1006 | ||
|
|
b790facf56 | ||
|
|
c8f43710d3 | ||
|
|
c40d2df1e9 | ||
|
|
ff394882a5 | ||
|
|
6a7806f5ea | ||
|
|
c622cb2f74 | ||
|
|
02a83700ba | ||
|
|
eebe30a232 | ||
|
|
e54a0b2253 | ||
|
|
df199cff53 | ||
|
|
d0d2b5d7a9 | ||
|
|
84aed438f8 | ||
|
|
8be971f0b9 | ||
|
|
118d8a56c7 | ||
|
|
0b3cb9778b | ||
|
|
cb948a160b | ||
|
|
c5d3792048 | ||
|
|
17042d9836 | ||
|
|
e9fc8816c1 | ||
|
|
f8769d0bf1 | ||
|
|
c0dbaa2c3f | ||
|
|
16010f177a | ||
|
|
7ec709581f | ||
|
|
2c3c3f1cdf | ||
|
|
ac17e2058b | ||
|
|
75bab2af0b | ||
|
|
60a9081ead | ||
|
|
2d18a5a2b3 | ||
|
|
6f58e7ad63 | ||
|
|
9a3201792c | ||
|
|
0b070de9f7 | ||
|
|
7cc9469b2b | ||
|
|
a4ce38511d | ||
|
|
95d5164b2f | ||
|
|
6df20eb960 | ||
|
|
a9c3a1368f | ||
|
|
92aee7e23e | ||
|
|
5cf5a64ad5 | ||
|
|
1d1adf017a | ||
|
|
fcba17c81f | ||
|
|
0e91dfe8a2 | ||
|
|
38ebd522a8 | ||
|
|
b86712efb8 | ||
|
|
8e9d89a2af | ||
|
|
fabcb3ee5a | ||
|
|
ec3a591126 | ||
|
|
ad2dddc9a4 | ||
|
|
68a34d03ae | ||
|
|
fc1f63f388 | ||
|
|
664d0dd787 | ||
|
|
c55242fd90 | ||
|
|
21bba4a131 | ||
|
|
82f96493ce | ||
|
|
2347a104c8 | ||
|
|
fbfd21df41 | ||
|
|
f6bfc4b5d0 | ||
|
|
8d8ae89ae6 | ||
|
|
6fa2418b19 | ||
|
|
b808a34b14 | ||
|
|
8a2ee508c0 | ||
|
|
5fb944e90f | ||
|
|
5a4670dda3 | ||
|
|
75436837a2 | ||
|
|
58b5c71a64 | ||
|
|
f9524638a7 | ||
|
|
f696b20671 | ||
|
|
8895d5a328 | ||
|
|
f9831b9aa4 | ||
|
|
986d5a382f | ||
|
|
9845af7046 | ||
|
|
14a24616d0 | ||
|
|
e990feddbc | ||
|
|
9744ab93a4 | ||
|
|
9971f8be4d | ||
|
|
b2e8eae518 | ||
|
|
f6cd76ed38 | ||
|
|
ab97d28a1c | ||
|
|
7f2ed69972 | ||
|
|
0d24e3ee12 | ||
|
|
42866765c2 | ||
|
|
a156cc5dda | ||
|
|
9710301b8d | ||
|
|
79538f5f5c | ||
|
|
8c07850486 | ||
|
|
5fbd07bb1f | ||
|
|
ac21337d4d | ||
|
|
67d6db3b05 | ||
|
|
f705cc41c3 | ||
|
|
8edc905a8c | ||
|
|
527decda43 | ||
|
|
7742558f17 | ||
|
|
a1b821521d | ||
|
|
b736239bf3 | ||
|
|
12a6e15a40 | ||
|
|
d59290364d | ||
|
|
0a25358860 | ||
|
|
9935f65e73 | ||
|
|
5ecaa58bdf | ||
|
|
dbc0345197 | ||
|
|
4bf2a129de | ||
|
|
75a15948e4 | ||
|
|
91dcf6c5c3 | ||
|
|
e0988de47b | ||
|
|
dfd76757ae | ||
|
|
84fc916c7f | ||
|
|
f39bdee1ee | ||
|
|
cc3c70024f | ||
|
|
2ac542e6c2 | ||
|
|
e3546e29a7 |
+68
-41
@@ -13,31 +13,31 @@ HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136
|
||||
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
|
||||
|
||||
# //New Dev oauth ESNR
|
||||
# CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
||||
# CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
|
||||
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
|
||||
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
||||
CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
|
||||
RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
|
||||
RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
|
||||
RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
|
||||
CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
|
||||
|
||||
# //New Test
|
||||
# CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
||||
# CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
|
||||
# CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
|
||||
CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
||||
CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
|
||||
RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
|
||||
RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
|
||||
RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
|
||||
CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
|
||||
|
||||
# //New PreProd
|
||||
CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
|
||||
RELAY_ROOT = https://ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-uks-01/
|
||||
RELAYURI = "ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net"
|
||||
RELAYPATH = "ar-hc-lz-pedw-ppe-uks-01"
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-ukw-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
|
||||
CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
|
||||
# # //New PreProd
|
||||
# CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||
# CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-uks-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-ppe-uks-01"
|
||||
# # RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-ukw-01/
|
||||
# # RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
|
||||
# # RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
|
||||
# CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
|
||||
|
||||
|
||||
# //Prod Oauth WGO
|
||||
@@ -48,6 +48,17 @@ CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
|
||||
# RELAYPATH = "prod-pedw-hc"
|
||||
# CRMURL = "crm2016.llc.gov.wales/PEDW"
|
||||
|
||||
# //New Prod
|
||||
CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
|
||||
CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR
|
||||
RELAY_ROOT = https://ar-ns-lz-pedw-prod-uks-01.servicebus.windows.net/ar-hc-lz-pedw-prod-uks-01/
|
||||
RELAYURI = "ar-ns-lz-pedw-prod-uks-01.servicebus.windows.net"
|
||||
RELAYPATH = "ar-hc-lz-pedw-prod-uks-01"
|
||||
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-prod-ukw-01/
|
||||
# RELAYURI = "ar-ns-lz-pedw-prod-ukw-01.servicebus.windows.net"
|
||||
# RELAYPATH = "ar-hc-lz-pedw-prod-ukw-01"
|
||||
CRMURL = "crm2016.llcdt.gov.wales/PEDW"
|
||||
|
||||
|
||||
//GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
GOOGLE_TAG_MANAGER = G-GTWW3JT03Z
|
||||
@@ -58,8 +69,9 @@ SHOWMAPS = false
|
||||
API_ROOT = "http://localhost:3000"
|
||||
CY_API_ROOT = "http://cymru.local:3000"
|
||||
I18N_DOMAIN = "cymru.local"
|
||||
DOCAPI_OFFLINE = "12:00:00,14:00:00"
|
||||
SHOWFILTERDOCS = false
|
||||
# DOCAPI_OFFLINE = "12:00:00,14:00:00"
|
||||
DOCAPI_OFFLINE = "02:00:00,04:00:00"
|
||||
SHOWFILTERDOCS = true
|
||||
|
||||
|
||||
// Next Auth vars
|
||||
@@ -68,18 +80,24 @@ NEXTAUTH_URL_INTERNAL = $API_ROOT
|
||||
NEXTAUTH_SECRET = SuperSecret
|
||||
|
||||
// CNR sql server
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// dev test sql server
|
||||
# DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
// DATABASE_URL = sqlserver://sql-srv-plt-pedw-dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// test sql server
|
||||
DATABASE_URL = sqlserver://sql-srv-plt-pedw-test-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
|
||||
// Pre prod sql server
|
||||
DATABASE_URL = sqlserver://sql-srv-plt-pedw-ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=true;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
|
||||
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=true;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
|
||||
|
||||
// Prod sql server
|
||||
# DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
// Prod sql server
|
||||
DATABASE_URL = sqlserver://sql-srv-plt-pedw-prod-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||
|
||||
SECRET = SuperSecret
|
||||
|
||||
@@ -91,24 +109,24 @@ AZURE_TENANT_ID = $TENANT
|
||||
AZURE_CLIENT_SECRET = $CLIENT_SECRET
|
||||
|
||||
// CNR key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
|
||||
|
||||
// new dev key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
|
||||
|
||||
// New test key
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
|
||||
|
||||
// New preprod key
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
|
||||
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
|
||||
|
||||
|
||||
// PROD key
|
||||
@@ -116,6 +134,11 @@ AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
|
||||
# AZURE_STORAGE_ACCOUNT_KEY = koZ46STRqapSa2Dod8MLL6aju1eYLhhyJ6DXpCLMTnFLJvbDT6CHUv/jwr5U/Ta8a60MWzwToHQy+AStADO7sg==
|
||||
# AZURE_PEDW_STORAGE_ENDPOINT = https://pedwprod.blob.core.windows.net
|
||||
|
||||
# // New PROD key
|
||||
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwproduks"
|
||||
AZURE_STORAGE_ACCOUNT_KEY = OfV9MFqXcLLPam9GhEdMWadIOwIzhc5hd5TUqzIuQoswFdtV4ybaemjatSv+Kht0Ny1qQKjLplwY+AStUTZJrg==
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwproduks.blob.core.windows.net
|
||||
|
||||
|
||||
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||
AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net
|
||||
@@ -126,7 +149,7 @@ NOTIFY_API_KEY = pedwnextauthlivekey-90f93710-9dae-423e-aea1-11eccd0dc132-5c0ed1
|
||||
|
||||
SHOW_DEBUG = true
|
||||
|
||||
|
||||
|
||||
// DEV Connection string
|
||||
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=4b7568b3-70bd-4591-9dc2-267c0a6501d1;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=447d38b5-5d40-4238-8fb3-0ef4741b3db1
|
||||
|
||||
@@ -146,4 +169,8 @@ NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=a41b91bf-f7dc-4f44-bb66-a67df4eee43
|
||||
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
|
||||
|
||||
|
||||
HIDEERRORLOGS = false
|
||||
HIDEERRORLOGS = false
|
||||
|
||||
SHOWSIPS = true
|
||||
|
||||
ALLOWED_IPS=::1,203.0.113.42,198.51.100.17
|
||||
|
||||
+14
-2
@@ -16,8 +16,8 @@ yarn-error.log*
|
||||
.yarn
|
||||
|
||||
#lock files
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
# yarn.lock
|
||||
# package-lock.json
|
||||
|
||||
tmp
|
||||
|
||||
@@ -36,3 +36,15 @@ pages/polling.js
|
||||
# dev apis to no include
|
||||
|
||||
pages/api/endpoint/getaccounts_api.js
|
||||
|
||||
# remove swagger api docs
|
||||
|
||||
next-swagger-doc.json
|
||||
pages/api-doc.js
|
||||
public/swagger.json
|
||||
certificates/cert-key.pem
|
||||
certificates/cert.pem
|
||||
gitclean.sh
|
||||
pages/admin/logcheck.js
|
||||
pages/admin/logchecker.js
|
||||
pages/baracuda.html
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@
|
||||
"name": "Next.js: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "yarn run dev"
|
||||
"command": "npm run dev"
|
||||
},
|
||||
{"name": "Launch Chrome against localhost",
|
||||
"type": "pwa-chrome",
|
||||
|
||||
+129
-27
@@ -210,31 +210,31 @@ export const getBlobs = async (containerName, casefolderID) => {
|
||||
"/api/file/downloadblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blob.name,
|
||||
encodeURIComponent(blob.name),
|
||||
"hashedfilepath": hashAPIPath(
|
||||
"/api/file/downloadblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[2]
|
||||
encodeURIComponent(blob.name.split("/")[2])
|
||||
),
|
||||
"deletepath":
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[2],
|
||||
encodeURIComponent(blob.name.split("/")[2]),
|
||||
"hasheddeletepath": hashAPIPath(
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[2]
|
||||
encodeURIComponent(blob.name.split("/")[2])
|
||||
),
|
||||
"hashgetblobs": hashAPIPath(
|
||||
"/api/file/getbloblist?container=" +
|
||||
@@ -309,7 +309,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
|
||||
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: formContent.caseRef,
|
||||
caseID: formContent.ticketnumber,
|
||||
blobType: "Representation",
|
||||
};
|
||||
|
||||
@@ -317,7 +317,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
|
||||
const withTags = await blockBlobClient.setTags(tags);
|
||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||
|
||||
return formContent.pinswg_name;
|
||||
return formContent.ticketnumber;
|
||||
};
|
||||
|
||||
export const createAppealPDFBlob = async (
|
||||
@@ -364,11 +364,14 @@ export const createAppealPDFBlob = async (
|
||||
const uploadBlobResponse = await blockBlobClient.uploadStream(content);
|
||||
|
||||
console.log(uploadBlobResponse);
|
||||
let whichLocation = "846040000"; // Default value
|
||||
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: caseID,
|
||||
blobType: "Appeal PDF",
|
||||
ishareLocation: whichLocation,
|
||||
documentLocationId: whichLocation,
|
||||
};
|
||||
|
||||
//console.log("the tags:", tags);
|
||||
@@ -428,6 +431,7 @@ export const createRepPDFBlob = async (
|
||||
caseID: caseID,
|
||||
blobType: "Representation PDF",
|
||||
ishareLocation: whichLocation,
|
||||
documentLocationId: whichLocation,
|
||||
};
|
||||
|
||||
//console.log("the tags:", tags);
|
||||
@@ -614,6 +618,7 @@ export const uploadFile = async (formContent, containerName, foldername) => {
|
||||
documentType: files[prop][0].fieldName.split(".")[1],
|
||||
blobType: "RepresentationFile",
|
||||
ishareLocation: whichLocation,
|
||||
documentLocationId: whichLocation,
|
||||
};
|
||||
const withTags = blockBlobClient.setTags(tags);
|
||||
const withMeta = blockBlobClient.setMetadata(tags);
|
||||
@@ -1230,17 +1235,17 @@ export const getProgressBlobs = async (containerName, caseReference) => {
|
||||
"/api/file/downloadblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
caseReference +
|
||||
encodeURIComponent(caseReference) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[1]
|
||||
encodeURIComponent(blob.name.split("/")[1])
|
||||
),
|
||||
"hasheddeletepath": hashAPIPath(
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
caseReference +
|
||||
encodeURIComponent(caseReference) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[1]
|
||||
encodeURIComponent(blob.name.split("/")[1])
|
||||
),
|
||||
"hashgetblobs": hashAPIPath(
|
||||
"/api/file/getbloblist?container=" +
|
||||
@@ -1401,20 +1406,20 @@ export const getRepsFilesBlobs = async (
|
||||
"/api/file/downloadblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
blob.name.split("/")[0] +
|
||||
"/" +
|
||||
blob.name.split("/")[1] +
|
||||
encodeURIComponent(
|
||||
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
|
||||
) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[3],
|
||||
encodeURIComponent(blob.name.split("/")[3]),
|
||||
"hashedfilepath": hashAPIPath(
|
||||
"/api/file/downloadblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
blob.name.split("/")[0] +
|
||||
"/" +
|
||||
blob.name.split("/")[1] +
|
||||
encodeURIComponent(
|
||||
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
|
||||
) +
|
||||
"&blobname=" +
|
||||
blob.name
|
||||
encodeURIComponent(blob.name.split("/")[3])
|
||||
),
|
||||
"deletepath":
|
||||
"/api/file/deleteblob?container=" +
|
||||
@@ -1429,11 +1434,11 @@ export const getRepsFilesBlobs = async (
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
blob.name.split("/")[0] +
|
||||
"/" +
|
||||
blob.name.split("/")[1] +
|
||||
encodeURIComponent(
|
||||
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
|
||||
) +
|
||||
"&blobname=" +
|
||||
blob.name.split("/")[3]
|
||||
encodeURIComponent(blob.name.split("/")[3])
|
||||
),
|
||||
"hashgetblobs": hashAPIPath(
|
||||
"/api/file/getbloblist?container=" +
|
||||
@@ -1445,7 +1450,7 @@ export const getRepsFilesBlobs = async (
|
||||
),
|
||||
});
|
||||
}
|
||||
//console.log("blobObj:", blobObj);
|
||||
console.log("blobObj:", blobObj);
|
||||
|
||||
return blobObj;
|
||||
};
|
||||
@@ -1688,3 +1693,100 @@ export const listBlobHierarchical = async (
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function formatTimeSince(date) {
|
||||
if (!date) return "Unknown date";
|
||||
|
||||
const now = new Date();
|
||||
const diffMs = now - date;
|
||||
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (diffDays < 7) {
|
||||
return `${diffDays} day${diffDays !== 1 ? "s" : ""} ago`;
|
||||
} else {
|
||||
const diffWeeks = Math.floor(diffDays / 7);
|
||||
return `${diffWeeks} week${diffWeeks !== 1 ? "s" : ""} ago`;
|
||||
}
|
||||
}
|
||||
|
||||
function formatDateDisplay(date) {
|
||||
return date
|
||||
? `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`
|
||||
: "Unknown";
|
||||
}
|
||||
|
||||
export async function listBlobHierarchicalForUser(containerClient) {
|
||||
const blobNames = [];
|
||||
for await (const blob of containerClient.listBlobsFlat()) {
|
||||
const lastModifiedDate = blob.properties?.lastModified || null;
|
||||
const createdOnDate = blob.properties?.createdOn || null;
|
||||
|
||||
let displayDate = "";
|
||||
|
||||
if (createdOnDate && lastModifiedDate) {
|
||||
if (
|
||||
createdOnDate.toDateString() === lastModifiedDate.toDateString()
|
||||
) {
|
||||
// Same day — show just one
|
||||
displayDate = `Date: ${formatDateDisplay(lastModifiedDate)}`;
|
||||
} else {
|
||||
// Different days — show both
|
||||
displayDate = `Created: ${formatDateDisplay(
|
||||
createdOnDate
|
||||
)}, Modified: ${formatDateDisplay(lastModifiedDate)}`;
|
||||
}
|
||||
} else if (lastModifiedDate) {
|
||||
displayDate = `Modified: ${formatDateDisplay(lastModifiedDate)}`;
|
||||
} else if (createdOnDate) {
|
||||
displayDate = `Created: ${formatDateDisplay(createdOnDate)}`;
|
||||
} else {
|
||||
displayDate = "Unknown date";
|
||||
}
|
||||
|
||||
blobNames.push({
|
||||
name: blob.name,
|
||||
size: blob.properties.contentLength || 0,
|
||||
lastModified: lastModifiedDate
|
||||
? lastModifiedDate.toISOString()
|
||||
: null,
|
||||
createdOn: createdOnDate ? createdOnDate.toISOString() : null,
|
||||
displayDate,
|
||||
});
|
||||
}
|
||||
return blobNames;
|
||||
}
|
||||
|
||||
export async function listContainersForUser(
|
||||
blobServiceClient,
|
||||
containerNamePrefix,
|
||||
emailAddress
|
||||
) {
|
||||
const options = {
|
||||
includeDeleted: false,
|
||||
includeMetadata: true,
|
||||
includeSystem: true,
|
||||
prefix: containerNamePrefix,
|
||||
};
|
||||
|
||||
const results = [];
|
||||
|
||||
for await (const containerItem of blobServiceClient.listContainers(
|
||||
options
|
||||
)) {
|
||||
const containerClient = blobServiceClient.getContainerClient(
|
||||
containerItem.name
|
||||
);
|
||||
const blobNames = await listBlobHierarchicalForUser(
|
||||
containerClient
|
||||
).catch(console.error);
|
||||
|
||||
if (blobNames && blobNames.length > 0) {
|
||||
results.push({
|
||||
container: containerItem.name,
|
||||
blobs: blobNames,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return results; // array of non-empty containers
|
||||
}
|
||||
|
||||
+140
-34
@@ -532,23 +532,30 @@ export const getBasicSearchDetailsPaged = async (
|
||||
appealTypeName,
|
||||
caseReference,
|
||||
primaryIdAttribute,
|
||||
incidentID
|
||||
incidentIDs
|
||||
) => {
|
||||
//console.log("check appealtype:", appealType, caseReference);
|
||||
if (!incidentIDs || incidentIDs.length === 0) return [];
|
||||
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=" +
|
||||
appealTypeName +
|
||||
"&primaryIdAttribute=" +
|
||||
primaryIdAttribute +
|
||||
"&incidentID=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
// Build OData filter correctly
|
||||
const filter = incidentIDs
|
||||
.map((id) => `_${primaryIdAttribute}s_value eq ${id}`)
|
||||
.join(" or ");
|
||||
|
||||
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
|
||||
filter
|
||||
)}`;
|
||||
|
||||
// console.log(
|
||||
// `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`
|
||||
// );
|
||||
|
||||
try {
|
||||
const res = await axios.get(url);
|
||||
return res.data.value || []; // ensure returning an array
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetails = (incidentID) => {
|
||||
@@ -786,6 +793,19 @@ export const getMyCases = (loggedInUserId) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyInvolvements = async (loggedInUserId) => {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmyinvolvements_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const getMyLPACases = (lpaid) => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getmylpacases_api?lpaid=" + lpaid)
|
||||
@@ -1431,7 +1451,7 @@ export const deleteMyRepresentationsFromBlob = (
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteWatchedCases = (watchedCaseID) => {
|
||||
export const deleteWatchedCases = async (watchedCaseID) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
|
||||
var config = {
|
||||
@@ -1439,14 +1459,12 @@ export const deleteWatchedCases = (watchedCaseID) => {
|
||||
url: queryUrl,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
//console.log("deleted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
try {
|
||||
const res = await axios(config);
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const createAccount = (formValues) => {
|
||||
@@ -1751,9 +1769,9 @@ export const deleteBlob = async (
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blobName +
|
||||
encodeURIComponent(blobName) +
|
||||
deleteblobhash
|
||||
);
|
||||
return res.data;
|
||||
@@ -1774,11 +1792,9 @@ export const deleteRepBlob = async (
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
"/" +
|
||||
filenamePrefix +
|
||||
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
|
||||
"&blobname=" +
|
||||
blobName +
|
||||
encodeURIComponent(blobName) +
|
||||
deleteblobhash
|
||||
);
|
||||
return res.data;
|
||||
@@ -1832,14 +1848,14 @@ export const getProgressFromBlob = async (containerName, casereference) => {
|
||||
const res = await axios.get(
|
||||
BASE_URL +
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
containerName +
|
||||
encodeURIComponent(containerName) +
|
||||
"&casefolderID=" +
|
||||
casereference +
|
||||
encodeURIComponent(casereference) +
|
||||
hashAPIPath(
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
containerName +
|
||||
encodeURIComponent(containerName) +
|
||||
"&casefolderID=" +
|
||||
casereference
|
||||
encodeURIComponent(casereference)
|
||||
)
|
||||
);
|
||||
return res.data;
|
||||
@@ -2089,3 +2105,93 @@ export const getAddressSearch = async (searchString) => {
|
||||
return ErrResponse;
|
||||
});
|
||||
};
|
||||
|
||||
export const getNewAppeals = async (searchString) => {
|
||||
try {
|
||||
const res = await axios.get(BASE_URL + "/api/admin/getnewappeals_api");
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
}
|
||||
};
|
||||
|
||||
export const getNewAppealsPage = async (
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords
|
||||
) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/admin/getnewappeals_api?searchString=" +
|
||||
searchString +
|
||||
"&pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getNewDocumentsPaged = async (
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
showNumberOfRecords,
|
||||
documentType,
|
||||
documentOrigin,
|
||||
selectedWeeks
|
||||
) => {
|
||||
console.log(
|
||||
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords +
|
||||
"&documentType=" +
|
||||
documentType +
|
||||
"&numberWeeks=" +
|
||||
selectedWeeks +
|
||||
"&documentOrigin=" +
|
||||
documentOrigin
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
||||
pageNumber +
|
||||
"&orderby=" +
|
||||
orderBy +
|
||||
"&fieldSort=" +
|
||||
fieldSort +
|
||||
"&showNumberOfRecords=" +
|
||||
showNumberOfRecords +
|
||||
"&documentType=" +
|
||||
documentType +
|
||||
"&numberWeeks=" +
|
||||
selectedWeeks +
|
||||
"&documentOrigin=" +
|
||||
documentOrigin
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ export const getSelectQuery = (appealTypeName) => {
|
||||
return "&$select=pinswg_speacialistcaseprocess,modifiedon,_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,pinswg_startdate,pinswg_otherpartiesstatement,pinswg_finalcommentsduedate,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_speacialistcaseprocess,pinswg_statementduedate";
|
||||
break;
|
||||
case "pinswg_callinss77s":
|
||||
return "&$select=modifiedon,_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,pinswg_statementsduedate";
|
||||
return "&$select=modifiedon,_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,pinswg_statementsduedate,pinswg_otherpartiesstatement";
|
||||
break;
|
||||
case "pinswg_commonlands":
|
||||
return "&$select=modifiedon,_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,pinswg_statementsduedate";
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// components/admin/tabs/AccountsTab.js
|
||||
import Link from "next/link";
|
||||
|
||||
export default function AccountsTab({ userData }) {
|
||||
return (
|
||||
<div>
|
||||
<h1>User Accounts</h1>
|
||||
<p>Number of accounts created: {userData.length}</p>
|
||||
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||
<div className="govuk-summary-list__row results-headings">
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
Name
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
Last accessed
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
{userData.map((user) => (
|
||||
<div key={user.id} className="govuk-summary-list__row">
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<Link
|
||||
target="_blank"
|
||||
href={`/auth/signin2?email=${user.email}`}
|
||||
>
|
||||
{user.email}
|
||||
</Link>
|
||||
<br />
|
||||
{user.id}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
Last accessed: {user.created}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
// components/admin/tabs/AppealsTab.js
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useCallback, useState, useEffect } from "react";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import PaginationControl from "../../../components/search/pagination";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
} from "../../../store/searchOutput/action";
|
||||
|
||||
import { getDetailsProxy, getSearchDetailsPaged } from "../../utils";
|
||||
import { getAdvancedSearchPaged, getNewAppealsPage } from "../../../actions";
|
||||
import {
|
||||
setCurrentPage,
|
||||
setCurrentReference,
|
||||
} from "../../../store/currentView/action";
|
||||
|
||||
function AppealsTab(props) {
|
||||
const [searchLoaded, setSearchLoaded] = useState(false);
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||
const [loginToWatch, setLoginToWatch] = useState("true");
|
||||
|
||||
const searchDetailsObj = props.searchResultsObj.searchDetailsObj || {};
|
||||
const resultsArr = props.searchResultsObj.searchResultsObj.value || [];
|
||||
const searchResultsObj = props.searchResultsObj.searchResultsObj;
|
||||
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const myportal = false;
|
||||
const advancedSearch = false;
|
||||
const searchString = "";
|
||||
|
||||
const spinnerState = () => {
|
||||
setShowSpinnerState((prev) => !prev);
|
||||
};
|
||||
|
||||
const pagesCount = Math.ceil(searchResultsObj["@odata.count"] / 10);
|
||||
|
||||
let currentPage = 0;
|
||||
try {
|
||||
currentPage = decodeURI(searchResultsObj["@odata.nextLink"]).split(
|
||||
"skiptoken="
|
||||
)[1];
|
||||
currentPage =
|
||||
typeof currentPage !== "undefined"
|
||||
? parseInt(
|
||||
decodeURI(currentPage)
|
||||
.split('pagenumber="')[1]
|
||||
.slice(
|
||||
0,
|
||||
decodeURI(currentPage)
|
||||
.split('pagenumber="')[1]
|
||||
.indexOf('"')
|
||||
) - 1
|
||||
)
|
||||
: pagesCount;
|
||||
} catch (e) {
|
||||
currentPage = pagesCount;
|
||||
}
|
||||
|
||||
const getSearchPageResults = useCallback(
|
||||
(pageNumber, orderBy, fieldSort) => {
|
||||
getNewAppealsPage(
|
||||
searchString,
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort,
|
||||
selectedOption
|
||||
).then((data) => {
|
||||
props.setSearchResults(data); // ✅ use props, not import
|
||||
return getSearchDetailsPaged(data).then((details) => {
|
||||
props.setSearchDetails(details); // ✅ use props, not import
|
||||
setShowSpinnerState(false);
|
||||
});
|
||||
});
|
||||
},
|
||||
[
|
||||
advancedSearch,
|
||||
searchString,
|
||||
selectedOption,
|
||||
props.setSearchDetails,
|
||||
props.setSearchResults,
|
||||
]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (searchLoaded) {
|
||||
if (selectedOption) {
|
||||
setShowSpinnerState(true);
|
||||
getSearchPageResults(1, orderByState, fieldSortState);
|
||||
}
|
||||
} else {
|
||||
setSearchLoaded(true);
|
||||
}
|
||||
}, [
|
||||
selectedOption,
|
||||
fieldSortState,
|
||||
orderByState,
|
||||
searchLoaded,
|
||||
getSearchPageResults,
|
||||
router.query,
|
||||
]);
|
||||
|
||||
const ResultsView = (resultsArr) => {
|
||||
return (
|
||||
<>
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||
<div className="govuk-summary-list__row results-headings">
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 results_wider ">
|
||||
<button
|
||||
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 className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{t("search:searchresults-site-address-label")}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
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 className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
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 className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
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 className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{/* {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 className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action">
|
||||
Origin
|
||||
</dd>
|
||||
</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({
|
||||
path:
|
||||
'$..[?(@ && @.ticketnumber=="' +
|
||||
item.ticketnumber +
|
||||
'")]',
|
||||
json: searchDetailsObj,
|
||||
eval: true,
|
||||
});
|
||||
|
||||
detailsObj = detailsObj[0] || {};
|
||||
return (
|
||||
<div
|
||||
className="govuk-summary-list__row"
|
||||
key={key}
|
||||
>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<div></div>
|
||||
{item.pinswg_publishtoweb == true ? (
|
||||
<Link
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
href={
|
||||
(router.locale == "cy"
|
||||
? myportal == true
|
||||
? "/fymhorth/achos"
|
||||
: "/achos"
|
||||
: myportal == true
|
||||
? "/myportal/case"
|
||||
: "/case") +
|
||||
"/" +
|
||||
item.ticketnumber
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"ticketnumber":
|
||||
item.ticketnumber,
|
||||
"currentReference":
|
||||
item.title,
|
||||
"currentType":
|
||||
"searchResultsObj",
|
||||
"incidentid":
|
||||
item.incidentid,
|
||||
"appealType":
|
||||
item.pinswg_appealcasetype,
|
||||
"showLoginCheck":
|
||||
props.showLoginCheck,
|
||||
"specialistProcess":
|
||||
detailsObj.hasOwnProperty(
|
||||
"pinswg_speacialistcaseprocess"
|
||||
)
|
||||
? detailsObj.pinswg_speacialistcaseprocess
|
||||
: detailsObj.hasOwnProperty(
|
||||
"pinswg_specialistcaseprocess"
|
||||
)
|
||||
? detailsObj.pinswg_specialistcaseprocess
|
||||
: "",
|
||||
});
|
||||
}}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-case-reference-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{item.title}
|
||||
</Link>
|
||||
) : (
|
||||
item.title
|
||||
)}
|
||||
|
||||
<br />
|
||||
{new Date(
|
||||
item.createdon
|
||||
).toLocaleString()}
|
||||
</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 !=
|
||||
null && <br />} */}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline2"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddressline2 !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresstown"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresstown"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddresstown !=
|
||||
null && <br />}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresscounty"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresscounty"
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddresscounty !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresspostcode"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"search:searchresults-applicant-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{item.pinswg_appellantagent == 846040001
|
||||
? item.pinswg_appellantfirstname +
|
||||
" " +
|
||||
item.pinswg_appellantlastname
|
||||
: _.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(item, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
item[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
})
|
||||
: 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({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
})
|
||||
: 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"
|
||||
? jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
})
|
||||
: item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
{item[
|
||||
"caseorigincode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</dl>
|
||||
<PaginationControl
|
||||
showNoOfRecords={selectedOption}
|
||||
currentPage={currentPage}
|
||||
searchResultsObj={props.searchResultsObj.searchResultsObj}
|
||||
orderBy={orderByState}
|
||||
fieldSort={fieldSortState}
|
||||
spinnerState={spinnerState}
|
||||
getSearchPageResults={getSearchPageResults}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Appeals</h1>
|
||||
{searchResultsObj["@odata.count"] > 5 && (
|
||||
<div id="recordCountSelect" className="">
|
||||
<div className="govuk-form-group">
|
||||
<label
|
||||
className="govuk-label-s "
|
||||
htmlFor="showNumberOfRecords"
|
||||
>
|
||||
{t("search:searchresults-show-records-label-a")}
|
||||
<select
|
||||
onChange={(e) => {
|
||||
setSelectedOption(e.target.value);
|
||||
props.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 ? (
|
||||
ResultsView(resultsArr)
|
||||
) : (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h3>{t("search:searchresults-no-records-label")}</h3>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentReference: (currentReference) => {
|
||||
dispatch(setCurrentReference(currentReference));
|
||||
},
|
||||
setSearchResults: (searchResultsObj) => {
|
||||
dispatch(setSearchResults(searchResultsObj));
|
||||
},
|
||||
setSearchDetails: (searchDetailsObj) => {
|
||||
dispatch(setSearchDetails(searchDetailsObj));
|
||||
},
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AppealsTab);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,266 @@
|
||||
// components/admin/tabs/StorageTab.js
|
||||
import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { bytesToSize } from "../../../components/utils";
|
||||
import {
|
||||
deleteMyRepresentationsFromBlob,
|
||||
deleteAwaitingSubmissionsFromBlob,
|
||||
sendRepCompleteMessage,
|
||||
} from "../../../actions";
|
||||
|
||||
import { formatBlobDates } from "../utils/adminHelper";
|
||||
|
||||
export default function StorageTab({ data, repCompleteCount }) {
|
||||
const [showRepJson, setShowRepJson] = useState(true);
|
||||
const [showTmpFile, setShowTmpFile] = useState(true);
|
||||
const [listData, setListData] = useState(data);
|
||||
|
||||
const toggleAll = () => {
|
||||
const newState = !(showRepJson || showTmpFile);
|
||||
setShowRepJson(newState);
|
||||
setShowTmpFile(newState);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Storage Account Contents</h1>
|
||||
{repCompleteCount > 0 && (
|
||||
<p>Number of Orphaned Reps: {repCompleteCount}</p>
|
||||
)}
|
||||
|
||||
{/* Toggle buttons */}
|
||||
<div style={{ marginBottom: "0.2rem" }}>
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary"
|
||||
onClick={() => setShowRepJson(!showRepJson)}
|
||||
>
|
||||
{showRepJson ? "Hide Reps" : "Show Reps"}
|
||||
</button>
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary"
|
||||
onClick={() => setShowTmpFile(!showTmpFile)}
|
||||
style={{ marginLeft: "0.5rem" }}
|
||||
>
|
||||
{showTmpFile ? "Hide Temp Appeal" : "Show Temp Appeal"}
|
||||
</button>
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary"
|
||||
onClick={toggleAll}
|
||||
style={{ marginLeft: "0.5rem" }}
|
||||
>
|
||||
Show/Hide All
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Render users & containers */}
|
||||
{listData.map((user) => (
|
||||
<div key={user.id} className="govuk-grid-row">
|
||||
{user.containers.map((c) => (
|
||||
<div key={c.container} className="card">
|
||||
<div className="card-body">
|
||||
<h3>
|
||||
{c.container} -{" "}
|
||||
<Link
|
||||
href={`/auth/signin2?email=${user.email}`}
|
||||
>
|
||||
{user.email}
|
||||
</Link>
|
||||
</h3>
|
||||
{/* folders */}
|
||||
{c.folders.map((folder) => (
|
||||
<div
|
||||
key={folder.folderPath}
|
||||
style={
|
||||
showRepJson && folder.hasRepJson
|
||||
? { display: "block" }
|
||||
: showTmpFile &&
|
||||
folder.hasTmpFile
|
||||
? { display: "block" }
|
||||
: { display: "none" }
|
||||
}
|
||||
>
|
||||
<h4>{folder.folderPath || "Root"}</h4>
|
||||
|
||||
{/* Buttons for TMP + Rep actions go here (same logic as before) */}
|
||||
|
||||
{folder.hasTmpFile && (
|
||||
<>
|
||||
<button
|
||||
onClick={() => {
|
||||
confirm(
|
||||
"Do you want to remove this unsubmitted appeal " +
|
||||
folder.folderPath +
|
||||
"?\n"
|
||||
) &&
|
||||
(deleteCaseItem(
|
||||
c.container,
|
||||
folder.folderPath,
|
||||
setData
|
||||
),
|
||||
alert(
|
||||
"Temp case Deleted!"
|
||||
));
|
||||
}}
|
||||
>
|
||||
Delete this TMP appeal
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{folder.hasRepJson && (
|
||||
<div>
|
||||
{" "}
|
||||
<button
|
||||
title={
|
||||
"Do you want to delete rep"
|
||||
}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
confirm(
|
||||
"Do you want tyo delete rep " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0] +
|
||||
"?\n"
|
||||
) &&
|
||||
(deleteRepItem(
|
||||
c.container,
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0],
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
),
|
||||
alert(
|
||||
"Rep Deleted!"
|
||||
),
|
||||
window.location.reload());
|
||||
}}
|
||||
>
|
||||
Delete Rep
|
||||
</button>
|
||||
{folder.repComplete && (
|
||||
<button
|
||||
onClick={async () => {
|
||||
const response =
|
||||
await fetch(
|
||||
"/api/file/editRepJson",
|
||||
{
|
||||
method: "POST",
|
||||
headers:
|
||||
{
|
||||
"Content-Type":
|
||||
"application/json",
|
||||
},
|
||||
body: JSON.stringify(
|
||||
{
|
||||
container:
|
||||
c.container,
|
||||
blobName:
|
||||
folder
|
||||
.repJsonBlob
|
||||
.name,
|
||||
}
|
||||
),
|
||||
}
|
||||
);
|
||||
const result =
|
||||
await response.json();
|
||||
if (response.ok) {
|
||||
alert(
|
||||
"repComplete removed!"
|
||||
),
|
||||
window.location.reload();
|
||||
// Optionally refresh the page or update UI state here
|
||||
} else {
|
||||
alert(
|
||||
"Error: " +
|
||||
result.error
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Remove repComplete
|
||||
</button>
|
||||
)}
|
||||
{folder.repComplete && (
|
||||
<button
|
||||
onClick={async () => {
|
||||
confirm(
|
||||
"Do you want resend the rep queue message " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0] +
|
||||
" --- " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
) &&
|
||||
(sendRepCompleteMessage(
|
||||
c.container,
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0],
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
),
|
||||
alert(
|
||||
"rep queue message sent!"
|
||||
),
|
||||
window.location.reload());
|
||||
}}
|
||||
>
|
||||
Recreate Queue Message
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<ul>
|
||||
{folder.blobs.map((blob) => (
|
||||
<li key={blob.name}>
|
||||
<Link
|
||||
scroll={false}
|
||||
href={`/api/file/downloadblob?container=${
|
||||
c.container
|
||||
}&casefolderID=${
|
||||
folder.folderPath
|
||||
}&blobname=${blob.name.substring(
|
||||
blob.name.lastIndexOf(
|
||||
"/"
|
||||
) + 1
|
||||
)}&hash=${
|
||||
blob.hashedfilepath
|
||||
}`}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-link"
|
||||
>
|
||||
{blob.name} (
|
||||
{bytesToSize(
|
||||
blob.contentLength ||
|
||||
blob.size
|
||||
)}
|
||||
)
|
||||
</Link>{" "}
|
||||
{blob.lastModified && (
|
||||
<span className="govuk-!-font-size-14">
|
||||
{/* {
|
||||
blob.displayDate
|
||||
} */}
|
||||
{formatBlobDates(
|
||||
blob
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// components/admin/utils/adminStorage.js
|
||||
|
||||
/**
|
||||
* Get the folder path up to the last slash.
|
||||
* Used for grouping blobs by "case folder".
|
||||
*/
|
||||
export function getUpToLastSlash(url) {
|
||||
let lastSlash = url.lastIndexOf("/");
|
||||
|
||||
url = url.substring(0, lastSlash);
|
||||
|
||||
url =
|
||||
url.lastIndexOf("/files") > 0
|
||||
? url.substring(0, url.lastIndexOf("/files"))
|
||||
: url;
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a stream (Azure blob download) to a string.
|
||||
*/
|
||||
export async function streamToString(readableStream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
readableStream.on("data", (data) => {
|
||||
chunks.push(data.toString());
|
||||
});
|
||||
readableStream.on("end", () => {
|
||||
resolve(chunks.join(""));
|
||||
});
|
||||
readableStream.on("error", reject);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Format how long ago a date occurred.
|
||||
*/
|
||||
export function formatTimeSince(date) {
|
||||
if (!date) return "Unknown date";
|
||||
|
||||
const now = new Date();
|
||||
const diffMs = now - date;
|
||||
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (diffDays < 7) {
|
||||
return `${diffDays} day${diffDays !== 1 ? "s" : ""} ago`;
|
||||
} else {
|
||||
const diffWeeks = Math.floor(diffDays / 7);
|
||||
return `${diffWeeks} week${diffWeeks !== 1 ? "s" : ""} ago`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format Azure blob created/modified dates into a readable string.
|
||||
*/
|
||||
export function formatBlobDates(blob) {
|
||||
const created = blob.createdOn ? new Date(blob.createdOn) : null;
|
||||
const modified = blob.lastModified ? new Date(blob.lastModified) : null;
|
||||
|
||||
if (!created && !modified) return "Unknown";
|
||||
|
||||
// If both exist and are the same
|
||||
if (created && modified && created.getTime() === modified.getTime()) {
|
||||
return `${created.toLocaleString("en-GB")} (${formatTimeSince(
|
||||
created
|
||||
)})`;
|
||||
}
|
||||
|
||||
// If modified exists and is newer than created
|
||||
if (created && modified && modified.getTime() > created.getTime()) {
|
||||
return `Created: ${created.toLocaleString("en-GB")} (${formatTimeSince(
|
||||
created
|
||||
)}), Modified: ${modified.toLocaleString("en-GB")} (${formatTimeSince(
|
||||
modified
|
||||
)})`;
|
||||
}
|
||||
|
||||
// Only one date exists
|
||||
const date = modified || created;
|
||||
return `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// lib/prisma.js
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const globalForPrisma = globalThis;
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ||
|
||||
new PrismaClient({
|
||||
log: ["query", "error", "warn"],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalForPrisma.prisma = prisma;
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
// components/admin/utils/serverStorage.js
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
import { BlobServiceClient } from "@azure/storage-blob";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getUpToLastSlash, streamToString } from "../utils/adminHelper";
|
||||
import { listContainersForUser } from "../../../actions/azurestorage";
|
||||
|
||||
const prisma = global.prisma || new PrismaClient();
|
||||
|
||||
/**
|
||||
* Generate HMAC hash for blob API link.
|
||||
*/
|
||||
function hashAPIPath(queryPath, WORDKEY) {
|
||||
let hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
return hashlink.toString(CryptoJS.enc.Hex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch blob structure + users for admin storage page.
|
||||
*/
|
||||
export async function fetchAdminStorageData() {
|
||||
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
|
||||
const creds = new DefaultAzureCredential();
|
||||
const blobServiceClient = new BlobServiceClient(
|
||||
`https://${accountName}.blob.core.windows.net`,
|
||||
creds
|
||||
);
|
||||
|
||||
const prisma = global.prisma || new PrismaClient();
|
||||
|
||||
const users = await prisma.user.findMany();
|
||||
|
||||
let data = await Promise.all(
|
||||
users.map(async (user) => {
|
||||
const containers = await listContainersForUser(
|
||||
blobServiceClient,
|
||||
`${user.id}`,
|
||||
user.email
|
||||
);
|
||||
|
||||
const containersWithHashes = await Promise.all(
|
||||
containers.map(async (container) => {
|
||||
const groupedByFolder = await container.blobs.reduce(
|
||||
async (accP, blob) => {
|
||||
const acc = await accP;
|
||||
const folderPath =
|
||||
getUpToLastSlash(blob.name.trim()) || "";
|
||||
|
||||
const hashedfilepath = hashAPIPath(
|
||||
`/api/file/downloadblob?container=${
|
||||
container.container
|
||||
}&casefolderID=${folderPath}&blobname=${blob.name
|
||||
.substring(blob.name.lastIndexOf("/") + 1)
|
||||
.trim()}`,
|
||||
process.env.HASHKEY
|
||||
);
|
||||
|
||||
const fileNameOnly = blob.name.substring(
|
||||
blob.name.lastIndexOf("/") + 1
|
||||
);
|
||||
const isTmpFile = fileNameOnly.startsWith("TMP-");
|
||||
|
||||
const blobWithHash = {
|
||||
...blob,
|
||||
hashedfilepath,
|
||||
isTmpFile,
|
||||
};
|
||||
|
||||
let folderGroup = acc.find(
|
||||
(f) => f.folderPath === folderPath
|
||||
);
|
||||
if (!folderGroup) {
|
||||
folderGroup = {
|
||||
folderPath,
|
||||
blobs: [],
|
||||
hasRepJson: false,
|
||||
repJsonBlob: null,
|
||||
repComplete: false,
|
||||
hasTmpFile: false,
|
||||
};
|
||||
acc.push(folderGroup);
|
||||
}
|
||||
|
||||
folderGroup.blobs.push(blobWithHash);
|
||||
|
||||
if (isTmpFile) {
|
||||
folderGroup.hasTmpFile = true;
|
||||
}
|
||||
|
||||
// rep.json handling
|
||||
if (blob.name.toLowerCase().endsWith("rep.json")) {
|
||||
folderGroup.hasRepJson = true;
|
||||
folderGroup.repJsonBlob = blobWithHash;
|
||||
|
||||
const containerClient =
|
||||
blobServiceClient.getContainerClient(
|
||||
container.container
|
||||
);
|
||||
const blockBlobClient =
|
||||
containerClient.getBlockBlobClient(
|
||||
blob.name
|
||||
);
|
||||
|
||||
try {
|
||||
const downloadResponse =
|
||||
await blockBlobClient.download(0);
|
||||
const downloaded = await streamToString(
|
||||
downloadResponse.readableStreamBody
|
||||
);
|
||||
const json = JSON.parse(downloaded);
|
||||
folderGroup.repComplete = Boolean(
|
||||
json.repComplete
|
||||
);
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"Error reading rep.json",
|
||||
err
|
||||
);
|
||||
folderGroup.repComplete = false;
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
Promise.resolve([])
|
||||
);
|
||||
|
||||
return { ...container, folders: groupedByFolder };
|
||||
})
|
||||
);
|
||||
|
||||
return containersWithHashes.length > 0
|
||||
? {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
containers: containersWithHashes,
|
||||
}
|
||||
: null;
|
||||
})
|
||||
);
|
||||
|
||||
data = data.filter(Boolean);
|
||||
|
||||
let userData = users
|
||||
.filter((user) => user.email && user.email.trim() !== "")
|
||||
.map((user) => ({
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
created: user.emailVerified?.toLocaleString("en-GB") || "",
|
||||
}));
|
||||
|
||||
let repCompleteCount = 0;
|
||||
data.forEach((user) => {
|
||||
user.containers.forEach((container) => {
|
||||
container.folders.forEach((folder) => {
|
||||
if (folder.repComplete === true) repCompleteCount++;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return { data, userData, repCompleteCount };
|
||||
}
|
||||
+28
-31
@@ -475,23 +475,26 @@ const Breadcrumbs = (props) => {
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{currentView.currentView.viewKey ==
|
||||
{(currentView.currentView.viewKey ||
|
||||
router.query.key) ==
|
||||
"awaitingSubmissionDetails" &&
|
||||
t(
|
||||
"myportal:awatitingsubmission-card-title"
|
||||
)}
|
||||
{currentView.currentView.viewKey ==
|
||||
"watchedCases" &&
|
||||
{(currentView.currentView.viewKey ||
|
||||
router.query.key) == "watchedCases" &&
|
||||
t("myportal:watchedcases-card-title")}
|
||||
{currentView.currentView.viewKey ==
|
||||
"myCases" &&
|
||||
{(currentView.currentView.viewKey ||
|
||||
router.query.key) == "myCases" &&
|
||||
t("myportal:mycases-card-title")}
|
||||
{currentView.currentView.viewKey ==
|
||||
{(currentView.currentView.viewKey ||
|
||||
router.query.key) ==
|
||||
"myRepresentations" &&
|
||||
t(
|
||||
"myportal:myrepresentations-card-title"
|
||||
)}
|
||||
{currentView.currentView.viewKey ==
|
||||
{(currentView.currentView.viewKey ||
|
||||
router.query.key) ==
|
||||
"mySubmittedReps" &&
|
||||
"Submitted representations"}
|
||||
</li>
|
||||
@@ -527,19 +530,13 @@ const Breadcrumbs = (props) => {
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale +
|
||||
"/searchresults?q=" +
|
||||
props.props.search
|
||||
.searchString
|
||||
: "/searchresults?q=" +
|
||||
props.props.search
|
||||
.searchString
|
||||
"/searchresults?q=" +
|
||||
props.props.search.searchString
|
||||
}
|
||||
onClick={() => {
|
||||
// spinnerState();
|
||||
router.back();
|
||||
}}
|
||||
// onClick={() => {
|
||||
// // spinnerState();
|
||||
// router.back();
|
||||
// }}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-search-results")}
|
||||
@@ -706,10 +703,10 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{props.props.currentView.caseReference
|
||||
.currentReference ||
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -793,10 +790,10 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{props.props.currentView.caseReference
|
||||
.currentReference ||
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -1057,10 +1054,10 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{props.props.currentView.caseReference
|
||||
.currentReference ||
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -27,6 +27,7 @@ const Case = (props) => {
|
||||
watchedCasesDetails={props.watchedCasesDetails}
|
||||
awaitingSubmission={props.awaitingSubmission}
|
||||
caseReference={props.caseReference}
|
||||
ticketnumber={props.ticketnumber}
|
||||
currentType={props.currentType}
|
||||
appealTypeID={props.appealTypeID}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
@@ -40,6 +41,7 @@ const Case = (props) => {
|
||||
docsOffline={props.props.docsOffline}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
showFilteredDocs={props.showFilteredDocs}
|
||||
showLoginCheck={props.showLoginCheck}
|
||||
/>
|
||||
{showRepresentations == true && (
|
||||
<RepresentationList
|
||||
|
||||
@@ -17,9 +17,11 @@ import {
|
||||
import { setCurrentPage } from "../../store/currentView/action";
|
||||
|
||||
import { setDocumentDetails } from "../../store/searchOutput/action";
|
||||
import DocumentLink from "../utils/downloads";
|
||||
import { useDownloadQueue } from "../utils/downloadmanager";
|
||||
|
||||
const DocumentDetails = (props) => {
|
||||
let { t } = useTranslation();
|
||||
let { t, lang } = useTranslation();
|
||||
const firstRender = useRef(false);
|
||||
const {
|
||||
incidentid,
|
||||
@@ -37,7 +39,7 @@ const DocumentDetails = (props) => {
|
||||
const { locale } = router;
|
||||
|
||||
var documentDetailsArr = documentDetailsObj || [];
|
||||
|
||||
const { startDownload, getStatus } = useDownloadQueue(3);
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
const [documentTypes, setDocumentTypes] = useState([{}]);
|
||||
const [selectedDocumentType, setSelectedDocumentType] = useState("all");
|
||||
@@ -416,7 +418,7 @@ const DocumentDetails = (props) => {
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
sanbox: {},
|
||||
eval: true,
|
||||
})
|
||||
: detailsObj[
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -504,7 +506,7 @@ const DocumentDetails = (props) => {
|
||||
</p>
|
||||
<div>
|
||||
<button onClick={clearCheckboxes}>
|
||||
Clear filter
|
||||
{t("search:clear-filter-button-label")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="govuk-checkboxes govuk-checkboxes--small">
|
||||
@@ -525,7 +527,10 @@ const DocumentDetails = (props) => {
|
||||
className="govuk-label-s govuk-checkboxes__label"
|
||||
htmlFor={"all" + "__" + 0}
|
||||
>
|
||||
All - (
|
||||
{router.locale == "cy"
|
||||
? "Pawb"
|
||||
: "All"}{" "}
|
||||
- (
|
||||
{documentTypes.reduce(
|
||||
(accumulator, currentItem) => {
|
||||
return (
|
||||
@@ -578,8 +583,8 @@ const DocumentDetails = (props) => {
|
||||
'$..[?(@ && @.value=="' +
|
||||
item.pinswg_isharedocumentlocationsLabel +
|
||||
'")].value_cy',
|
||||
jsonL: transLookup,
|
||||
sanbox: {},
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
})
|
||||
: item.pinswg_isharedocumentlocationsLabel ||
|
||||
t(
|
||||
@@ -605,7 +610,7 @@ const DocumentDetails = (props) => {
|
||||
setCurrentPage(1);
|
||||
}}
|
||||
>
|
||||
Filter documents
|
||||
{t("search:filter-documents-label")}
|
||||
</button>
|
||||
</div>
|
||||
{documentDetailsObj["@odata.count"] > 5 && (
|
||||
@@ -761,41 +766,63 @@ const DocumentDetails = (props) => {
|
||||
)}
|
||||
|
||||
{!ShowDocLinks ? (
|
||||
<Link
|
||||
scroll={false}
|
||||
href={
|
||||
detailsObj.pinswg_hashlink
|
||||
}
|
||||
key={key}
|
||||
onClick={() => {
|
||||
toggleDownLoadLink(
|
||||
key
|
||||
),
|
||||
sendGAEvent(
|
||||
"event",
|
||||
"DownloadedFile",
|
||||
{
|
||||
caseReference:
|
||||
props.caseReference,
|
||||
filename:
|
||||
detailsObj.pinswg_name,
|
||||
}
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-name-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_name"
|
||||
)
|
||||
? detailsObj.pinswg_name
|
||||
: ""}
|
||||
</Link>
|
||||
<>
|
||||
<DocumentLink
|
||||
key={
|
||||
detailsObj.pinswg_documentid
|
||||
}
|
||||
id={
|
||||
detailsObj.pinswg_documentid
|
||||
}
|
||||
detailsObj={
|
||||
detailsObj
|
||||
}
|
||||
caseReference={
|
||||
caseReference
|
||||
}
|
||||
startDownload={
|
||||
startDownload
|
||||
}
|
||||
getStatus={
|
||||
getStatus
|
||||
}
|
||||
/>
|
||||
{/* <Link
|
||||
scroll={false}
|
||||
href={
|
||||
detailsObj.pinswg_hashlink
|
||||
}
|
||||
key={key}
|
||||
onClick={() => {
|
||||
toggleDownLoadLink(
|
||||
key
|
||||
),
|
||||
sendGAEvent(
|
||||
"event",
|
||||
"DownloadedFile",
|
||||
{
|
||||
caseReference:
|
||||
props.caseReference,
|
||||
filename:
|
||||
detailsObj.pinswg_name,
|
||||
}
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-name-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_name"
|
||||
)
|
||||
? detailsObj.pinswg_name
|
||||
: ""}
|
||||
</Link> */}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span className="results-visually-hidden">
|
||||
@@ -1032,6 +1059,7 @@ const DocumentDetails = (props) => {
|
||||
orderByState,
|
||||
getDocumentTypes,
|
||||
getDocumentResults,
|
||||
lang,
|
||||
]);
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
|
||||
@@ -62,6 +62,7 @@ let MakeRepresentation = (props) => {
|
||||
showQuestionnaireSection,
|
||||
initialValues,
|
||||
setCurrentReference,
|
||||
ticketnumber,
|
||||
} = props;
|
||||
const formObj = props.props.form;
|
||||
let setCaseQueryObj = props[currentType] || {};
|
||||
@@ -268,7 +269,7 @@ let MakeRepresentation = (props) => {
|
||||
resultsObj = jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.ticketnumber=="' +
|
||||
currentView.caseReference.currentReference +
|
||||
currentView.caseReference.ticketnumber +
|
||||
'")]',
|
||||
json: setCaseResultsObj,
|
||||
eval: true,
|
||||
@@ -296,8 +297,8 @@ let MakeRepresentation = (props) => {
|
||||
})
|
||||
: jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.pinswg_name =="' +
|
||||
currentView.caseReference.currentReference +
|
||||
'$..[?(@ && @.ticketnumber =="' +
|
||||
currentView.caseReference.ticketnumber +
|
||||
'")]',
|
||||
json: setCaseDetailsObj,
|
||||
eval: true,
|
||||
@@ -458,6 +459,7 @@ let MakeRepresentation = (props) => {
|
||||
setSubmitBack={setSubmitBack}
|
||||
props={props}
|
||||
caseReference={caseReference}
|
||||
ticketnumber={ticketnumber}
|
||||
setRepFileName={setRepFileName}
|
||||
updateRepresentation={updateRepresentation}
|
||||
setSavingStatus={setSavingStatus}
|
||||
@@ -767,6 +769,26 @@ let MakeRepresentation = (props) => {
|
||||
return blobList;
|
||||
};
|
||||
|
||||
const buildAddressStr = (detailsObj) => {
|
||||
const toTitleCase = (str) =>
|
||||
str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
|
||||
|
||||
return [
|
||||
detailsObj?.pinswg_siteaddressline1 ||
|
||||
detailsObj?.pinswg_addressline1,
|
||||
detailsObj?.pinswg_siteaddressline2 ||
|
||||
detailsObj?.pinswg_addressline2,
|
||||
detailsObj?.pinswg_siteaddresstown ||
|
||||
detailsObj?.pinswg_addresstown,
|
||||
detailsObj?.pinswg_siteaddresspostcode ||
|
||||
detailsObj?.pinswg_postcode,
|
||||
detailsObj?.pinswg_siteaddresscounty ||
|
||||
detailsObj?.pinswg_addresscounty,
|
||||
]
|
||||
.filter((v) => !!v && v.trim()) // remove empty/whitespace-only values
|
||||
.map((v) => toTitleCase(v.trim())) // title-case each segment
|
||||
.join(" ");
|
||||
};
|
||||
const updateRepresentation = async (
|
||||
values,
|
||||
sendSavedEmail,
|
||||
@@ -807,19 +829,12 @@ let MakeRepresentation = (props) => {
|
||||
"lastname": props.props.accountDetails.accountDetails.lastname,
|
||||
"emailAddress":
|
||||
props.props.accountDetails.accountDetails.emailaddress1,
|
||||
"siteAddress":
|
||||
detailsObj.pinswg_siteaddressline1 +
|
||||
(detailsObj.pinswg_siteaddressline2 != null
|
||||
? " " + detailsObj.pinswg_siteaddressline2 + " "
|
||||
: " ") +
|
||||
detailsObj.pinswg_siteaddresstown +
|
||||
" " +
|
||||
detailsObj.pinswg_siteaddresspostcode,
|
||||
"siteAddress": buildAddressStr(detailsObj),
|
||||
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
||||
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
||||
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
||||
"pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode,
|
||||
"pinswg_lpareference": resultsObj.pinswg_lpareference,
|
||||
// "pinswg_lpareference": resultsObj.pinswg_lpareference,
|
||||
"_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"],
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
|
||||
detailsObj[
|
||||
@@ -945,7 +960,10 @@ let MakeRepresentation = (props) => {
|
||||
var detailsObj = {};
|
||||
|
||||
detailsObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
||||
path:
|
||||
'$..[?(@ && @.ticketnumber=="' +
|
||||
currentView.caseReference.ticketnumber +
|
||||
'")]',
|
||||
json: setCaseDetailsObj,
|
||||
eval: true,
|
||||
});
|
||||
@@ -974,16 +992,19 @@ let MakeRepresentation = (props) => {
|
||||
props.props.currentView.caseReference.currentReference,
|
||||
"casereference":
|
||||
props.props.currentView.caseReference.currentReference,
|
||||
"ticketnumber":
|
||||
props.props.currentView.caseReference.ticketnumber,
|
||||
"pinswg_questionnaireduedate":
|
||||
detailsObj.pinswg_questionnaireduedate,
|
||||
detailsObj?.pinswg_questionnaireduedate,
|
||||
"pinswg_endofrepresentationperiod":
|
||||
detailsObj.pinswg_endofrepresentationperiod,
|
||||
detailsObj?.pinswg_endofrepresentationperiod,
|
||||
"pinswg_applicationacceptedasvalid":
|
||||
detailsObj.pinswg_applicationacceptedasvalid,
|
||||
"pinswg_statementduedate": detailsObj.pinswg_statementduedate,
|
||||
"pinswg_statementsduedate": detailsObj.pinswg_statementsduedate,
|
||||
detailsObj?.pinswg_applicationacceptedasvalid,
|
||||
"pinswg_statementduedate": detailsObj?.pinswg_statementduedate,
|
||||
"pinswg_statementsduedate":
|
||||
detailsObj?.pinswg_statementsduedate,
|
||||
"pinswg_finalcommentsduedate":
|
||||
detailsObj.pinswg_finalcommentsduedate,
|
||||
detailsObj?.pinswg_finalcommentsduedate,
|
||||
"pinswg_name":
|
||||
props.props.currentView.caseReference.currentReference,
|
||||
"firstname":
|
||||
@@ -991,20 +1012,13 @@ let MakeRepresentation = (props) => {
|
||||
"lastname": props.props.accountDetails.accountDetails.lastname,
|
||||
"emailAddress":
|
||||
props.props.accountDetails.accountDetails.emailaddress1,
|
||||
"siteAddress":
|
||||
detailsObj.pinswg_siteaddressline1 +
|
||||
(detailsObj.pinswg_siteaddressline2 != null
|
||||
? " " + detailsObj.pinswg_siteaddressline2 + " "
|
||||
: " ") +
|
||||
detailsObj.pinswg_siteaddresstown +
|
||||
" " +
|
||||
detailsObj.pinswg_siteaddresspostcode,
|
||||
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
||||
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
||||
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
||||
"siteAddress": buildAddressStr(detailsObj),
|
||||
"pinswg_siteaddressline1": detailsObj?.pinswg_siteaddressline1,
|
||||
"pinswg_siteaddressline2": detailsObj?.pinswg_siteaddressline2,
|
||||
"pinswg_siteaddresstown": detailsObj?.pinswg_siteaddresstown,
|
||||
"pinswg_siteaddresspostcode":
|
||||
detailsObj.pinswg_siteaddresspostcode,
|
||||
"pinswg_lpareference": resultsObj.pinswg_lpareference,
|
||||
detailsObj?.pinswg_siteaddresspostcode,
|
||||
"pinswg_lpareference": resultsObj?.pinswg_lpareference || "",
|
||||
"_pinswg_appellant_value":
|
||||
detailsObj["_pinswg_appellant_value"],
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
|
||||
@@ -1068,7 +1082,7 @@ let MakeRepresentation = (props) => {
|
||||
console.log("has errors:", props.invalid);
|
||||
Object.assign(values, {
|
||||
"locale": router.locale,
|
||||
"repComplete": currentView.caseReference.currentReference,
|
||||
"repComplete": currentView.caseReference.ticketnumber,
|
||||
});
|
||||
props.invalid == false &&
|
||||
updateRepresentation(values, false, false);
|
||||
@@ -1169,7 +1183,9 @@ let MakeRepresentation = (props) => {
|
||||
dataObj,
|
||||
[{}],
|
||||
values.containerID,
|
||||
props.caseReference + "/" + dataObj.repfile_name
|
||||
props.props.currentView.caseReference.ticketnumber +
|
||||
"/" +
|
||||
dataObj.repfile_name
|
||||
).then((data) => {
|
||||
return data;
|
||||
});
|
||||
|
||||
@@ -196,7 +196,8 @@ const RepAgent = (props) => {
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={
|
||||
props.props.caseReference
|
||||
props.currentView.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
|
||||
@@ -188,7 +188,10 @@ const RepAppellant = (props) => {
|
||||
label={t(
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={props.props.caseReference}
|
||||
ticketnumber={
|
||||
props.currentView.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
props.currentView.fileList
|
||||
|
||||
@@ -35,6 +35,9 @@ let RepCapacitySelection = (props) => {
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
caseReference={props.props.caseReference}
|
||||
ticketnumber={
|
||||
props.props.currentView.caseReference.ticketnumber
|
||||
}
|
||||
searchResultsObj={props.props.searchResultsObj}
|
||||
myRepresentations={props.props.myRepresentations}
|
||||
props={props}
|
||||
|
||||
@@ -36,9 +36,17 @@ const RepComplete = (props) => {
|
||||
</li>
|
||||
));
|
||||
|
||||
const isSIPS =
|
||||
props.props.currentView.caseReference.appealType === 846040002;
|
||||
|
||||
useEffect(() => {
|
||||
const reference = "PEDW-REPRESENTATION-COMPLETE";
|
||||
const templateId = "c49785e7-3217-40b6-b33f-dffc4e58d5c1";
|
||||
const reference = isSIPS
|
||||
? "PEDW-CONSULTATION-COMPLETE"
|
||||
: "PEDW-REPRESENTATION-COMPLETE";
|
||||
const templateId = isSIPS
|
||||
? "c3f373ca-df9d-4967-bea0-3ad3a57f8dcc"
|
||||
: "c49785e7-3217-40b6-b33f-dffc4e58d5c1";
|
||||
|
||||
const emailAddress =
|
||||
props.props.props.props.accountDetails.accountDetails.emailaddress1;
|
||||
const personalisation = {
|
||||
@@ -57,7 +65,7 @@ const RepComplete = (props) => {
|
||||
),
|
||||
sendRepCompleteMessage(
|
||||
props.props.props.props.accountDetails.containerID,
|
||||
props.props.currentView.caseReference.currentReference,
|
||||
props.props.currentView.caseReference.ticketnumber,
|
||||
props.repFormData.repfile_name
|
||||
),
|
||||
sendEmail(templateId, emailAddress, personalisation, reference),
|
||||
@@ -83,7 +91,8 @@ const RepComplete = (props) => {
|
||||
: props.props.currentView.caseReference
|
||||
.representationType,
|
||||
}),
|
||||
setRepresentationMessageSent(true));
|
||||
setRepresentationMessageSent(true)),
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
});
|
||||
return (
|
||||
<div id="rep-appellant">
|
||||
|
||||
@@ -10,7 +10,7 @@ const RepDetails = (props) => {
|
||||
|
||||
const { currentType, casesObj } = props;
|
||||
|
||||
let { caseReference } = props;
|
||||
let { caseReference, ticketnumber } = props;
|
||||
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
@@ -29,7 +29,7 @@ const RepDetails = (props) => {
|
||||
: caseReference;
|
||||
|
||||
detailsObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
||||
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||
json: setCaseDetailsObj,
|
||||
eval: true,
|
||||
});
|
||||
|
||||
@@ -939,10 +939,6 @@ export const RenderFileUpload = (field) => {
|
||||
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":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "image/png":
|
||||
@@ -1091,7 +1087,6 @@ export const RenderFileUpload = (field) => {
|
||||
[".docx"],
|
||||
"image/tiff": [".tif", ".tiff"],
|
||||
"image/jpeg": [".jpg", ".jpeg"],
|
||||
"application/zip": [".zip"],
|
||||
"image/png": [".png"],
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||
[".xlsx"],
|
||||
@@ -1338,7 +1333,7 @@ export const RenderFileUpload = (field) => {
|
||||
?.values?.repfile_name
|
||||
) +
|
||||
"&blobname=" +
|
||||
blob.name +
|
||||
encodeURIComponent(blob.name) +
|
||||
blob.hashedfilepath
|
||||
}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
|
||||
|
||||
@@ -188,7 +188,8 @@ const RepInterestedPartyPerson = (props) => {
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={
|
||||
props.props.caseReference
|
||||
props.currentView.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
|
||||
@@ -353,7 +353,7 @@ let RepLPA = (props) => {
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={
|
||||
props.props.caseReference
|
||||
props.currentView.caseReference.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
|
||||
@@ -34,6 +34,7 @@ let RepLPACapacitySelection = (props) => {
|
||||
casesObj={casesObj}
|
||||
detailsObj={detailsObj}
|
||||
caseReference={props.props.caseReference}
|
||||
ticketnumber={props.props.ticketnumber}
|
||||
searchResultsObj={props.props.searchResultsObj}
|
||||
props={props.props}
|
||||
/>{" "}
|
||||
|
||||
@@ -8,7 +8,7 @@ const RepLPADetails = (props) => {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { currentType, casesObj, caseReference } = props;
|
||||
const { currentType, casesObj, caseReference, ticketnumber } = props;
|
||||
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
@@ -21,7 +21,7 @@ const RepLPADetails = (props) => {
|
||||
var detailsObj = {};
|
||||
|
||||
detailsObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
||||
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||
json: setCaseDetailsObj,
|
||||
eval: true,
|
||||
});
|
||||
|
||||
@@ -84,7 +84,10 @@ const RepLandOwner = (props) => {
|
||||
label={t(
|
||||
"myrepresentations:add-files-label"
|
||||
)}
|
||||
ticketnumber={props.props.caseReference}
|
||||
ticketnumber={
|
||||
props.currentView.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={[]}
|
||||
setFilesForRepresentation={[]}
|
||||
|
||||
+4
-1
@@ -1213,7 +1213,10 @@ let Enforcement_Questionnaire = (props) => {
|
||||
name={"representationDocuments"}
|
||||
id={"representationDocuments"}
|
||||
label={t("myrepresentations:add-files-label")}
|
||||
ticketnumber={props.props.props.caseReference}
|
||||
ticketnumber={
|
||||
props.props.currentView.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
props.currentView.fileList
|
||||
|
||||
+4
-1
@@ -1022,7 +1022,10 @@ let S78_Questionnaire = (props) => {
|
||||
name={"representationDocuments"}
|
||||
id={"representationDocuments"}
|
||||
label={t("myrepresentations:add-files-label")}
|
||||
ticketnumber={props.props.props.caseReference}
|
||||
ticketnumber={
|
||||
props.props.currentView.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
hint={"sdsd"}
|
||||
fileList={
|
||||
props.currentView.fileList
|
||||
|
||||
+243
-155
@@ -85,10 +85,13 @@ const CaseSummary = (props) => {
|
||||
currentView,
|
||||
messagesObj,
|
||||
docsOffline,
|
||||
ticketnumber,
|
||||
} = props;
|
||||
|
||||
const showLoginCheck =
|
||||
currentType == "directResultsObj" ? "true" : currentView.showLogin;
|
||||
// const showLoginCheck =
|
||||
// currentType == "directResultsObj" ? "true" : currentView.showLogin;
|
||||
|
||||
let showLoginCheck = props.showLoginCheck;
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
@@ -110,6 +113,38 @@ const CaseSummary = (props) => {
|
||||
? true
|
||||
: false;
|
||||
|
||||
let ShowDocLinks = false;
|
||||
let checkShowDocLinks = docsOffline != false ? true : false;
|
||||
|
||||
const getDocLink = (docsOffline) => {
|
||||
var startTime = docsOffline.split(",")[0];
|
||||
var endTime = docsOffline.split(",")[1];
|
||||
|
||||
// console.log(startTime);
|
||||
// console.log(endTime);
|
||||
|
||||
var currentDate = new Date();
|
||||
|
||||
var startDate = new Date(currentDate.getTime());
|
||||
startDate.setHours(startTime.split(":")[0]);
|
||||
startDate.setMinutes(startTime.split(":")[1]);
|
||||
startDate.setSeconds(startTime.split(":")[2]);
|
||||
|
||||
var endDate = new Date(currentDate.getTime());
|
||||
endDate.setHours(endTime.split(":")[0]);
|
||||
endDate.setMinutes(endTime.split(":")[1]);
|
||||
endDate.setSeconds(endTime.split(":")[2]);
|
||||
|
||||
// console.log(startDate);
|
||||
// console.log(endDate);
|
||||
// console.log(currentDate);
|
||||
|
||||
var valid = startDate < currentDate && endDate > currentDate;
|
||||
ShowDocLinks = valid;
|
||||
};
|
||||
|
||||
checkShowDocLinks && getDocLink(docsOffline);
|
||||
|
||||
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
||||
let updateBody = {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
@@ -121,14 +156,14 @@ const CaseSummary = (props) => {
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(loggedInUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
(setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
setCaseInvolvment(incidentid, loggedInUser);
|
||||
//setCaseInvolvment(incidentid, loggedInUser);
|
||||
};
|
||||
|
||||
const isWatchedCase = (whichIncident) => {
|
||||
@@ -151,12 +186,12 @@ const CaseSummary = (props) => {
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
(setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
},
|
||||
));
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -176,33 +211,33 @@ const CaseSummary = (props) => {
|
||||
|
||||
currentType == "searchResultsObj"
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.title=="' + caseReference + '")]',
|
||||
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||
json: searchResultsObj,
|
||||
eval: true,
|
||||
}))
|
||||
: currentType == "watchedCases"
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}))
|
||||
: currentType == "myCases"
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}))
|
||||
: currentType == "directResultsObj"
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.ticketnumber=="' + caseReference + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}))
|
||||
: (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.reference=="' + caseReference + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}));
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}))
|
||||
: currentType == "myCases"
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}))
|
||||
: currentType == "directResultsObj"
|
||||
? (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}))
|
||||
: (casesObj = jsonpath({
|
||||
path: '$..[?(@ && @.reference=="' + caseReference + '")]',
|
||||
json: setCaseQueryObj,
|
||||
eval: true,
|
||||
}));
|
||||
|
||||
casesObj = Object.assign({}, ...casesObj);
|
||||
|
||||
@@ -215,12 +250,12 @@ const CaseSummary = (props) => {
|
||||
eval: true,
|
||||
}))
|
||||
: currentType == "directResultsObj"
|
||||
? (detailsObj = setCaseDetailsObj[0].value[0])
|
||||
: (detailsObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
||||
jsopn: setCaseDetailsObj,
|
||||
eval: true,
|
||||
}));
|
||||
? (detailsObj = setCaseDetailsObj[0].value[0])
|
||||
: (detailsObj = jsonpath({
|
||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
||||
jsopn: setCaseDetailsObj,
|
||||
eval: true,
|
||||
}));
|
||||
|
||||
detailsObj = typeof detailsObj == "object" ? detailsObj : detailsObj[0];
|
||||
|
||||
@@ -248,10 +283,10 @@ const CaseSummary = (props) => {
|
||||
{currentType == "searchResultsObj"
|
||||
? detailsObj.pinswg_name
|
||||
: currentType == "directResultsObj"
|
||||
? casesObj.title
|
||||
: currentType == "watchedCases"
|
||||
? casesObj.pinswg_title
|
||||
: casesObj.reference}
|
||||
? casesObj.title
|
||||
: currentType == "watchedCases"
|
||||
? casesObj.pinswg_title
|
||||
: casesObj.reference}
|
||||
</h1>
|
||||
{props.messagesObj["@odata.count"] > 0 && (
|
||||
<CaseNoticeBanner messagesObj={props.messagesObj} />
|
||||
@@ -259,14 +294,22 @@ const CaseSummary = (props) => {
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{getFormCollectionByID(appealTypeID)
|
||||
.PrimaryIdAttribute == "pinswg_dnsid"
|
||||
{getFormCollectionByID(
|
||||
appealTypeID ||
|
||||
setCaseQueryObj.value[0]
|
||||
.pinswg_appealcasetype,
|
||||
).PrimaryIdAttribute == "pinswg_dnsid"
|
||||
? t("case:summary-applicantonly-label")
|
||||
: getFormCollectionByID(appealTypeID)
|
||||
.PrimaryIdAttribute ==
|
||||
"pinswg_nonvalidationid"
|
||||
? t("case:summary-appellantonly-label")
|
||||
: t("case:summary-applicant-label")}
|
||||
: getFormCollectionByID(
|
||||
appealTypeID ||
|
||||
setCaseQueryObj.value[0]
|
||||
.pinswg_appealcasetype,
|
||||
).PrimaryIdAttribute ==
|
||||
"pinswg_nonvalidationid"
|
||||
? t(
|
||||
"case:summary-appellantonly-label",
|
||||
)
|
||||
: t("case:summary-applicant-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.pinswg_appellantagent == 846040001
|
||||
@@ -281,7 +324,7 @@ const CaseSummary = (props) => {
|
||||
{detailsObj.pinswg_agentcontactname != null &&
|
||||
(_.has(
|
||||
detailsObj,
|
||||
"pinswg_agentcontactname"
|
||||
"pinswg_agentcontactname",
|
||||
) ? (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
@@ -290,7 +333,7 @@ const CaseSummary = (props) => {
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_agentcontactname"
|
||||
"pinswg_agentcontactname",
|
||||
)
|
||||
? detailsObj.pinswg_agentcontactname
|
||||
: ""}
|
||||
@@ -304,44 +347,47 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-site-address-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{getFormCollectionByID(appealTypeID)
|
||||
.PrimaryIdAttribute == "pinswg_dnsid"
|
||||
{getFormCollectionByID(
|
||||
appealTypeID ||
|
||||
setCaseQueryObj.value[0]
|
||||
.pinswg_appealcasetype,
|
||||
).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]
|
||||
? detailsObj.pinswg_projectlocation.split(
|
||||
";",
|
||||
)[1]
|
||||
: detailsObj.pinswg_projectlocation.split(
|
||||
";",
|
||||
)[0]
|
||||
: ""
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
"pinswg_siteaddressline1",
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
"pinswg_siteaddressline1",
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline2"
|
||||
"pinswg_siteaddressline2",
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline2"
|
||||
"pinswg_siteaddressline2",
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddressline2 !=
|
||||
null && <br />}
|
||||
@@ -350,25 +396,25 @@ const CaseSummary = (props) => {
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresstown"
|
||||
"pinswg_siteaddresstown",
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddresstown !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresscounty"
|
||||
"pinswg_siteaddresscounty",
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresscounty"
|
||||
"pinswg_siteaddresscounty",
|
||||
) &&
|
||||
detailsObj.pinswg_siteaddresscounty !=
|
||||
null && <br />}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddresspostcode"
|
||||
"pinswg_siteaddresspostcode",
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
@@ -383,10 +429,12 @@ const CaseSummary = (props) => {
|
||||
{casesObj.description.indexOf(";") < 0
|
||||
? casesObj.description
|
||||
: router.locale == "cy"
|
||||
? casesObj.description.split(";")[1]
|
||||
: casesObj.description.split(
|
||||
";"
|
||||
)[0]}
|
||||
? casesObj.description.split(
|
||||
";",
|
||||
)[1]
|
||||
: casesObj.description.split(
|
||||
";",
|
||||
)[0]}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
@@ -411,7 +459,7 @@ const CaseSummary = (props) => {
|
||||
"pinswg_casestage@OData.Community.Display.V1.FormattedValue"
|
||||
] ||
|
||||
t(
|
||||
"case:summary-no-date-entered-label"
|
||||
"case:summary-no-date-entered-label",
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
@@ -438,51 +486,69 @@ const CaseSummary = (props) => {
|
||||
{(_.has(detailsObj, "pinswg_startdate") ||
|
||||
_.has(
|
||||
detailsObj,
|
||||
"pinswg_applicationacceptedasvalid"
|
||||
"pinswg_applicationacceptedasvalid",
|
||||
) ||
|
||||
_.has(
|
||||
detailsObj,
|
||||
"pinswg_startdates"
|
||||
"pinswg_startdates",
|
||||
)) &&
|
||||
showReps(
|
||||
detailsObj.pinswg_startdate ||
|
||||
detailsObj.pinswg_startdates ||
|
||||
detailsObj.pinswg_applicationacceptedasvalid,
|
||||
detailsObj.pinswg_finalcommentsduedate ||
|
||||
detailsObj.pinswg_endofrepresentationperiod
|
||||
detailsObj.pinswg_endofrepresentationperiod,
|
||||
) && (
|
||||
<>
|
||||
{showRepButton(
|
||||
props.currentView
|
||||
.caseReference
|
||||
.appealType
|
||||
.appealType,
|
||||
) ? (
|
||||
<>
|
||||
<Link
|
||||
href={{
|
||||
pathname:
|
||||
"/myportal/representation",
|
||||
query: {
|
||||
case:
|
||||
currentType ==
|
||||
"searchResultsObj"
|
||||
? detailsObj.pinswg_name
|
||||
: currentType ==
|
||||
"watchedCases"
|
||||
? casesObj.pinswg_title
|
||||
: currentType ==
|
||||
"directResultsObj"
|
||||
? detailsObj.pinswg_name
|
||||
: casesObj.reference,
|
||||
},
|
||||
}}
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</Link>
|
||||
|
||||
{ShowDocLinks ? (
|
||||
<div className="govuk-warning-text ">
|
||||
<span
|
||||
className="govuk-warning-text__icon"
|
||||
aria-hidden="true"
|
||||
>
|
||||
!
|
||||
</span>
|
||||
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||
<span className="govuk-visually-hidden">
|
||||
Notice
|
||||
</span>
|
||||
{t(
|
||||
"case:docsoffline-reps-label",
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
href={{
|
||||
pathname:
|
||||
"/myportal/representation",
|
||||
query: {
|
||||
case:
|
||||
currentType ==
|
||||
"searchResultsObj"
|
||||
? detailsObj.ticketnumber
|
||||
: currentType ==
|
||||
"watchedCases"
|
||||
? casesObj.pinswg_title
|
||||
: currentType ==
|
||||
"directResultsObj"
|
||||
? detailsObj.ticketnumber
|
||||
: casesObj.reference,
|
||||
},
|
||||
}}
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label",
|
||||
)}
|
||||
</Link>
|
||||
)}
|
||||
<a
|
||||
onClick={() => {
|
||||
//spinnerState();
|
||||
@@ -491,7 +557,7 @@ const CaseSummary = (props) => {
|
||||
className="govuk-button govuk-button--secondary"
|
||||
>
|
||||
{t(
|
||||
"case:summary-back-button-label"
|
||||
"case:summary-back-button-label",
|
||||
)}
|
||||
</a>
|
||||
</>
|
||||
@@ -511,7 +577,7 @@ const CaseSummary = (props) => {
|
||||
{
|
||||
startDate:
|
||||
formatDates(
|
||||
detailsObj.pinswg_startdate
|
||||
detailsObj.pinswg_startdate,
|
||||
),
|
||||
endDate:
|
||||
props
|
||||
@@ -520,27 +586,27 @@ const CaseSummary = (props) => {
|
||||
.appealType ==
|
||||
846040019
|
||||
? formatDates(
|
||||
detailsObj.pinswg_statementduedate
|
||||
detailsObj.pinswg_statementduedate,
|
||||
)
|
||||
: formatDates(
|
||||
detailsObj.pinswg_finalcommentsduedate
|
||||
detailsObj.pinswg_finalcommentsduedate,
|
||||
),
|
||||
}
|
||||
},
|
||||
)}
|
||||
<br />{" "}
|
||||
{t(
|
||||
"case:representation-date-passed-additional-label"
|
||||
"case:representation-date-passed-additional-label",
|
||||
)}{" "}
|
||||
<Link
|
||||
href={
|
||||
"mailto:" +
|
||||
t(
|
||||
"home:login-contact-email"
|
||||
"home:login-contact-email",
|
||||
)
|
||||
}
|
||||
>
|
||||
{t(
|
||||
"home:login-contact-email"
|
||||
"home:login-contact-email",
|
||||
)}
|
||||
</Link>
|
||||
</p>
|
||||
@@ -554,40 +620,40 @@ const CaseSummary = (props) => {
|
||||
{session &&
|
||||
(isWatchedCase(
|
||||
props.currentView.caseReference
|
||||
.incidentid
|
||||
.incidentid,
|
||||
).length >
|
||||
0 ==
|
||||
true ? (
|
||||
<button
|
||||
className="govuk-link watchCase"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
(confirm(
|
||||
t(
|
||||
"case:you-have-stopped-watching-label"
|
||||
"case:you-have-stopped-watching-label",
|
||||
) +
|
||||
props
|
||||
.currentView
|
||||
.caseReference
|
||||
.currentReference +
|
||||
"?"
|
||||
"?",
|
||||
) &&
|
||||
deleteItem(
|
||||
isWatchedCase(
|
||||
props
|
||||
.currentView
|
||||
.caseReference
|
||||
.incidentid
|
||||
.incidentid,
|
||||
)[0]
|
||||
.pinswg_watchlistid,
|
||||
|
||||
"watchedCases"
|
||||
"watchedCases",
|
||||
),
|
||||
setCurrentView({
|
||||
"viewName":
|
||||
"Watched Cases",
|
||||
"viewKey":
|
||||
"watchedCases",
|
||||
});
|
||||
}));
|
||||
setCurrentReference({
|
||||
"ticketnumber":
|
||||
props
|
||||
@@ -615,11 +681,11 @@ const CaseSummary = (props) => {
|
||||
});
|
||||
}}
|
||||
title={t(
|
||||
"case:stop-watching-case-link"
|
||||
"case:stop-watching-case-link",
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"case:stop-watching-case-link"
|
||||
"case:stop-watching-case-link",
|
||||
)}{" "}
|
||||
</button>
|
||||
) : (
|
||||
@@ -629,14 +695,14 @@ const CaseSummary = (props) => {
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:you-are-watching-label"
|
||||
"case:you-are-watching-label",
|
||||
) +
|
||||
" " +
|
||||
props
|
||||
.currentView
|
||||
.caseReference
|
||||
.currentReference +
|
||||
"?"
|
||||
"?",
|
||||
) &&
|
||||
selectWatchedCase(
|
||||
props
|
||||
@@ -649,12 +715,12 @@ const CaseSummary = (props) => {
|
||||
props
|
||||
.currentView
|
||||
.caseReference
|
||||
.appealType
|
||||
.appealType,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t(
|
||||
"case:watch-this-case-link"
|
||||
"case:watch-this-case-link",
|
||||
)}
|
||||
</button>
|
||||
{/* <button
|
||||
@@ -672,13 +738,13 @@ const CaseSummary = (props) => {
|
||||
<button
|
||||
className="govuk-link watchCase"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
(confirm(
|
||||
"Trying to watch case " +
|
||||
props
|
||||
.currentView
|
||||
.caseReference
|
||||
.currentReference +
|
||||
"\n\nYou will now be prompted to sign in"
|
||||
"\n\nYou will now be prompted to sign in",
|
||||
) &&
|
||||
// signIn("email", {
|
||||
// callbackUrl:
|
||||
@@ -696,23 +762,23 @@ const CaseSummary = (props) => {
|
||||
"searchResultsObj"
|
||||
? detailsObj.pinswg_name
|
||||
: currentType ==
|
||||
"directResultsObj"
|
||||
? casesObj.title
|
||||
: casesObj.reference,
|
||||
"directResultsObj"
|
||||
? casesObj.title
|
||||
: casesObj.reference,
|
||||
{
|
||||
path: "/",
|
||||
expires:
|
||||
expDate,
|
||||
}
|
||||
},
|
||||
),
|
||||
signIn();
|
||||
signIn());
|
||||
}}
|
||||
title={t(
|
||||
"case:watch-this-case-link"
|
||||
"case:watch-this-case-link",
|
||||
)}
|
||||
>
|
||||
{t(
|
||||
"case:watch-this-case-link"
|
||||
"case:watch-this-case-link",
|
||||
)}
|
||||
</button>
|
||||
{/* <button
|
||||
@@ -734,19 +800,19 @@ const CaseSummary = (props) => {
|
||||
null) &&
|
||||
showRepsEnded(
|
||||
detailsObj.pinswg_startdate,
|
||||
detailsObj.pinswg_finalcommentsduedate
|
||||
detailsObj.pinswg_finalcommentsduedate,
|
||||
) && (
|
||||
<div className="govuk-body">
|
||||
{t(
|
||||
"case:representation-period-ended-on-label"
|
||||
"case:representation-period-ended-on-label",
|
||||
)}
|
||||
{props.currentView.caseReference
|
||||
.appealType == 846040019
|
||||
? formatDates(
|
||||
detailsObj.pinswg_statementduedate
|
||||
detailsObj.pinswg_statementduedate,
|
||||
)
|
||||
: formatDates(
|
||||
detailsObj.pinswg_finalcommentsduedate
|
||||
detailsObj.pinswg_finalcommentsduedate,
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -757,7 +823,9 @@ const CaseSummary = (props) => {
|
||||
|
||||
{showSummary(casesObj, detailsObj)}
|
||||
<Documents
|
||||
incidentid={props.incidentid}
|
||||
incidentid={
|
||||
props.incidentid || setCaseQueryObj.value[0].incidentid
|
||||
}
|
||||
caseReference={props.caseReference}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
@@ -782,23 +850,40 @@ const CaseSummary = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{showLoginCheck == "true" && (
|
||||
{(showLoginCheck === "true" || showLoginCheck === true) && (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-button-group">
|
||||
{noRepresentationLink.includes(
|
||||
router.pathname
|
||||
router.pathname,
|
||||
) == true ? (
|
||||
""
|
||||
) : ShowDocLinks ? (
|
||||
<div className="govuk-warning-text ">
|
||||
<span
|
||||
className="govuk-warning-text__icon"
|
||||
aria-hidden="true"
|
||||
>
|
||||
!
|
||||
</span>
|
||||
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||
<span className="govuk-visually-hidden">
|
||||
Notice
|
||||
</span>
|
||||
{t("case:docsoffline-reps-label")}
|
||||
</strong>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
href="/representation"
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</Link>
|
||||
<div>
|
||||
<Link
|
||||
href="/representation"
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label",
|
||||
)}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<a
|
||||
@@ -818,8 +903,9 @@ const CaseSummary = (props) => {
|
||||
);
|
||||
|
||||
function showSummary(casesObj, detailsObj) {
|
||||
let appealIDObj =
|
||||
getFormCollectionByID(appealTypeID).PrimaryIdAttribute;
|
||||
let appealIDObj = getFormCollectionByID(
|
||||
appealTypeID || setCaseQueryObj.value[0].pinswg_appealcasetype,
|
||||
).PrimaryIdAttribute;
|
||||
|
||||
switch (appealIDObj) {
|
||||
case "pinswg_advertsid":
|
||||
@@ -1106,7 +1192,9 @@ const CaseSummary = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
const linkCaseObj = async () => {
|
||||
let docObj = await getLinkedCases(incidentid).then((data) => {
|
||||
let docObj = await getLinkedCases(
|
||||
incidentid || setCaseQueryObj.value[0].incidentid,
|
||||
).then((data) => {
|
||||
//console.log(data);
|
||||
setCurrentLinkedCases(data);
|
||||
return data;
|
||||
@@ -1204,7 +1292,7 @@ const CaseSummary = (props) => {
|
||||
? showReps(
|
||||
props.searchDetailsObj[0].value[0].pinswg_startdate,
|
||||
props.searchDetailsObj[0].value[0]
|
||||
.pinswg_finalcommentsduedate
|
||||
.pinswg_finalcommentsduedate,
|
||||
)
|
||||
: true;
|
||||
|
||||
@@ -1214,16 +1302,16 @@ const CaseSummary = (props) => {
|
||||
.pinswg_speacialistcaseprocess == 846040000 && isLPA
|
||||
? true
|
||||
: props.searchDetailsObj[0].value[0]
|
||||
.pinswg_speacialistcaseprocess == 846040001
|
||||
? true
|
||||
: false;
|
||||
.pinswg_speacialistcaseprocess == 846040001
|
||||
? true
|
||||
: false;
|
||||
|
||||
return shouldShow;
|
||||
|
||||
case 846040019:
|
||||
return showReps(
|
||||
props.searchDetailsObj[0].value[0].pinswg_startdate,
|
||||
props.searchDetailsObj[0].value[0].pinswg_statementduedate
|
||||
props.searchDetailsObj[0].value[0].pinswg_statementduedate,
|
||||
);
|
||||
|
||||
default:
|
||||
@@ -1243,7 +1331,7 @@ const CaseSummary = (props) => {
|
||||
selectWatchedCase(
|
||||
props.accountDetails.accountDetails.contactid,
|
||||
incidentid,
|
||||
appealTypeID
|
||||
appealTypeID,
|
||||
);
|
||||
destroyCookie({}, "pedwWatchCase", { path: "/" });
|
||||
}
|
||||
|
||||
@@ -129,7 +129,6 @@ const Pinswg_dnsid = (props) => {
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy',
|
||||
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
})
|
||||
|
||||
@@ -4,8 +4,14 @@ import CRMError from "./crmError";
|
||||
import DNSSearchResults from "./search/dnssearchresults";
|
||||
|
||||
export default function Search(props) {
|
||||
const { searchString, searchResultsObj, myportal, watchedCases, showMap } =
|
||||
props;
|
||||
const {
|
||||
searchString,
|
||||
searchResultsObj,
|
||||
myportal,
|
||||
watchedCases,
|
||||
showMap,
|
||||
showLoginCheck,
|
||||
} = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
@@ -41,6 +47,7 @@ export default function Search(props) {
|
||||
myportal={myportal}
|
||||
watchedCases={watchedCases}
|
||||
showMap={showMap}
|
||||
showLoginCheck={showLoginCheck}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1973,10 +1973,6 @@ const RenderFileUpload = (field) => {
|
||||
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":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "image/png":
|
||||
@@ -2145,7 +2141,6 @@ const RenderFileUpload = (field) => {
|
||||
[".docx"],
|
||||
"image/tiff": [".tif", ".tiff"],
|
||||
"image/jpeg": [".jpg", ".jpeg"],
|
||||
"application/zip": [".zip"],
|
||||
"image/png": [".png"],
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||
[".xlsx"],
|
||||
@@ -2383,9 +2378,9 @@ const RenderFileUpload = (field) => {
|
||||
"/api/file/downloadblob?container=" +
|
||||
field.containerID +
|
||||
"&casefolderID=" +
|
||||
field.ticketnumber +
|
||||
encodeURIComponent(field.ticketnumber) +
|
||||
"&blobname=" +
|
||||
blob.name +
|
||||
encodeURIComponent(blob.name) +
|
||||
blob.hashedfilepath
|
||||
}
|
||||
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
|
||||
|
||||
@@ -53,6 +53,7 @@ const Header = (props) => {
|
||||
"/myportal/advancedsearch",
|
||||
"/myportal/advancedsearchresults",
|
||||
"/myportal/case/[ticketnumber]",
|
||||
"/status",
|
||||
];
|
||||
|
||||
const hasContactLink = [
|
||||
@@ -73,14 +74,14 @@ const Header = (props) => {
|
||||
|
||||
const handleLogout = () => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
window.localStorage.clear(),
|
||||
(window.localStorage.clear(),
|
||||
destroyCookie(null, "next-auth.csrf-token", { path: "/" }),
|
||||
destroyCookie(null, "next-auth.callback-url", { path: "/" }),
|
||||
destroyCookie(null, "pedw_locale", { path: "/" }),
|
||||
destroyCookie(null, "pinsUser", { path: "/" }),
|
||||
signOut({
|
||||
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout",
|
||||
});
|
||||
}));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -242,7 +243,7 @@ const Header = (props) => {
|
||||
Object.keys(router.query)
|
||||
.map(
|
||||
(key) =>
|
||||
key + "=" + router.query[key]
|
||||
key + "=" + router.query[key],
|
||||
)
|
||||
.join("&")
|
||||
: router.pathname
|
||||
@@ -268,7 +269,7 @@ const Header = (props) => {
|
||||
locale == "en" ? "cy" : "en",
|
||||
{
|
||||
path: "/",
|
||||
}
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -7,11 +7,8 @@ export default function CaseComment() {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
return (
|
||||
<div className="card" id="casescomment-card">
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("home:casescomment-card-title")}
|
||||
</h3>
|
||||
<div id="casescomment-card">
|
||||
<div className="card-body card-body govuk-!-padding-top-4">
|
||||
<p className="govuk-body-s">
|
||||
{t("home:casescomment-card-paragraph-one")}{" "}
|
||||
<a
|
||||
@@ -21,9 +18,10 @@ export default function CaseComment() {
|
||||
{t("home:login-contact-email")}
|
||||
</a>
|
||||
</p>
|
||||
<p className="govuk-body-s">
|
||||
|
||||
{/* <p className="govuk-body-s">
|
||||
{t("home:casescomment-card-paragraph-two")}
|
||||
</p>
|
||||
</p> */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, reduxForm, SubmissionError } from "redux-form";
|
||||
import { sendGAEvent } from "@next/third-parties/google";
|
||||
import Dns from "./dns";
|
||||
|
||||
const required = (errorMsg) => (value) =>
|
||||
value || typeof value === "number" ? undefined : errorMsg;
|
||||
@@ -175,6 +176,7 @@ let CaseSearch = (props) => {
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
<Dns />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function Dns() {
|
||||
// : setShowSpinnerState(true);
|
||||
// };
|
||||
return (
|
||||
<div className="card" id="dns-card">
|
||||
<div id="dns-card">
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("home:dns-card-title")}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { connect } from "react-redux";
|
||||
import { parseCookies } from "nookies";
|
||||
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import CaseComment from "./casecomment";
|
||||
|
||||
const required = (errorMsg) => (value) =>
|
||||
value || typeof value === "number" ? undefined : errorMsg;
|
||||
@@ -71,51 +72,31 @@ let Login = (props) => {
|
||||
<>
|
||||
<div className="card" id="login-card">
|
||||
<div className="card-body active">
|
||||
<h3 className="heading-small card-heading">
|
||||
{/* {t("home:login-card-title")} */}
|
||||
{t("home:login-card-title-temp")}
|
||||
</h3>{" "}
|
||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||
<div className="govuk-body">
|
||||
{session && "Signed in as " + session.user?.email}
|
||||
</div>
|
||||
<br />
|
||||
|
||||
{!session && (
|
||||
<button
|
||||
className="govuk-button withChevron govuk-button-cta"
|
||||
type="button"
|
||||
onClick={
|
||||
() => signInButton()
|
||||
// signIn("email", {
|
||||
// callbackUrl:
|
||||
// (router.locale != "en"
|
||||
// ? "/cy"
|
||||
// : "") + "/",
|
||||
// })
|
||||
}
|
||||
>
|
||||
{t("home:login-via-nextuth-label")}
|
||||
</button>
|
||||
)}
|
||||
{session && (
|
||||
<button
|
||||
className="govuk-button"
|
||||
type="button"
|
||||
onClick={() => signOut()}
|
||||
>
|
||||
Magic Link Sign Out
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<h3 className="heading-mid card-heading">
|
||||
{t("home:signin-benefits-title")}
|
||||
</h3>
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-temp-1")}{" "}
|
||||
</p>
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-temp-1a")}{" "}
|
||||
{t("home:signin-benefits-paragraph")}
|
||||
</p>
|
||||
<ul className="cardList-nobullet">
|
||||
<li className="govuk-body-s">
|
||||
{" "}
|
||||
<strong>
|
||||
{" "}
|
||||
{t("home:login-card-title-temp")}{" "}
|
||||
</strong>{" "}
|
||||
{t("home:login-comingsoon-temp-1")}
|
||||
</li>
|
||||
<li>
|
||||
<strong>{t("home:casescomment-card-title")}</strong>{" "}
|
||||
{t("home:casescomment-card-paragraph-two")}
|
||||
</li>
|
||||
<li>
|
||||
<strong> {t("home:watch-case-card-title")}</strong>{" "}
|
||||
{t("home:watch-case-paragraph-one")}
|
||||
</li>
|
||||
</ul>
|
||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||
<hr className="govuk-!-margin-bottom-4" />
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-temp-2")}
|
||||
</p>
|
||||
@@ -172,10 +153,8 @@ let Login = (props) => {
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<br />
|
||||
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-email-link-label")}{" "}
|
||||
{t("home:casescomment-card-paragraph-one")}{" "}
|
||||
<a
|
||||
href={"mailto:" + t("home:login-contact-email")}
|
||||
className="govuk-link--no-underline"
|
||||
|
||||
+5
-14
@@ -22,20 +22,11 @@ const MainHome = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="flex-container grid-row govuk-body ">
|
||||
{showLogin != "true" && (
|
||||
<>
|
||||
<LoginSoon />
|
||||
<CaseSearch />
|
||||
</>
|
||||
)}
|
||||
{showLogin == "true" && (
|
||||
<>
|
||||
<CaseSearch />
|
||||
<Login session={session} siteurl={siteurl} />
|
||||
</>
|
||||
)}{" "}
|
||||
<CaseComment />
|
||||
<Dns />
|
||||
<CaseSearch />
|
||||
<Login session={session} siteurl={siteurl} />
|
||||
|
||||
{/* <CaseComment /> */}
|
||||
{/* <Dns /> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@ import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../data/lookuptranslations.json";
|
||||
|
||||
const MyPortal = (props) => {
|
||||
const { showFileUpload, showLoginCheck } = props;
|
||||
const { showFileUpload, showLoginCheck, docsOffline } = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
@@ -126,7 +126,9 @@ const MyPortal = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="flex-container grid-row govuk-body ">
|
||||
{!isLPA && <MakeNewAppeal />}
|
||||
{!isLPA && (
|
||||
<MakeNewAppeal docsOffline={docsOffline} />
|
||||
)}
|
||||
<SearchCases />
|
||||
{/* {props.awaitingSubmission.awaitingSubmission[
|
||||
"@odata.count"
|
||||
@@ -168,6 +170,7 @@ const MyPortal = (props) => {
|
||||
watchedCases={props.watchedCases}
|
||||
isLPA={isLPA}
|
||||
myReps={false}
|
||||
accountDetails={props.accountDetails}
|
||||
/>
|
||||
)}
|
||||
{props.myRepresentations.hasOwnProperty(
|
||||
|
||||
@@ -37,8 +37,8 @@ const AwaitingSubmission = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=awaitingSubmission"
|
||||
: "/myportal/viewall?key=awaitingSubmission"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -354,8 +354,8 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=awaitingSubmissionDetails"
|
||||
: "/myportal/viewall?key=awaitingSubmissionDetails"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -2,11 +2,46 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function MakeNewAppeal() {
|
||||
export default function MakeNewAppeal(props) {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const { docsOffline } = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
let ShowDocLinks = false;
|
||||
let checkShowDocLinks = docsOffline != false ? true : false;
|
||||
|
||||
const getDocLink = (docsOffline) => {
|
||||
var startTime = docsOffline.split(",")[0];
|
||||
var endTime = docsOffline.split(",")[1];
|
||||
|
||||
// console.log(startTime);
|
||||
// console.log(endTime);
|
||||
|
||||
var currentDate = new Date();
|
||||
|
||||
var startDate = new Date(currentDate.getTime());
|
||||
startDate.setHours(startTime.split(":")[0]);
|
||||
startDate.setMinutes(startTime.split(":")[1]);
|
||||
startDate.setSeconds(startTime.split(":")[2]);
|
||||
|
||||
var endDate = new Date(currentDate.getTime());
|
||||
endDate.setHours(endTime.split(":")[0]);
|
||||
endDate.setMinutes(endTime.split(":")[1]);
|
||||
endDate.setSeconds(endTime.split(":")[2]);
|
||||
|
||||
// console.log(startDate);
|
||||
// console.log(endDate);
|
||||
// console.log(currentDate);
|
||||
|
||||
var valid = startDate < currentDate && endDate > currentDate;
|
||||
ShowDocLinks = valid;
|
||||
};
|
||||
|
||||
console.log("docsOffline", docsOffline, getDocLink(docsOffline));
|
||||
|
||||
return (
|
||||
<div className="card" id="new-appeal-card">
|
||||
<div className="card-body">
|
||||
@@ -22,11 +57,29 @@ export default function MakeNewAppeal() {
|
||||
<p className="govuk-body-s">
|
||||
{t("myportal:makenewappeal-card-paragraph-two")}
|
||||
</p>
|
||||
<div>
|
||||
<Link href={"/newappeal"} className="govuk-button">
|
||||
{t("myportal:makenewappeal-card-button-label")}
|
||||
</Link>
|
||||
</div>
|
||||
{ShowDocLinks ? (
|
||||
<div className="govuk-warning-text ">
|
||||
<span
|
||||
className="govuk-warning-text__icon"
|
||||
aria-hidden="true"
|
||||
>
|
||||
!
|
||||
</span>
|
||||
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||
<span className="govuk-visually-hidden">
|
||||
Notice
|
||||
</span>
|
||||
{t("myportal:docsoffline-newappeal-label")}
|
||||
</strong>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<Link href={"/newappeal"} className="govuk-button">
|
||||
{t("myportal:makenewappeal-card-button-label")}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className="govuk-body-s govuk govuk-!-margin-top-5">
|
||||
{t("myportal:makenewappeal-card-paragraph-three")}
|
||||
</p>
|
||||
|
||||
@@ -32,8 +32,8 @@ const MyCases = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=myCases"
|
||||
: "/myportal/viewall?key=myCases"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -37,8 +37,8 @@ const MyRepresentations = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=myRepresentations"
|
||||
: "/myportal/viewall?key=myRepresentations"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -36,8 +36,8 @@ const MyRepresentations = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=myRepresentations"
|
||||
: "/myportal/viewall?key=myRepresentations"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -43,8 +43,8 @@ const MySubmittedReps = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=mySubmittedReps"
|
||||
: "/myportal/viewall?key=mySubmittedReps"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -43,6 +43,11 @@ const ServiceBanner = (props) => {
|
||||
{portalLogoLink.includes(router.pathname) ? (
|
||||
<Link href={"/myportal"}>
|
||||
<img
|
||||
className={
|
||||
router.locale == "cy"
|
||||
? "serviceTitle cy"
|
||||
: "serviceTitle"
|
||||
}
|
||||
src={
|
||||
router.locale == "cy"
|
||||
? "/assets/images/planning-casework-cy.svg"
|
||||
@@ -57,6 +62,11 @@ const ServiceBanner = (props) => {
|
||||
</Link>
|
||||
) : (
|
||||
<img
|
||||
className={
|
||||
router.locale == "cy"
|
||||
? "serviceTitle cy"
|
||||
: "serviceTitle"
|
||||
}
|
||||
src={
|
||||
router.locale == "cy"
|
||||
? "/assets/images/planning-casework-cy.svg"
|
||||
|
||||
@@ -114,13 +114,32 @@ const TopThree = (props) => {
|
||||
deleteWatchedCases(caseID)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
getWatchedCasesProxy(
|
||||
props.accountDetails.loggedinUserId
|
||||
).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
let filteredWatchedCases = showWatchedCases(data);
|
||||
|
||||
setWatchedCases(filteredWatchedCases),
|
||||
getDetailsProxy(
|
||||
filteredWatchedCases,
|
||||
"myWatchedCases"
|
||||
).then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -207,11 +226,11 @@ const TopThree = (props) => {
|
||||
showTopThreeArr[key].incidentid
|
||||
: router.locale == "cy"
|
||||
? "/fymhorth/achos/" +
|
||||
showTopThreeArr[key].pinswg_title +
|
||||
showTopThreeArr[key].ticketnumber +
|
||||
"?key=" +
|
||||
topThreeType
|
||||
: "/myportal/case/" +
|
||||
showTopThreeArr[key].pinswg_title +
|
||||
showTopThreeArr[key].ticketnumber +
|
||||
"?key=" +
|
||||
topThreeType
|
||||
}
|
||||
@@ -239,9 +258,8 @@ const TopThree = (props) => {
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
: showTopThreeArr[key]
|
||||
.ticketnumber,
|
||||
"currentType": topThreeType,
|
||||
|
||||
"incidentid": getIncidentId(
|
||||
@@ -255,15 +273,18 @@ const TopThree = (props) => {
|
||||
});
|
||||
}}
|
||||
>
|
||||
{topThreeType != "watchedCases"
|
||||
{showTopThreeArr[key].pinswg_title}
|
||||
{/* {topThreeType != "watchedCases"
|
||||
? topThreeType != "myRepresentations"
|
||||
? showTopThreeArr[key].ticketnumber
|
||||
? topThreeType == "mySubmittedReps"
|
||||
? showTopThreeArr[key].pinswg_title
|
||||
: showTopThreeArr[key].ticketnumber
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}{" "}
|
||||
]}{" "} */}
|
||||
</Link>
|
||||
)}
|
||||
{topThreeType == "watchedCases" && !props.myReps && (
|
||||
|
||||
@@ -193,21 +193,26 @@ const TopThree = (props) => {
|
||||
{showTopThreeArr[key].hasOwnProperty("repComplete") ? (
|
||||
<b>{showTopThreeArr[key].pinswg_name}</b>
|
||||
) : (
|
||||
<Link
|
||||
<span
|
||||
// href="#"
|
||||
href={{
|
||||
pathname:
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/representation"
|
||||
: "/myportal/representation",
|
||||
query: {
|
||||
case: showTopThreeArr[key].caseRef,
|
||||
state: "edit",
|
||||
created:
|
||||
showTopThreeArr[key].repfile_name,
|
||||
},
|
||||
}}
|
||||
// href={{
|
||||
// pathname:
|
||||
// router.locale == "cy"
|
||||
// ? "/fymhorth/representation"
|
||||
// : "/myportal/representation",
|
||||
// query: {
|
||||
// case: showTopThreeArr[key].ticketnumber,
|
||||
// state: "edit",
|
||||
// created:
|
||||
// showTopThreeArr[key].repfile_name,
|
||||
// },
|
||||
// }}
|
||||
className="govuk-link--no-underline"
|
||||
style={{
|
||||
color: "#0360a6",
|
||||
cursor: "pointer",
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
data-id={index}
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
@@ -223,10 +228,24 @@ const TopThree = (props) => {
|
||||
"repDetails": showTopThreeArr[key],
|
||||
});
|
||||
isLPA && setRepresentationCapacity("LPA");
|
||||
router.push({
|
||||
pathname:
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/representation"
|
||||
: "/myportal/representation",
|
||||
query: {
|
||||
case: showTopThreeArr[key]
|
||||
.ticketnumber,
|
||||
state: "edit",
|
||||
created:
|
||||
showTopThreeArr[key]
|
||||
.repfile_name,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{showTopThreeArr[key].pinswg_name}
|
||||
</Link>
|
||||
</span>
|
||||
)}
|
||||
{!showTopThreeArr[key].hasOwnProperty(
|
||||
"repComplete"
|
||||
@@ -234,13 +253,13 @@ const TopThree = (props) => {
|
||||
<div className="deleteCase">
|
||||
<button
|
||||
title={t(
|
||||
"case:do-you-want-to-delete-case-label"
|
||||
"case:do-you-want-to-delete-rep-label"
|
||||
)}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:do-you-want-to-delete-case-label"
|
||||
"case:do-you-want-to-delete-rep-label"
|
||||
) +
|
||||
showTopThreeArr[key]
|
||||
.pinswg_name +
|
||||
@@ -253,7 +272,7 @@ const TopThree = (props) => {
|
||||
props.accountDetails
|
||||
.containerID,
|
||||
showTopThreeArr[key]
|
||||
.pinswg_name,
|
||||
.ticketnumber,
|
||||
showTopThreeArr[key]
|
||||
.repfile_name
|
||||
);
|
||||
|
||||
+139
-103
@@ -36,6 +36,8 @@ import {
|
||||
setMyRepresentationsDetails,
|
||||
} from "../../store/myRepresentations/action";
|
||||
|
||||
import RepsOnResults from "../search/repsonresults";
|
||||
|
||||
const ViewAllResults = (props) => {
|
||||
const {
|
||||
searchString,
|
||||
@@ -74,19 +76,23 @@ const ViewAllResults = (props) => {
|
||||
return dateObj.toLocaleString();
|
||||
};
|
||||
|
||||
let currentView = props.currentView.currentView;
|
||||
//console.log("currentView.viewKey:", typeof currentView.viewKey);
|
||||
let viewKeyFromUrl = router.query.key;
|
||||
|
||||
// typeof currentView.viewKey == "undefined"
|
||||
let currentView = props.currentView.currentView;
|
||||
//console.log("currentViewKey:", typeof currentViewKey);
|
||||
|
||||
// typeof currentViewKey == "undefined"
|
||||
// ? console.log("no currentview")
|
||||
// : console.log("has currentview");
|
||||
|
||||
let currentViewKey = currentView.viewKey || viewKeyFromUrl;
|
||||
|
||||
var resultsArr =
|
||||
currentView.viewKey == "awaitingSubmissionDetails"
|
||||
currentViewKey == "awaitingSubmissionDetails"
|
||||
? props["awaitingSubmission"].awaitingSubmissionDetails.case
|
||||
: currentView.viewKey == "mySubmittedReps"
|
||||
? props[currentView.viewKey][currentView.viewKey]
|
||||
: props[currentView.viewKey][currentView.viewKey].value || [];
|
||||
: currentViewKey == "mySubmittedReps"
|
||||
? props[currentViewKey][currentViewKey]
|
||||
: props[currentViewKey][currentViewKey].value || [];
|
||||
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
||||
@@ -103,11 +109,11 @@ const ViewAllResults = (props) => {
|
||||
}
|
||||
|
||||
var searchDetailsObj =
|
||||
currentView.viewKey == "awaitingSubmissionDetails"
|
||||
currentViewKey == "awaitingSubmissionDetails"
|
||||
? props["awaitingSubmission"].awaitingSubmissionDetails.value
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
: currentViewKey == "myRepresentations"
|
||||
? props["myRepresentations"].myRepresentations.value
|
||||
: props[currentView.viewKey][currentView.viewKey + "Details"] || [];
|
||||
: props[currentViewKey][currentViewKey + "Details"] || [];
|
||||
|
||||
let resultsRowArr = [];
|
||||
const buildResultsRowArr = () => {
|
||||
@@ -115,15 +121,13 @@ const ViewAllResults = (props) => {
|
||||
let detailsObj = jsonpath({
|
||||
path:
|
||||
"$" +
|
||||
(currentView.viewKey == "myRepresentations"
|
||||
? ""
|
||||
: "..value") +
|
||||
(currentViewKey == "myRepresentations" ? "" : "..value") +
|
||||
'[?(@ && @.pinswg_name=="' +
|
||||
(currentView.viewKey == "awaitingSubmissionDetails"
|
||||
(currentViewKey == "awaitingSubmissionDetails"
|
||||
? item.title
|
||||
: currentView.viewKey == "watchedCases"
|
||||
: currentViewKey == "watchedCases"
|
||||
? item.ticketnumber
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
: currentViewKey == "myRepresentations"
|
||||
? item.pinswg_name
|
||||
: item.pinswg_title) +
|
||||
'")]',
|
||||
@@ -135,7 +139,7 @@ const ViewAllResults = (props) => {
|
||||
//console.log(searchDetailsObj[key]);
|
||||
|
||||
// searchDetailsObj[key] =
|
||||
// currentView.viewKey == "myRepresentations"
|
||||
// currentViewKey == "myRepresentations"
|
||||
// ? searchDetailsObj[key].value[0]
|
||||
// : searchDetailsObj[key];
|
||||
|
||||
@@ -143,7 +147,7 @@ const ViewAllResults = (props) => {
|
||||
resultsRowArr.push(
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
||||
{currentView.viewKey == "myCases" &&
|
||||
{currentViewKey == "myCases" &&
|
||||
resultsArr[key].pinswg_publishtoweb === false ? (
|
||||
<div className="cardModuleReference">
|
||||
{resultsArr[key].ticketnumber}{" "}
|
||||
@@ -153,8 +157,7 @@ const ViewAllResults = (props) => {
|
||||
<>
|
||||
<Link
|
||||
href={
|
||||
currentView.viewKey ==
|
||||
"myRepresentations"
|
||||
currentViewKey == "myRepresentations"
|
||||
? {
|
||||
pathname:
|
||||
"/myportal/representation",
|
||||
@@ -167,7 +170,7 @@ const ViewAllResults = (props) => {
|
||||
.repfile_name,
|
||||
},
|
||||
}
|
||||
: currentView.viewKey ==
|
||||
: currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? "/fymhorth/parhauigyflwyno"
|
||||
@@ -189,21 +192,25 @@ const ViewAllResults = (props) => {
|
||||
"&inid=" +
|
||||
resultsArr[key].incidentid +
|
||||
"&key=" +
|
||||
currentView.viewKey
|
||||
currentViewKey
|
||||
: router.locale == "cy"
|
||||
? myportal == true
|
||||
? "/fymhorth/achos"
|
||||
: "/achos"
|
||||
? "/fymhorth/achos" +
|
||||
resultsArr[key].ticketnumber +
|
||||
"?key=" +
|
||||
currentViewKey
|
||||
: "/achos" +
|
||||
resultsArr[key].ticketnumber
|
||||
: myportal == true
|
||||
? "/myportal/case/" +
|
||||
resultsArr[key].ticketnumber +
|
||||
"?key=" +
|
||||
currentView.viewKey
|
||||
currentViewKey
|
||||
: "/case/" +
|
||||
resultsArr[key].ticketnumber
|
||||
}
|
||||
onClick={() => {
|
||||
currentView.viewKey == "watchedCases" &&
|
||||
currentViewKey == "watchedCases" &&
|
||||
setSearchResults(
|
||||
props.watchedCases.watchedCases
|
||||
),
|
||||
@@ -216,9 +223,9 @@ const ViewAllResults = (props) => {
|
||||
resultsArr[key]
|
||||
.ticketnumber,
|
||||
"currentReference":
|
||||
currentView.viewKey !=
|
||||
currentViewKey !=
|
||||
"watchedCases"
|
||||
? currentView.viewKey ==
|
||||
? currentViewKey ==
|
||||
"myRepresentations"
|
||||
? resultsArr[key]
|
||||
.caseRef
|
||||
@@ -228,10 +235,9 @@ const ViewAllResults = (props) => {
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
|
||||
"currentType":
|
||||
currentView.viewKey,
|
||||
"currentType": currentViewKey,
|
||||
"incidentid":
|
||||
currentView.viewKey !=
|
||||
currentViewKey !=
|
||||
"watchedCases"
|
||||
? resultsArr[key]
|
||||
.incidentid
|
||||
@@ -243,14 +249,14 @@ const ViewAllResults = (props) => {
|
||||
resultsArr[key]
|
||||
.pinswg_appealcasetype,
|
||||
"repDetails":
|
||||
currentView.viewKey ==
|
||||
currentViewKey ==
|
||||
"myRepresentations" &&
|
||||
resultsArr[key],
|
||||
}),
|
||||
setCurrentView({
|
||||
"viewName":
|
||||
currentView.viewName,
|
||||
"viewKey": currentView.viewKey,
|
||||
"viewKey": currentViewKey,
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -260,16 +266,18 @@ const ViewAllResults = (props) => {
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{currentView.viewKey != "watchedCases"
|
||||
? currentView.viewKey ==
|
||||
"myRepresentations"
|
||||
{currentViewKey != "watchedCases"
|
||||
? currentViewKey == "myRepresentations"
|
||||
? resultsArr[key].caseRef
|
||||
: resultsArr[key].ticketnumber
|
||||
: currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? resultsArr[key].title
|
||||
: resultsArr[key].pinswg_title
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}
|
||||
</Link>
|
||||
{currentView.viewKey == "myRepresentations" && (
|
||||
{currentViewKey == "myRepresentations" && (
|
||||
<>
|
||||
<br />
|
||||
<span>
|
||||
@@ -277,6 +285,8 @@ const ViewAllResults = (props) => {
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
|
||||
<RepsOnResults detailsObj={resultsArr[key]} />
|
||||
</>
|
||||
)}
|
||||
</dd>
|
||||
@@ -285,14 +295,14 @@ const ViewAllResults = (props) => {
|
||||
{t("search:searchresults-site-address-label")}:
|
||||
</span>
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
|
||||
? searchDetailsObj[key].pinswg_siteaddressline1
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(searchDetailsObj[key].pinswg_siteaddressline1)
|
||||
? searchDetailsObj[key].value[0]
|
||||
.pinswg_siteaddressline1
|
||||
@@ -300,14 +310,14 @@ const ViewAllResults = (props) => {
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddressline1"
|
||||
) &&
|
||||
searchDetailsObj[key].pinswg_siteaddressline1 !=
|
||||
null && <br />}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(
|
||||
searchDetailsObj[key].pinswg_siteaddressline1
|
||||
) &&
|
||||
@@ -317,25 +327,25 @@ const ViewAllResults = (props) => {
|
||||
detailsObj.pinswg_siteaddressline1 != null && (
|
||||
<br />
|
||||
)}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
|
||||
? searchDetailsObj[key].pinswg_siteaddressline2
|
||||
: ""}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(searchDetailsObj[key].pinswg_siteaddressline1)
|
||||
? searchDetailsObj[key].pinswg_siteaddressline2
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddressline2"
|
||||
) &&
|
||||
searchDetailsObj[key].pinswg_siteaddressline2 !=
|
||||
null && <br />}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(
|
||||
searchDetailsObj[key].pinswg_siteaddressline2
|
||||
) &&
|
||||
@@ -345,25 +355,25 @@ const ViewAllResults = (props) => {
|
||||
detailsObj.pinswg_siteaddressline2 != null && (
|
||||
<br />
|
||||
)}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddresstown")
|
||||
? searchDetailsObj[key].pinswg_siteaddresstown
|
||||
: ""}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddresstown")
|
||||
? searchDetailsObj[key].pinswg_siteaddresstown
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown")
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddresstown"
|
||||
) &&
|
||||
searchDetailsObj[key].pinswg_siteaddresstown !=
|
||||
null && <br />}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddresstown"
|
||||
@@ -372,18 +382,18 @@ const ViewAllResults = (props) => {
|
||||
null && <br />}
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown") &&
|
||||
detailsObj.pinswg_siteaddresstown != null && <br />}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
|
||||
? searchDetailsObj[key].pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
|
||||
? searchDetailsObj[key].pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddresscounty")
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddresscounty"
|
||||
@@ -394,7 +404,7 @@ const ViewAllResults = (props) => {
|
||||
detailsObj.pinswg_siteaddresscounty != null && (
|
||||
<br />
|
||||
)}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddresspostcode"
|
||||
@@ -420,10 +430,9 @@ const ViewAllResults = (props) => {
|
||||
"pinswg_siteaddresspostcode",
|
||||
].map((field, idx) => {
|
||||
const isAwaitingSubmission =
|
||||
currentView.viewKey ===
|
||||
"awaitingSubmissionDetails";
|
||||
currentViewKey === "awaitingSubmissionDetails";
|
||||
const isMyRepresentations =
|
||||
currentView.viewKey === "myRepresentations";
|
||||
currentViewKey === "myRepresentations";
|
||||
const searchValue = _.get(
|
||||
searchDetailsObj,
|
||||
`${key}.${field}`
|
||||
@@ -451,11 +460,11 @@ const ViewAllResults = (props) => {
|
||||
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
{currentViewKey == "awaitingSubmissionDetails"
|
||||
? t("search:searchresults-created-on-label")
|
||||
: t("search:searchresults-applicant-label")}
|
||||
</span>
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
{currentViewKey == "awaitingSubmissionDetails"
|
||||
? formatDates(item.createdon)
|
||||
: _.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||
@@ -463,7 +472,7 @@ const ViewAllResults = (props) => {
|
||||
? detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
: currentViewKey == "myRepresentations"
|
||||
? searchDetailsObj[key][
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
@@ -475,7 +484,7 @@ const ViewAllResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-authority-label")}:
|
||||
</span>
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(resultsArr[key], "pinswg_lpaname")
|
||||
? router.locale == "cy"
|
||||
? jsonpath({
|
||||
@@ -520,7 +529,7 @@ const ViewAllResults = (props) => {
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
})
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
: currentViewKey == "myRepresentations"
|
||||
? searchDetailsObj[key].value
|
||||
: searchDetailsObj[key].value[0][
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -543,10 +552,10 @@ const ViewAllResults = (props) => {
|
||||
: resultsArr[key][
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
|
||||
] ||
|
||||
(currentView.viewKey == "myRepresentations"
|
||||
(currentViewKey == "myRepresentations"
|
||||
? ""
|
||||
: "N/A")
|
||||
: currentView.viewKey == "myRepresentations" &&
|
||||
: currentViewKey == "myRepresentations" &&
|
||||
router.locale == "cy" &&
|
||||
jsonpath({
|
||||
path:
|
||||
@@ -564,7 +573,7 @@ const ViewAllResults = (props) => {
|
||||
{t("search:searchresults-case-type-label")}:
|
||||
</span>
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
{currentViewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
@@ -593,11 +602,11 @@ const ViewAllResults = (props) => {
|
||||
: item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] ||
|
||||
(currentView.viewKey == "myRepresentations"
|
||||
(currentViewKey == "myRepresentations"
|
||||
? ""
|
||||
: "N/A")}
|
||||
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
(router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
@@ -619,13 +628,13 @@ const ViewAllResults = (props) => {
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{currentView.viewKey == "myRepresentations"
|
||||
{currentViewKey == "myRepresentations"
|
||||
? "Created"
|
||||
: t("search:searchresults-status-label")}
|
||||
:
|
||||
</span>
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
{currentViewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? jsonpath({
|
||||
path:
|
||||
@@ -643,7 +652,7 @@ const ViewAllResults = (props) => {
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
}) || "N/A"
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
: currentViewKey == "myRepresentations"
|
||||
? repRaisedDate(item.repfile_name) // ? router.locale == "cy"
|
||||
: // ? jsonpath({path:
|
||||
//
|
||||
@@ -681,13 +690,13 @@ const ViewAllResults = (props) => {
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
|
||||
{currentViewKey == "awaitingSubmissionDetails" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<button
|
||||
title={t(
|
||||
"case:do-you-want-to-delete-case-label"
|
||||
)}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
className=" cardModuleRemoveCase govuk-summary-list__actionLink"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
@@ -709,13 +718,13 @@ const ViewAllResults = (props) => {
|
||||
</button>
|
||||
</dd>
|
||||
)}
|
||||
{currentView.viewKey == "myRepresentations" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
|
||||
{currentViewKey == "myRepresentations" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<button
|
||||
title={t(
|
||||
"case:do-you-want-to-delete-case-label"
|
||||
"case:do-you-want-to-delete-rep-label"
|
||||
)}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
className=" cardModuleRemoveCase govuk-summary-list__actionLink "
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
@@ -739,13 +748,13 @@ const ViewAllResults = (props) => {
|
||||
</dd>
|
||||
)}
|
||||
|
||||
{currentView.viewKey == "watchedCases" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
|
||||
{currentViewKey == "watchedCases" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
<button
|
||||
title={t(
|
||||
"case:do-you-want-to-delete-case-label"
|
||||
"case:you-have-stopped-watching-label"
|
||||
)}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
className=" cardModuleRemoveCase govuk-summary-list__actionLink "
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
@@ -870,9 +879,31 @@ const ViewAllResults = (props) => {
|
||||
deleteWatchedCases(caseID)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases")
|
||||
console.log("in heree");
|
||||
getWatchedCasesProxy(
|
||||
props.accountDetails.loggedinUserId
|
||||
).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
let filteredWatchedCases = showWatchedCases(data);
|
||||
|
||||
setWatchedCases(filteredWatchedCases),
|
||||
getDetailsProxy(
|
||||
filteredWatchedCases,
|
||||
"myWatchedCases"
|
||||
)
|
||||
.then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
})
|
||||
@@ -891,15 +922,15 @@ const ViewAllResults = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
t("myportal:awatitingsubmission-card-title")}
|
||||
{currentView.viewKey == "watchedCases" &&
|
||||
{currentViewKey == "watchedCases" &&
|
||||
t("myportal:watchedcases-card-title")}
|
||||
{currentView.viewKey == "myCases" &&
|
||||
{currentViewKey == "myCases" &&
|
||||
t("myportal:mycases-card-title")}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
t("myportal:myrepresentations-card-title")}
|
||||
{currentView.viewKey == "mySubmittedReps" &&
|
||||
{currentViewKey == "mySubmittedReps" &&
|
||||
"Submitted representations"}
|
||||
</h1>
|
||||
|
||||
@@ -907,14 +938,13 @@ const ViewAllResults = (props) => {
|
||||
<h3>
|
||||
{" "}
|
||||
There are no{" "}
|
||||
{currentView.viewKey ==
|
||||
"awaitingSubmissionDetails" &&
|
||||
{currentViewKey == "awaitingSubmissionDetails" &&
|
||||
t("myportal:awatitingsubmission-card-title")}
|
||||
{currentView.viewKey == "watchedCases" &&
|
||||
{currentViewKey == "watchedCases" &&
|
||||
t("myportal:watchedcases-card-title")}
|
||||
{currentView.viewKey == "myCases" &&
|
||||
{currentViewKey == "myCases" &&
|
||||
t("myportal:mycases-card-title")}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
{currentViewKey == "myRepresentations" &&
|
||||
t("myportal:myrepresentations-card-title")}{" "}
|
||||
records
|
||||
</h3>
|
||||
@@ -926,7 +956,7 @@ const ViewAllResults = (props) => {
|
||||
type="button"
|
||||
onClick={() =>
|
||||
sortDataBy(
|
||||
currentView.viewKey ==
|
||||
currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? "title"
|
||||
: "pinswg_title"
|
||||
@@ -934,7 +964,7 @@ const ViewAllResults = (props) => {
|
||||
}
|
||||
className={
|
||||
orderByState ==
|
||||
(currentView.viewKey ==
|
||||
(currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? "title"
|
||||
: "pinswg_title")
|
||||
@@ -954,7 +984,7 @@ const ViewAllResults = (props) => {
|
||||
"search:searchresults-site-address-label"
|
||||
)}
|
||||
</dd>
|
||||
{currentView.viewKey ==
|
||||
{currentViewKey ==
|
||||
"awaitingSubmissionDetails" ? (
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
<button
|
||||
@@ -987,7 +1017,7 @@ const ViewAllResults = (props) => {
|
||||
type="button"
|
||||
onClick={() =>
|
||||
sortDataBy(
|
||||
currentView.viewKey ==
|
||||
currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? "pinswg_lpaname"
|
||||
: "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -995,7 +1025,7 @@ const ViewAllResults = (props) => {
|
||||
}
|
||||
className={
|
||||
orderByState ==
|
||||
(currentView.viewKey ==
|
||||
(currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? "pinswg_lpaname"
|
||||
: "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue")
|
||||
@@ -1011,7 +1041,7 @@ const ViewAllResults = (props) => {
|
||||
</button>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{currentView.viewKey !=
|
||||
{currentViewKey !=
|
||||
"awaitingSubmissionDetails" ? (
|
||||
<button
|
||||
type="button"
|
||||
@@ -1022,7 +1052,7 @@ const ViewAllResults = (props) => {
|
||||
}
|
||||
className={
|
||||
orderByState ==
|
||||
(currentView.viewKey ==
|
||||
(currentViewKey ==
|
||||
"awaitingSubmissionDetails"
|
||||
? "pinswg_lpaname"
|
||||
: "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue")
|
||||
@@ -1043,8 +1073,7 @@ const ViewAllResults = (props) => {
|
||||
)}{" "}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{currentView.viewKey ==
|
||||
"myRepresentations" ? (
|
||||
{currentViewKey == "myRepresentations" ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
@@ -1064,6 +1093,13 @@ const ViewAllResults = (props) => {
|
||||
t("search:searchresults-status-label")
|
||||
)}
|
||||
</dd>
|
||||
|
||||
{(currentViewKey == "watchedCases" ||
|
||||
currentViewKey ==
|
||||
"awaitingSubmissionDetails" ||
|
||||
currentViewKey == "myRepresentations") && (
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
|
||||
)}
|
||||
</div>
|
||||
{showSpinnerState == true ? (
|
||||
<div className="govuk-summary-list__row">
|
||||
|
||||
@@ -31,6 +31,7 @@ const WatchedCases = (props) => {
|
||||
currentView={props.currentView}
|
||||
myReps={props.myReps}
|
||||
props={props}
|
||||
accountDetails={props.accountDetails}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -43,8 +44,8 @@ const WatchedCases = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
"/fymhorth/gweldpopeth?key=watchedCases"
|
||||
: "/myportal/viewall?key=watchedCases"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -65,6 +65,7 @@ let CompleteAppeal = (props) => {
|
||||
console.log("patching///////////////");
|
||||
//
|
||||
//patchCase(incidentId);
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
}, [
|
||||
props.appealType.caseReference,
|
||||
props.props.form.appealForm.values,
|
||||
|
||||
@@ -22,6 +22,7 @@ const CaseRepresentation = (props) => {
|
||||
watchedCases={props.watchedCases}
|
||||
awaitingSubmission={props.awaitingSubmission}
|
||||
caseReference={props.caseReference}
|
||||
ticketnumber={props.ticketnumber}
|
||||
currentType={props.currentType}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
|
||||
@@ -247,8 +247,8 @@ const SearchResults = (props) => {
|
||||
resultsArrPaged.map((item, key) => {
|
||||
let detailsObj = jsonpath({
|
||||
path:
|
||||
'$..value[?(@ && @.pinswg_name=="' +
|
||||
item.pinswg_name +
|
||||
'$..value[?(@ && @.ticketnumber=="' +
|
||||
item.ticketnumber +
|
||||
'")]',
|
||||
|
||||
json: searchDetailsObj,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useCallback, useEffect, useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import PaginationControl from "./pagination";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
|
||||
import { getBasicDNSSearchPaged } from "../../actions";
|
||||
|
||||
@@ -31,6 +32,7 @@ import {
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
|
||||
import { signIn, useSession } from "next-auth/react";
|
||||
|
||||
const DNSSearchResults = (props) => {
|
||||
const {
|
||||
@@ -48,11 +50,13 @@ const DNSSearchResults = (props) => {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
showMap,
|
||||
showLoginCheck,
|
||||
} = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { data: session } = useSession();
|
||||
|
||||
var resultsArr = searchResultsObj.value || [];
|
||||
|
||||
@@ -143,7 +147,7 @@ const DNSSearchResults = (props) => {
|
||||
};
|
||||
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
|
||||
const cookies = parseCookies();
|
||||
@@ -299,8 +303,8 @@ const DNSSearchResults = (props) => {
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath({
|
||||
path:
|
||||
'$..value[?(@ && @.pinswg_name=="' +
|
||||
item.title +
|
||||
'$..[?(@ && @.ticketnumber=="' +
|
||||
item.ticketnumber +
|
||||
'")]',
|
||||
json: searchDetailsObj,
|
||||
eval: true,
|
||||
@@ -339,6 +343,8 @@ const DNSSearchResults = (props) => {
|
||||
"appealType":
|
||||
item.pinswg_appealcasetype,
|
||||
"showMap": showMap,
|
||||
"showLoginCheck":
|
||||
props.showLoginCheck,
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -350,6 +356,9 @@ const DNSSearchResults = (props) => {
|
||||
</span>
|
||||
{item.title}
|
||||
</Link>
|
||||
<RepsOnResults
|
||||
detailsObj={detailsObj}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
@@ -553,6 +562,51 @@ const DNSSearchResults = (props) => {
|
||||
)}
|
||||
</dd>
|
||||
)}
|
||||
|
||||
{(showLoginCheck == "true" ||
|
||||
showLoginCheck == true) &&
|
||||
!session && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-summary-list__action">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:watch-this-case-link"
|
||||
)}
|
||||
</span>
|
||||
<button
|
||||
className="govuk-summary-list__actionLink watchLink"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:trying-to-watch-case-label"
|
||||
) +
|
||||
item.title +
|
||||
"\n\n" +
|
||||
t(
|
||||
"case:trying-to-watch-case-redirect-label"
|
||||
)
|
||||
) &&
|
||||
// signIn("email");
|
||||
signIn(
|
||||
undefined,
|
||||
{
|
||||
callbackUrl:
|
||||
"/myportal/searchresults?q=" +
|
||||
searchString +
|
||||
"&toWatch=" +
|
||||
item.incidentid +
|
||||
"_" +
|
||||
item.pinswg_appealcasetype,
|
||||
}
|
||||
);
|
||||
}}
|
||||
title={t(
|
||||
"case:watch-this-case-link"
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</button>
|
||||
</dd>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
@@ -744,7 +798,14 @@ const DNSSearchResults = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{resultsArr.length > 0 ? (
|
||||
|
||||
{!searchLoaded ? (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h3>Loading...</h3>
|
||||
</div>
|
||||
</div>
|
||||
) : resultsArr.length > 0 ? (
|
||||
ResultsView(resultsArr)
|
||||
) : (
|
||||
<div className="govuk-grid-row">
|
||||
@@ -753,6 +814,16 @@ const DNSSearchResults = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* {resultsArr.length > 0 ? (
|
||||
ResultsView(resultsArr)
|
||||
) : (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h3>{t("search:searchresults-no-records-label")}</h3>
|
||||
</div>
|
||||
</div>
|
||||
)} */}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ const SearchResults = (props) => {
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||
const [loginToWatch, setLoginToWatch] = useState("true");
|
||||
|
||||
let spinnerState = () => {
|
||||
@@ -244,8 +244,8 @@ const SearchResults = (props) => {
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath({
|
||||
path:
|
||||
'$..value[?(@ && @.pinswg_name=="' +
|
||||
item.title +
|
||||
'$..[?(@ && @.ticketnumber=="' +
|
||||
item.ticketnumber +
|
||||
'")]',
|
||||
json: searchDetailsObj,
|
||||
eval: true,
|
||||
@@ -261,15 +261,15 @@ const SearchResults = (props) => {
|
||||
<div></div>
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
(router.locale == "cy"
|
||||
? myportal == true
|
||||
? "/fymhorth/achos"
|
||||
: "/achos"
|
||||
: myportal == true
|
||||
? "/myportal/case/" +
|
||||
item.ticketnumber
|
||||
: "/case/" +
|
||||
item.ticketnumber
|
||||
? "/myportal/case"
|
||||
: "/case") +
|
||||
"/" +
|
||||
item.ticketnumber
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
+98
-22
@@ -1,42 +1,118 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import router from "next/router";
|
||||
import Link from "next/link";
|
||||
import CaseNoticeBanner from "./case/caseNoticeBanner";
|
||||
|
||||
export default function ServiceBanner(props) {
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const showSigninFromEnv = false;
|
||||
const showNoticeFromEnv = true;
|
||||
|
||||
// keep backwards-compat with existing usage
|
||||
const showSignin = props?.noSignin === true ? false : showSigninFromEnv;
|
||||
|
||||
const signInButton = () => {
|
||||
router.push(
|
||||
`${
|
||||
router.locale == "cy" ? "/awd/mewngofnodi" : "/auth/signin"
|
||||
}?callbackUrl=${encodeURIComponent(
|
||||
window.location.href
|
||||
)}&error=EmailSignin`
|
||||
window.location.href,
|
||||
)}&error=EmailSignin`,
|
||||
);
|
||||
};
|
||||
return (
|
||||
<div className="servicebanner">
|
||||
<h1>
|
||||
<img
|
||||
className="govuk-!-margin-top-4"
|
||||
src={
|
||||
router.locale == "cy"
|
||||
? "/assets/images/planning-casework-cy.svg"
|
||||
: "/assets/images/planning-casework-en.svg"
|
||||
}
|
||||
alt="Planning casework"
|
||||
/>
|
||||
</h1>
|
||||
{props.noSignin != true && (
|
||||
<div className="serviceBanner_userDetails">
|
||||
<button
|
||||
onClick={() => signInButton()}
|
||||
className="govuk-header__link "
|
||||
<>
|
||||
<div className="servicebanner">
|
||||
<h1>
|
||||
<img
|
||||
className={
|
||||
router.locale == "cy"
|
||||
? "govuk-!-margin-top-4 serviceTitle cy"
|
||||
: "govuk-!-margin-top-4 serviceTitle"
|
||||
}
|
||||
src={
|
||||
router.locale == "cy"
|
||||
? "/assets/images/planning-casework-cy.svg"
|
||||
: "/assets/images/planning-casework-en.svg"
|
||||
}
|
||||
alt="Planning casework"
|
||||
/>
|
||||
</h1>
|
||||
|
||||
{showSignin && props.noSignin != true && (
|
||||
<div className="serviceBanner_userDetails">
|
||||
<button
|
||||
onClick={() => signInButton()}
|
||||
className="govuk-header__link "
|
||||
>
|
||||
{t("common:signin-label")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{showNoticeFromEnv && (
|
||||
<div>
|
||||
<div
|
||||
className="govuk-warning-text noticebanner govuk-!-margin-bottom-0"
|
||||
key={1}
|
||||
>
|
||||
{t("common:signin-label")}
|
||||
</button>
|
||||
<strong className="govuk-warning-text__text">
|
||||
<span className="govuk-visually-hidden">
|
||||
Announcement
|
||||
</span>
|
||||
</strong>
|
||||
<div>
|
||||
<div className=" govuk-body-s">
|
||||
<h2 className="govuk-heading-s">
|
||||
{router.locale == "cy"
|
||||
? "Cyhoeddiad"
|
||||
: "Announcement"}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="govuk-body-s">
|
||||
{router.locale == "cy" ? (
|
||||
<>
|
||||
<p>
|
||||
Oherwydd gwaith cynnal a chadw
|
||||
hanfodol, rydym yn disgwyl rhywfaint
|
||||
o darfu ar ein gwasanaethau Porth
|
||||
Gwaith Achos rhwng 9-13 Chwefror
|
||||
2026.{" "}
|
||||
</p>
|
||||
<p>
|
||||
Ymddiheurwn am yr anghyfleustra. Am
|
||||
ymholiadau brys yn ystod y cyfnod
|
||||
hwn, cysylltwch â{" "}
|
||||
<a href="mailto:pedw.gwaithachos@llyw.cymru">
|
||||
pedw.gwaithachos@llyw.cymru
|
||||
</a>
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
Due to essential maintenance, we are
|
||||
expecting some disruption to our
|
||||
Casework Portal services between
|
||||
9-13 February 2026.
|
||||
</p>
|
||||
<p>
|
||||
We apologise for the inconvenience.
|
||||
For urgent enquries during this time
|
||||
please contact{" "}
|
||||
<a href="mailto:pedw.casework@gov.wales">
|
||||
pedw.casework@gov.wales
|
||||
</a>
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { useState, useCallback } from "react";
|
||||
|
||||
export function useDownloadQueue(maxConcurrent = 3) {
|
||||
const [queue, setQueue] = useState([]); // queued tasks
|
||||
const [activeCount, setActiveCount] = useState(0);
|
||||
const [statuses, setStatuses] = useState({}); // { id: "idle"|"queued"|"downloading"|"done"|"failed" }
|
||||
|
||||
const scheduleNext = useCallback(() => {
|
||||
setQueue((queueCurr) => {
|
||||
if (activeCount >= maxConcurrent || queueCurr.length === 0)
|
||||
return queueCurr;
|
||||
|
||||
const [task, ...rest] = queueCurr;
|
||||
|
||||
setStatuses((s) => ({ ...s, [task.id]: "downloading" }));
|
||||
setActiveCount((c) => c + 1);
|
||||
|
||||
// Run the download fully in async IIFE
|
||||
(async () => {
|
||||
try {
|
||||
await task.downloadFn(); // triggers fetch + blob + <a> click
|
||||
setStatuses((s) => ({ ...s, [task.id]: "done" }));
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setStatuses((s) => ({ ...s, [task.id]: "failed" }));
|
||||
} finally {
|
||||
setActiveCount((c) => c - 1);
|
||||
scheduleNext(); // promote next in queue
|
||||
}
|
||||
})();
|
||||
|
||||
return rest;
|
||||
});
|
||||
}, [activeCount, maxConcurrent]);
|
||||
|
||||
const startDownload = useCallback(
|
||||
(id, downloadFn) => {
|
||||
setStatuses((s) => ({ ...s, [id]: "queued" }));
|
||||
setQueue((curr) => [...curr, { id, downloadFn }]);
|
||||
scheduleNext();
|
||||
},
|
||||
[scheduleNext]
|
||||
);
|
||||
|
||||
const getStatus = useCallback((id) => statuses[id] || "idle", [statuses]);
|
||||
|
||||
return { startDownload, getStatus };
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
// // import { useState } from "react";
|
||||
|
||||
// // export default function DocumentLink({ detailsObj, caseReference }) {
|
||||
// // const [downloadStatus, setDownloadStatus] = useState("");
|
||||
// // const [progress, setProgress] = useState(null);
|
||||
|
||||
// // const handleDownload = async () => {
|
||||
// // setDownloadStatus("Downloading");
|
||||
// // setProgress(0);
|
||||
|
||||
// // try {
|
||||
// // const res = await fetch(detailsObj.pinswg_hashlink);
|
||||
// // if (!res.ok) throw new Error("Download failed");
|
||||
|
||||
// // const contentDisposition = res.headers.get("content-disposition");
|
||||
// // const filename = contentDisposition
|
||||
// // ? contentDisposition.split("filename=")[1]
|
||||
// // : detailsObj.pinswg_name || "document";
|
||||
|
||||
// // const contentLength = res.headers.get("content-length");
|
||||
// // const totalBytes = contentLength
|
||||
// // ? parseInt(contentLength, 10)
|
||||
// // : null;
|
||||
|
||||
// // const reader = res.body.getReader();
|
||||
// // let receivedBytes = 0;
|
||||
// // const chunks = [];
|
||||
|
||||
// // while (true) {
|
||||
// // const { done, value } = await reader.read();
|
||||
// // if (done) break;
|
||||
|
||||
// // chunks.push(value);
|
||||
// // receivedBytes += value.length;
|
||||
|
||||
// // if (totalBytes) {
|
||||
// // const percent = Math.round(
|
||||
// // (receivedBytes / totalBytes) * 100
|
||||
// // );
|
||||
// // setProgress(percent);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // // Combine chunks into one blob
|
||||
// // const blob = new Blob(chunks);
|
||||
// // const url = window.URL.createObjectURL(blob);
|
||||
|
||||
// // const link = document.createElement("a");
|
||||
// // link.href = url;
|
||||
// // link.download = filename;
|
||||
// // document.body.appendChild(link);
|
||||
// // link.click();
|
||||
// // document.body.removeChild(link);
|
||||
|
||||
// // setDownloadStatus("Download complete!");
|
||||
// // setProgress(100);
|
||||
|
||||
// // // Fire GA event
|
||||
// // window.gtag?.("event", "DownloadedFile", {
|
||||
// // caseReference,
|
||||
// // filename,
|
||||
// // });
|
||||
// // } catch (err) {
|
||||
// // console.error(err);
|
||||
// // setDownloadStatus("Download failed");
|
||||
// // setProgress(null);
|
||||
// // }
|
||||
// // };
|
||||
|
||||
// // return (
|
||||
// // <>
|
||||
// // {detailsObj.pinswg_publishtoweb ? (
|
||||
// // <button className="documentLink" onClick={handleDownload}>
|
||||
// // <span className="results-visually-hidden">
|
||||
// // Document name:
|
||||
// // </span>
|
||||
// // {detailsObj.pinswg_name || ""}
|
||||
// // </button>
|
||||
// // ) : (
|
||||
// // <>
|
||||
// // <span className="results-visually-hidden">
|
||||
// // Document name:
|
||||
// // </span>
|
||||
// // {detailsObj.pinswg_name || ""}
|
||||
// // </>
|
||||
// // )}
|
||||
|
||||
// // {downloadStatus && (
|
||||
// // <p
|
||||
// // className={
|
||||
// // downloadStatus == "Downloading"
|
||||
// // ? "govuk-!-font-size-14 govuk-!-margin-left-0 textloading"
|
||||
// // : "govuk-!-font-size-14 govuk-!-margin-left-0 "
|
||||
// // }
|
||||
// // >
|
||||
// // {downloadStatus}
|
||||
// // {/* {progress !== null && ` (${progress}%)`} */}
|
||||
// // </p>
|
||||
// // )}
|
||||
// // </>
|
||||
// // );
|
||||
// // }
|
||||
// import { useState } from "react";
|
||||
|
||||
// export default function DocumentLink({
|
||||
// id,
|
||||
// detailsObj,
|
||||
// caseReference,
|
||||
// startDownload,
|
||||
// getStatus,
|
||||
// }) {
|
||||
// const [downloadStatus, setDownloadStatus] = useState("");
|
||||
// const [progress, setProgress] = useState(null);
|
||||
|
||||
// const downloadFile = async () => {
|
||||
// setDownloadStatus("Downloading");
|
||||
// setProgress(0);
|
||||
|
||||
// try {
|
||||
// const res = await fetch(detailsObj.pinswg_hashlink);
|
||||
// if (!res.ok) throw new Error("Download failed");
|
||||
|
||||
// const contentDisposition = res.headers.get("content-disposition");
|
||||
// const filename = contentDisposition
|
||||
// ? contentDisposition.split("filename=")[1]
|
||||
// : detailsObj.pinswg_name || "document";
|
||||
|
||||
// const contentLength = res.headers.get("content-length");
|
||||
// const totalBytes = contentLength
|
||||
// ? parseInt(contentLength, 10)
|
||||
// : null;
|
||||
|
||||
// const reader = res.body.getReader();
|
||||
// let receivedBytes = 0;
|
||||
// const chunks = [];
|
||||
|
||||
// while (true) {
|
||||
// const { done, value } = await reader.read();
|
||||
// if (done) break;
|
||||
|
||||
// chunks.push(value);
|
||||
// receivedBytes += value.length;
|
||||
|
||||
// if (totalBytes) {
|
||||
// const percent = Math.round(
|
||||
// (receivedBytes / totalBytes) * 100
|
||||
// );
|
||||
// setProgress(percent);
|
||||
// }
|
||||
// }
|
||||
|
||||
// const blob = new Blob(chunks);
|
||||
// const url = window.URL.createObjectURL(blob);
|
||||
|
||||
// const link = document.createElement("a");
|
||||
// link.href = url;
|
||||
// link.download = filename;
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
|
||||
// setDownloadStatus("Download complete!");
|
||||
// setProgress(100);
|
||||
|
||||
// window.gtag?.("event", "DownloadedFile", {
|
||||
// caseReference,
|
||||
// filename,
|
||||
// });
|
||||
// } catch (err) {
|
||||
// console.error(err);
|
||||
// setDownloadStatus("Download failed");
|
||||
// setProgress(null);
|
||||
// }
|
||||
// };
|
||||
|
||||
// const handleClick = () => {
|
||||
// if (getStatus(id) !== "idle") return; // don't double enqueue
|
||||
// startDownload(id, downloadFile);
|
||||
// };
|
||||
|
||||
// const status = getStatus(id);
|
||||
|
||||
// return (
|
||||
// <>
|
||||
// {detailsObj.pinswg_publishtoweb ? (
|
||||
// <button className="documentLink" onClick={handleClick}>
|
||||
// <span className="results-visually-hidden">
|
||||
// Document name:
|
||||
// </span>
|
||||
// {detailsObj.pinswg_name || ""}
|
||||
// </button>
|
||||
// ) : (
|
||||
// <>
|
||||
// <span className="results-visually-hidden">
|
||||
// Document name:
|
||||
// </span>
|
||||
// {detailsObj.pinswg_name || ""}
|
||||
// </>
|
||||
// )}
|
||||
|
||||
// {status !== "idle" && (
|
||||
// <p
|
||||
// className={
|
||||
// status === "downloading"
|
||||
// ? "govuk-!-font-size-14 govuk-!-margin-left-0 textloading"
|
||||
// : "govuk-!-font-size-14 govuk-!-margin-left-0"
|
||||
// }
|
||||
// >
|
||||
// {status === "downloading" && progress !== null
|
||||
// ? `Downloading (${progress}%)`
|
||||
// : status === "queued"
|
||||
// ? "Queued"
|
||||
// : status === "done"
|
||||
// ? "Download complete!"
|
||||
// : status === "failed"
|
||||
// ? "Download failed"
|
||||
// : ""}
|
||||
// </p>
|
||||
// )}
|
||||
// </>
|
||||
// );
|
||||
// }
|
||||
|
||||
import { useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
export default function DocumentLink({
|
||||
id,
|
||||
detailsObj,
|
||||
caseReference,
|
||||
startDownload,
|
||||
getStatus,
|
||||
}) {
|
||||
const [progress, setProgress] = useState(null);
|
||||
let { t } = useTranslation();
|
||||
const downloadFile = async () => {
|
||||
setProgress(0);
|
||||
|
||||
const res = await fetch(detailsObj.pinswg_hashlink);
|
||||
if (!res.ok) throw new Error("Download failed");
|
||||
|
||||
const contentDisposition = res.headers.get("content-disposition");
|
||||
const filename = contentDisposition
|
||||
? contentDisposition.split("filename=")[1]
|
||||
: detailsObj.pinswg_name || "document";
|
||||
|
||||
const contentLength = res.headers.get("content-length");
|
||||
const totalBytes = contentLength ? parseInt(contentLength, 10) : null;
|
||||
|
||||
const reader = res.body.getReader();
|
||||
let receivedBytes = 0;
|
||||
const chunks = [];
|
||||
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
chunks.push(value);
|
||||
receivedBytes += value.length;
|
||||
|
||||
if (totalBytes) {
|
||||
const percent = Math.round((receivedBytes / totalBytes) * 100);
|
||||
setProgress(percent);
|
||||
}
|
||||
}
|
||||
|
||||
const blob = new Blob(chunks);
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
setProgress(100);
|
||||
window.gtag?.("event", "DownloadedFile", { caseReference, filename });
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
if (getStatus(id) !== "idle") return; // avoid double enqueue
|
||||
startDownload(id, downloadFile);
|
||||
};
|
||||
|
||||
const status = getStatus(id);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{detailsObj.pinswg_publishtoweb ? (
|
||||
<button className="documentLink" onClick={handleClick}>
|
||||
<span className="results-visually-hidden">
|
||||
Document name:
|
||||
</span>
|
||||
{detailsObj.pinswg_name || ""}
|
||||
</button>
|
||||
) : (
|
||||
<span className="results-visually-hidden">
|
||||
{detailsObj.pinswg_name || ""}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{status !== "idle" && (
|
||||
<p
|
||||
className={
|
||||
status === "downloading"
|
||||
? "govuk-!-font-size-14 govuk-!-margin-left-0 textloading"
|
||||
: "govuk-!-font-size-14 govuk-!-margin-left-0"
|
||||
}
|
||||
>
|
||||
{status === "downloading" && progress !== null
|
||||
? t("case:downloading-label")
|
||||
: status === "queued"
|
||||
? t("case:download-queued-label")
|
||||
: status === "done"
|
||||
? t("case:download-complete-label")
|
||||
: status === "failed"
|
||||
? t("case:download-failed-label")
|
||||
: ""}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+161
-52
@@ -34,6 +34,15 @@ export const getFormCollectionByID = (appealTypeID) => {
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
export const getNavigationPropertyByPrimaryAttribute = (primaryAttribute) => {
|
||||
const collectionName = jsonpath({
|
||||
path: "$..[?(@ && @.PrimaryIdAttribute =='" + primaryAttribute + "')]",
|
||||
json: data,
|
||||
eval: true,
|
||||
});
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
export const getFormIDByLogicalName = (appealTypeLogicalName) => {
|
||||
const collectionName = jsonpath({
|
||||
path: "$..[?(@ && @.LogicalName =='" + appealTypeLogicalName + "')]",
|
||||
@@ -115,17 +124,19 @@ export const getSearchDetails = async (searchResultsObj) => {
|
||||
}
|
||||
);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getBasicSearchDetails(
|
||||
formMeta.LogicalCollectionName,
|
||||
searchDetail.title,
|
||||
formMeta.PrimaryIdAttribute,
|
||||
searchDetail.incidentid
|
||||
) || {
|
||||
"@odata.count": 1,
|
||||
"value": [{ "title": searchDetail.title }],
|
||||
}
|
||||
);
|
||||
formMeta?.LogicalCollectionName &&
|
||||
formMeta?.LogicalCollectionName != "pinswg_sipses" &&
|
||||
detailsArr.push(
|
||||
getBasicSearchDetails(
|
||||
formMeta.LogicalCollectionName,
|
||||
searchDetail.title,
|
||||
formMeta.PrimaryIdAttribute,
|
||||
searchDetail.incidentid
|
||||
) || {
|
||||
"@odata.count": 1,
|
||||
"value": [{ "title": searchDetail.title }],
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
// Promise.all(detailsArr).then((data) => {
|
||||
@@ -150,7 +161,7 @@ export const getPartSavedDetails = (searchResultsObj) => {
|
||||
let formMeta = getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
);
|
||||
console.log(formMeta);
|
||||
// console.log(formMeta);
|
||||
detailsArr.push(
|
||||
getBasicPartSavedDetails(
|
||||
formMeta.LogicalCollectionName,
|
||||
@@ -168,48 +179,146 @@ export const getPartSavedDetails = (searchResultsObj) => {
|
||||
* Get the details of a case from the appeal type
|
||||
* @param object searchResultsObj
|
||||
*/
|
||||
export const getSearchDetailsPaged = (searchResultsObj) => {
|
||||
let detailsArr = [];
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.title);
|
||||
} else {
|
||||
let formMeta = getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
);
|
||||
|
||||
detailsArr.push(
|
||||
getBasicSearchDetailsPaged(
|
||||
formMeta.LogicalCollectionName,
|
||||
searchDetail.title,
|
||||
formMeta.PrimaryIdAttribute,
|
||||
searchDetail.incidentid
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
// export const absoluteUrl = (req, setLocalhost) => {
|
||||
// var protocol = "https:";
|
||||
// var host = req
|
||||
// ? req.headers["x-forwarded-host"] || req.headers["host"]
|
||||
// : window.location.host;
|
||||
|
||||
// if (host.indexOf("localhost") > -1) {
|
||||
// if (setLocalhost) host = setLocalhost;
|
||||
// protocol = "http:";
|
||||
// }
|
||||
|
||||
// return {
|
||||
// protocol: protocol,
|
||||
// host: host,
|
||||
// origin: protocol + "//" + host,
|
||||
// };
|
||||
// export const getSearchDetailsPaged = (searchResultsObj) => {
|
||||
// let detailsArr = [];
|
||||
// searchResultsObj = searchResultsObj.value;
|
||||
// const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
// if (searchDetail.pinswg_appealcasetype == null) {
|
||||
// console.log(searchDetail.title);
|
||||
// } else {
|
||||
// let formMeta = getFormCollectionByID(
|
||||
// searchDetail.pinswg_appealcasetype
|
||||
// );
|
||||
// formMeta?.LogicalCollectionName &&
|
||||
// formMeta?.LogicalCollectionName != "pinswg_sipses" &&
|
||||
// detailsArr.push(
|
||||
// getBasicSearchDetailsPaged(
|
||||
// formMeta.LogicalCollectionName,
|
||||
// searchDetail.title,
|
||||
// formMeta.PrimaryIdAttribute,
|
||||
// searchDetail.incidentid
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// return Promise.all(detailsArr);
|
||||
// };
|
||||
|
||||
// export const getSearchDetailsPaged = async (searchResultsObj) => {
|
||||
// const searchResults = searchResultsObj.value;
|
||||
|
||||
// //Group incidents by appeal type
|
||||
// const groupedByAppealType = {};
|
||||
|
||||
// searchResults.forEach((incident) => {
|
||||
// const appealType = incident.pinswg_appealcasetype;
|
||||
// if (!appealType) return;
|
||||
|
||||
// const formMeta = getFormCollectionByID(appealType);
|
||||
// if (
|
||||
// !formMeta?.LogicalCollectionName ||
|
||||
// formMeta.LogicalCollectionName === "pinswg_sipses"
|
||||
// )
|
||||
// return;
|
||||
|
||||
// const key = formMeta.LogicalCollectionName;
|
||||
// if (!groupedByAppealType[key]) groupedByAppealType[key] = [];
|
||||
// groupedByAppealType[key].push({
|
||||
// incidentID: incident.incidentid,
|
||||
// caseReference: incident.title,
|
||||
// primaryIdAttribute: formMeta.PrimaryIdAttribute,
|
||||
// });
|
||||
// });
|
||||
|
||||
// // Make all API calls in parallel per appeal type
|
||||
// const allDetails = await Promise.all(
|
||||
// Object.entries(groupedByAppealType).map(
|
||||
// async ([appealTypeName, incidents]) => {
|
||||
// console.log(
|
||||
// `Fetching details for appeal type: ${appealTypeName}, incidents: ${incidents.length}`
|
||||
// );
|
||||
|
||||
// // Fully parallel for each incident
|
||||
// const results = await Promise.all(
|
||||
// incidents.map((i) =>
|
||||
// getBasicSearchDetailsPaged(
|
||||
// appealTypeName,
|
||||
// i.caseReference,
|
||||
// i.primaryIdAttribute,
|
||||
// i.incidentID
|
||||
// ).catch((err) => {
|
||||
// console.error(
|
||||
// `Error fetching incident ${i.caseReference}:`,
|
||||
// err
|
||||
// );
|
||||
// return null; // continue other calls even if one fails
|
||||
// })
|
||||
// )
|
||||
// );
|
||||
|
||||
// return results.filter((r) => r); // remove nulls from failed calls
|
||||
// }
|
||||
// )
|
||||
// );
|
||||
|
||||
// //Flatten all results into a single array
|
||||
// return allDetails.flat();
|
||||
// };
|
||||
|
||||
export const getSearchDetailsPaged = async (searchResultsObj) => {
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
|
||||
// Group incidents by appeal type
|
||||
const groupedByAppealType = searchResultsObj.reduce((acc, detail) => {
|
||||
const appealType = detail.pinswg_appealcasetype;
|
||||
if (!appealType) {
|
||||
console.log("No appeal type for:", detail.title);
|
||||
return acc;
|
||||
}
|
||||
|
||||
if (!acc[appealType]) acc[appealType] = [];
|
||||
acc[appealType].push({
|
||||
incidentID: detail.incidentid,
|
||||
title: detail.title,
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const allDetails = [];
|
||||
|
||||
// For each appeal type, call getBasicSearchDetailsPaged once with all incident IDs
|
||||
for (const [appealType, incidents] of Object.entries(groupedByAppealType)) {
|
||||
const incidentIDs = incidents.map((i) => i.incidentID);
|
||||
|
||||
// Get the form meta for this appeal type to access primaryIdAttribute
|
||||
const formMeta = getFormCollectionByID(appealType);
|
||||
|
||||
if (!formMeta || !formMeta.PrimaryIdAttribute) {
|
||||
console.log(`Missing form metadata for appeal type: ${appealType}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// console.log(
|
||||
// `Fetching ${incidentIDs.length} incidents for appeal type: ${appealType} with primaryIdAttribute: ${formMeta.PrimaryIdAttribute}`
|
||||
// );
|
||||
|
||||
try {
|
||||
const details = await getBasicSearchDetailsPaged(
|
||||
formMeta.LogicalCollectionName, // appealTypeName
|
||||
null, // caseReference is no longer used in batch
|
||||
formMeta.PrimaryIdAttribute, // primaryIdAttribute
|
||||
incidentIDs // pass array of incidentIDs
|
||||
);
|
||||
|
||||
allDetails.push(...details);
|
||||
} catch (err) {
|
||||
consoleLogger(err);
|
||||
}
|
||||
}
|
||||
|
||||
return allDetails;
|
||||
};
|
||||
|
||||
export const getProgressObj = (
|
||||
formObjXML,
|
||||
titleList,
|
||||
|
||||
+11
-21
@@ -47,27 +47,7 @@
|
||||
"UrlName": "transportandworkact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040013",
|
||||
"NavigationProperty": "",
|
||||
"value": "Transport and Works Act"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworkact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"UrlName": "transportandworkact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040013",
|
||||
"NavigationProperty": "pinswg_TransportandWorkActIdspinswg_TransportandWorkActIds",
|
||||
"value": "Transport and Works Act"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworksact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"UrlName": "transportandworksact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040013",
|
||||
"NavigationProperty": "pinswg_TransportandWorkActIdspinswg_TransportandWorkActIds",
|
||||
"NavigationProperty": "pinswg_TransportandWorkActIds",
|
||||
"value": "Transport and Works Act"
|
||||
},
|
||||
{
|
||||
@@ -370,6 +350,16 @@
|
||||
"appealTypeID": "846040012",
|
||||
"NavigationProperty": "pinswg_ElectricityActIds",
|
||||
"value": "Electricity Act"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_sipses",
|
||||
"LogicalName": "pinswg_sips",
|
||||
"PrimaryIdAttribute": "pinswg_sipscase",
|
||||
"UrlName": "sips",
|
||||
"MetadataId": "8d31911b-b8ea-ef11-ab08-00224800be9c",
|
||||
"appealTypeID": "846040002",
|
||||
"NavigationProperty": "pinswg_SIPSIds",
|
||||
"value": "SIP"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -20,7 +20,12 @@ module.exports = {
|
||||
"/myportal/searchresults": ["search", "myportal", "case"],
|
||||
"/myportal/case": ["case"],
|
||||
"/myportal/case/[ticketnumber]": ["case"],
|
||||
"/myportal/dnsapplications": ["search", "dnsCommon", "dnsApplications"],
|
||||
"/myportal/dnsapplications": [
|
||||
"search",
|
||||
"dnsCommon",
|
||||
"dnsApplications",
|
||||
"case",
|
||||
],
|
||||
"/myportal/dnsdetails": [
|
||||
"case",
|
||||
"search",
|
||||
@@ -59,7 +64,7 @@ module.exports = {
|
||||
"/dns": ["dnsCommon", "dnsHome"],
|
||||
"/dns/applications": ["dnsCommon", "dnsApplications"],
|
||||
"/dns/application-view": ["dnsCommon", "dnsApplicationView"],
|
||||
"/dnsapplications": ["search", "dnsCommon", "dnsApplications"],
|
||||
"/dnsapplications": ["search", "dnsCommon", "dnsApplications", "case"],
|
||||
"/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"],
|
||||
"/help/cookies": ["common", "cookies"],
|
||||
"/account/register": ["common", "account"],
|
||||
@@ -70,5 +75,6 @@ module.exports = {
|
||||
"/auth/signin": ["common", "common", "auth"],
|
||||
"/auth/verify-request": ["common", "common", "auth"],
|
||||
"/auth/error": ["common", "common", "auth"],
|
||||
"/admin": ["case"],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -96,8 +96,14 @@
|
||||
"trying-to-watch-case-redirect-label": "Fe'ch anogir nawr i fewngofnodi",
|
||||
"you-have-stopped-watching-label": "Ydych chi am roi'r gorau i wylio achos ",
|
||||
"do-you-want-to-delete-case-label": "Ydych chi am ddileu achos",
|
||||
"do-you-want-to-delete-rep-label": "Ydych chi eisiau dileu cynrychiolaeth sy'n aros i'w chyflwyno",
|
||||
"do-you-want-to-delete-case-disclaimer-label": "Ar ôl dileu, bydd yr holl wybodaeth a gyflwynwyd gennych yn cael ei cholli.",
|
||||
"representation-date-passed-label": "Mae'r cyfnod cyflwyno sylwadau ar gyfer yr apêl hon rhwng {{startDate}} a {{endDate}}",
|
||||
"representation-date-passed-additional-label": "Gallwch wneud sylw drwy e-bostio,",
|
||||
"date-raised": "Dyddiad codi"
|
||||
"date-raised": "Dyddiad codi",
|
||||
"download-complete-label": "Lawrlwytho wedi'i gwblhau!",
|
||||
"downloading-label": "Wrthi'n llwytho i lawr",
|
||||
"download-failed-label": "Methodd y lawrlwythiad",
|
||||
"download-queued-label": "Wedi'i giwio",
|
||||
"docsoffline-reps-label": "Oherwydd cynnal a chadw'r system, ni allwn dderbyn sylwadau ar hyn o bryd. Rhowch gynnig arall arni yn nes ymlaen."
|
||||
}
|
||||
+15
-9
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"login-card-title-temp": "Apeliadau neu geisiadau newydd",
|
||||
"login-comingsoon-temp-1": "Mae'r gwasanaeth hwn yn cael ei ddatblygu i gefnogi apeliadau a cheisiadau ar-lein.",
|
||||
"login-card-title-temp": "Cyflwyno apêl newydd",
|
||||
"login-comingsoon-temp-1": "yn erbyn gwrthodiad eich Awdurdod Cynllunio Lleol i roi caniatâd cynllunio neu fethiant i benderfynu ar gais cynllunio mewn pryd.",
|
||||
"login-comingsoon-temp-1a": "Ar hyn o bryd, gallwch gyflwyno Apeliadau Cynllunio a78, Apeliadau Cydsyniad Adeilad Rhestredig ac Ardal Gadwraeth, Apeliadau Deiliaid Tai a Mân Apeliadau Masnachol - HAS/CAS, Apeliadau Hysbysebion a Barnu'n Annilys.",
|
||||
"login-comingsoon-temp-2": "Wrth i ni ddatblygu’r gwasanaeth ar-lein, dewch o hyd i:",
|
||||
"login-comingsoon-temp-2": "Mae'r gwasanaeth hwn ar agor ar hyn o bryd i gyflwyno apeliadau newydd yn erbyn gwrthod caniatâd cynllunio neu fethu â phenderfynu ar gais cynllunio mewn pryd (apeliadau adran 78). Mae'r gwasanaeth yn cael ei ddatblygu i gefnogi apeliadau a cheisiadau ar-lein eraill. Yn y cyfamser, gallwch ddod o hyd i'r ffurflenni yma",
|
||||
"login-comingsoon-forms-link-1": "https://llyw.cymru/ffurflenni-apelio",
|
||||
"login-comingsoon-forms-label-1": "ffurflenni apêl cynllunio a ffurflenni cais cynllunio",
|
||||
"login-comingsoon-forms-link-2": "https://llyw.cymru/trwyddedau-amgylcheddol",
|
||||
@@ -32,19 +32,25 @@
|
||||
"casesearch-card-advanced-link": "Chwiliad uwch",
|
||||
"casesearch-search-validation-required": "Angenrheidiol",
|
||||
"casesearch-search-validation-minlength": "Rhaid iddo gynnwys 4 nod neu fwy",
|
||||
"casescomment-card-title": "Rhowch sylwadau ar apêl",
|
||||
"casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl (ac eithrio apêl deiliaid tai neu fasnachol) drwy e-bostio ",
|
||||
"casescomment-card-paragraph-two": "Ni all partïon â buddiant wneud sylwadau ar apeliadau deiliaid tai a masnachol yn ystod y cam apelio. Bydd unrhyw sylwadau a wnaed yn ystod y cam ymgeisio yn cael eu darparu gan yr awdurdod cynllunio lleol a'u hystyried gan yr Arolygydd.",
|
||||
"casescomment-card-title": "Sylwadau ar apeliadau neu geisiadau",
|
||||
"casescomment-card-paragraph-one": "Fel arall, gallwch ofyn am ffurflenni neu wneud sylwadau ar apêl yn ystod y cyfnod cynrychioliadau drwy e-bostio ",
|
||||
"casescomment-card-paragraph-two": "yn ystod y cyfnod cynrychioliadau neu gyflwyno datganiadau achos. Cyfeiriwch at y dyddiadau cau penodol i'r achos. Ar gyfer apeliadau deiliaid tai a masnachol, ni all partïon â diddordeb wneud sylwadau yn ystod y cam apelio. Bydd unrhyw sylwadau a wneir yn ystod y cam ymgeisio yn cael eu darparu gan yr Awdurdod Cynllunio Lleol a'u hystyried gan yr Arolygydd.",
|
||||
"inspectorate-card-visit-label": "Ymweld â'r Arolygiaeth Gynllunio",
|
||||
"inspectorate-card-visit-link": "Hafan",
|
||||
"inspectorate-card-alt-text": "Yr Arolygiaeth Gynllunio",
|
||||
"dns-card-title": "Gweld yr holl Ddatblygiadau o Arwyddocâd Cenedlaethol",
|
||||
"dns-card-paragraph": "Mae Datblygiad o Arwyddocâd Cenedlaethol yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr sydd o bwysigrwydd cenedlaethol.",
|
||||
"dns-card-button": "Gweld pob cais",
|
||||
"dns-card-paragraph": "Mae Datblygiad o Arwyddocâd Cenedlaethol (DNS) yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr sydd o bwysigrwydd cenedlaethol.",
|
||||
"dns-card-button": "Gweld pob rhaglen DNS",
|
||||
"logging-in-heading": "Rydym yn dilysu eich cyfrif. Arhoswch a pheidiwch ag adnewyddu'r dudalen",
|
||||
"logging-in-paragraph": "Arhoswch os gwelwch yn dda...",
|
||||
"uploading-files-progress-label": "Wrthi'n llwytho i fyny...",
|
||||
"uploading-files-label": "Wrthi'n uwchlwytho {{number}} ffeil",
|
||||
"completed-uploading-files-label": "{{number}} ffeil wedi'u huwchlwytho",
|
||||
"remove-this-file-label": "Tynnu'r ffeil hon"
|
||||
"remove-this-file-label": "Tynnu'r ffeil hon",
|
||||
"watch-case-card-title": "Gwylio achos",
|
||||
"watch-case-paragraph-one": "i gadw golwg ar y camau nesaf a chanlyniad yr apêl.",
|
||||
"casescomment-card-paragraph-three": "Gallwch wneud sylwadau ar apeliadau a cheisiadau yn ystod y cyfnod cynrychioli neu gyflwyno datganiadau achos neu'r Holiadur LPA.",
|
||||
"casescomment-card-paragraph-four": "Cyfeiriwch at y dyddiadau cau ar gyfer cynrychioli achosion unigol ar gyfer datganiadau a sylwadau.",
|
||||
"signin-benefits-title": "Mewngofnodwch i'ch porth",
|
||||
"signin-benefits-paragraph": "Drwy fewngofnodi gyda'r botwm Mewngofnodi, byddwch yn gallu:"
|
||||
}
|
||||
@@ -51,5 +51,6 @@
|
||||
"date-raised": "Dyddiad codi",
|
||||
"representation-submitted": "Cyflwynwyd y sylw",
|
||||
"submission-processing-label": "Prosesu cyflwyniad",
|
||||
"appeal-pending-label": "Yn yr arfaeth"
|
||||
"appeal-pending-label": "Yn yr arfaeth",
|
||||
"docsoffline-newappeal-label": "Oherwydd gwaith cynnal a chadw'r system, ni allwn dderbyn apeliadau newydd ar hyn o bryd. Rhowch gynnig arall arni yn nes ymlaen."
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
"questionnaire-publish-policy-label": "Sylwch y gallai'r holl ddogfennau holiadur gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich holiadur yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi",
|
||||
"add-files-label": "Ychwanegwch eich ffeiliau",
|
||||
"fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
|
||||
"fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg, .jpg neu .zip a dderbynnir",
|
||||
"fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg neu .jpg a dderbynnir",
|
||||
"fileupload-file-error-filesize-label": "yn rhy fawr. Llwythwch ffeil lai i fyny.",
|
||||
"fileupload-file-error-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
|
||||
"fileupload-file-error-invalid-label": "yn annilys",
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
"new-appeal-procedure-option-inperson": "Wyneb yn wyneb",
|
||||
"new-appeal-procedure-option-hybrid": "Hybrid",
|
||||
"new-appeal-fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
|
||||
"new-appeal-fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx .tif, .tiff, .jpeg, .jpg neu .zip a dderbynnir",
|
||||
"new-appeal-fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg neu .jpg a dderbynnir",
|
||||
"new-appeal-fileupload-file-error-filesize-label": "yn rhy fawr. Llwythwch ffeil lai i fyny.",
|
||||
"new-appeal-fileupload-file-error-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
|
||||
"new-appeal-fileupload-file-error-invalid-label": "yn annilys",
|
||||
|
||||
@@ -66,5 +66,7 @@
|
||||
"searchresults-show-records-label-a": "Dangos",
|
||||
"searchresults-show-records-label-b": "cofnodion",
|
||||
"searchresults-created-on-label": "Crëwyd ar",
|
||||
"address-search-appellant-validation": "Mae angen rhan o'r cyfeiriad i chwilio gydag enw"
|
||||
"address-search-appellant-validation": "Mae angen rhan o'r cyfeiriad i chwilio gydag enw",
|
||||
"filter-documents-label": "Hidlo dogfennau",
|
||||
"clear-filter-button-label": "Clirio'r hidlydd"
|
||||
}
|
||||
@@ -96,8 +96,14 @@
|
||||
"trying-to-watch-case-redirect-label": "You will now be prompted to sign in",
|
||||
"you-have-stopped-watching-label": "Do you want to stop watching case ",
|
||||
"do-you-want-to-delete-case-label": "Do you want to delete case ",
|
||||
"do-you-want-to-delete-rep-label": "Do you want to delete representation awaiting submission",
|
||||
"do-you-want-to-delete-case-disclaimer-label": "Once deleted all information you have submited, will be lost.",
|
||||
"representation-date-passed-label": "The representation period for this appeal is between {{startDate}} and {{endDate}}",
|
||||
"representation-date-passed-additional-label": "You can make a representation by emailing,",
|
||||
"date-raised": "Date raised"
|
||||
"date-raised": "Date raised",
|
||||
"download-complete-label": "Download complete!",
|
||||
"downloading-label": "Downloading",
|
||||
"download-failed-label": "Download failed",
|
||||
"download-queued-label": "Queued",
|
||||
"docsoffline-reps-label": "Due to system maintenance, we are unable to accept representations at this time. Please try again later."
|
||||
}
|
||||
+15
-9
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"login-card-title-temp": "New appeals or applications",
|
||||
"login-comingsoon-temp-1": "This service is being developed to support online appeals and applications.",
|
||||
"login-card-title-temp": "Submit a new appeal",
|
||||
"login-comingsoon-temp-1": "against your Local Planning Authority’s refusal of planning permission or failure to determine a planning application in time.",
|
||||
"login-comingsoon-temp-1a": "You can currently raise Planning Appeals s78.",
|
||||
"login-comingsoon-temp-2": "While we develop the online service, find:",
|
||||
"login-comingsoon-temp-2": "This service is currently open to submit new appeals against refusal of planning permission or failure to determine a planning application in time (section 78 appeals). The service is being developed to support other online appeals and applications. In the meantime, you can find the forms here",
|
||||
"login-comingsoon-forms-link-1": "https://gov.wales/planning-appeal-forms",
|
||||
"login-comingsoon-forms-label-1": "planning appeal and application forms",
|
||||
"login-comingsoon-forms-link-2": "https://gov.wales/environmental-permits",
|
||||
@@ -32,19 +32,25 @@
|
||||
"casesearch-card-advanced-link": "Advanced search",
|
||||
"casesearch-search-validation-required": "Required",
|
||||
"casesearch-search-validation-minlength": "Must be 4 characters or more",
|
||||
"casescomment-card-title": "Comment on an appeal ",
|
||||
"casescomment-card-paragraph-one": "Comment on an appeal (excluding householder or commercial) by emailing ",
|
||||
"casescomment-card-paragraph-two": "For householder and commercial appeals, interested parties are unable to comment at appeal stage. Any comments made at application stage will be provided by the Local Planning Authority and considered by the inspector.",
|
||||
"casescomment-card-title": "Comment on appeals or applications",
|
||||
"casescomment-card-paragraph-one": "Alternatively, you can request forms or comment on an appeal during the representation period by emailing ",
|
||||
"casescomment-card-paragraph-two": "during the representation period or submit statements of case. Please refer to the case specific deadlines. For householder and commercial appeals, interested parties are unable to comment at appeal stage. Any comments made at application stage will be provided by the Local Planning Authority and considered by the Inspector.",
|
||||
"inspectorate-card-visit-label": "Visit the Planning Inspectorate",
|
||||
"inspectorate-card-visit-link": "Home",
|
||||
"inspectorate-card-alt-text": "The Planning Inspectorate",
|
||||
"dns-card-title": "View all Developments of National Significance ",
|
||||
"dns-card-paragraph": "A Development of National Significance is a type of planning application for a large infrastructure project of national importance.",
|
||||
"dns-card-button": "View all applications",
|
||||
"dns-card-paragraph": "A Development of National Significance (DNS) is a type of planning application for a large infrastructure project of national importance.",
|
||||
"dns-card-button": "View all DNS applications",
|
||||
"logging-in-heading": "We are authenticating your account please wait and don't refresh",
|
||||
"logging-in-paragraph": "Please wait...",
|
||||
"uploading-files-progress-label": "Uploading...",
|
||||
"uploading-files-label": "Uploading {{number}} files",
|
||||
"completed-uploading-files-label": "{{number}} files uploaded",
|
||||
"remove-this-file-label": "Remove this file"
|
||||
"remove-this-file-label": "Remove this file",
|
||||
"watch-case-card-title": "Watch a case",
|
||||
"watch-case-paragraph-one": "to keep track of the next steps and outcome of the appeal.",
|
||||
"casescomment-card-paragraph-three": "You can make comments on appeals and applications during the representation period or submit statements of case or the LPA Questionnaire.",
|
||||
"casescomment-card-paragraph-four": "Please refer to the individual case representation deadlines for statements and comments.",
|
||||
"signin-benefits-title": "Sign in to your portal",
|
||||
"signin-benefits-paragraph": "By signing in with the Sign in button, you will be able to:"
|
||||
}
|
||||
@@ -51,5 +51,6 @@
|
||||
"date-raised": "Date raised",
|
||||
"representation-submitted": "Representation submitted",
|
||||
"submission-processing-label": "Submission processing",
|
||||
"appeal-pending-label": "Pending"
|
||||
"appeal-pending-label": "Pending",
|
||||
"docsoffline-newappeal-label": "Due to system maintenance, we are unable to accept new appeals at this time. Please try again later."
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
"questionnaire-publish-policy-label": "Please note that all questionnaire documents may be published in line with our Publishing Policy. Should your questionnaire include any sensitive information or potentially defamatory information, it may be redacted before publishing",
|
||||
"add-files-label": "Add your files",
|
||||
"fileupload-drop-label": "Drag and drop your files here.",
|
||||
"fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg, .jpg or .zip files will be accepted",
|
||||
"fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg or .jpg files will be accepted",
|
||||
"fileupload-file-error-filesize-label": "is too large. Please upload a smaller file.",
|
||||
"fileupload-file-error-invalid-type-label": "has an invalid type. Please upload an allowed type.",
|
||||
"fileupload-file-error-invalid-label": "is invalid",
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
"new-appeal-procedure-option-inperson": "In person",
|
||||
"new-appeal-procedure-option-hybrid": "Hybrid",
|
||||
"new-appeal-fileupload-drop-label": "Drag and drop your files here.",
|
||||
"new-appeal-fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg, .jpg or .zip files will be accepted",
|
||||
"new-appeal-fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg or .jpg files will be accepted",
|
||||
"new-appeal-fileupload-file-error-filesize-label": "is too large. Please upload a smaller file.",
|
||||
"new-appeal-fileupload-file-error-invalid-type-label": "has an invalid type. Please upload an allowed type.",
|
||||
"new-appeal-fileupload-file-error-invalid-label": "is invalid",
|
||||
|
||||
@@ -66,5 +66,7 @@
|
||||
"searchresults-show-records-label-a": "Show",
|
||||
"searchresults-show-records-label-b": "records",
|
||||
"searchresults-created-on-label": "Created on",
|
||||
"address-search-appellant-validation": "Need part of the address to search with a name"
|
||||
"address-search-appellant-validation": "Need part of the address to search with a name",
|
||||
"filter-documents-label": "Filter documents",
|
||||
"clear-filter-button-label": "Clear filter"
|
||||
}
|
||||
Vendored
+1
-2
@@ -1,6 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
/// <reference types="next/navigation-types/compat/navigation" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
|
||||
|
||||
@@ -1,588 +0,0 @@
|
||||
{
|
||||
"apiFolder": "pages/api",
|
||||
"schemaFolders": [
|
||||
"models"
|
||||
],
|
||||
"definition": {
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "PEDW API",
|
||||
"version": "1.0"
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"emailBody": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reference": {
|
||||
"type": "string",
|
||||
"example": "PEDW-COMPLETE"
|
||||
},
|
||||
"templateId": {
|
||||
"type": "string",
|
||||
"example": "618e0463-b092-4733-a024-bf8a3bbde808"
|
||||
},
|
||||
"emailAddress": {
|
||||
"type": "string",
|
||||
"example": "rob@rdbtech.co.uk"
|
||||
},
|
||||
"personalisation": {
|
||||
"type": "object",
|
||||
"example": {
|
||||
"caseReference": "CAS-TEST-TEST",
|
||||
"emailAddress": "rob@rdbtech.co.uk",
|
||||
"linkExpiry": "10 * 60"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
"pedw_auth": {
|
||||
"type": "oauth2",
|
||||
"flows": {
|
||||
"clientCredentials": {
|
||||
"tokenUrl": "https://login.microsoftonline.com/9ac1a5ab-cd58-409e-a1b6-6b10422a68f5/oauth2/v2.0/token",
|
||||
"scopes": "https://dev-pedw-ns.servicebus.windows.net/.default"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_key": {
|
||||
"type": "apiKey",
|
||||
"name": "api_key",
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
},
|
||||
"paths": {
|
||||
"/api/auth/[...nextauth]": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Login"
|
||||
],
|
||||
"description": "NextAuth",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/documents/download/{id}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Documents"
|
||||
],
|
||||
"description": "Get document",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "iShare ID",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"default": "A41567436"
|
||||
},
|
||||
{
|
||||
"name": "hash",
|
||||
"in": "query",
|
||||
"description": "Hash string",
|
||||
"default": "e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/email/notify": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Email"
|
||||
],
|
||||
"summary": "Email to user",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Send email via gov notify",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"requestBody": {
|
||||
"name": "Email",
|
||||
"description": "Email body",
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/emailBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"405": {
|
||||
"description": "Failed"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/createaccount_api": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Account"
|
||||
],
|
||||
"description": "Create password",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/createcase_api": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"description": "Create case",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/createmywatchedcases_api": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Portal",
|
||||
"Case"
|
||||
],
|
||||
"description": "Create my watched cases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/deleteawaitingsubmissions_api": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"description": "Delete awaiting case submission",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/deleteamyrepresentations_api": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"Portal",
|
||||
"Representations"
|
||||
],
|
||||
"description": "Delete my representations",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/deleteamywatchedcases_api": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"Portal",
|
||||
"Case"
|
||||
],
|
||||
"description": "Delete my watched cases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getadvancedsearch_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Advanced search",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getadvancedsearchpaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Advanced search paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getappealid_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Misc"
|
||||
],
|
||||
"description": "Get Appeal ID",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getappealtypes_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Misc"
|
||||
],
|
||||
"description": "Get Appeal Types",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getappealtypesfornewappeal_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Misc"
|
||||
],
|
||||
"description": "Get Appeal Types for appeal",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getawaitingsubmission_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"description": "get awaiting case submission",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getawaitingsubmissionproxy_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"description": "get awaiting case submission proxy",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicdnssearch_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic DNS search",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicdnssearchdetails_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic DNS search details",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicdnssearchdetailspaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic DNS search details paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicdnssearchpaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic DNS search paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicdnsurlsearch_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic DNS search URL",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicsearch_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicsearchdetails_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search details",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicsearchdetailspaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search details paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getbasicsearchpaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getcase_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"summary": "Not used",
|
||||
"description": "Get case",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getlogin_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Login"
|
||||
],
|
||||
"description": "Returns the hello world",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "hello world"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getlpa_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Get list of LPA's",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"relay_auth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getsearchdocumentdetails_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search",
|
||||
"Documents"
|
||||
],
|
||||
"description": "Basic search documents details",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getsearchdocumentdetailspaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search documents details paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getsearchdocumenthistory_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search documents history",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getsearchdocumenthistorypaged_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search documents history paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/getsearchdocumentTypes_api": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Search"
|
||||
],
|
||||
"description": "Basic search documents history paged",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/patchcase_api": {
|
||||
"patch": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"description": "Patch case",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/updateaccount_api": {
|
||||
"patch": {
|
||||
"tags": [
|
||||
"Account"
|
||||
],
|
||||
"description": "Update account",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/updatecase_api": {
|
||||
"patch": {
|
||||
"tags": [
|
||||
"Case"
|
||||
],
|
||||
"description": "Update case",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/endpoint/updatepassword_api": {
|
||||
"patch": {
|
||||
"tags": [
|
||||
"Account"
|
||||
],
|
||||
"description": "Update password",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
}
|
||||
+10
-6
@@ -146,17 +146,21 @@ module.exports = {
|
||||
destination: "/case",
|
||||
},
|
||||
{
|
||||
source: "/achos/id/:slug",
|
||||
destination: "/case/id/:slug",
|
||||
source: "/achos/:slug",
|
||||
destination: "/case/:slug",
|
||||
},
|
||||
// {
|
||||
// source: "/achos/id/:slug",
|
||||
// destination: "/case/id/:slug",
|
||||
// },
|
||||
{
|
||||
source: "/fymhorth/achos",
|
||||
destination: "/myportal/case",
|
||||
},
|
||||
{
|
||||
source: "/fymhorth/achos/id/:slug",
|
||||
destination: "/myportal/case/id/:slug",
|
||||
},
|
||||
// {
|
||||
// source: "/fymhorth/achos/id/:slug",
|
||||
// destination: "/myportal/case/id/:slug",
|
||||
// },
|
||||
{
|
||||
source: "/fymhorth/achos/:slug",
|
||||
destination: "/myportal/case/:slug",
|
||||
|
||||
Generated
+11285
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -7,9 +7,10 @@
|
||||
"debugdev": "NODE_OPTIONS='--inspect' next dev",
|
||||
"dev:app": "node ./server/server.js",
|
||||
"build": "NODE_ENV=production node_modules/next/dist/bin/next build",
|
||||
"start2": "NODE_ENV=production node ./server/server.js",
|
||||
"start2": "NODE_ENV=production node server.js",
|
||||
"start": "NODE_ENV=production node_modules/next/dist/bin/next start",
|
||||
"lint": "next lint"
|
||||
"lint": "next lint",
|
||||
"prisma:generate": "prisma generate"
|
||||
},
|
||||
"browser": {
|
||||
"child_process": false
|
||||
@@ -48,8 +49,7 @@
|
||||
"moment": "^2.29.4",
|
||||
"multiparty": "^4.2.3",
|
||||
"mysql": "^2.18.1",
|
||||
"nanoid": "^3.2.0",
|
||||
"next": "14.1.2",
|
||||
"next": "^14.2.28",
|
||||
"next-auth": "^4.24.4",
|
||||
"next-build-id": "^3.0.0",
|
||||
"next-connect": "^0.12.2",
|
||||
@@ -104,4 +104,4 @@
|
||||
"eslint-plugin-jsdoc": "^48.2.3",
|
||||
"prisma": "^5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import Document, { Html, Head, Main, NextScript } from "next/document";
|
||||
import SkipLink from "../components/skiplink";
|
||||
import { Tracking, TrackingNoScript } from "../components/tracking";
|
||||
import { nanoid } from "nanoid";
|
||||
//import { nanoid } from "nanoid";
|
||||
import { setCookie } from "nookies";
|
||||
import Script from "next/script";
|
||||
|
||||
@@ -23,7 +23,7 @@ class MyDocument extends Document {
|
||||
|
||||
const cookieObj = ctx.req.cookies.CookiePolicy || {};
|
||||
|
||||
console.log("useGATracking: ", useGATracking);
|
||||
//console.log("useGATracking: ", useGATracking);
|
||||
setCookie(ctx, "pedw_locale", ctx.locale, {
|
||||
path: "/",
|
||||
});
|
||||
@@ -41,7 +41,7 @@ class MyDocument extends Document {
|
||||
//const generatedNonce = nanoid();
|
||||
const generatedNonce = this.props.generatedNonce;
|
||||
|
||||
console.log("this is the nonce:", generatedNonce);
|
||||
//console.log("this is the nonce:", generatedNonce);
|
||||
|
||||
let csp = ``;
|
||||
csp += `base-uri 'self';`;
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
// pages/admin/storage.js
|
||||
import { useState } from "react";
|
||||
import Head from "next/head";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Header from "../../components/header";
|
||||
import Footer from "../../components/footer";
|
||||
import { connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import StorageTab from "../../components/admin/tabs/storage";
|
||||
import AccountsTab from "../../components/admin/tabs/accounts";
|
||||
import AppealsTab from "../../components/admin/tabs/appeals";
|
||||
import DocumentsTab from "../../components/admin/tabs/documents";
|
||||
|
||||
import { fetchAdminStorageData } from "../../components/admin/utils/serverside";
|
||||
import { getNewAppeals } from "../../actions";
|
||||
|
||||
import { getSearchDetails } from "../../components/utils";
|
||||
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { setCurrentPage } from "../../store/currentView/action";
|
||||
|
||||
const StoragePage = (props) => {
|
||||
const {
|
||||
data,
|
||||
userData,
|
||||
repCompleteCount,
|
||||
searchResultsObj,
|
||||
docsOffline,
|
||||
showFilteredDocs,
|
||||
} = props;
|
||||
const [whichTab, setWhichTab] = useState("documents");
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>Admin Browser</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header />
|
||||
|
||||
<div
|
||||
className="govuk-width-containera"
|
||||
style={{ width: "90%", margin: "auto" }}
|
||||
>
|
||||
<div className="js-enabled govuk-template__body govuk-frontend-supported">
|
||||
<div className="govuk-tabs" data-module="govuk-tabs">
|
||||
<h2 className="govuk-tabs__title">Contents</h2>
|
||||
|
||||
{/* Tabs */}
|
||||
<ul className="govuk-tabs__list">
|
||||
{[
|
||||
"documents",
|
||||
"appeals",
|
||||
"storage",
|
||||
"accounts",
|
||||
].map((tab) => (
|
||||
<li
|
||||
key={tab}
|
||||
className={
|
||||
whichTab === tab
|
||||
? "govuk-tabs__list-item govuk-tabs__list-item--selected"
|
||||
: "govuk-tabs__list-item"
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="govuk-tabs__tab"
|
||||
href={`#${tab}`}
|
||||
onClick={() => {
|
||||
setWhichTab(tab);
|
||||
tab === "appeals" &&
|
||||
props.setCurrentPage(1);
|
||||
}}
|
||||
>
|
||||
{" "}
|
||||
{tab === "documents" &&
|
||||
"Latest Documents"}
|
||||
{tab === "appeals" &&
|
||||
"Latest Appeals"}
|
||||
{tab === "storage" &&
|
||||
"Storage Account"}
|
||||
{tab === "accounts" &&
|
||||
"User Accounts"}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{/* Panels */}
|
||||
|
||||
<div
|
||||
className={
|
||||
whichTab === "documents"
|
||||
? "govuk-tabs__panel"
|
||||
: "govuk-tabs__panel govuk-tabs__panel--hidden"
|
||||
}
|
||||
>
|
||||
<DocumentsTab
|
||||
documentDetailsObj={
|
||||
props.searchResultsObj
|
||||
.documentDetailsObj
|
||||
}
|
||||
docsOffline={docsOffline}
|
||||
showFilteredDocs={props.showFilteredDocs}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
whichTab === "appeals"
|
||||
? "govuk-tabs__panel"
|
||||
: "govuk-tabs__panel govuk-tabs__panel--hidden"
|
||||
}
|
||||
>
|
||||
<AppealsTab
|
||||
searchResultsObj={searchResultsObj}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={
|
||||
whichTab === "storage"
|
||||
? "govuk-tabs__panel"
|
||||
: "govuk-tabs__panel govuk-tabs__panel--hidden"
|
||||
}
|
||||
>
|
||||
<StorageTab
|
||||
data={data}
|
||||
repCompleteCount={repCompleteCount}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={
|
||||
whichTab === "accounts"
|
||||
? "govuk-tabs__panel"
|
||||
: "govuk-tabs__panel govuk-tabs__panel--hidden"
|
||||
}
|
||||
>
|
||||
<AccountsTab userData={userData} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
// IP restriction check
|
||||
const ALLOWED_IPS = process.env.ALLOWED_IPS
|
||||
? process.env.ALLOWED_IPS.split(",").map((ip) => ip.trim())
|
||||
: [];
|
||||
const LOCALHOST_IPS = ["127.0.0.1", "::1"];
|
||||
const forwarded = req.headers["x-forwarded-for"];
|
||||
const ip =
|
||||
typeof forwarded === "string"
|
||||
? forwarded.split(",")[0]
|
||||
: req.socket.remoteAddress;
|
||||
|
||||
if (![...ALLOWED_IPS, ...LOCALHOST_IPS].includes(ip)) {
|
||||
return {
|
||||
redirect: { destination: "/403", permanent: false },
|
||||
};
|
||||
}
|
||||
|
||||
// 🔹 fetch actual data
|
||||
const { data, userData, repCompleteCount } =
|
||||
await fetchAdminStorageData();
|
||||
|
||||
const newAppeals = await getNewAppeals();
|
||||
|
||||
const searchDetailsObj = await getSearchDetails(newAppeals);
|
||||
|
||||
store.dispatch(setSearchResults(newAppeals));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
const state = store.getState();
|
||||
|
||||
store.dispatch(setCurrentPage(1));
|
||||
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
userData,
|
||||
repCompleteCount,
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
console.log("===============================\n state:", state);
|
||||
return {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(StoragePage);
|
||||
@@ -124,8 +124,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// "=============================== Advanced Search results:",
|
||||
// searchResultsObj
|
||||
// );
|
||||
const searchDetailsObj =
|
||||
(await getSearchDetails(searchResultsObj)) || null;
|
||||
// const searchDetailsObj =
|
||||
// (await getSearchDetails(searchResultsObj)) || null;
|
||||
// console.log(
|
||||
// "=============================== Advanced Search results details:",
|
||||
// searchDetailsObj
|
||||
@@ -136,7 +136,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
// store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(Object.entries(query)));
|
||||
return {
|
||||
props: {
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
import { createSwaggerSpec } from "next-swagger-doc";
|
||||
import dynamic from "next/dynamic";
|
||||
import "swagger-ui-react/swagger-ui.css";
|
||||
|
||||
const SwaggerUI = dynamic(import("swagger-ui-react"), { ssr: false });
|
||||
|
||||
function ApiDoc({ spec }) {
|
||||
return <SwaggerUI spec={spec} docExpansion={"list"} />;
|
||||
}
|
||||
|
||||
let BASE_URL;
|
||||
const port = parseInt(process.env.PORT, 10) || 3000;
|
||||
|
||||
if (process.browser) {
|
||||
BASE_URL = window.apiRoot;
|
||||
} else {
|
||||
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
|
||||
}
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const cache = {};
|
||||
const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||
const tenantId = process.env.TENANT;
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
const spec = createSwaggerSpec({
|
||||
layout: "StandaloneLayout",
|
||||
apiFolder: "pages/api",
|
||||
schemaFolders: ["models"],
|
||||
definition: {
|
||||
openapi: "3.0.3",
|
||||
info: {
|
||||
title: "PEDW API",
|
||||
version: "1.0",
|
||||
contact: {
|
||||
email: "rob@rdbsolutions.co.uk",
|
||||
},
|
||||
},
|
||||
docExpansion: "none",
|
||||
components: {
|
||||
schemas: {
|
||||
emailBody: {
|
||||
type: "object",
|
||||
properties: {
|
||||
reference: {
|
||||
type: "string",
|
||||
example: "PEDW-COMPLETE",
|
||||
},
|
||||
templateId: {
|
||||
type: "string",
|
||||
example: "618e0463-b092-4733-a024-bf8a3bbde808",
|
||||
},
|
||||
emailAddress: {
|
||||
type: "string",
|
||||
example: "rob@rdbtech.co.uk",
|
||||
},
|
||||
personalisation: {
|
||||
type: "object",
|
||||
example: {
|
||||
caseReference: "CAS-TEST-TEST",
|
||||
emailAddress: "rob@rdbtech.co.uk",
|
||||
linkExpiry: "10 * 60",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
// securitySchemes: {
|
||||
// pedw_auth: {
|
||||
// type: "oauth2",
|
||||
// flows: {
|
||||
// clientCredentials: {
|
||||
// tokenUrl: `${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
|
||||
// scopes:
|
||||
// "https://" +
|
||||
// process.env.RELAYURI +
|
||||
// "/.default",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// api_key: {
|
||||
// type: "apiKey",
|
||||
// name: "api_key",
|
||||
// in: "header",
|
||||
// },
|
||||
// },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
//console.log(JSON.stringify(spec));
|
||||
|
||||
return {
|
||||
props: {
|
||||
spec,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default ApiDoc;
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getbasicsearch_api:
|
||||
* get:
|
||||
* tags: [Search]
|
||||
* description: Basic search
|
||||
* parameters:
|
||||
* - name: searchString
|
||||
* in: query
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
azureHeadersPagedCustom,
|
||||
consoleLogger,
|
||||
getToken,
|
||||
} from "../../../actions";
|
||||
import { number } from "prop-types";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
const encryptDocReference = (documentRef) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
"documents/download/" + documentRef,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
var hashStr =
|
||||
"/api/documents/download/" + documentRef + "?hash=" + hashlink;
|
||||
|
||||
return hashStr;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var pageNumber = req.query.pageNumber || 1;
|
||||
var token = await getToken();
|
||||
|
||||
var orderby = req.query.orderby || "createdon";
|
||||
var fieldSort = req.query.fieldSort || "desc";
|
||||
var showNumberOfRecords = req.query.showNumberOfRecords || 10;
|
||||
var documentType = req.query.documentType || "all";
|
||||
var documentOrigin = req.query.documentOrigin || "all";
|
||||
var numberOfWeeks = req.query.numberWeeks || 1;
|
||||
|
||||
var docTypeQueryString = "";
|
||||
var docOriginQueryString = "";
|
||||
|
||||
if (documentType != "all") {
|
||||
if (documentType.indexOf(",") >= 0) {
|
||||
const documentTypeArr = documentType.split(",");
|
||||
|
||||
docTypeQueryString = " and (";
|
||||
documentTypeArr.forEach(function (item, index) {
|
||||
console.log(item, index);
|
||||
|
||||
if (item != "all") {
|
||||
docTypeQueryString +=
|
||||
" pinswg_isharedocumentlocations eq " + item;
|
||||
|
||||
docTypeQueryString +=
|
||||
index < documentTypeArr.length - 1 ? " or " : "";
|
||||
}
|
||||
});
|
||||
docTypeQueryString += " )";
|
||||
} else {
|
||||
docTypeQueryString +=
|
||||
" and pinswg_isharedocumentlocations eq " + documentType;
|
||||
}
|
||||
}
|
||||
|
||||
if (documentOrigin != "all") {
|
||||
if (documentOrigin.indexOf(",") >= 0) {
|
||||
const documentOriginArr = documentOrigin.split(",");
|
||||
|
||||
docOriginQueryString = " and (";
|
||||
documentOriginArr.forEach(function (item, index) {
|
||||
console.log(item, index);
|
||||
|
||||
if (item != "all") {
|
||||
docOriginQueryString += " pinswg_origin eq " + item;
|
||||
|
||||
docOriginQueryString +=
|
||||
index < documentOriginArr.length - 1 ? " or " : "";
|
||||
}
|
||||
});
|
||||
docOriginQueryString += " )";
|
||||
} else {
|
||||
docOriginQueryString += " and pinswg_origin eq " + documentOrigin;
|
||||
}
|
||||
}
|
||||
|
||||
function daysAgoISO(days) {
|
||||
const today = new Date();
|
||||
const resultDate = new Date(today);
|
||||
resultDate.setUTCDate(today.getUTCDate() - days); // subtract weeks
|
||||
resultDate.setUTCHours(0, 0, 0, 0); // reset time to 00:00:00
|
||||
return resultDate.toISOString().replace(/\.000Z$/, "Z"); // format as 'YYYY-MM-DDT00:00:00Z'
|
||||
}
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_documents?$select=pinswg_name,createdon,pinswg_publishtoweb,_pinswg_documentids_value,pinswg_isharedocumentlocations,pinswg_isharedocumentreference,pinswg_uploadurl,pinswg_uploadstatus,pinswg_origin&$filter=createdon ge " +
|
||||
daysAgoISO(numberOfWeeks) +
|
||||
docTypeQueryString +
|
||||
docOriginQueryString +
|
||||
"&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
"&$expand=pinswg_DocumentIds($select = ticketnumber,pinswg_publishtoweb)" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
|
||||
console.log(
|
||||
"\n==========================================\n",
|
||||
"\nnew docs search---- ",
|
||||
"\n\nQuery url: " + queryUrl,
|
||||
"\n\nRelay link: " + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
"\n==========================================\n"
|
||||
);
|
||||
|
||||
var apiResponse = axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPagedCustom(token.access_token, showNumberOfRecords)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r.pinswg_DocumentIds?.ticketnumber || null,
|
||||
publishtoweb: r.pinswg_DocumentIds?.pinswg_publishtoweb || null,
|
||||
}));
|
||||
|
||||
data.value = flattened;
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_hashlink = encryptDocReference(
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
|
||||
var dataStr;
|
||||
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getbasicsearch_api:
|
||||
* get:
|
||||
* tags: [Search]
|
||||
* description: Basic search
|
||||
* parameters:
|
||||
* - name: searchString
|
||||
* in: query
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
azureHeadersPagedCustom,
|
||||
consoleLogger,
|
||||
getToken,
|
||||
} from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchString;
|
||||
var pageNumber = req.query.pageNumber || 1;
|
||||
var token = await getToken();
|
||||
|
||||
var orderby = req.query.orderby || "createdon";
|
||||
var fieldSort = req.query.fieldSort || "desc";
|
||||
var showNumberOfRecords = req.query.showNumberOfRecords || 10;
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=caseorigincode,pinswg_publishtoweb,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
|
||||
console.log(
|
||||
"\n==========================================\n",
|
||||
"\nnew appeal search ",
|
||||
"\n\nQuery url: " + queryUrl,
|
||||
"\n\nRelay link: " + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
"\n==========================================\n"
|
||||
);
|
||||
|
||||
var apiResponse = axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPagedCustom(token.access_token, showNumberOfRecords)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -1,110 +1,203 @@
|
||||
/**
|
||||
* @swagger
|
||||
* /api/documents/download/{id}:
|
||||
* get:
|
||||
* tags:
|
||||
* - Documents
|
||||
* description: Get document
|
||||
* parameters:
|
||||
* - name: id
|
||||
* in: path
|
||||
* description: iShare ID
|
||||
* type: string
|
||||
* required: true
|
||||
* default: A41567436
|
||||
* - name: hash
|
||||
* in: query
|
||||
* description: Hash string
|
||||
* default: e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
*/
|
||||
// /**
|
||||
// * @swagger
|
||||
// * /api/documents/download/{id}:
|
||||
// * get:
|
||||
// * tags:
|
||||
// * - Documents
|
||||
// * description: Get document
|
||||
// * parameters:
|
||||
// * - name: id
|
||||
// * in: path
|
||||
// * description: iShare ID
|
||||
// * type: string
|
||||
// * required: true
|
||||
// * default: A41567436
|
||||
// * - name: hash
|
||||
// * in: query
|
||||
// * description: Hash string
|
||||
// * default: e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71
|
||||
// * responses:
|
||||
// * 200:
|
||||
// * description: Success
|
||||
// */
|
||||
|
||||
// import axios from "axios";
|
||||
// import CryptoJS from "crypto-js";
|
||||
// import { getToken, consoleLogger } from "../../../../actions";
|
||||
|
||||
// const WORDKEY = process.env.HASHKEY;
|
||||
// const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||
// const tenantId = process.env.TENANT;
|
||||
|
||||
// const WEBAPI_URL =
|
||||
// process.env.RELAY_ROOT ||
|
||||
// "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
// const hashAPIPath = (queryPath) => {
|
||||
// var hashlink = CryptoJS.HmacSHA256(
|
||||
// queryPath,
|
||||
// CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
// );
|
||||
// hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
// //return "&hash=" + hashlink;
|
||||
|
||||
// return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
// };
|
||||
|
||||
// const azureHeadersPaged = (access_token) => {
|
||||
// return {
|
||||
// headers: {
|
||||
// "OData-MaxVersion": "4.0",
|
||||
// "OData-Version": "4.0",
|
||||
// "Accept": "application/json;odata.metadata=none",
|
||||
// "Prefer":
|
||||
// 'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
|
||||
// "Content-Type": "application/json",
|
||||
// "Authorization": "Bearer " + access_token,
|
||||
// },
|
||||
// };
|
||||
// };
|
||||
|
||||
// export default async function ApiProxy(req, res) {
|
||||
// var token = await getToken();
|
||||
|
||||
// var docRef = req.query;
|
||||
|
||||
// var queryUrl = "documents/download/" + docRef.id + "?hash=" + docRef.hash;
|
||||
|
||||
// const configDocument = (access_token) => {
|
||||
// return {
|
||||
// headers: {
|
||||
// "OData-MaxVersion": "4.0",
|
||||
// "OData-Version": "4.0",
|
||||
// "Accept": "application/json",
|
||||
// "Prefer": 'odata.include-annotations="*",return=representation',
|
||||
// "Content-Type": "application/json",
|
||||
// "Authorization": "Bearer " + access_token,
|
||||
// },
|
||||
// responseType: "arraybuffer",
|
||||
// };
|
||||
// };
|
||||
|
||||
// return axios
|
||||
// .get(
|
||||
// WEBAPI_URL + queryUrl, // + hashAPIPath(queryUrl),
|
||||
// configDocument(token.access_token)
|
||||
// )
|
||||
// .then((response) => {
|
||||
// const bytes = response.data.byteLength;
|
||||
// console.log(bytes);
|
||||
|
||||
// res.setHeader(
|
||||
// "content-disposition",
|
||||
// "attachment; filename=" +
|
||||
// response.headers["content-disposition"].split(
|
||||
// "filename="
|
||||
// )[1]
|
||||
// );
|
||||
// return res.status(200).send(response.data);
|
||||
// })
|
||||
// .then(() => {
|
||||
// console.log(docRef.id + "has downloaded");
|
||||
|
||||
// return "downloadComplete";
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// consoleLogger(error);
|
||||
// res.redirect("/filenotavailable");
|
||||
// });
|
||||
// }
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, consoleLogger } from "../../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||
const tenantId = process.env.TENANT;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
const azureHeadersPaged = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json;odata.metadata=none",
|
||||
"Prefer":
|
||||
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
|
||||
var docRef = req.query;
|
||||
|
||||
var queryUrl = "documents/download/" + docRef.id + "?hash=" + docRef.hash;
|
||||
|
||||
const configDocument = (access_token) => {
|
||||
return {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + access_token,
|
||||
},
|
||||
responseType: "arraybuffer",
|
||||
};
|
||||
};
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl, // + hashAPIPath(queryUrl),
|
||||
configDocument(token.access_token)
|
||||
)
|
||||
.then((response) => {
|
||||
const bytes = response.data.byteLength;
|
||||
console.log(bytes);
|
||||
|
||||
res.setHeader(
|
||||
"content-disposition",
|
||||
"attachment; filename=" +
|
||||
response.headers["content-disposition"].split(
|
||||
"filename="
|
||||
)[1]
|
||||
);
|
||||
return res.status(200).send(response.data);
|
||||
})
|
||||
.then(() => {
|
||||
console.log(docRef.id + "has downloaded");
|
||||
|
||||
return "downloadComplete";
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.redirect("/filenotavailable");
|
||||
});
|
||||
// Retry utility with logging
|
||||
async function retry(fn, retries = 3, delay = 1000) {
|
||||
for (let attempt = 1; attempt <= retries; attempt++) {
|
||||
try {
|
||||
return { response: await fn(), attempts: attempt };
|
||||
} catch (err) {
|
||||
if (attempt === retries) throw err;
|
||||
console.log(`Retry ${attempt} failed, retrying in ${delay}ms...`);
|
||||
await new Promise((res) => setTimeout(res, delay));
|
||||
delay *= 2; // exponential backoff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ApiProxy = async (req, res) => {
|
||||
const docRef = req.query;
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const startTime = Date.now();
|
||||
|
||||
const fetchStream = async () => {
|
||||
const queryUrl =
|
||||
"documents/download/" + docRef.id + "?hash=" + docRef.hash;
|
||||
|
||||
return axios.get(WEBAPI_URL + queryUrl, {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer":
|
||||
'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
},
|
||||
responseType: "stream",
|
||||
});
|
||||
};
|
||||
|
||||
const { response, attempts } = await retry(fetchStream, 3, 1000);
|
||||
|
||||
// Extract filename
|
||||
const contentDisposition = response.headers["content-disposition"];
|
||||
const filename = contentDisposition
|
||||
? contentDisposition.split("filename=")[1]
|
||||
: docRef.id;
|
||||
|
||||
res.setHeader(
|
||||
"Content-Disposition",
|
||||
`attachment; filename=${filename}`
|
||||
);
|
||||
res.setHeader("Content-Type", "application/octet-stream");
|
||||
|
||||
let totalBytes = 0;
|
||||
|
||||
response.data.on("data", (chunk) => {
|
||||
totalBytes += chunk.length;
|
||||
});
|
||||
|
||||
response.data.pipe(res);
|
||||
|
||||
response.data.on("end", () => {
|
||||
const durationMs = Date.now() - startTime;
|
||||
console.log(
|
||||
`[Download Complete] Document: ${filename}, ID: ${docRef.id}, Size: ${totalBytes} bytes, Duration: ${durationMs}ms, Attempts: ${attempts}`
|
||||
);
|
||||
});
|
||||
|
||||
response.data.on("error", (err) => {
|
||||
consoleLogger(err);
|
||||
if (!res.headersSent) res.redirect("/filenotavailable");
|
||||
});
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
if (!res.headersSent) res.redirect("/filenotavailable");
|
||||
}
|
||||
};
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
responseLimit: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default ApiProxy;
|
||||
|
||||
@@ -35,11 +35,19 @@ export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and attributevalue ne 846040002"
|
||||
: "") +
|
||||
"&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
// for sips
|
||||
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
//"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
//console.log(queryUrl);
|
||||
console.log(queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -49,7 +49,11 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
"')) and pinswg_appealcasetype ne null " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and pinswg_appealcasetype ne 846040002 "
|
||||
: "") +
|
||||
"and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
console.log(
|
||||
"\n==========================================\n",
|
||||
|
||||
@@ -33,7 +33,7 @@ import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { azureHeaders, consoleLogger, getToken } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -55,21 +55,25 @@ export default async function ApiProxy(req, res) {
|
||||
var incidentID = req.query.incidentID;
|
||||
var token = await getToken();
|
||||
|
||||
let navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
|
||||
var queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
primaryIdAttribute +
|
||||
"s_value eq " +
|
||||
incidentID +
|
||||
"&$count=true";
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
|
||||
//" and statuscode eq 1&$count=true";
|
||||
|
||||
queryUrl =
|
||||
queryUrl +
|
||||
getSelectQuery(appealTypeName) +
|
||||
",_" +
|
||||
primaryIdAttribute +
|
||||
"s_value";
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
console.log(
|
||||
"\n==========================================\n",
|
||||
@@ -86,6 +90,13 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null,
|
||||
}));
|
||||
|
||||
data.value = flattened;
|
||||
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -34,7 +34,7 @@ import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -59,18 +59,25 @@ export default async function ApiProxy(req, res) {
|
||||
var incidentID = req.query.incidentID;
|
||||
var token = await getToken();
|
||||
|
||||
let navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
|
||||
var queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
primaryIdAttribute +
|
||||
"s_value eq " +
|
||||
"?$filter=" +
|
||||
incidentID +
|
||||
"&$count=true";
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
|
||||
//" and statuscode eq 1&$count=true";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
//console.log("query: ", queryUrl, "<<<<end query");
|
||||
console.log("query: ", queryUrl, "<<<<end query");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -78,10 +85,18 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null,
|
||||
}));
|
||||
|
||||
data.value = flattened;
|
||||
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -83,7 +83,11 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=" +
|
||||
"')) and pinswg_appealcasetype ne null " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and pinswg_appealcasetype ne 846040002 "
|
||||
: "") +
|
||||
"and pinswg_publishtoweb eq true&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
|
||||
@@ -43,7 +43,7 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -51,6 +51,33 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.ticketnumber = element.pinswg_WatchedCase.ticketnumber;
|
||||
element.pinswg_title =
|
||||
element[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
|
||||
element[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._pinswg_associatedlpa_value =
|
||||
element.pinswg_WatchedCase._pinswg_associatedlpa_value;
|
||||
element[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._ownerid_value =
|
||||
element.pinswg_WatchedCase._ownerid_value;
|
||||
|
||||
delete element.pinswg_WatchedCase;
|
||||
});
|
||||
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -43,9 +43,11 @@ export default async function ApiProxy(req, res) {
|
||||
console.log(req.body, queryUrl);
|
||||
|
||||
var crmUrl = "https://" + process.env.CRMURL;
|
||||
var crmVersion = process.env.CRMURL_VERSION;
|
||||
|
||||
var data = {
|
||||
"@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")",
|
||||
"@odata.id":
|
||||
crmUrl + "/api/data/" + crmVersion + "/contacts(" + contactid + ")",
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
||||
@@ -17,12 +17,9 @@ ApiProxy.get(async (req, res) => {
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blobName;
|
||||
|
||||
//console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
encodeURIComponent(blobName);
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
await deleteBlob(
|
||||
|
||||
@@ -20,14 +20,17 @@ ApiProxy.get(async (req, res) => {
|
||||
"/api/file/downloadblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
encodeURIComponent(casefolderID) +
|
||||
"&blobname=" +
|
||||
blobName.trim();
|
||||
encodeURIComponent(blobName.trim());
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const bloblocation =
|
||||
casefolderID + (blobName.indexOf(".json") > 0 ? "/" : "/files/");
|
||||
|
||||
const downloaded = await downloadFile(
|
||||
containerName,
|
||||
casefolderID + "/files/" + decodeURI(blobName)
|
||||
bloblocation + decodeURI(blobName)
|
||||
);
|
||||
|
||||
res.setHeader(
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { DefaultAzureCredential } from "@azure/identity";
|
||||
import { BlobServiceClient } from "@azure/storage-blob";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
if (req.method !== "POST") {
|
||||
res.status(405).json({ error: "Method not allowed" });
|
||||
return;
|
||||
}
|
||||
|
||||
const { container, blobName } = req.body;
|
||||
|
||||
if (!container || !blobName) {
|
||||
res.status(400).json({ error: "Missing container or blobName" });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
|
||||
const creds = new DefaultAzureCredential();
|
||||
const blobServiceClient = new BlobServiceClient(
|
||||
`https://${accountName}.blob.core.windows.net`,
|
||||
creds
|
||||
);
|
||||
|
||||
const containerClient = blobServiceClient.getContainerClient(container);
|
||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||
|
||||
// Download blob content
|
||||
const downloadResponse = await blockBlobClient.download(0);
|
||||
const downloaded = await streamToString(
|
||||
downloadResponse.readableStreamBody
|
||||
);
|
||||
|
||||
// Parse JSON
|
||||
const json = JSON.parse(downloaded);
|
||||
|
||||
// Remove repComplete element if it exists
|
||||
if ("repComplete" in json) {
|
||||
delete json.repComplete;
|
||||
}
|
||||
|
||||
const tags = {
|
||||
containerid: json.containerID,
|
||||
caseID: json.ticketnumber,
|
||||
blobType: "Representation",
|
||||
};
|
||||
|
||||
// Convert back to string
|
||||
const updatedContent = JSON.stringify(json, null, 2);
|
||||
|
||||
// Upload updated content (overwrite)
|
||||
await blockBlobClient.upload(
|
||||
updatedContent,
|
||||
Buffer.byteLength(updatedContent),
|
||||
{
|
||||
blobHTTPHeaders: { blobContentType: "application/json" },
|
||||
}
|
||||
);
|
||||
|
||||
console.log("the tags:", tags);
|
||||
const withTags = await blockBlobClient.setTags(tags);
|
||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||
|
||||
res.status(200).json({ message: "repComplete removed successfully" });
|
||||
} catch (error) {
|
||||
console.error("Error editing rep.json:", error);
|
||||
res.status(500).json({ error: "Failed to edit rep.json" });
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to read stream to string
|
||||
async function streamToString(readableStream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
readableStream.on("data", (data) => {
|
||||
chunks.push(data.toString());
|
||||
});
|
||||
readableStream.on("end", () => {
|
||||
resolve(chunks.join(""));
|
||||
});
|
||||
readableStream.on("error", reject);
|
||||
});
|
||||
}
|
||||
@@ -166,7 +166,7 @@ export default async function handler(req, res) {
|
||||
|
||||
var containerID = reqBodyobj.containerID;
|
||||
var casefolderID = reqBodyobj.casefolderID;
|
||||
var caseRef = reqBodyobj.caseRef;
|
||||
var caseRef = reqBodyobj.ticketnumber;
|
||||
var representationType = reqBodyobj.representationType;
|
||||
var repRaiser = reqBodyobj.lastname;
|
||||
var localeSelect = reqBodyobj.locale;
|
||||
|
||||
+10
-8
@@ -53,7 +53,9 @@ const SignIn = (props) => {
|
||||
<div className="govuk-body-m">
|
||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
|
||||
<h1 className="govuk-fieldset__heading govuk-heading-m">
|
||||
{t("auth:auth-page-title")}{" "}
|
||||
{t(
|
||||
"auth:auth-page-title",
|
||||
)}{" "}
|
||||
</h1>
|
||||
</legend>
|
||||
|
||||
@@ -91,7 +93,7 @@ const SignIn = (props) => {
|
||||
htmlFor="email"
|
||||
>
|
||||
{t(
|
||||
"auth:auth-email-label"
|
||||
"auth:auth-email-label",
|
||||
)}
|
||||
</label>
|
||||
|
||||
@@ -111,7 +113,7 @@ const SignIn = (props) => {
|
||||
}
|
||||
>
|
||||
{t(
|
||||
"auth:auth-signin-button-label"
|
||||
"auth:auth-signin-button-label",
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
@@ -132,10 +134,10 @@ const SignIn = (props) => {
|
||||
};
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
if (process.env.SHOWLOGIN == false) {
|
||||
if (process.env.SHOWLOGIN === "false" || process.env.SHOWLOGIN === false) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/404",
|
||||
destination: "/status",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
@@ -146,7 +148,7 @@ export async function getServerSideProps(context) {
|
||||
"\n//////////////////////\n",
|
||||
"Sign in callbackurl: " + context.query.callbackUrl,
|
||||
context.locale,
|
||||
"\n//////////////////////\n"
|
||||
"\n//////////////////////\n",
|
||||
);
|
||||
let formURL = context.req.headers.host;
|
||||
//console.log("formUrl:", formURL);
|
||||
@@ -176,7 +178,7 @@ export async function getServerSideProps(context) {
|
||||
|
||||
// Append the query parameters to the new URL
|
||||
params.forEach((value, key) =>
|
||||
toUrlObj.searchParams.append(key, value)
|
||||
toUrlObj.searchParams.append(key, value),
|
||||
);
|
||||
|
||||
return toUrlObj.toString(); // Return the full new URL as a string
|
||||
@@ -185,7 +187,7 @@ export async function getServerSideProps(context) {
|
||||
typeof context.query.callbackUrl != "undefined" &&
|
||||
(formURL = appendParamsAndPathToNewUrl(
|
||||
context.query.callbackUrl,
|
||||
formURL
|
||||
formURL,
|
||||
));
|
||||
|
||||
//formURL = appendParamsAndPathToNewUrl(context.query.callbackUrl, formURL);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user