Author SHA1 Message Date
Robert Bond 4cbc674788 Merged PR 2068: Set portal to readonly
Related work items: #21227
2026-01-30 10:24:07 +00:00
robbond 46bc5d1006 pass showlogin vars to pages and components 2026-01-28 13:31:19 +00:00
robbond b790facf56 redirect login attempts to status page 2026-01-28 13:30:27 +00:00
robbond c8f43710d3 service banner annpouncement and display logic 2026-01-28 13:30:05 +00:00
robbond c40d2df1e9 announcement page 2026-01-28 13:29:26 +00:00
Robert Bond ff394882a5 Merged PR 1999: fixed ui misaligned button and wrong text
fixed ui misaligned button and wrong text

Related work items: #20166
2025-11-18 08:04:38 +00:00
robbond 6a7806f5ea fixed ui misaligned button and wrong text 2025-11-18 07:57:09 +00:00
Robert Bond c622cb2f74 Merged PR 1987: docoffline dependant appeals and reps
docoffline dependant appeals and reps

Related work items: #20166
2025-11-10 08:57:48 +00:00
robbond 02a83700ba docoffline dependant appeals and reps 2025-11-10 06:22:31 +00:00
Robert Bond eebe30a232 Merged PR 1957: Fixes for d365
Related work items: #19548, #19887, #19889
2025-10-28 11:26:42 +00:00
robbond e54a0b2253 updated serching to reduce CRM calls for performance and stability 2025-10-28 11:21:38 +00:00
robbond df199cff53 19889 added in curmurl_version variable 2025-10-28 11:20:02 +00:00
robbond d0d2b5d7a9 19845 other party rep dates now showing - added in query 2025-10-28 11:18:10 +00:00
robbond 84aed438f8 19548 remove setcaseinvolvement 2025-10-28 11:17:08 +00:00
Robert Bond 8be971f0b9 Merged PR 1905: Download throttling
Related work items: #19431
2025-10-01 08:28:16 +00:00
robbond 118d8a56c7 welsh language labels 2025-10-01 09:18:31 +01:00
robbond 0b3cb9778b queued downloads and stream not buffer of downloads 2025-09-23 12:45:20 +01:00
robbond cb948a160b updated admin tabs and filtering 2025-09-23 12:44:21 +01:00
Robert Bond c5d3792048 Merged PR 1870: Fix downloading reps links
updated download and delete links to encode with correct hash values

Related work items: #18901
2025-09-11 09:55:16 +00:00
robbond 17042d9836 update copy to remove allowed zip files 2025-09-11 10:51:47 +01:00
robbond e9fc8816c1 url encode values corect for hash and remove .zip files allowed 2025-09-11 10:51:14 +01:00
robbond f8769d0bf1 url encode/decode correctly paths for hashed values 2025-09-11 10:50:45 +01:00
robbond c0dbaa2c3f reps files to use ticket number not title for case ref 2025-09-11 10:49:47 +01:00
Robert Bond 16010f177a Merged PR 1847: doc link fix for unpublished docs and cases
doc link fix for unpublished docs and cases

Related work items: #18559
2025-09-01 08:48:23 +00:00
robbond 7ec709581f doc link fix for unpublished docs and cases 2025-09-01 08:19:22 +01:00
Robert Bond 2c3c3f1cdf Merged PR 1846: Admin tabs
Related work items: #18559
2025-08-29 07:59:12 +00:00
robbond ac17e2058b removed older storage pages 2025-08-29 08:25:01 +01:00
robbond 75bab2af0b admin tabbed pages 2025-08-29 08:24:00 +01:00
Robert Bond 60a9081ead Merged PR 1836: added in navigation property for transport acts
added in navigation property for transport acts

Related work items: #17346
2025-08-21 10:13:04 +00:00
robbond 2d18a5a2b3 added in navigation property for transport acts 2025-08-21 11:10:20 +01:00
Robert Bond 6f58e7ad63 Merged PR 1832: right mouse click fixes on view all
Related work items: #17346
2025-08-19 11:39:59 +00:00
robbond 9a3201792c removed link for res awiating submissin making it onclick instead 2025-08-19 12:35:51 +01:00
robbond 0b070de9f7 updated breadcrumb when key is used 2025-08-19 12:35:29 +01:00
robbond 7cc9469b2b added in a key to be used when right clicked on link 2025-08-19 12:35:00 +01:00
Robert Bond a4ce38511d Merged PR 1830: updated right click actions
updated right click actions

Related work items: #17346
2025-08-19 08:01:21 +00:00
robbond 95d5164b2f updated right click actions 2025-08-18 18:24:42 +01:00
Robert Bond 6df20eb960 Merged PR 1829: updated text for home page to say DNS on button
updated text for home page to say DNS on button

Related work items: #17346
2025-08-18 12:01:32 +00:00
robbond a9c3a1368f updated text for home page to say DNS on button 2025-08-18 12:57:16 +01:00
Robert Bond 92aee7e23e Merged PR 1825: updated watched case filter on dashboard to not count reps
Related work items: #18356
2025-08-14 11:23:17 +00:00
robbond 5cf5a64ad5 added count for orphaned reps 2025-08-14 12:20:22 +01:00
robbond 1d1adf017a tidied up view all and icon 2025-08-14 12:18:35 +01:00
robbond fcba17c81f updated watch case filter on dashboard 2025-08-14 10:54:59 +01:00
Robert Bond 0e91dfe8a2 Merged PR 1819: updated watched case filter
Related work items: #18356
2025-08-14 07:40:28 +00:00
robbond 38ebd522a8 added count of accounts 2025-08-14 08:31:18 +01:00
robbond b86712efb8 storage admin update 2025-08-14 08:25:20 +01:00
robbond 8e9d89a2af included filter out reps 2025-08-14 08:25:05 +01:00
Robert Bond fabcb3ee5a Merged PR 1818: home page content update and storage admin updates
Related work items: #17346
2025-08-13 14:59:55 +00:00
robbond ec3a591126 updated storage admin 2025-08-13 15:57:18 +01:00
robbond ad2dddc9a4 updated home page copy 2025-08-13 13:45:33 +01:00
Robert Bond 68a34d03ae Merged PR 1815: Ticketnumber on watched cases and storage browser
Related work items: #18356
2025-08-13 09:11:20 +00:00
robbond fc1f63f388 updated weatched case for tickent number 2025-08-13 09:58:39 +01:00
robbond 664d0dd787 storage admin browser 2025-08-13 09:56:50 +01:00
Robert Bond c55242fd90 Merged PR 1813: ticket number not ref/title/pinswg_name
Related work items: #18356
2025-08-12 11:57:18 +00:00
robbond 21bba4a131 use ticketnumber not ref/title/pinswg_name 2025-08-12 12:52:43 +01:00
robbond 82f96493ce storage account report 2025-08-12 12:49:42 +01:00
Robert Bond 2347a104c8 Merged PR 1812: fix build for multiple repsonresults import
fix build for multiple repsonresults import

Related work items: #18356
2025-08-12 09:09:46 +00:00
robbond fbfd21df41 fix build for multiple repsonresults import 2025-08-12 10:05:43 +01:00
Robert Bond f6bfc4b5d0 Merged PR 1811: use ticket number not title/reference/pinswg_name
Related work items: #18356
2025-08-12 08:42:11 +00:00
robbond 8d8ae89ae6 show reps on results for view all 2025-08-12 07:20:43 +01:00
robbond 6fa2418b19 use ticketnumber not ref/title/pinswg_name 2025-08-12 07:20:17 +01:00
robbond b808a34b14 pass showlogincheck prop 2025-08-12 07:18:51 +01:00
robbond 8a2ee508c0 use ticket not title/ref/pinswg_name 2025-08-12 07:18:36 +01:00
robbond 5fb944e90f pass showlogincheck prop to display correctly 2025-08-12 07:17:30 +01:00
robbond 5a4670dda3 update query to get ticketnumber using navigationproproperty 2025-08-12 07:16:48 +01:00
robbond 75436837a2 pass ticketnumber as prop 2025-08-12 07:15:31 +01:00
robbond 58b5c71a64 update tags with ticketnumber not title/ref 2025-08-12 07:14:43 +01:00
Robert Bond f9524638a7 Merged PR 1793: And reps open/available on results lists
Related work items: #17728
2025-08-11 08:32:35 +00:00
robbond f696b20671 Merge branch '17728-show-reps-open-on-dnsapplications-list-page' of https://welshgovernment.visualstudio.com/PEDW%20-%20Planning%20Casework/_git/FrontEnd into 17728-show-reps-open-on-dnsapplications-list-page 2025-08-11 07:49:14 +01:00
robbond 8895d5a328 included ticketnumber 2025-08-11 07:35:49 +01:00
bevanl3 f9831b9aa4 fix missing case info when signed out 2025-08-04 16:15:55 +01:00
robbond 986d5a382f case ref not case title 2025-08-04 06:27:29 +01:00
robbond 9845af7046 updated lang label for myportal/dnsapplications 2025-08-01 07:41:12 +01:00
robbond 14a24616d0 updated language label for repsonresults to dns list 2025-08-01 07:34:35 +01:00
robbond e990feddbc added repsonresults to dns list 2025-08-01 07:34:08 +01:00
Robert Bond 9744ab93a4 Merged PR 1778: re ordered home page cards and updated text
re ordered home page cards and updated text

Related work items: #17346
2025-07-25 07:57:08 +00:00
robbond 9971f8be4d re ordered home page cards and updated text 2025-07-25 08:16:16 +01:00
Robert Bond b2e8eae518 Merged PR 1756: added chaining and a blank
added chaining and a blank

Related work items: #17728
2025-07-17 11:26:43 +00:00
robbond f6cd76ed38 added chaining and a blank 2025-07-17 12:21:26 +01:00
Robert Bond ab97d28a1c Merged PR 1744: fix to service title size
fix to  service title size

Related work items: #17592, #17552
2025-07-10 11:17:44 +00:00
robbond 7f2ed69972 fix to service title size 2025-07-09 15:16:51 +01:00
Robert Bond 0d24e3ee12 Merged PR 1738: adjsuted image size
adjsuted image size

Related work items: #17552
2025-07-09 08:39:49 +00:00
robbond 42866765c2 adjsuted image size 2025-07-09 09:20:41 +01:00
Robert Bond a156cc5dda Merged PR 1735: adjsuted size of service banner title svg
adjsuted size of service banner title svg

Related work items: #17552
2025-07-08 15:10:14 +00:00
robbond 9710301b8d adjsuted size of service banner title svg 2025-07-08 16:07:38 +01:00
Robert Bond 79538f5f5c Merged PR 1731: added scrol ltop on complete
added scrol ltop on complete

Related work items: #17344
2025-07-08 08:23:00 +00:00
robbond 8c07850486 added scrol ltop on complete 2025-07-08 09:11:50 +01:00
Robert Bond 5fbd07bb1f Merged PR 1726: corrected query for getappealtypes to exclude sips
corrected query for getappealtypes to exclude sips

Related work items: #17466
2025-07-04 13:06:47 +00:00
robbond ac21337d4d corrected query for getappealtypes to exclude sips 2025-07-04 14:04:55 +01:00
Robert Bond 67d6db3b05 Merged PR 1725: doc label and breadcrumb
doc label and breadcrumb

Related work items: #17392
2025-07-04 12:08:49 +00:00
robbond f705cc41c3 doc label and breadcrumb 2025-07-04 13:07:01 +01:00
Robert Bond 8edc905a8c Merged PR 1721: fix typon in jsonpath expression
fix typon in jsonpath expression

Related work items: #17392
2025-07-03 14:58:03 +00:00
robbond 527decda43 fix typon in jsonpath expression 2025-07-03 15:54:36 +01:00
Robert Bond 7742558f17 Merged PR 1720: remove reference to sandbox to see if helps
remove reference to sandbox to see if helps

Related work items: #17392
2025-07-03 13:11:40 +00:00
robbond a1b821521d remove reference to sandbox to see if helps 2025-07-03 14:09:42 +01:00
Robert Bond b736239bf3 Merged PR 1719: adjusted query typo
adjusted query typo

Related work items: #17392
2025-07-03 12:05:58 +00:00
robbond 12a6e15a40 adjusted query typo 2025-07-03 12:44:09 +01:00
Robert Bond d59290364d Merged PR 1716: tweak for welsh link to fix build
tweak for welsh link to fix build

Related work items: #17392
2025-07-02 16:32:52 +00:00
robbond 0a25358860 tweak for welsh link to fix build 2025-07-02 17:30:58 +01:00
Robert Bond 9935f65e73 Merged PR 1713: updated welsh path to cas summary include case ref
updated welsh path to cas summary include case ref

Related work items: #17392
2025-07-02 13:16:55 +00:00
robbond 5ecaa58bdf updated welsh path to cas summary include case ref 2025-07-02 14:07:29 +01:00
Robert Bond dbc0345197 Merged PR 1708: fixed query url
fixed query url

Related work items: #17334
2025-06-30 13:03:03 +00:00
robbond 4bf2a129de fixed query url 2025-06-30 12:43:20 +01:00
Robert Bond 75a15948e4 Merged PR 1706: new appeal pdf file location tag
Related work items: #12956
2025-06-27 07:49:29 +00:00
robbond 91dcf6c5c3 rep create fix 2025-06-27 06:40:51 +01:00
robbond e0988de47b createappealpdf function fix 2025-06-27 06:21:47 +01:00
Robert Bond dfd76757ae Merged PR 1704: docuemnt location update
docuemnt location  update

Related work items: #12956
2025-06-26 21:06:01 +00:00
robbond 84fc916c7f docuemnt location update 2025-06-26 21:51:50 +01:00
Robert Bond f39bdee1ee Merged PR 1641: remove swagger docs
remove swagger docs

Related work items: #12956
2025-05-22 16:21:25 +00:00
robbond cc3c70024f remove swagger docs 2025-05-22 17:11:57 +01:00
Robert Bond 2ac542e6c2 Merged PR 1618: updated gitignore,package lock for node 20 pipeline
updated gitignore,package lock for node 20 pipeline

Related work items: #12956
2025-05-13 12:57:21 +00:00
robbond e3546e29a7 updated gitignore,package lock for node 20 pipeline 2025-05-13 13:54:23 +01:00
119 changed files with 16824 additions and 2442 deletions
+68 -41
View File
@@ -13,31 +13,31 @@ HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS" # CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
# //New Dev oauth ESNR # //New Dev oauth ESNR
# CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
# CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk 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/ 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" RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-dev-uks-01" RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS" CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
# //New Test # //New Test
# CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1 CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
# CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM 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/ 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" RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-test-uks-01" RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
# CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS" CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
# //New PreProd # # //New PreProd
CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a # CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E # 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/ # 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" # RELAYURI = "ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-ppe-uks-01" # 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/ # # 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" # # RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01" # # RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales" # CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
# //Prod Oauth WGO # //Prod Oauth WGO
@@ -48,6 +48,17 @@ CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
# RELAYPATH = "prod-pedw-hc" # RELAYPATH = "prod-pedw-hc"
# CRMURL = "crm2016.llc.gov.wales/PEDW" # 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 = GTM-T78CBC3
GOOGLE_TAG_MANAGER = G-GTWW3JT03Z GOOGLE_TAG_MANAGER = G-GTWW3JT03Z
@@ -58,8 +69,9 @@ SHOWMAPS = false
API_ROOT = "http://localhost:3000" API_ROOT = "http://localhost:3000"
CY_API_ROOT = "http://cymru.local:3000" CY_API_ROOT = "http://cymru.local:3000"
I18N_DOMAIN = "cymru.local" I18N_DOMAIN = "cymru.local"
DOCAPI_OFFLINE = "12:00:00,14:00:00" # DOCAPI_OFFLINE = "12:00:00,14:00:00"
SHOWFILTERDOCS = false DOCAPI_OFFLINE = "02:00:00,04:00:00"
SHOWFILTERDOCS = true
// Next Auth vars // Next Auth vars
@@ -68,18 +80,24 @@ NEXTAUTH_URL_INTERNAL = $API_ROOT
NEXTAUTH_SECRET = SuperSecret NEXTAUTH_SECRET = SuperSecret
// CNR sql server // 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 // 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://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 // 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 // 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 # 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 SECRET = SuperSecret
@@ -91,24 +109,24 @@ AZURE_TENANT_ID = $TENANT
AZURE_CLIENT_SECRET = $CLIENT_SECRET AZURE_CLIENT_SECRET = $CLIENT_SECRET
// CNR key // CNR key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks" AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks"
# AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw== AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
// new dev key // new dev key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks" AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
# AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA== AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
// New test key // New test key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks" AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
# AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg== AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
// New preprod key // New preprod key
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks" # AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ== # AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net # AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
// PROD key // 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_STORAGE_ACCOUNT_KEY = koZ46STRqapSa2Dod8MLL6aju1eYLhhyJ6DXpCLMTnFLJvbDT6CHUv/jwr5U/Ta8a60MWzwToHQy+AStADO7sg==
# AZURE_PEDW_STORAGE_ENDPOINT = https://pedwprod.blob.core.windows.net # 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_CONTAINER = "pedwapplications"
AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net 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 SHOW_DEBUG = true
// DEV Connection string // 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 //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 //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
View File
@@ -16,8 +16,8 @@ yarn-error.log*
.yarn .yarn
#lock files #lock files
yarn.lock # yarn.lock
package-lock.json # package-lock.json
tmp tmp
@@ -36,3 +36,15 @@ pages/polling.js
# dev apis to no include # dev apis to no include
pages/api/endpoint/getaccounts_api.js 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
+1 -1
View File
@@ -8,7 +8,7 @@
"name": "Next.js: debug server-side", "name": "Next.js: debug server-side",
"type": "node-terminal", "type": "node-terminal",
"request": "launch", "request": "launch",
"command": "yarn run dev" "command": "npm run dev"
}, },
{"name": "Launch Chrome against localhost", {"name": "Launch Chrome against localhost",
"type": "pwa-chrome", "type": "pwa-chrome",
+129 -27
View File
@@ -210,31 +210,31 @@ export const getBlobs = async (containerName, casefolderID) => {
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blob.name, encodeURIComponent(blob.name),
"hashedfilepath": hashAPIPath( "hashedfilepath": hashAPIPath(
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[2] encodeURIComponent(blob.name.split("/")[2])
), ),
"deletepath": "deletepath":
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[2], encodeURIComponent(blob.name.split("/")[2]),
"hasheddeletepath": hashAPIPath( "hasheddeletepath": hashAPIPath(
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[2] encodeURIComponent(blob.name.split("/")[2])
), ),
"hashgetblobs": hashAPIPath( "hashgetblobs": hashAPIPath(
"/api/file/getbloblist?container=" + "/api/file/getbloblist?container=" +
@@ -309,7 +309,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: formContent.caseRef, caseID: formContent.ticketnumber,
blobType: "Representation", blobType: "Representation",
}; };
@@ -317,7 +317,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const withTags = await blockBlobClient.setTags(tags); const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags); const withMeta = await blockBlobClient.setMetadata(tags);
return formContent.pinswg_name; return formContent.ticketnumber;
}; };
export const createAppealPDFBlob = async ( export const createAppealPDFBlob = async (
@@ -364,11 +364,14 @@ export const createAppealPDFBlob = async (
const uploadBlobResponse = await blockBlobClient.uploadStream(content); const uploadBlobResponse = await blockBlobClient.uploadStream(content);
console.log(uploadBlobResponse); console.log(uploadBlobResponse);
let whichLocation = "846040000"; // Default value
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: caseID, caseID: caseID,
blobType: "Appeal PDF", blobType: "Appeal PDF",
ishareLocation: whichLocation,
documentLocationId: whichLocation,
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -428,6 +431,7 @@ export const createRepPDFBlob = async (
caseID: caseID, caseID: caseID,
blobType: "Representation PDF", blobType: "Representation PDF",
ishareLocation: whichLocation, ishareLocation: whichLocation,
documentLocationId: whichLocation,
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -614,6 +618,7 @@ export const uploadFile = async (formContent, containerName, foldername) => {
documentType: files[prop][0].fieldName.split(".")[1], documentType: files[prop][0].fieldName.split(".")[1],
blobType: "RepresentationFile", blobType: "RepresentationFile",
ishareLocation: whichLocation, ishareLocation: whichLocation,
documentLocationId: whichLocation,
}; };
const withTags = blockBlobClient.setTags(tags); const withTags = blockBlobClient.setTags(tags);
const withMeta = blockBlobClient.setMetadata(tags); const withMeta = blockBlobClient.setMetadata(tags);
@@ -1230,17 +1235,17 @@ export const getProgressBlobs = async (containerName, caseReference) => {
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
caseReference + encodeURIComponent(caseReference) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[1] encodeURIComponent(blob.name.split("/")[1])
), ),
"hasheddeletepath": hashAPIPath( "hasheddeletepath": hashAPIPath(
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
caseReference + encodeURIComponent(caseReference) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[1] encodeURIComponent(blob.name.split("/")[1])
), ),
"hashgetblobs": hashAPIPath( "hashgetblobs": hashAPIPath(
"/api/file/getbloblist?container=" + "/api/file/getbloblist?container=" +
@@ -1401,20 +1406,20 @@ export const getRepsFilesBlobs = async (
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
blob.name.split("/")[0] + encodeURIComponent(
"/" + blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
blob.name.split("/")[1] + ) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[3], encodeURIComponent(blob.name.split("/")[3]),
"hashedfilepath": hashAPIPath( "hashedfilepath": hashAPIPath(
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
blob.name.split("/")[0] + encodeURIComponent(
"/" + blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
blob.name.split("/")[1] + ) +
"&blobname=" + "&blobname=" +
blob.name encodeURIComponent(blob.name.split("/")[3])
), ),
"deletepath": "deletepath":
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
@@ -1429,11 +1434,11 @@ export const getRepsFilesBlobs = async (
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
blob.name.split("/")[0] + encodeURIComponent(
"/" + blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
blob.name.split("/")[1] + ) +
"&blobname=" + "&blobname=" +
blob.name.split("/")[3] encodeURIComponent(blob.name.split("/")[3])
), ),
"hashgetblobs": hashAPIPath( "hashgetblobs": hashAPIPath(
"/api/file/getbloblist?container=" + "/api/file/getbloblist?container=" +
@@ -1445,7 +1450,7 @@ export const getRepsFilesBlobs = async (
), ),
}); });
} }
//console.log("blobObj:", blobObj); console.log("blobObj:", blobObj);
return 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
View File
@@ -532,23 +532,30 @@ export const getBasicSearchDetailsPaged = async (
appealTypeName, appealTypeName,
caseReference, caseReference,
primaryIdAttribute, primaryIdAttribute,
incidentID incidentIDs
) => { ) => {
//console.log("check appealtype:", appealType, caseReference); if (!incidentIDs || incidentIDs.length === 0) return [];
return axios // Build OData filter correctly
.get( const filter = incidentIDs
"/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=" + .map((id) => `_${primaryIdAttribute}s_value eq ${id}`)
appealTypeName + .join(" or ");
"&primaryIdAttribute=" +
primaryIdAttribute + const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
"&incidentID=" + filter
incidentID )}`;
)
.then((res) => res.data) // console.log(
.catch((error) => { // `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`
consoleLogger(error); // );
});
try {
const res = await axios.get(url);
return res.data.value || []; // ensure returning an array
} catch (error) {
consoleLogger(error);
return [];
}
}; };
export const getSearchDocumentDetails = (incidentID) => { 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) => { export const getMyLPACases = (lpaid) => {
return axios return axios
.get(BASE_URL + "/api/endpoint/getmylpacases_api?lpaid=" + lpaid) .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 = var queryUrl =
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID; "/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
var config = { var config = {
@@ -1439,14 +1459,12 @@ export const deleteWatchedCases = (watchedCaseID) => {
url: queryUrl, url: queryUrl,
}; };
return axios(config) try {
.then((res) => { const res = await axios(config);
//console.log("deleted ", res.data); return res.data;
return res.data; } catch (error) {
}) consoleLogger(error);
.catch((error) => { }
consoleLogger(error);
});
}; };
export const createAccount = (formValues) => { export const createAccount = (formValues) => {
@@ -1751,9 +1769,9 @@ export const deleteBlob = async (
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blobName + encodeURIComponent(blobName) +
deleteblobhash deleteblobhash
); );
return res.data; return res.data;
@@ -1774,11 +1792,9 @@ export const deleteRepBlob = async (
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID + "/" + filenamePrefix) +
"/" +
filenamePrefix +
"&blobname=" + "&blobname=" +
blobName + encodeURIComponent(blobName) +
deleteblobhash deleteblobhash
); );
return res.data; return res.data;
@@ -1832,14 +1848,14 @@ export const getProgressFromBlob = async (containerName, casereference) => {
const res = await axios.get( const res = await axios.get(
BASE_URL + BASE_URL +
"/api/file/getprogressobjblob?container=" + "/api/file/getprogressobjblob?container=" +
containerName + encodeURIComponent(containerName) +
"&casefolderID=" + "&casefolderID=" +
casereference + encodeURIComponent(casereference) +
hashAPIPath( hashAPIPath(
"/api/file/getprogressobjblob?container=" + "/api/file/getprogressobjblob?container=" +
containerName + encodeURIComponent(containerName) +
"&casefolderID=" + "&casefolderID=" +
casereference encodeURIComponent(casereference)
) )
); );
return res.data; return res.data;
@@ -2089,3 +2105,93 @@ export const getAddressSearch = async (searchString) => {
return ErrResponse; 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;
});
};
+1 -1
View File
@@ -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"; 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; break;
case "pinswg_callinss77s": 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; break;
case "pinswg_commonlands": 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"; 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";
+40
View File
@@ -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>
);
}
+568
View File
@@ -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
+266
View File
@@ -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>
);
}
+81
View File
@@ -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)})`;
}
+14
View File
@@ -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;
}
+166
View File
@@ -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
View File
@@ -475,23 +475,26 @@ const Breadcrumbs = (props) => {
</Link> </Link>
</li> </li>
<li className="govuk-breadcrumbs__list-item"> <li className="govuk-breadcrumbs__list-item">
{currentView.currentView.viewKey == {(currentView.currentView.viewKey ||
router.query.key) ==
"awaitingSubmissionDetails" && "awaitingSubmissionDetails" &&
t( t(
"myportal:awatitingsubmission-card-title" "myportal:awatitingsubmission-card-title"
)} )}
{currentView.currentView.viewKey == {(currentView.currentView.viewKey ||
"watchedCases" && router.query.key) == "watchedCases" &&
t("myportal:watchedcases-card-title")} t("myportal:watchedcases-card-title")}
{currentView.currentView.viewKey == {(currentView.currentView.viewKey ||
"myCases" && router.query.key) == "myCases" &&
t("myportal:mycases-card-title")} t("myportal:mycases-card-title")}
{currentView.currentView.viewKey == {(currentView.currentView.viewKey ||
router.query.key) ==
"myRepresentations" && "myRepresentations" &&
t( t(
"myportal:myrepresentations-card-title" "myportal:myrepresentations-card-title"
)} )}
{currentView.currentView.viewKey == {(currentView.currentView.viewKey ||
router.query.key) ==
"mySubmittedReps" && "mySubmittedReps" &&
"Submitted representations"} "Submitted representations"}
</li> </li>
@@ -527,19 +530,13 @@ const Breadcrumbs = (props) => {
<li className="govuk-breadcrumbs__list-item"> <li className="govuk-breadcrumbs__list-item">
<Link <Link
href={ href={
router.locale != "en" "/searchresults?q=" +
? router.locale + props.props.search.searchString
"/searchresults?q=" +
props.props.search
.searchString
: "/searchresults?q=" +
props.props.search
.searchString
} }
onClick={() => { // onClick={() => {
// spinnerState(); // // spinnerState();
router.back(); // router.back();
}} // }}
className="govuk-breadcrumbs__link" className="govuk-breadcrumbs__link"
> >
{t("common:breadcrumb-search-results")} {t("common:breadcrumb-search-results")}
@@ -706,10 +703,10 @@ const Breadcrumbs = (props) => {
</li> </li>
<li className="govuk-breadcrumbs__list-item"> <li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "} {t("common:breadcrumb-case-reference")}:{" "}
{ {props.props.currentView.caseReference
props.props.currentView.caseReference .currentReference ||
.currentReference props.props.searchResultsObj
} .searchResultsObj.value[0].title}
</li> </li>
</> </>
)} )}
@@ -793,10 +790,10 @@ const Breadcrumbs = (props) => {
</li> </li>
<li className="govuk-breadcrumbs__list-item"> <li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "} {t("common:breadcrumb-case-reference")}:{" "}
{ {props.props.currentView.caseReference
props.props.currentView.caseReference .currentReference ||
.currentReference props.props.searchResultsObj
} .searchResultsObj.value[0].title}
</li> </li>
</> </>
)} )}
@@ -1057,10 +1054,10 @@ const Breadcrumbs = (props) => {
</li> </li>
<li className="govuk-breadcrumbs__list-item"> <li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "} {t("common:breadcrumb-case-reference")}:{" "}
{ {props.props.currentView.caseReference
props.props.currentView.caseReference .currentReference ||
.currentReference props.props.searchResultsObj
} .searchResultsObj.value[0].title}
</li> </li>
</> </>
)} )}
+2
View File
@@ -27,6 +27,7 @@ const Case = (props) => {
watchedCasesDetails={props.watchedCasesDetails} watchedCasesDetails={props.watchedCasesDetails}
awaitingSubmission={props.awaitingSubmission} awaitingSubmission={props.awaitingSubmission}
caseReference={props.caseReference} caseReference={props.caseReference}
ticketnumber={props.ticketnumber}
currentType={props.currentType} currentType={props.currentType}
appealTypeID={props.appealTypeID} appealTypeID={props.appealTypeID}
searchResultsObj={props.searchResultsObj} searchResultsObj={props.searchResultsObj}
@@ -40,6 +41,7 @@ const Case = (props) => {
docsOffline={props.props.docsOffline} docsOffline={props.props.docsOffline}
documentDetailsObj={props.documentDetailsObj} documentDetailsObj={props.documentDetailsObj}
showFilteredDocs={props.showFilteredDocs} showFilteredDocs={props.showFilteredDocs}
showLoginCheck={props.showLoginCheck}
/> />
{showRepresentations == true && ( {showRepresentations == true && (
<RepresentationList <RepresentationList
+71 -43
View File
@@ -17,9 +17,11 @@ import {
import { setCurrentPage } from "../../store/currentView/action"; import { setCurrentPage } from "../../store/currentView/action";
import { setDocumentDetails } from "../../store/searchOutput/action"; import { setDocumentDetails } from "../../store/searchOutput/action";
import DocumentLink from "../utils/downloads";
import { useDownloadQueue } from "../utils/downloadmanager";
const DocumentDetails = (props) => { const DocumentDetails = (props) => {
let { t } = useTranslation(); let { t, lang } = useTranslation();
const firstRender = useRef(false); const firstRender = useRef(false);
const { const {
incidentid, incidentid,
@@ -37,7 +39,7 @@ const DocumentDetails = (props) => {
const { locale } = router; const { locale } = router;
var documentDetailsArr = documentDetailsObj || []; var documentDetailsArr = documentDetailsObj || [];
const { startDownload, getStatus } = useDownloadQueue(3);
const [selectedOption, setSelectedOption] = useState(10); const [selectedOption, setSelectedOption] = useState(10);
const [documentTypes, setDocumentTypes] = useState([{}]); const [documentTypes, setDocumentTypes] = useState([{}]);
const [selectedDocumentType, setSelectedDocumentType] = useState("all"); const [selectedDocumentType, setSelectedDocumentType] = useState("all");
@@ -416,7 +418,7 @@ const DocumentDetails = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
sanbox: {}, eval: true,
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -504,7 +506,7 @@ const DocumentDetails = (props) => {
</p> </p>
<div> <div>
<button onClick={clearCheckboxes}> <button onClick={clearCheckboxes}>
Clear filter {t("search:clear-filter-button-label")}
</button> </button>
</div> </div>
<div className="govuk-checkboxes govuk-checkboxes--small"> <div className="govuk-checkboxes govuk-checkboxes--small">
@@ -525,7 +527,10 @@ const DocumentDetails = (props) => {
className="govuk-label-s govuk-checkboxes__label" className="govuk-label-s govuk-checkboxes__label"
htmlFor={"all" + "__" + 0} htmlFor={"all" + "__" + 0}
> >
All - ( {router.locale == "cy"
? "Pawb"
: "All"}{" "}
- (
{documentTypes.reduce( {documentTypes.reduce(
(accumulator, currentItem) => { (accumulator, currentItem) => {
return ( return (
@@ -578,8 +583,8 @@ const DocumentDetails = (props) => {
'$..[?(@ && @.value=="' + '$..[?(@ && @.value=="' +
item.pinswg_isharedocumentlocationsLabel + item.pinswg_isharedocumentlocationsLabel +
'")].value_cy', '")].value_cy',
jsonL: transLookup, json: transLookup,
sanbox: {}, eval: true,
}) })
: item.pinswg_isharedocumentlocationsLabel || : item.pinswg_isharedocumentlocationsLabel ||
t( t(
@@ -605,7 +610,7 @@ const DocumentDetails = (props) => {
setCurrentPage(1); setCurrentPage(1);
}} }}
> >
Filter documents {t("search:filter-documents-label")}
</button> </button>
</div> </div>
{documentDetailsObj["@odata.count"] > 5 && ( {documentDetailsObj["@odata.count"] > 5 && (
@@ -761,41 +766,63 @@ const DocumentDetails = (props) => {
)} )}
{!ShowDocLinks ? ( {!ShowDocLinks ? (
<Link <>
scroll={false} <DocumentLink
href={ key={
detailsObj.pinswg_hashlink detailsObj.pinswg_documentid
} }
key={key} id={
onClick={() => { detailsObj.pinswg_documentid
toggleDownLoadLink( }
key detailsObj={
), detailsObj
sendGAEvent( }
"event", caseReference={
"DownloadedFile", caseReference
{ }
caseReference: startDownload={
props.caseReference, startDownload
filename: }
detailsObj.pinswg_name, getStatus={
} getStatus
); }
}} />
> {/* <Link
<span className="results-visually-hidden"> scroll={false}
{t( href={
"case:documents-name-label" detailsObj.pinswg_hashlink
)} }
: key={key}
</span> onClick={() => {
{_.has( toggleDownLoadLink(
detailsObj, key
"pinswg_name" ),
) sendGAEvent(
? detailsObj.pinswg_name "event",
: ""} "DownloadedFile",
</Link> {
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"> <span className="results-visually-hidden">
@@ -1032,6 +1059,7 @@ const DocumentDetails = (props) => {
orderByState, orderByState,
getDocumentTypes, getDocumentTypes,
getDocumentResults, getDocumentResults,
lang,
]); ]);
return ( return (
<div className="govuk-grid-row"> <div className="govuk-grid-row">
+50 -34
View File
@@ -62,6 +62,7 @@ let MakeRepresentation = (props) => {
showQuestionnaireSection, showQuestionnaireSection,
initialValues, initialValues,
setCurrentReference, setCurrentReference,
ticketnumber,
} = props; } = props;
const formObj = props.props.form; const formObj = props.props.form;
let setCaseQueryObj = props[currentType] || {}; let setCaseQueryObj = props[currentType] || {};
@@ -268,7 +269,7 @@ let MakeRepresentation = (props) => {
resultsObj = jsonpath({ resultsObj = jsonpath({
path: path:
'$..[?(@ && @.ticketnumber=="' + '$..[?(@ && @.ticketnumber=="' +
currentView.caseReference.currentReference + currentView.caseReference.ticketnumber +
'")]', '")]',
json: setCaseResultsObj, json: setCaseResultsObj,
eval: true, eval: true,
@@ -296,8 +297,8 @@ let MakeRepresentation = (props) => {
}) })
: jsonpath({ : jsonpath({
path: path:
'$..[?(@ && @.pinswg_name =="' + '$..[?(@ && @.ticketnumber =="' +
currentView.caseReference.currentReference + currentView.caseReference.ticketnumber +
'")]', '")]',
json: setCaseDetailsObj, json: setCaseDetailsObj,
eval: true, eval: true,
@@ -458,6 +459,7 @@ let MakeRepresentation = (props) => {
setSubmitBack={setSubmitBack} setSubmitBack={setSubmitBack}
props={props} props={props}
caseReference={caseReference} caseReference={caseReference}
ticketnumber={ticketnumber}
setRepFileName={setRepFileName} setRepFileName={setRepFileName}
updateRepresentation={updateRepresentation} updateRepresentation={updateRepresentation}
setSavingStatus={setSavingStatus} setSavingStatus={setSavingStatus}
@@ -767,6 +769,26 @@ let MakeRepresentation = (props) => {
return blobList; 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 ( const updateRepresentation = async (
values, values,
sendSavedEmail, sendSavedEmail,
@@ -807,19 +829,12 @@ let MakeRepresentation = (props) => {
"lastname": props.props.accountDetails.accountDetails.lastname, "lastname": props.props.accountDetails.accountDetails.lastname,
"emailAddress": "emailAddress":
props.props.accountDetails.accountDetails.emailaddress1, props.props.accountDetails.accountDetails.emailaddress1,
"siteAddress": "siteAddress": buildAddressStr(detailsObj),
detailsObj.pinswg_siteaddressline1 +
(detailsObj.pinswg_siteaddressline2 != null
? " " + detailsObj.pinswg_siteaddressline2 + " "
: " ") +
detailsObj.pinswg_siteaddresstown +
" " +
detailsObj.pinswg_siteaddresspostcode,
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1, "pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2, "pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown, "pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
"pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode, "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": detailsObj["_pinswg_appellant_value"],
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue": "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
detailsObj[ detailsObj[
@@ -945,7 +960,10 @@ let MakeRepresentation = (props) => {
var detailsObj = {}; var detailsObj = {};
detailsObj = jsonpath({ detailsObj = jsonpath({
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', path:
'$..[?(@ && @.ticketnumber=="' +
currentView.caseReference.ticketnumber +
'")]',
json: setCaseDetailsObj, json: setCaseDetailsObj,
eval: true, eval: true,
}); });
@@ -974,16 +992,19 @@ let MakeRepresentation = (props) => {
props.props.currentView.caseReference.currentReference, props.props.currentView.caseReference.currentReference,
"casereference": "casereference":
props.props.currentView.caseReference.currentReference, props.props.currentView.caseReference.currentReference,
"ticketnumber":
props.props.currentView.caseReference.ticketnumber,
"pinswg_questionnaireduedate": "pinswg_questionnaireduedate":
detailsObj.pinswg_questionnaireduedate, detailsObj?.pinswg_questionnaireduedate,
"pinswg_endofrepresentationperiod": "pinswg_endofrepresentationperiod":
detailsObj.pinswg_endofrepresentationperiod, detailsObj?.pinswg_endofrepresentationperiod,
"pinswg_applicationacceptedasvalid": "pinswg_applicationacceptedasvalid":
detailsObj.pinswg_applicationacceptedasvalid, detailsObj?.pinswg_applicationacceptedasvalid,
"pinswg_statementduedate": detailsObj.pinswg_statementduedate, "pinswg_statementduedate": detailsObj?.pinswg_statementduedate,
"pinswg_statementsduedate": detailsObj.pinswg_statementsduedate, "pinswg_statementsduedate":
detailsObj?.pinswg_statementsduedate,
"pinswg_finalcommentsduedate": "pinswg_finalcommentsduedate":
detailsObj.pinswg_finalcommentsduedate, detailsObj?.pinswg_finalcommentsduedate,
"pinswg_name": "pinswg_name":
props.props.currentView.caseReference.currentReference, props.props.currentView.caseReference.currentReference,
"firstname": "firstname":
@@ -991,20 +1012,13 @@ let MakeRepresentation = (props) => {
"lastname": props.props.accountDetails.accountDetails.lastname, "lastname": props.props.accountDetails.accountDetails.lastname,
"emailAddress": "emailAddress":
props.props.accountDetails.accountDetails.emailaddress1, props.props.accountDetails.accountDetails.emailaddress1,
"siteAddress": "siteAddress": buildAddressStr(detailsObj),
detailsObj.pinswg_siteaddressline1 + "pinswg_siteaddressline1": detailsObj?.pinswg_siteaddressline1,
(detailsObj.pinswg_siteaddressline2 != null "pinswg_siteaddressline2": detailsObj?.pinswg_siteaddressline2,
? " " + detailsObj.pinswg_siteaddressline2 + " " "pinswg_siteaddresstown": detailsObj?.pinswg_siteaddresstown,
: " ") +
detailsObj.pinswg_siteaddresstown +
" " +
detailsObj.pinswg_siteaddresspostcode,
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
"pinswg_siteaddresspostcode": "pinswg_siteaddresspostcode":
detailsObj.pinswg_siteaddresspostcode, detailsObj?.pinswg_siteaddresspostcode,
"pinswg_lpareference": resultsObj.pinswg_lpareference, "pinswg_lpareference": resultsObj?.pinswg_lpareference || "",
"_pinswg_appellant_value": "_pinswg_appellant_value":
detailsObj["_pinswg_appellant_value"], detailsObj["_pinswg_appellant_value"],
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue": "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
@@ -1068,7 +1082,7 @@ let MakeRepresentation = (props) => {
console.log("has errors:", props.invalid); console.log("has errors:", props.invalid);
Object.assign(values, { Object.assign(values, {
"locale": router.locale, "locale": router.locale,
"repComplete": currentView.caseReference.currentReference, "repComplete": currentView.caseReference.ticketnumber,
}); });
props.invalid == false && props.invalid == false &&
updateRepresentation(values, false, false); updateRepresentation(values, false, false);
@@ -1169,7 +1183,9 @@ let MakeRepresentation = (props) => {
dataObj, dataObj,
[{}], [{}],
values.containerID, values.containerID,
props.caseReference + "/" + dataObj.repfile_name props.props.currentView.caseReference.ticketnumber +
"/" +
dataObj.repfile_name
).then((data) => { ).then((data) => {
return data; return data;
}); });
@@ -196,7 +196,8 @@ const RepAgent = (props) => {
"myrepresentations:add-files-label" "myrepresentations:add-files-label"
)} )}
ticketnumber={ ticketnumber={
props.props.caseReference props.currentView.caseReference
.ticketnumber
} }
hint={"sdsd"} hint={"sdsd"}
fileList={ fileList={
@@ -188,7 +188,10 @@ const RepAppellant = (props) => {
label={t( label={t(
"myrepresentations:add-files-label" "myrepresentations:add-files-label"
)} )}
ticketnumber={props.props.caseReference} ticketnumber={
props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"} hint={"sdsd"}
fileList={ fileList={
props.currentView.fileList props.currentView.fileList
@@ -35,6 +35,9 @@ let RepCapacitySelection = (props) => {
currentType={currentType} currentType={currentType}
casesObj={casesObj} casesObj={casesObj}
caseReference={props.props.caseReference} caseReference={props.props.caseReference}
ticketnumber={
props.props.currentView.caseReference.ticketnumber
}
searchResultsObj={props.props.searchResultsObj} searchResultsObj={props.props.searchResultsObj}
myRepresentations={props.props.myRepresentations} myRepresentations={props.props.myRepresentations}
props={props} props={props}
@@ -36,9 +36,17 @@ const RepComplete = (props) => {
</li> </li>
)); ));
const isSIPS =
props.props.currentView.caseReference.appealType === 846040002;
useEffect(() => { useEffect(() => {
const reference = "PEDW-REPRESENTATION-COMPLETE"; const reference = isSIPS
const templateId = "c49785e7-3217-40b6-b33f-dffc4e58d5c1"; ? "PEDW-CONSULTATION-COMPLETE"
: "PEDW-REPRESENTATION-COMPLETE";
const templateId = isSIPS
? "c3f373ca-df9d-4967-bea0-3ad3a57f8dcc"
: "c49785e7-3217-40b6-b33f-dffc4e58d5c1";
const emailAddress = const emailAddress =
props.props.props.props.accountDetails.accountDetails.emailaddress1; props.props.props.props.accountDetails.accountDetails.emailaddress1;
const personalisation = { const personalisation = {
@@ -57,7 +65,7 @@ const RepComplete = (props) => {
), ),
sendRepCompleteMessage( sendRepCompleteMessage(
props.props.props.props.accountDetails.containerID, props.props.props.props.accountDetails.containerID,
props.props.currentView.caseReference.currentReference, props.props.currentView.caseReference.ticketnumber,
props.repFormData.repfile_name props.repFormData.repfile_name
), ),
sendEmail(templateId, emailAddress, personalisation, reference), sendEmail(templateId, emailAddress, personalisation, reference),
@@ -83,7 +91,8 @@ const RepComplete = (props) => {
: props.props.currentView.caseReference : props.props.currentView.caseReference
.representationType, .representationType,
}), }),
setRepresentationMessageSent(true)); setRepresentationMessageSent(true)),
window.scrollTo({ top: 0, behavior: "smooth" });
}); });
return ( return (
<div id="rep-appellant"> <div id="rep-appellant">
@@ -10,7 +10,7 @@ const RepDetails = (props) => {
const { currentType, casesObj } = props; const { currentType, casesObj } = props;
let { caseReference } = props; let { caseReference, ticketnumber } = props;
let setCaseDetailsObj = router.query.hasOwnProperty("state") let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit" ? router.query.state == "edit"
@@ -29,7 +29,7 @@ const RepDetails = (props) => {
: caseReference; : caseReference;
detailsObj = jsonpath({ detailsObj = jsonpath({
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseDetailsObj, json: setCaseDetailsObj,
eval: true, eval: true,
}); });
@@ -939,10 +939,6 @@ export const RenderFileUpload = (field) => {
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
return "/assets/images/documenttypes/xlsx.png"; return "/assets/images/documenttypes/xlsx.png";
break; break;
case "application/zip":
return "/assets/images/documenttypes/zip.png";
break;
case "image/jpeg": case "image/jpeg":
return "/assets/images/documenttypes/jpg.png"; return "/assets/images/documenttypes/jpg.png";
case "image/png": case "image/png":
@@ -1091,7 +1087,6 @@ export const RenderFileUpload = (field) => {
[".docx"], [".docx"],
"image/tiff": [".tif", ".tiff"], "image/tiff": [".tif", ".tiff"],
"image/jpeg": [".jpg", ".jpeg"], "image/jpeg": [".jpg", ".jpeg"],
"application/zip": [".zip"],
"image/png": [".png"], "image/png": [".png"],
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
[".xlsx"], [".xlsx"],
@@ -1338,7 +1333,7 @@ export const RenderFileUpload = (field) => {
?.values?.repfile_name ?.values?.repfile_name
) + ) +
"&blobname=" + "&blobname=" +
blob.name + encodeURIComponent(blob.name) +
blob.hashedfilepath blob.hashedfilepath
} }
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link" className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
@@ -188,7 +188,8 @@ const RepInterestedPartyPerson = (props) => {
"myrepresentations:add-files-label" "myrepresentations:add-files-label"
)} )}
ticketnumber={ ticketnumber={
props.props.caseReference props.currentView.caseReference
.ticketnumber
} }
hint={"sdsd"} hint={"sdsd"}
fileList={ fileList={
@@ -353,7 +353,7 @@ let RepLPA = (props) => {
"myrepresentations:add-files-label" "myrepresentations:add-files-label"
)} )}
ticketnumber={ ticketnumber={
props.props.caseReference props.currentView.caseReference.ticketnumber
} }
hint={"sdsd"} hint={"sdsd"}
fileList={ fileList={
@@ -34,6 +34,7 @@ let RepLPACapacitySelection = (props) => {
casesObj={casesObj} casesObj={casesObj}
detailsObj={detailsObj} detailsObj={detailsObj}
caseReference={props.props.caseReference} caseReference={props.props.caseReference}
ticketnumber={props.props.ticketnumber}
searchResultsObj={props.props.searchResultsObj} searchResultsObj={props.props.searchResultsObj}
props={props.props} props={props.props}
/>{" "} />{" "}
@@ -8,7 +8,7 @@ const RepLPADetails = (props) => {
const router = useRouter(); const router = useRouter();
const { locale } = router; const { locale } = router;
const { currentType, casesObj, caseReference } = props; const { currentType, casesObj, caseReference, ticketnumber } = props;
let setCaseDetailsObj = router.query.hasOwnProperty("state") let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit" ? router.query.state == "edit"
@@ -21,7 +21,7 @@ const RepLPADetails = (props) => {
var detailsObj = {}; var detailsObj = {};
detailsObj = jsonpath({ detailsObj = jsonpath({
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseDetailsObj, json: setCaseDetailsObj,
eval: true, eval: true,
}); });
@@ -84,7 +84,10 @@ const RepLandOwner = (props) => {
label={t( label={t(
"myrepresentations:add-files-label" "myrepresentations:add-files-label"
)} )}
ticketnumber={props.props.caseReference} ticketnumber={
props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"} hint={"sdsd"}
fileList={[]} fileList={[]}
setFilesForRepresentation={[]} setFilesForRepresentation={[]}
@@ -1213,7 +1213,10 @@ let Enforcement_Questionnaire = (props) => {
name={"representationDocuments"} name={"representationDocuments"}
id={"representationDocuments"} id={"representationDocuments"}
label={t("myrepresentations:add-files-label")} label={t("myrepresentations:add-files-label")}
ticketnumber={props.props.props.caseReference} ticketnumber={
props.props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"} hint={"sdsd"}
fileList={ fileList={
props.currentView.fileList props.currentView.fileList
@@ -1022,7 +1022,10 @@ let S78_Questionnaire = (props) => {
name={"representationDocuments"} name={"representationDocuments"}
id={"representationDocuments"} id={"representationDocuments"}
label={t("myrepresentations:add-files-label")} label={t("myrepresentations:add-files-label")}
ticketnumber={props.props.props.caseReference} ticketnumber={
props.props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"} hint={"sdsd"}
fileList={ fileList={
props.currentView.fileList props.currentView.fileList
+243 -155
View File
@@ -85,10 +85,13 @@ const CaseSummary = (props) => {
currentView, currentView,
messagesObj, messagesObj,
docsOffline, docsOffline,
ticketnumber,
} = props; } = props;
const showLoginCheck = // const showLoginCheck =
currentType == "directResultsObj" ? "true" : currentView.showLogin; // currentType == "directResultsObj" ? "true" : currentView.showLogin;
let showLoginCheck = props.showLoginCheck;
const { data: session, status } = useSession(); const { data: session, status } = useSession();
const [isModalOpen, setIsModalOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false);
@@ -110,6 +113,38 @@ const CaseSummary = (props) => {
? true ? true
: false; : 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) => { const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
let updateBody = { let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
@@ -121,14 +156,14 @@ const CaseSummary = (props) => {
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(loggedInUser).then((data) => { getWatchedCasesProxy(loggedInUser).then((data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then((data) => { getDetailsProxy(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
}); }));
}); });
}); });
setCaseInvolvment(incidentid, loggedInUser); //setCaseInvolvment(incidentid, loggedInUser);
}; };
const isWatchedCase = (whichIncident) => { const isWatchedCase = (whichIncident) => {
@@ -151,12 +186,12 @@ const CaseSummary = (props) => {
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => { getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} },
); ));
}); });
}); });
}; };
@@ -176,33 +211,33 @@ const CaseSummary = (props) => {
currentType == "searchResultsObj" currentType == "searchResultsObj"
? (casesObj = jsonpath({ ? (casesObj = jsonpath({
path: '$..[?(@ && @.title=="' + caseReference + '")]', path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: searchResultsObj, json: searchResultsObj,
eval: true, eval: true,
})) }))
: currentType == "watchedCases" : currentType == "watchedCases"
? (casesObj = jsonpath({ ? (casesObj = jsonpath({
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]', path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseQueryObj, json: setCaseQueryObj,
eval: true, eval: true,
})) }))
: currentType == "myCases" : currentType == "myCases"
? (casesObj = jsonpath({ ? (casesObj = jsonpath({
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]', path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
json: setCaseQueryObj, json: setCaseQueryObj,
eval: true, eval: true,
})) }))
: currentType == "directResultsObj" : currentType == "directResultsObj"
? (casesObj = jsonpath({ ? (casesObj = jsonpath({
path: '$..[?(@ && @.ticketnumber=="' + caseReference + '")]', path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseQueryObj, json: setCaseQueryObj,
eval: true, eval: true,
})) }))
: (casesObj = jsonpath({ : (casesObj = jsonpath({
path: '$..[?(@ && @.reference=="' + caseReference + '")]', path: '$..[?(@ && @.reference=="' + caseReference + '")]',
json: setCaseQueryObj, json: setCaseQueryObj,
eval: true, eval: true,
})); }));
casesObj = Object.assign({}, ...casesObj); casesObj = Object.assign({}, ...casesObj);
@@ -215,12 +250,12 @@ const CaseSummary = (props) => {
eval: true, eval: true,
})) }))
: currentType == "directResultsObj" : currentType == "directResultsObj"
? (detailsObj = setCaseDetailsObj[0].value[0]) ? (detailsObj = setCaseDetailsObj[0].value[0])
: (detailsObj = jsonpath({ : (detailsObj = jsonpath({
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
jsopn: setCaseDetailsObj, jsopn: setCaseDetailsObj,
eval: true, eval: true,
})); }));
detailsObj = typeof detailsObj == "object" ? detailsObj : detailsObj[0]; detailsObj = typeof detailsObj == "object" ? detailsObj : detailsObj[0];
@@ -248,10 +283,10 @@ const CaseSummary = (props) => {
{currentType == "searchResultsObj" {currentType == "searchResultsObj"
? detailsObj.pinswg_name ? detailsObj.pinswg_name
: currentType == "directResultsObj" : currentType == "directResultsObj"
? casesObj.title ? casesObj.title
: currentType == "watchedCases" : currentType == "watchedCases"
? casesObj.pinswg_title ? casesObj.pinswg_title
: casesObj.reference} : casesObj.reference}
</h1> </h1>
{props.messagesObj["@odata.count"] > 0 && ( {props.messagesObj["@odata.count"] > 0 && (
<CaseNoticeBanner messagesObj={props.messagesObj} /> <CaseNoticeBanner messagesObj={props.messagesObj} />
@@ -259,14 +294,22 @@ const CaseSummary = (props) => {
<dl className="govuk-summary-list govuk-!-margin-bottom-9"> <dl className="govuk-summary-list govuk-!-margin-bottom-9">
<div className="govuk-summary-list__row"> <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key"> <dt className="govuk-summary-list__key">
{getFormCollectionByID(appealTypeID) {getFormCollectionByID(
.PrimaryIdAttribute == "pinswg_dnsid" appealTypeID ||
setCaseQueryObj.value[0]
.pinswg_appealcasetype,
).PrimaryIdAttribute == "pinswg_dnsid"
? t("case:summary-applicantonly-label") ? t("case:summary-applicantonly-label")
: getFormCollectionByID(appealTypeID) : getFormCollectionByID(
.PrimaryIdAttribute == appealTypeID ||
"pinswg_nonvalidationid" setCaseQueryObj.value[0]
? t("case:summary-appellantonly-label") .pinswg_appealcasetype,
: t("case:summary-applicant-label")} ).PrimaryIdAttribute ==
"pinswg_nonvalidationid"
? t(
"case:summary-appellantonly-label",
)
: t("case:summary-applicant-label")}
</dt> </dt>
<dd className="govuk-summary-list__value"> <dd className="govuk-summary-list__value">
{casesObj.pinswg_appellantagent == 846040001 {casesObj.pinswg_appellantagent == 846040001
@@ -281,7 +324,7 @@ const CaseSummary = (props) => {
{detailsObj.pinswg_agentcontactname != null && {detailsObj.pinswg_agentcontactname != null &&
(_.has( (_.has(
detailsObj, detailsObj,
"pinswg_agentcontactname" "pinswg_agentcontactname",
) ? ( ) ? (
<div className="govuk-summary-list__row"> <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key"> <dt className="govuk-summary-list__key">
@@ -290,7 +333,7 @@ const CaseSummary = (props) => {
<dd className="govuk-summary-list__value"> <dd className="govuk-summary-list__value">
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_agentcontactname" "pinswg_agentcontactname",
) )
? detailsObj.pinswg_agentcontactname ? detailsObj.pinswg_agentcontactname
: ""} : ""}
@@ -304,44 +347,47 @@ const CaseSummary = (props) => {
{t("case:summary-site-address-label")} {t("case:summary-site-address-label")}
</dt> </dt>
<dd className="govuk-summary-list__value"> <dd className="govuk-summary-list__value">
{getFormCollectionByID(appealTypeID) {getFormCollectionByID(
.PrimaryIdAttribute == "pinswg_dnsid" appealTypeID ||
setCaseQueryObj.value[0]
.pinswg_appealcasetype,
).PrimaryIdAttribute == "pinswg_dnsid"
? detailsObj.pinswg_projectlocation != ? detailsObj.pinswg_projectlocation !=
null null
? detailsObj.pinswg_projectlocation.indexOf( ? detailsObj.pinswg_projectlocation.indexOf(
";" ";",
) < 0 ) < 0
? detailsObj.pinswg_projectlocation ? detailsObj.pinswg_projectlocation
: router.locale == "cy" : router.locale == "cy"
? detailsObj.pinswg_projectlocation.split( ? detailsObj.pinswg_projectlocation.split(
";" ";",
)[1] )[1]
: detailsObj.pinswg_projectlocation.split( : detailsObj.pinswg_projectlocation.split(
";" ";",
)[0] )[0]
: "" : ""
: ""} : ""}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddressline1" "pinswg_siteaddressline1",
) )
? detailsObj.pinswg_siteaddressline1 ? detailsObj.pinswg_siteaddressline1
: ""} : ""}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddressline1" "pinswg_siteaddressline1",
) && ) &&
detailsObj.pinswg_siteaddressline1 != detailsObj.pinswg_siteaddressline1 !=
null && <br />} null && <br />}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddressline2" "pinswg_siteaddressline2",
) )
? detailsObj.pinswg_siteaddressline2 ? detailsObj.pinswg_siteaddressline2
: ""} : ""}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddressline2" "pinswg_siteaddressline2",
) && ) &&
detailsObj.pinswg_siteaddressline2 != detailsObj.pinswg_siteaddressline2 !=
null && <br />} null && <br />}
@@ -350,25 +396,25 @@ const CaseSummary = (props) => {
: ""} : ""}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddresstown" "pinswg_siteaddresstown",
) && ) &&
detailsObj.pinswg_siteaddresstown != detailsObj.pinswg_siteaddresstown !=
null && <br />} null && <br />}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddresscounty" "pinswg_siteaddresscounty",
) )
? detailsObj.pinswg_siteaddresscounty ? detailsObj.pinswg_siteaddresscounty
: ""} : ""}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddresscounty" "pinswg_siteaddresscounty",
) && ) &&
detailsObj.pinswg_siteaddresscounty != detailsObj.pinswg_siteaddresscounty !=
null && <br />} null && <br />}
{_.has( {_.has(
detailsObj, detailsObj,
"pinswg_siteaddresspostcode" "pinswg_siteaddresspostcode",
) )
? detailsObj.pinswg_siteaddresspostcode ? detailsObj.pinswg_siteaddresspostcode
: ""} : ""}
@@ -383,10 +429,12 @@ const CaseSummary = (props) => {
{casesObj.description.indexOf(";") < 0 {casesObj.description.indexOf(";") < 0
? casesObj.description ? casesObj.description
: router.locale == "cy" : router.locale == "cy"
? casesObj.description.split(";")[1] ? casesObj.description.split(
: casesObj.description.split( ";",
";" )[1]
)[0]} : casesObj.description.split(
";",
)[0]}
</dd> </dd>
</div> </div>
)} )}
@@ -411,7 +459,7 @@ const CaseSummary = (props) => {
"pinswg_casestage@OData.Community.Display.V1.FormattedValue" "pinswg_casestage@OData.Community.Display.V1.FormattedValue"
] || ] ||
t( t(
"case:summary-no-date-entered-label" "case:summary-no-date-entered-label",
)} )}
</dd> </dd>
</div> </div>
@@ -438,51 +486,69 @@ const CaseSummary = (props) => {
{(_.has(detailsObj, "pinswg_startdate") || {(_.has(detailsObj, "pinswg_startdate") ||
_.has( _.has(
detailsObj, detailsObj,
"pinswg_applicationacceptedasvalid" "pinswg_applicationacceptedasvalid",
) || ) ||
_.has( _.has(
detailsObj, detailsObj,
"pinswg_startdates" "pinswg_startdates",
)) && )) &&
showReps( showReps(
detailsObj.pinswg_startdate || detailsObj.pinswg_startdate ||
detailsObj.pinswg_startdates || detailsObj.pinswg_startdates ||
detailsObj.pinswg_applicationacceptedasvalid, detailsObj.pinswg_applicationacceptedasvalid,
detailsObj.pinswg_finalcommentsduedate || detailsObj.pinswg_finalcommentsduedate ||
detailsObj.pinswg_endofrepresentationperiod detailsObj.pinswg_endofrepresentationperiod,
) && ( ) && (
<> <>
{showRepButton( {showRepButton(
props.currentView props.currentView
.caseReference .caseReference
.appealType .appealType,
) ? ( ) ? (
<> <>
<Link {ShowDocLinks ? (
href={{ <div className="govuk-warning-text ">
pathname: <span
"/myportal/representation", className="govuk-warning-text__icon"
query: { aria-hidden="true"
case: >
currentType == !
"searchResultsObj" </span>
? detailsObj.pinswg_name <strong className="govuk-warning-text__text govuk-!-margin-top-2">
: currentType == <span className="govuk-visually-hidden">
"watchedCases" Notice
? casesObj.pinswg_title </span>
: currentType == {t(
"directResultsObj" "case:docsoffline-reps-label",
? detailsObj.pinswg_name )}
: casesObj.reference, </strong>
}, </div>
}} ) : (
className="govuk-button" <Link
> href={{
{t( pathname:
"case:summary-make-representation-label" "/myportal/representation",
)} query: {
</Link> 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 <a
onClick={() => { onClick={() => {
//spinnerState(); //spinnerState();
@@ -491,7 +557,7 @@ const CaseSummary = (props) => {
className="govuk-button govuk-button--secondary" className="govuk-button govuk-button--secondary"
> >
{t( {t(
"case:summary-back-button-label" "case:summary-back-button-label",
)} )}
</a> </a>
</> </>
@@ -511,7 +577,7 @@ const CaseSummary = (props) => {
{ {
startDate: startDate:
formatDates( formatDates(
detailsObj.pinswg_startdate detailsObj.pinswg_startdate,
), ),
endDate: endDate:
props props
@@ -520,27 +586,27 @@ const CaseSummary = (props) => {
.appealType == .appealType ==
846040019 846040019
? formatDates( ? formatDates(
detailsObj.pinswg_statementduedate detailsObj.pinswg_statementduedate,
) )
: formatDates( : formatDates(
detailsObj.pinswg_finalcommentsduedate detailsObj.pinswg_finalcommentsduedate,
), ),
} },
)} )}
<br />{" "} <br />{" "}
{t( {t(
"case:representation-date-passed-additional-label" "case:representation-date-passed-additional-label",
)}{" "} )}{" "}
<Link <Link
href={ href={
"mailto:" + "mailto:" +
t( t(
"home:login-contact-email" "home:login-contact-email",
) )
} }
> >
{t( {t(
"home:login-contact-email" "home:login-contact-email",
)} )}
</Link> </Link>
</p> </p>
@@ -554,40 +620,40 @@ const CaseSummary = (props) => {
{session && {session &&
(isWatchedCase( (isWatchedCase(
props.currentView.caseReference props.currentView.caseReference
.incidentid .incidentid,
).length > ).length >
0 == 0 ==
true ? ( true ? (
<button <button
className="govuk-link watchCase" className="govuk-link watchCase"
onClick={() => { onClick={() => {
confirm( (confirm(
t( t(
"case:you-have-stopped-watching-label" "case:you-have-stopped-watching-label",
) + ) +
props props
.currentView .currentView
.caseReference .caseReference
.currentReference + .currentReference +
"?" "?",
) && ) &&
deleteItem( deleteItem(
isWatchedCase( isWatchedCase(
props props
.currentView .currentView
.caseReference .caseReference
.incidentid .incidentid,
)[0] )[0]
.pinswg_watchlistid, .pinswg_watchlistid,
"watchedCases" "watchedCases",
), ),
setCurrentView({ setCurrentView({
"viewName": "viewName":
"Watched Cases", "Watched Cases",
"viewKey": "viewKey":
"watchedCases", "watchedCases",
}); }));
setCurrentReference({ setCurrentReference({
"ticketnumber": "ticketnumber":
props props
@@ -615,11 +681,11 @@ const CaseSummary = (props) => {
}); });
}} }}
title={t( title={t(
"case:stop-watching-case-link" "case:stop-watching-case-link",
)} )}
> >
{t( {t(
"case:stop-watching-case-link" "case:stop-watching-case-link",
)}{" "} )}{" "}
</button> </button>
) : ( ) : (
@@ -629,14 +695,14 @@ const CaseSummary = (props) => {
onClick={() => { onClick={() => {
confirm( confirm(
t( t(
"case:you-are-watching-label" "case:you-are-watching-label",
) + ) +
" " + " " +
props props
.currentView .currentView
.caseReference .caseReference
.currentReference + .currentReference +
"?" "?",
) && ) &&
selectWatchedCase( selectWatchedCase(
props props
@@ -649,12 +715,12 @@ const CaseSummary = (props) => {
props props
.currentView .currentView
.caseReference .caseReference
.appealType .appealType,
); );
}} }}
> >
{t( {t(
"case:watch-this-case-link" "case:watch-this-case-link",
)} )}
</button> </button>
{/* <button {/* <button
@@ -672,13 +738,13 @@ const CaseSummary = (props) => {
<button <button
className="govuk-link watchCase" className="govuk-link watchCase"
onClick={() => { onClick={() => {
confirm( (confirm(
"Trying to watch case " + "Trying to watch case " +
props props
.currentView .currentView
.caseReference .caseReference
.currentReference + .currentReference +
"\n\nYou will now be prompted to sign in" "\n\nYou will now be prompted to sign in",
) && ) &&
// signIn("email", { // signIn("email", {
// callbackUrl: // callbackUrl:
@@ -696,23 +762,23 @@ const CaseSummary = (props) => {
"searchResultsObj" "searchResultsObj"
? detailsObj.pinswg_name ? detailsObj.pinswg_name
: currentType == : currentType ==
"directResultsObj" "directResultsObj"
? casesObj.title ? casesObj.title
: casesObj.reference, : casesObj.reference,
{ {
path: "/", path: "/",
expires: expires:
expDate, expDate,
} },
), ),
signIn(); signIn());
}} }}
title={t( title={t(
"case:watch-this-case-link" "case:watch-this-case-link",
)} )}
> >
{t( {t(
"case:watch-this-case-link" "case:watch-this-case-link",
)} )}
</button> </button>
{/* <button {/* <button
@@ -734,19 +800,19 @@ const CaseSummary = (props) => {
null) && null) &&
showRepsEnded( showRepsEnded(
detailsObj.pinswg_startdate, detailsObj.pinswg_startdate,
detailsObj.pinswg_finalcommentsduedate detailsObj.pinswg_finalcommentsduedate,
) && ( ) && (
<div className="govuk-body"> <div className="govuk-body">
{t( {t(
"case:representation-period-ended-on-label" "case:representation-period-ended-on-label",
)} )}
{props.currentView.caseReference {props.currentView.caseReference
.appealType == 846040019 .appealType == 846040019
? formatDates( ? formatDates(
detailsObj.pinswg_statementduedate detailsObj.pinswg_statementduedate,
) )
: formatDates( : formatDates(
detailsObj.pinswg_finalcommentsduedate detailsObj.pinswg_finalcommentsduedate,
)} )}
</div> </div>
)} )}
@@ -757,7 +823,9 @@ const CaseSummary = (props) => {
{showSummary(casesObj, detailsObj)} {showSummary(casesObj, detailsObj)}
<Documents <Documents
incidentid={props.incidentid} incidentid={
props.incidentid || setCaseQueryObj.value[0].incidentid
}
caseReference={props.caseReference} caseReference={props.caseReference}
searchResultsObj={props.searchResultsObj} searchResultsObj={props.searchResultsObj}
searchDetailsObj={props.searchDetailsObj} searchDetailsObj={props.searchDetailsObj}
@@ -782,23 +850,40 @@ const CaseSummary = (props) => {
</div> </div>
</div> </div>
</div> </div>
{showLoginCheck == "true" && ( {(showLoginCheck === "true" || showLoginCheck === true) && (
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-grid-column-full"> <div className="govuk-grid-column-full">
<div className="govuk-button-group"> <div className="govuk-button-group">
{noRepresentationLink.includes( {noRepresentationLink.includes(
router.pathname router.pathname,
) == true ? ( ) == 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 <div>
href="/representation" <Link
className="govuk-button" href="/representation"
> className="govuk-button"
{t( >
"case:summary-make-representation-label" {t(
)} "case:summary-make-representation-label",
</Link> )}
</Link>
</div>
)} )}
<a <a
@@ -818,8 +903,9 @@ const CaseSummary = (props) => {
); );
function showSummary(casesObj, detailsObj) { function showSummary(casesObj, detailsObj) {
let appealIDObj = let appealIDObj = getFormCollectionByID(
getFormCollectionByID(appealTypeID).PrimaryIdAttribute; appealTypeID || setCaseQueryObj.value[0].pinswg_appealcasetype,
).PrimaryIdAttribute;
switch (appealIDObj) { switch (appealIDObj) {
case "pinswg_advertsid": case "pinswg_advertsid":
@@ -1106,7 +1192,9 @@ const CaseSummary = (props) => {
useEffect(() => { useEffect(() => {
const linkCaseObj = async () => { const linkCaseObj = async () => {
let docObj = await getLinkedCases(incidentid).then((data) => { let docObj = await getLinkedCases(
incidentid || setCaseQueryObj.value[0].incidentid,
).then((data) => {
//console.log(data); //console.log(data);
setCurrentLinkedCases(data); setCurrentLinkedCases(data);
return data; return data;
@@ -1204,7 +1292,7 @@ const CaseSummary = (props) => {
? showReps( ? showReps(
props.searchDetailsObj[0].value[0].pinswg_startdate, props.searchDetailsObj[0].value[0].pinswg_startdate,
props.searchDetailsObj[0].value[0] props.searchDetailsObj[0].value[0]
.pinswg_finalcommentsduedate .pinswg_finalcommentsduedate,
) )
: true; : true;
@@ -1214,16 +1302,16 @@ const CaseSummary = (props) => {
.pinswg_speacialistcaseprocess == 846040000 && isLPA .pinswg_speacialistcaseprocess == 846040000 && isLPA
? true ? true
: props.searchDetailsObj[0].value[0] : props.searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess == 846040001 .pinswg_speacialistcaseprocess == 846040001
? true ? true
: false; : false;
return shouldShow; return shouldShow;
case 846040019: case 846040019:
return showReps( return showReps(
props.searchDetailsObj[0].value[0].pinswg_startdate, props.searchDetailsObj[0].value[0].pinswg_startdate,
props.searchDetailsObj[0].value[0].pinswg_statementduedate props.searchDetailsObj[0].value[0].pinswg_statementduedate,
); );
default: default:
@@ -1243,7 +1331,7 @@ const CaseSummary = (props) => {
selectWatchedCase( selectWatchedCase(
props.accountDetails.accountDetails.contactid, props.accountDetails.accountDetails.contactid,
incidentid, incidentid,
appealTypeID appealTypeID,
); );
destroyCookie({}, "pedwWatchCase", { path: "/" }); destroyCookie({}, "pedwWatchCase", { path: "/" });
} }
@@ -129,7 +129,6 @@ const Pinswg_dnsid = (props) => {
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true,
}) })
+9 -2
View File
@@ -4,8 +4,14 @@ import CRMError from "./crmError";
import DNSSearchResults from "./search/dnssearchresults"; import DNSSearchResults from "./search/dnssearchresults";
export default function Search(props) { export default function Search(props) {
const { searchString, searchResultsObj, myportal, watchedCases, showMap } = const {
props; searchString,
searchResultsObj,
myportal,
watchedCases,
showMap,
showLoginCheck,
} = props;
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -41,6 +47,7 @@ export default function Search(props) {
myportal={myportal} myportal={myportal}
watchedCases={watchedCases} watchedCases={watchedCases}
showMap={showMap} showMap={showMap}
showLoginCheck={showLoginCheck}
/> />
</div> </div>
</div> </div>
+2 -7
View File
@@ -1973,10 +1973,6 @@ const RenderFileUpload = (field) => {
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
return "/assets/images/documenttypes/xlsx.png"; return "/assets/images/documenttypes/xlsx.png";
break; break;
case "application/zip":
return "/assets/images/documenttypes/zip.png";
break;
case "image/jpeg": case "image/jpeg":
return "/assets/images/documenttypes/jpg.png"; return "/assets/images/documenttypes/jpg.png";
case "image/png": case "image/png":
@@ -2145,7 +2141,6 @@ const RenderFileUpload = (field) => {
[".docx"], [".docx"],
"image/tiff": [".tif", ".tiff"], "image/tiff": [".tif", ".tiff"],
"image/jpeg": [".jpg", ".jpeg"], "image/jpeg": [".jpg", ".jpeg"],
"application/zip": [".zip"],
"image/png": [".png"], "image/png": [".png"],
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
[".xlsx"], [".xlsx"],
@@ -2383,9 +2378,9 @@ const RenderFileUpload = (field) => {
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
field.containerID + field.containerID +
"&casefolderID=" + "&casefolderID=" +
field.ticketnumber + encodeURIComponent(field.ticketnumber) +
"&blobname=" + "&blobname=" +
blob.name + encodeURIComponent(blob.name) +
blob.hashedfilepath blob.hashedfilepath
} }
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link" className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
+5 -4
View File
@@ -53,6 +53,7 @@ const Header = (props) => {
"/myportal/advancedsearch", "/myportal/advancedsearch",
"/myportal/advancedsearchresults", "/myportal/advancedsearchresults",
"/myportal/case/[ticketnumber]", "/myportal/case/[ticketnumber]",
"/status",
]; ];
const hasContactLink = [ const hasContactLink = [
@@ -73,14 +74,14 @@ const Header = (props) => {
const handleLogout = () => { const handleLogout = () => {
console.info("////////////\n" + "logout" + "\n////////////"); console.info("////////////\n" + "logout" + "\n////////////");
window.localStorage.clear(), (window.localStorage.clear(),
destroyCookie(null, "next-auth.csrf-token", { path: "/" }), destroyCookie(null, "next-auth.csrf-token", { path: "/" }),
destroyCookie(null, "next-auth.callback-url", { path: "/" }), destroyCookie(null, "next-auth.callback-url", { path: "/" }),
destroyCookie(null, "pedw_locale", { path: "/" }), destroyCookie(null, "pedw_locale", { path: "/" }),
destroyCookie(null, "pinsUser", { path: "/" }), destroyCookie(null, "pinsUser", { path: "/" }),
signOut({ signOut({
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout", callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout",
}); }));
}; };
return ( return (
@@ -242,7 +243,7 @@ const Header = (props) => {
Object.keys(router.query) Object.keys(router.query)
.map( .map(
(key) => (key) =>
key + "=" + router.query[key] key + "=" + router.query[key],
) )
.join("&") .join("&")
: router.pathname : router.pathname
@@ -268,7 +269,7 @@ const Header = (props) => {
locale == "en" ? "cy" : "en", locale == "en" ? "cy" : "en",
{ {
path: "/", path: "/",
} },
); );
}} }}
> >
+5 -7
View File
@@ -7,11 +7,8 @@ export default function CaseComment() {
const router = useRouter(); const router = useRouter();
const { locale } = router; const { locale } = router;
return ( return (
<div className="card" id="casescomment-card"> <div id="casescomment-card">
<div className="card-body"> <div className="card-body card-body govuk-!-padding-top-4">
<h3 className="heading-small card-heading">
{t("home:casescomment-card-title")}
</h3>
<p className="govuk-body-s"> <p className="govuk-body-s">
{t("home:casescomment-card-paragraph-one")}{" "} {t("home:casescomment-card-paragraph-one")}{" "}
<a <a
@@ -21,9 +18,10 @@ export default function CaseComment() {
{t("home:login-contact-email")} {t("home:login-contact-email")}
</a> </a>
</p> </p>
<p className="govuk-body-s">
{/* <p className="govuk-body-s">
{t("home:casescomment-card-paragraph-two")} {t("home:casescomment-card-paragraph-two")}
</p> </p> */}
</div> </div>
</div> </div>
); );
+2
View File
@@ -4,6 +4,7 @@ import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, reduxForm, SubmissionError } from "redux-form"; import { Field, reduxForm, SubmissionError } from "redux-form";
import { sendGAEvent } from "@next/third-parties/google"; import { sendGAEvent } from "@next/third-parties/google";
import Dns from "./dns";
const required = (errorMsg) => (value) => const required = (errorMsg) => (value) =>
value || typeof value === "number" ? undefined : errorMsg; value || typeof value === "number" ? undefined : errorMsg;
@@ -175,6 +176,7 @@ let CaseSearch = (props) => {
</Link> </Link>
</div> </div>
</form> </form>
<Dns />
</div> </div>
</> </>
); );
+1 -1
View File
@@ -15,7 +15,7 @@ export default function Dns() {
// : setShowSpinnerState(true); // : setShowSpinnerState(true);
// }; // };
return ( return (
<div className="card" id="dns-card"> <div id="dns-card">
<div className="card-body"> <div className="card-body">
<h3 className="heading-small card-heading"> <h3 className="heading-small card-heading">
{t("home:dns-card-title")} {t("home:dns-card-title")}
+24 -45
View File
@@ -5,6 +5,7 @@ import { connect } from "react-redux";
import { parseCookies } from "nookies"; import { parseCookies } from "nookies";
import { setLoggedInUserId } from "../../store/accountDetails/action"; import { setLoggedInUserId } from "../../store/accountDetails/action";
import { signOut, useSession } from "next-auth/react"; import { signOut, useSession } from "next-auth/react";
import CaseComment from "./casecomment";
const required = (errorMsg) => (value) => const required = (errorMsg) => (value) =>
value || typeof value === "number" ? undefined : errorMsg; value || typeof value === "number" ? undefined : errorMsg;
@@ -71,51 +72,31 @@ let Login = (props) => {
<> <>
<div className="card" id="login-card"> <div className="card" id="login-card">
<div className="card-body active"> <div className="card-body active">
<h3 className="heading-small card-heading"> <h3 className="heading-mid card-heading">
{/* {t("home:login-card-title")} */} {t("home:signin-benefits-title")}
{t("home:login-card-title-temp")} </h3>
</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>
<p className="govuk-body-s"> <p className="govuk-body-s">
{t("home:login-comingsoon-temp-1")}{" "} {t("home:signin-benefits-paragraph")}
</p>
<p className="govuk-body-s">
{t("home:login-comingsoon-temp-1a")}{" "}
</p> </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"> <div className="govuk-form-group govuk-!-margin-top-4">
<hr className="govuk-!-margin-bottom-4" />
<p className="govuk-body-s"> <p className="govuk-body-s">
{t("home:login-comingsoon-temp-2")} {t("home:login-comingsoon-temp-2")}
</p> </p>
@@ -172,10 +153,8 @@ let Login = (props) => {
</a> </a>
</li> </li>
</ul> </ul>
<br />
<p className="govuk-body-s"> <p className="govuk-body-s">
{t("home:login-comingsoon-email-link-label")}{" "} {t("home:casescomment-card-paragraph-one")}{" "}
<a <a
href={"mailto:" + t("home:login-contact-email")} href={"mailto:" + t("home:login-contact-email")}
className="govuk-link--no-underline" className="govuk-link--no-underline"
+5 -14
View File
@@ -22,20 +22,11 @@ const MainHome = (props) => {
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-grid-column-full"> <div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body "> <div className="flex-container grid-row govuk-body ">
{showLogin != "true" && ( <CaseSearch />
<> <Login session={session} siteurl={siteurl} />
<LoginSoon />
<CaseSearch /> {/* <CaseComment /> */}
</> {/* <Dns /> */}
)}
{showLogin == "true" && (
<>
<CaseSearch />
<Login session={session} siteurl={siteurl} />
</>
)}{" "}
<CaseComment />
<Dns />
</div> </div>
</div> </div>
</div> </div>
+5 -2
View File
@@ -19,7 +19,7 @@ import { JSONPath as jsonpath } from "jsonpath-plus";
import transLookup from "../data/lookuptranslations.json"; import transLookup from "../data/lookuptranslations.json";
const MyPortal = (props) => { const MyPortal = (props) => {
const { showFileUpload, showLoginCheck } = props; const { showFileUpload, showLoginCheck, docsOffline } = props;
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -126,7 +126,9 @@ const MyPortal = (props) => {
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-grid-column-full"> <div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body "> <div className="flex-container grid-row govuk-body ">
{!isLPA && <MakeNewAppeal />} {!isLPA && (
<MakeNewAppeal docsOffline={docsOffline} />
)}
<SearchCases /> <SearchCases />
{/* {props.awaitingSubmission.awaitingSubmission[ {/* {props.awaitingSubmission.awaitingSubmission[
"@odata.count" "@odata.count"
@@ -168,6 +170,7 @@ const MyPortal = (props) => {
watchedCases={props.watchedCases} watchedCases={props.watchedCases}
isLPA={isLPA} isLPA={isLPA}
myReps={false} myReps={false}
accountDetails={props.accountDetails}
/> />
)} )}
{props.myRepresentations.hasOwnProperty( {props.myRepresentations.hasOwnProperty(
+2 -2
View File
@@ -37,8 +37,8 @@ const AwaitingSubmission = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=awaitingSubmission"
: "/myportal/viewall" : "/myportal/viewall?key=awaitingSubmission"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
@@ -354,8 +354,8 @@ const AwaitingSubmissionFromBlob = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=awaitingSubmissionDetails"
: "/myportal/viewall" : "/myportal/viewall?key=awaitingSubmissionDetails"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
+59 -6
View File
@@ -2,11 +2,46 @@ import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
export default function MakeNewAppeal() { export default function MakeNewAppeal(props) {
let { t } = useTranslation(); let { t } = useTranslation();
const { docsOffline } = props;
const router = useRouter(); const router = useRouter();
const { locale } = router; 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 ( return (
<div className="card" id="new-appeal-card"> <div className="card" id="new-appeal-card">
<div className="card-body"> <div className="card-body">
@@ -22,11 +57,29 @@ export default function MakeNewAppeal() {
<p className="govuk-body-s"> <p className="govuk-body-s">
{t("myportal:makenewappeal-card-paragraph-two")} {t("myportal:makenewappeal-card-paragraph-two")}
</p> </p>
<div> {ShowDocLinks ? (
<Link href={"/newappeal"} className="govuk-button"> <div className="govuk-warning-text ">
{t("myportal:makenewappeal-card-button-label")} <span
</Link> className="govuk-warning-text__icon"
</div> 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"> <p className="govuk-body-s govuk govuk-!-margin-top-5">
{t("myportal:makenewappeal-card-paragraph-three")} {t("myportal:makenewappeal-card-paragraph-three")}
</p> </p>
+2 -2
View File
@@ -32,8 +32,8 @@ const MyCases = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=myCases"
: "/myportal/viewall" : "/myportal/viewall?key=myCases"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
+2 -2
View File
@@ -37,8 +37,8 @@ const MyRepresentations = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=myRepresentations"
: "/myportal/viewall" : "/myportal/viewall?key=myRepresentations"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
@@ -36,8 +36,8 @@ const MyRepresentations = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=myRepresentations"
: "/myportal/viewall" : "/myportal/viewall?key=myRepresentations"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
@@ -43,8 +43,8 @@ const MySubmittedReps = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=mySubmittedReps"
: "/myportal/viewall" : "/myportal/viewall?key=mySubmittedReps"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
+10
View File
@@ -43,6 +43,11 @@ const ServiceBanner = (props) => {
{portalLogoLink.includes(router.pathname) ? ( {portalLogoLink.includes(router.pathname) ? (
<Link href={"/myportal"}> <Link href={"/myportal"}>
<img <img
className={
router.locale == "cy"
? "serviceTitle cy"
: "serviceTitle"
}
src={ src={
router.locale == "cy" router.locale == "cy"
? "/assets/images/planning-casework-cy.svg" ? "/assets/images/planning-casework-cy.svg"
@@ -57,6 +62,11 @@ const ServiceBanner = (props) => {
</Link> </Link>
) : ( ) : (
<img <img
className={
router.locale == "cy"
? "serviceTitle cy"
: "serviceTitle"
}
src={ src={
router.locale == "cy" router.locale == "cy"
? "/assets/images/planning-casework-cy.svg" ? "/assets/images/planning-casework-cy.svg"
+36 -15
View File
@@ -114,13 +114,32 @@ const TopThree = (props) => {
deleteWatchedCases(caseID) deleteWatchedCases(caseID)
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => { getWatchedCasesProxy(
setWatchedCases(data), props.accountDetails.loggedinUserId
getDetailsProxy(data, "myWatchedCases").then( ).then((data) => {
(data) => { let showWatchedCases = (submittedArr) => {
setWatchedCasesDetails(data); 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 showTopThreeArr[key].incidentid
: router.locale == "cy" : router.locale == "cy"
? "/fymhorth/achos/" + ? "/fymhorth/achos/" +
showTopThreeArr[key].pinswg_title + showTopThreeArr[key].ticketnumber +
"?key=" + "?key=" +
topThreeType topThreeType
: "/myportal/case/" + : "/myportal/case/" +
showTopThreeArr[key].pinswg_title + showTopThreeArr[key].ticketnumber +
"?key=" + "?key=" +
topThreeType topThreeType
} }
@@ -239,9 +258,8 @@ const TopThree = (props) => {
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue" "_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
] ]
: showTopThreeArr[key][ : showTopThreeArr[key]
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" .ticketnumber,
],
"currentType": topThreeType, "currentType": topThreeType,
"incidentid": getIncidentId( "incidentid": getIncidentId(
@@ -255,15 +273,18 @@ const TopThree = (props) => {
}); });
}} }}
> >
{topThreeType != "watchedCases" {showTopThreeArr[key].pinswg_title}
{/* {topThreeType != "watchedCases"
? topThreeType != "myRepresentations" ? topThreeType != "myRepresentations"
? showTopThreeArr[key].ticketnumber ? topThreeType == "mySubmittedReps"
? showTopThreeArr[key].pinswg_title
: showTopThreeArr[key].ticketnumber
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue" "_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
] ]
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]}{" "} ]}{" "} */}
</Link> </Link>
)} )}
{topThreeType == "watchedCases" && !props.myReps && ( {topThreeType == "watchedCases" && !props.myReps && (
+36 -17
View File
@@ -193,21 +193,26 @@ const TopThree = (props) => {
{showTopThreeArr[key].hasOwnProperty("repComplete") ? ( {showTopThreeArr[key].hasOwnProperty("repComplete") ? (
<b>{showTopThreeArr[key].pinswg_name}</b> <b>{showTopThreeArr[key].pinswg_name}</b>
) : ( ) : (
<Link <span
// href="#" // href="#"
href={{ // href={{
pathname: // pathname:
router.locale == "cy" // router.locale == "cy"
? "/fymhorth/representation" // ? "/fymhorth/representation"
: "/myportal/representation", // : "/myportal/representation",
query: { // query: {
case: showTopThreeArr[key].caseRef, // case: showTopThreeArr[key].ticketnumber,
state: "edit", // state: "edit",
created: // created:
showTopThreeArr[key].repfile_name, // showTopThreeArr[key].repfile_name,
}, // },
}} // }}
className="govuk-link--no-underline" className="govuk-link--no-underline"
style={{
color: "#0360a6",
cursor: "pointer",
fontWeight: "bold",
}}
data-id={index} data-id={index}
onClick={() => { onClick={() => {
setCurrentReference({ setCurrentReference({
@@ -223,10 +228,24 @@ const TopThree = (props) => {
"repDetails": showTopThreeArr[key], "repDetails": showTopThreeArr[key],
}); });
isLPA && setRepresentationCapacity("LPA"); 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} {showTopThreeArr[key].pinswg_name}
</Link> </span>
)} )}
{!showTopThreeArr[key].hasOwnProperty( {!showTopThreeArr[key].hasOwnProperty(
"repComplete" "repComplete"
@@ -234,13 +253,13 @@ const TopThree = (props) => {
<div className="deleteCase"> <div className="deleteCase">
<button <button
title={t( 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-link govuk-link--no-underline govuk-link--inverse "
onClick={() => { onClick={() => {
confirm( confirm(
t( t(
"case:do-you-want-to-delete-case-label" "case:do-you-want-to-delete-rep-label"
) + ) +
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_name + .pinswg_name +
@@ -253,7 +272,7 @@ const TopThree = (props) => {
props.accountDetails props.accountDetails
.containerID, .containerID,
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_name, .ticketnumber,
showTopThreeArr[key] showTopThreeArr[key]
.repfile_name .repfile_name
); );
+139 -103
View File
@@ -36,6 +36,8 @@ import {
setMyRepresentationsDetails, setMyRepresentationsDetails,
} from "../../store/myRepresentations/action"; } from "../../store/myRepresentations/action";
import RepsOnResults from "../search/repsonresults";
const ViewAllResults = (props) => { const ViewAllResults = (props) => {
const { const {
searchString, searchString,
@@ -74,19 +76,23 @@ const ViewAllResults = (props) => {
return dateObj.toLocaleString(); return dateObj.toLocaleString();
}; };
let currentView = props.currentView.currentView; let viewKeyFromUrl = router.query.key;
//console.log("currentView.viewKey:", typeof currentView.viewKey);
// typeof currentView.viewKey == "undefined" let currentView = props.currentView.currentView;
//console.log("currentViewKey:", typeof currentViewKey);
// typeof currentViewKey == "undefined"
// ? console.log("no currentview") // ? console.log("no currentview")
// : console.log("has currentview"); // : console.log("has currentview");
let currentViewKey = currentView.viewKey || viewKeyFromUrl;
var resultsArr = var resultsArr =
currentView.viewKey == "awaitingSubmissionDetails" currentViewKey == "awaitingSubmissionDetails"
? props["awaitingSubmission"].awaitingSubmissionDetails.case ? props["awaitingSubmission"].awaitingSubmissionDetails.case
: currentView.viewKey == "mySubmittedReps" : currentViewKey == "mySubmittedReps"
? props[currentView.viewKey][currentView.viewKey] ? props[currentViewKey][currentViewKey]
: props[currentView.viewKey][currentView.viewKey].value || []; : props[currentViewKey][currentViewKey].value || [];
const [orderByState, setOrderbyState] = useState("createdon"); const [orderByState, setOrderbyState] = useState("createdon");
const [fieldSortState, setfieldSortState] = useState("asc"); const [fieldSortState, setfieldSortState] = useState("asc");
@@ -103,11 +109,11 @@ const ViewAllResults = (props) => {
} }
var searchDetailsObj = var searchDetailsObj =
currentView.viewKey == "awaitingSubmissionDetails" currentViewKey == "awaitingSubmissionDetails"
? props["awaitingSubmission"].awaitingSubmissionDetails.value ? props["awaitingSubmission"].awaitingSubmissionDetails.value
: currentView.viewKey == "myRepresentations" : currentViewKey == "myRepresentations"
? props["myRepresentations"].myRepresentations.value ? props["myRepresentations"].myRepresentations.value
: props[currentView.viewKey][currentView.viewKey + "Details"] || []; : props[currentViewKey][currentViewKey + "Details"] || [];
let resultsRowArr = []; let resultsRowArr = [];
const buildResultsRowArr = () => { const buildResultsRowArr = () => {
@@ -115,15 +121,13 @@ const ViewAllResults = (props) => {
let detailsObj = jsonpath({ let detailsObj = jsonpath({
path: path:
"$" + "$" +
(currentView.viewKey == "myRepresentations" (currentViewKey == "myRepresentations" ? "" : "..value") +
? ""
: "..value") +
'[?(@ && @.pinswg_name=="' + '[?(@ && @.pinswg_name=="' +
(currentView.viewKey == "awaitingSubmissionDetails" (currentViewKey == "awaitingSubmissionDetails"
? item.title ? item.title
: currentView.viewKey == "watchedCases" : currentViewKey == "watchedCases"
? item.ticketnumber ? item.ticketnumber
: currentView.viewKey == "myRepresentations" : currentViewKey == "myRepresentations"
? item.pinswg_name ? item.pinswg_name
: item.pinswg_title) + : item.pinswg_title) +
'")]', '")]',
@@ -135,7 +139,7 @@ const ViewAllResults = (props) => {
//console.log(searchDetailsObj[key]); //console.log(searchDetailsObj[key]);
// searchDetailsObj[key] = // searchDetailsObj[key] =
// currentView.viewKey == "myRepresentations" // currentViewKey == "myRepresentations"
// ? searchDetailsObj[key].value[0] // ? searchDetailsObj[key].value[0]
// : searchDetailsObj[key]; // : searchDetailsObj[key];
@@ -143,7 +147,7 @@ const ViewAllResults = (props) => {
resultsRowArr.push( resultsRowArr.push(
<div className="govuk-summary-list__row" key={key}> <div className="govuk-summary-list__row" key={key}>
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2"> <dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
{currentView.viewKey == "myCases" && {currentViewKey == "myCases" &&
resultsArr[key].pinswg_publishtoweb === false ? ( resultsArr[key].pinswg_publishtoweb === false ? (
<div className="cardModuleReference"> <div className="cardModuleReference">
{resultsArr[key].ticketnumber}{" "} {resultsArr[key].ticketnumber}{" "}
@@ -153,8 +157,7 @@ const ViewAllResults = (props) => {
<> <>
<Link <Link
href={ href={
currentView.viewKey == currentViewKey == "myRepresentations"
"myRepresentations"
? { ? {
pathname: pathname:
"/myportal/representation", "/myportal/representation",
@@ -167,7 +170,7 @@ const ViewAllResults = (props) => {
.repfile_name, .repfile_name,
}, },
} }
: currentView.viewKey == : currentViewKey ==
"awaitingSubmissionDetails" "awaitingSubmissionDetails"
? router.locale == "cy" ? router.locale == "cy"
? "/fymhorth/parhauigyflwyno" ? "/fymhorth/parhauigyflwyno"
@@ -189,21 +192,25 @@ const ViewAllResults = (props) => {
"&inid=" + "&inid=" +
resultsArr[key].incidentid + resultsArr[key].incidentid +
"&key=" + "&key=" +
currentView.viewKey currentViewKey
: router.locale == "cy" : router.locale == "cy"
? myportal == true ? myportal == true
? "/fymhorth/achos" ? "/fymhorth/achos" +
: "/achos" resultsArr[key].ticketnumber +
"?key=" +
currentViewKey
: "/achos" +
resultsArr[key].ticketnumber
: myportal == true : myportal == true
? "/myportal/case/" + ? "/myportal/case/" +
resultsArr[key].ticketnumber + resultsArr[key].ticketnumber +
"?key=" + "?key=" +
currentView.viewKey currentViewKey
: "/case/" + : "/case/" +
resultsArr[key].ticketnumber resultsArr[key].ticketnumber
} }
onClick={() => { onClick={() => {
currentView.viewKey == "watchedCases" && currentViewKey == "watchedCases" &&
setSearchResults( setSearchResults(
props.watchedCases.watchedCases props.watchedCases.watchedCases
), ),
@@ -216,9 +223,9 @@ const ViewAllResults = (props) => {
resultsArr[key] resultsArr[key]
.ticketnumber, .ticketnumber,
"currentReference": "currentReference":
currentView.viewKey != currentViewKey !=
"watchedCases" "watchedCases"
? currentView.viewKey == ? currentViewKey ==
"myRepresentations" "myRepresentations"
? resultsArr[key] ? resultsArr[key]
.caseRef .caseRef
@@ -228,10 +235,9 @@ const ViewAllResults = (props) => {
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
], ],
"currentType": "currentType": currentViewKey,
currentView.viewKey,
"incidentid": "incidentid":
currentView.viewKey != currentViewKey !=
"watchedCases" "watchedCases"
? resultsArr[key] ? resultsArr[key]
.incidentid .incidentid
@@ -243,14 +249,14 @@ const ViewAllResults = (props) => {
resultsArr[key] resultsArr[key]
.pinswg_appealcasetype, .pinswg_appealcasetype,
"repDetails": "repDetails":
currentView.viewKey == currentViewKey ==
"myRepresentations" && "myRepresentations" &&
resultsArr[key], resultsArr[key],
}), }),
setCurrentView({ setCurrentView({
"viewName": "viewName":
currentView.viewName, currentView.viewName,
"viewKey": currentView.viewKey, "viewKey": currentViewKey,
}); });
}} }}
> >
@@ -260,16 +266,18 @@ const ViewAllResults = (props) => {
)} )}
: :
</span> </span>
{currentView.viewKey != "watchedCases" {currentViewKey != "watchedCases"
? currentView.viewKey == ? currentViewKey == "myRepresentations"
"myRepresentations"
? resultsArr[key].caseRef ? resultsArr[key].caseRef
: resultsArr[key].ticketnumber : currentViewKey ==
"awaitingSubmissionDetails"
? resultsArr[key].title
: resultsArr[key].pinswg_title
: resultsArr[key][ : resultsArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]} ]}
</Link> </Link>
{currentView.viewKey == "myRepresentations" && ( {currentViewKey == "myRepresentations" && (
<> <>
<br /> <br />
<span> <span>
@@ -277,6 +285,8 @@ const ViewAllResults = (props) => {
</span> </span>
</> </>
)} )}
<RepsOnResults detailsObj={resultsArr[key]} />
</> </>
)} )}
</dd> </dd>
@@ -285,14 +295,14 @@ const ViewAllResults = (props) => {
{t("search:searchresults-site-address-label")}: {t("search:searchresults-site-address-label")}:
</span> </span>
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1") _.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline1 ? searchDetailsObj[key].pinswg_siteaddressline1
: ""} : ""}
{_.has(detailsObj, "pinswg_siteaddressline1") {_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1 ? detailsObj.pinswg_siteaddressline1
: ""} : ""}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key].pinswg_siteaddressline1) _.has(searchDetailsObj[key].pinswg_siteaddressline1)
? searchDetailsObj[key].value[0] ? searchDetailsObj[key].value[0]
.pinswg_siteaddressline1 .pinswg_siteaddressline1
@@ -300,14 +310,14 @@ const ViewAllResults = (props) => {
{_.has(detailsObj, "pinswg_siteaddressline1") {_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1 ? detailsObj.pinswg_siteaddressline1
: ""} : ""}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has( _.has(
searchDetailsObj[key], searchDetailsObj[key],
"pinswg_siteaddressline1" "pinswg_siteaddressline1"
) && ) &&
searchDetailsObj[key].pinswg_siteaddressline1 != searchDetailsObj[key].pinswg_siteaddressline1 !=
null && <br />} null && <br />}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has( _.has(
searchDetailsObj[key].pinswg_siteaddressline1 searchDetailsObj[key].pinswg_siteaddressline1
) && ) &&
@@ -317,25 +327,25 @@ const ViewAllResults = (props) => {
detailsObj.pinswg_siteaddressline1 != null && ( detailsObj.pinswg_siteaddressline1 != null && (
<br /> <br />
)} )}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1") _.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline2 ? searchDetailsObj[key].pinswg_siteaddressline2
: ""} : ""}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key].pinswg_siteaddressline1) _.has(searchDetailsObj[key].pinswg_siteaddressline1)
? searchDetailsObj[key].pinswg_siteaddressline2 ? searchDetailsObj[key].pinswg_siteaddressline2
: ""} : ""}
{_.has(detailsObj, "pinswg_siteaddressline1") {_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline2 ? detailsObj.pinswg_siteaddressline2
: ""} : ""}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has( _.has(
searchDetailsObj[key], searchDetailsObj[key],
"pinswg_siteaddressline2" "pinswg_siteaddressline2"
) && ) &&
searchDetailsObj[key].pinswg_siteaddressline2 != searchDetailsObj[key].pinswg_siteaddressline2 !=
null && <br />} null && <br />}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has( _.has(
searchDetailsObj[key].pinswg_siteaddressline2 searchDetailsObj[key].pinswg_siteaddressline2
) && ) &&
@@ -345,25 +355,25 @@ const ViewAllResults = (props) => {
detailsObj.pinswg_siteaddressline2 != null && ( detailsObj.pinswg_siteaddressline2 != null && (
<br /> <br />
)} )}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresstown") _.has(searchDetailsObj[key], "pinswg_siteaddresstown")
? searchDetailsObj[key].pinswg_siteaddresstown ? searchDetailsObj[key].pinswg_siteaddresstown
: ""} : ""}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresstown") _.has(searchDetailsObj[key], "pinswg_siteaddresstown")
? searchDetailsObj[key].pinswg_siteaddresstown ? searchDetailsObj[key].pinswg_siteaddresstown
: ""} : ""}
{_.has(detailsObj, "pinswg_siteaddresstown") {_.has(detailsObj, "pinswg_siteaddresstown")
? detailsObj.pinswg_siteaddresstown ? detailsObj.pinswg_siteaddresstown
: ""} : ""}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has( _.has(
searchDetailsObj[key], searchDetailsObj[key],
"pinswg_siteaddresstown" "pinswg_siteaddresstown"
) && ) &&
searchDetailsObj[key].pinswg_siteaddresstown != searchDetailsObj[key].pinswg_siteaddresstown !=
null && <br />} null && <br />}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has( _.has(
searchDetailsObj[key], searchDetailsObj[key],
"pinswg_siteaddresstown" "pinswg_siteaddresstown"
@@ -372,18 +382,18 @@ const ViewAllResults = (props) => {
null && <br />} null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown") && {_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown != null && <br />} detailsObj.pinswg_siteaddresstown != null && <br />}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty") _.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
? searchDetailsObj[key].pinswg_siteaddresscounty ? searchDetailsObj[key].pinswg_siteaddresscounty
: ""} : ""}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty") _.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
? searchDetailsObj[key].pinswg_siteaddresscounty ? searchDetailsObj[key].pinswg_siteaddresscounty
: ""} : ""}
{_.has(detailsObj, "pinswg_siteaddresscounty") {_.has(detailsObj, "pinswg_siteaddresscounty")
? detailsObj.pinswg_siteaddresscounty ? detailsObj.pinswg_siteaddresscounty
: ""} : ""}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has( _.has(
searchDetailsObj[key], searchDetailsObj[key],
"pinswg_siteaddresscounty" "pinswg_siteaddresscounty"
@@ -394,7 +404,7 @@ const ViewAllResults = (props) => {
detailsObj.pinswg_siteaddresscounty != null && ( detailsObj.pinswg_siteaddresscounty != null && (
<br /> <br />
)} )}
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has( _.has(
searchDetailsObj[key], searchDetailsObj[key],
"pinswg_siteaddresspostcode" "pinswg_siteaddresspostcode"
@@ -420,10 +430,9 @@ const ViewAllResults = (props) => {
"pinswg_siteaddresspostcode", "pinswg_siteaddresspostcode",
].map((field, idx) => { ].map((field, idx) => {
const isAwaitingSubmission = const isAwaitingSubmission =
currentView.viewKey === currentViewKey === "awaitingSubmissionDetails";
"awaitingSubmissionDetails";
const isMyRepresentations = const isMyRepresentations =
currentView.viewKey === "myRepresentations"; currentViewKey === "myRepresentations";
const searchValue = _.get( const searchValue = _.get(
searchDetailsObj, searchDetailsObj,
`${key}.${field}` `${key}.${field}`
@@ -451,11 +460,11 @@ const ViewAllResults = (props) => {
<dd className="govuk-summary-list__value govuk-!-font-size-16"> <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden"> <span className="results-visually-hidden">
{currentView.viewKey == "awaitingSubmissionDetails" {currentViewKey == "awaitingSubmissionDetails"
? t("search:searchresults-created-on-label") ? t("search:searchresults-created-on-label")
: t("search:searchresults-applicant-label")} : t("search:searchresults-applicant-label")}
</span> </span>
{currentView.viewKey == "awaitingSubmissionDetails" {currentViewKey == "awaitingSubmissionDetails"
? formatDates(item.createdon) ? formatDates(item.createdon)
: _.has(detailsObj, [ : _.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
@@ -463,7 +472,7 @@ const ViewAllResults = (props) => {
? detailsObj[ ? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] ]
: currentView.viewKey == "myRepresentations" : currentViewKey == "myRepresentations"
? searchDetailsObj[key][ ? searchDetailsObj[key][
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] ]
@@ -475,7 +484,7 @@ const ViewAllResults = (props) => {
<span className="results-visually-hidden"> <span className="results-visually-hidden">
{t("search:searchresults-authority-label")}: {t("search:searchresults-authority-label")}:
</span> </span>
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
_.has(resultsArr[key], "pinswg_lpaname") _.has(resultsArr[key], "pinswg_lpaname")
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
@@ -520,7 +529,7 @@ const ViewAllResults = (props) => {
json: transLookup, json: transLookup,
eval: true, eval: true,
}) })
: currentView.viewKey == "myRepresentations" : currentViewKey == "myRepresentations"
? searchDetailsObj[key].value ? searchDetailsObj[key].value
: searchDetailsObj[key].value[0][ : searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
@@ -543,10 +552,10 @@ const ViewAllResults = (props) => {
: resultsArr[key][ : resultsArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || ] ||
(currentView.viewKey == "myRepresentations" (currentViewKey == "myRepresentations"
? "" ? ""
: "N/A") : "N/A")
: currentView.viewKey == "myRepresentations" && : currentViewKey == "myRepresentations" &&
router.locale == "cy" && router.locale == "cy" &&
jsonpath({ jsonpath({
path: path:
@@ -564,7 +573,7 @@ const ViewAllResults = (props) => {
{t("search:searchresults-case-type-label")}: {t("search:searchresults-case-type-label")}:
</span> </span>
{currentView.viewKey == "awaitingSubmissionDetails" {currentViewKey == "awaitingSubmissionDetails"
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
path: path:
@@ -593,11 +602,11 @@ const ViewAllResults = (props) => {
: item[ : item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] || ] ||
(currentView.viewKey == "myRepresentations" (currentViewKey == "myRepresentations"
? "" ? ""
: "N/A")} : "N/A")}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
(router.locale == "cy" (router.locale == "cy"
? jsonpath({ ? jsonpath({
path: path:
@@ -619,13 +628,13 @@ const ViewAllResults = (props) => {
</dd> </dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16"> <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden"> <span className="results-visually-hidden">
{currentView.viewKey == "myRepresentations" {currentViewKey == "myRepresentations"
? "Created" ? "Created"
: t("search:searchresults-status-label")} : t("search:searchresults-status-label")}
: :
</span> </span>
{currentView.viewKey == "awaitingSubmissionDetails" {currentViewKey == "awaitingSubmissionDetails"
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
path: path:
@@ -643,7 +652,7 @@ const ViewAllResults = (props) => {
json: transLookup, json: transLookup,
eval: true, eval: true,
}) || "N/A" }) || "N/A"
: currentView.viewKey == "myRepresentations" : currentViewKey == "myRepresentations"
? repRaisedDate(item.repfile_name) // ? router.locale == "cy" ? repRaisedDate(item.repfile_name) // ? router.locale == "cy"
: // ? jsonpath({path: : // ? jsonpath({path:
// //
@@ -681,13 +690,13 @@ const ViewAllResults = (props) => {
"statuscode@OData.Community.Display.V1.FormattedValue" "statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"} ] || "N/A"}
</dd> </dd>
{currentView.viewKey == "awaitingSubmissionDetails" && ( {currentViewKey == "awaitingSubmissionDetails" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem "> <dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<button <button
title={t( title={t(
"case:do-you-want-to-delete-case-label" "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={() => { onClick={() => {
confirm( confirm(
t( t(
@@ -709,13 +718,13 @@ const ViewAllResults = (props) => {
</button> </button>
</dd> </dd>
)} )}
{currentView.viewKey == "myRepresentations" && ( {currentViewKey == "myRepresentations" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem "> <dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<button <button
title={t( 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={() => { onClick={() => {
confirm( confirm(
t( t(
@@ -739,13 +748,13 @@ const ViewAllResults = (props) => {
</dd> </dd>
)} )}
{currentView.viewKey == "watchedCases" && ( {currentViewKey == "watchedCases" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem "> <dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<button <button
title={t( 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={() => { onClick={() => {
confirm( confirm(
t( t(
@@ -870,9 +879,31 @@ const ViewAllResults = (props) => {
deleteWatchedCases(caseID) deleteWatchedCases(caseID)
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => { console.log("in heree");
setWatchedCases(data), getWatchedCasesProxy(
getDetailsProxy(data, "myWatchedCases") 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) => { .then((data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
}) })
@@ -891,15 +922,15 @@ const ViewAllResults = (props) => {
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-grid-column-full"> <div className="govuk-grid-column-full">
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7"> <h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
{currentView.viewKey == "awaitingSubmissionDetails" && {currentViewKey == "awaitingSubmissionDetails" &&
t("myportal:awatitingsubmission-card-title")} t("myportal:awatitingsubmission-card-title")}
{currentView.viewKey == "watchedCases" && {currentViewKey == "watchedCases" &&
t("myportal:watchedcases-card-title")} t("myportal:watchedcases-card-title")}
{currentView.viewKey == "myCases" && {currentViewKey == "myCases" &&
t("myportal:mycases-card-title")} t("myportal:mycases-card-title")}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
t("myportal:myrepresentations-card-title")} t("myportal:myrepresentations-card-title")}
{currentView.viewKey == "mySubmittedReps" && {currentViewKey == "mySubmittedReps" &&
"Submitted representations"} "Submitted representations"}
</h1> </h1>
@@ -907,14 +938,13 @@ const ViewAllResults = (props) => {
<h3> <h3>
{" "} {" "}
There are no{" "} There are no{" "}
{currentView.viewKey == {currentViewKey == "awaitingSubmissionDetails" &&
"awaitingSubmissionDetails" &&
t("myportal:awatitingsubmission-card-title")} t("myportal:awatitingsubmission-card-title")}
{currentView.viewKey == "watchedCases" && {currentViewKey == "watchedCases" &&
t("myportal:watchedcases-card-title")} t("myportal:watchedcases-card-title")}
{currentView.viewKey == "myCases" && {currentViewKey == "myCases" &&
t("myportal:mycases-card-title")} t("myportal:mycases-card-title")}
{currentView.viewKey == "myRepresentations" && {currentViewKey == "myRepresentations" &&
t("myportal:myrepresentations-card-title")}{" "} t("myportal:myrepresentations-card-title")}{" "}
records records
</h3> </h3>
@@ -926,7 +956,7 @@ const ViewAllResults = (props) => {
type="button" type="button"
onClick={() => onClick={() =>
sortDataBy( sortDataBy(
currentView.viewKey == currentViewKey ==
"awaitingSubmissionDetails" "awaitingSubmissionDetails"
? "title" ? "title"
: "pinswg_title" : "pinswg_title"
@@ -934,7 +964,7 @@ const ViewAllResults = (props) => {
} }
className={ className={
orderByState == orderByState ==
(currentView.viewKey == (currentViewKey ==
"awaitingSubmissionDetails" "awaitingSubmissionDetails"
? "title" ? "title"
: "pinswg_title") : "pinswg_title")
@@ -954,7 +984,7 @@ const ViewAllResults = (props) => {
"search:searchresults-site-address-label" "search:searchresults-site-address-label"
)} )}
</dd> </dd>
{currentView.viewKey == {currentViewKey ==
"awaitingSubmissionDetails" ? ( "awaitingSubmissionDetails" ? (
<dd className="govuk-summary-list__key govuk-!-font-size-16"> <dd className="govuk-summary-list__key govuk-!-font-size-16">
<button <button
@@ -987,7 +1017,7 @@ const ViewAllResults = (props) => {
type="button" type="button"
onClick={() => onClick={() =>
sortDataBy( sortDataBy(
currentView.viewKey == currentViewKey ==
"awaitingSubmissionDetails" "awaitingSubmissionDetails"
? "pinswg_lpaname" ? "pinswg_lpaname"
: "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" : "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -995,7 +1025,7 @@ const ViewAllResults = (props) => {
} }
className={ className={
orderByState == orderByState ==
(currentView.viewKey == (currentViewKey ==
"awaitingSubmissionDetails" "awaitingSubmissionDetails"
? "pinswg_lpaname" ? "pinswg_lpaname"
: "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue") : "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue")
@@ -1011,7 +1041,7 @@ const ViewAllResults = (props) => {
</button> </button>
</dd> </dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16"> <dd className="govuk-summary-list__key govuk-!-font-size-16">
{currentView.viewKey != {currentViewKey !=
"awaitingSubmissionDetails" ? ( "awaitingSubmissionDetails" ? (
<button <button
type="button" type="button"
@@ -1022,7 +1052,7 @@ const ViewAllResults = (props) => {
} }
className={ className={
orderByState == orderByState ==
(currentView.viewKey == (currentViewKey ==
"awaitingSubmissionDetails" "awaitingSubmissionDetails"
? "pinswg_lpaname" ? "pinswg_lpaname"
: "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue") : "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue")
@@ -1043,8 +1073,7 @@ const ViewAllResults = (props) => {
)}{" "} )}{" "}
</dd> </dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16"> <dd className="govuk-summary-list__key govuk-!-font-size-16">
{currentView.viewKey == {currentViewKey == "myRepresentations" ? (
"myRepresentations" ? (
<button <button
type="button" type="button"
onClick={() => onClick={() =>
@@ -1064,6 +1093,13 @@ const ViewAllResults = (props) => {
t("search:searchresults-status-label") t("search:searchresults-status-label")
)} )}
</dd> </dd>
{(currentViewKey == "watchedCases" ||
currentViewKey ==
"awaitingSubmissionDetails" ||
currentViewKey == "myRepresentations") && (
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
)}
</div> </div>
{showSpinnerState == true ? ( {showSpinnerState == true ? (
<div className="govuk-summary-list__row"> <div className="govuk-summary-list__row">
+3 -2
View File
@@ -31,6 +31,7 @@ const WatchedCases = (props) => {
currentView={props.currentView} currentView={props.currentView}
myReps={props.myReps} myReps={props.myReps}
props={props} props={props}
accountDetails={props.accountDetails}
/> />
</div> </div>
@@ -43,8 +44,8 @@ const WatchedCases = (props) => {
router.locale != "en" router.locale != "en"
? "/" + ? "/" +
router.locale + router.locale +
"/fymhorth/gweldpopeth" "/fymhorth/gweldpopeth?key=watchedCases"
: "/myportal/viewall" : "/myportal/viewall?key=watchedCases"
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
+1
View File
@@ -65,6 +65,7 @@ let CompleteAppeal = (props) => {
console.log("patching///////////////"); console.log("patching///////////////");
// //
//patchCase(incidentId); //patchCase(incidentId);
window.scrollTo({ top: 0, behavior: "smooth" });
}, [ }, [
props.appealType.caseReference, props.appealType.caseReference,
props.props.form.appealForm.values, props.props.form.appealForm.values,
+1
View File
@@ -22,6 +22,7 @@ const CaseRepresentation = (props) => {
watchedCases={props.watchedCases} watchedCases={props.watchedCases}
awaitingSubmission={props.awaitingSubmission} awaitingSubmission={props.awaitingSubmission}
caseReference={props.caseReference} caseReference={props.caseReference}
ticketnumber={props.ticketnumber}
currentType={props.currentType} currentType={props.currentType}
searchResultsObj={props.searchResultsObj} searchResultsObj={props.searchResultsObj}
searchDetailsObj={props.searchDetailsObj} searchDetailsObj={props.searchDetailsObj}
+2 -2
View File
@@ -247,8 +247,8 @@ const SearchResults = (props) => {
resultsArrPaged.map((item, key) => { resultsArrPaged.map((item, key) => {
let detailsObj = jsonpath({ let detailsObj = jsonpath({
path: path:
'$..value[?(@ && @.pinswg_name=="' + '$..value[?(@ && @.ticketnumber=="' +
item.pinswg_name + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
+75 -4
View File
@@ -7,6 +7,7 @@ import { useCallback, useEffect, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import PaginationControl from "./pagination"; import PaginationControl from "./pagination";
import RepsOnResults from "./repsonresults";
import { getBasicDNSSearchPaged } from "../../actions"; import { getBasicDNSSearchPaged } from "../../actions";
@@ -31,6 +32,7 @@ import {
setWatchedCasesDetails, setWatchedCasesDetails,
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { getDetailsProxy, getSearchDetailsPaged } from "../utils"; import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
import { signIn, useSession } from "next-auth/react";
const DNSSearchResults = (props) => { const DNSSearchResults = (props) => {
const { const {
@@ -48,11 +50,13 @@ const DNSSearchResults = (props) => {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails,
showMap, showMap,
showLoginCheck,
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
const { locale } = router; const { locale } = router;
const { data: session } = useSession();
var resultsArr = searchResultsObj.value || []; var resultsArr = searchResultsObj.value || [];
@@ -143,7 +147,7 @@ const DNSSearchResults = (props) => {
}; };
const [orderByState, setOrderbyState] = useState("createdon"); const [orderByState, setOrderbyState] = useState("createdon");
const [fieldSortState, setfieldSortState] = useState("asc"); const [fieldSortState, setfieldSortState] = useState("desc");
const [selectedOption, setSelectedOption] = useState(10); const [selectedOption, setSelectedOption] = useState(10);
const cookies = parseCookies(); const cookies = parseCookies();
@@ -299,8 +303,8 @@ const DNSSearchResults = (props) => {
resultsArr.map((item, key) => { resultsArr.map((item, key) => {
let detailsObj = jsonpath({ let detailsObj = jsonpath({
path: path:
'$..value[?(@ && @.pinswg_name=="' + '$..[?(@ && @.ticketnumber=="' +
item.title + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
eval: true, eval: true,
@@ -339,6 +343,8 @@ const DNSSearchResults = (props) => {
"appealType": "appealType":
item.pinswg_appealcasetype, item.pinswg_appealcasetype,
"showMap": showMap, "showMap": showMap,
"showLoginCheck":
props.showLoginCheck,
}); });
}} }}
> >
@@ -350,6 +356,9 @@ const DNSSearchResults = (props) => {
</span> </span>
{item.title} {item.title}
</Link> </Link>
<RepsOnResults
detailsObj={detailsObj}
/>
</dd> </dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16"> <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden"> <span className="results-visually-hidden">
@@ -553,6 +562,51 @@ const DNSSearchResults = (props) => {
)} )}
</dd> </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> </div>
); );
}) })
@@ -744,7 +798,14 @@ const DNSSearchResults = (props) => {
</div> </div>
</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) ResultsView(resultsArr)
) : ( ) : (
<div className="govuk-grid-row"> <div className="govuk-grid-row">
@@ -753,6 +814,16 @@ const DNSSearchResults = (props) => {
</div> </div>
</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>
)} */}
</> </>
); );
}; };
+8 -8
View File
@@ -66,7 +66,7 @@ const SearchResults = (props) => {
const [showSpinnerState, setShowSpinnerState] = useState(false); const [showSpinnerState, setShowSpinnerState] = useState(false);
const [selectedOption, setSelectedOption] = useState(10); const [selectedOption, setSelectedOption] = useState(10);
const [orderByState, setOrderbyState] = useState("createdon"); const [orderByState, setOrderbyState] = useState("createdon");
const [fieldSortState, setfieldSortState] = useState("asc"); const [fieldSortState, setfieldSortState] = useState("desc");
const [loginToWatch, setLoginToWatch] = useState("true"); const [loginToWatch, setLoginToWatch] = useState("true");
let spinnerState = () => { let spinnerState = () => {
@@ -244,8 +244,8 @@ const SearchResults = (props) => {
resultsArr.map((item, key) => { resultsArr.map((item, key) => {
let detailsObj = jsonpath({ let detailsObj = jsonpath({
path: path:
'$..value[?(@ && @.pinswg_name=="' + '$..[?(@ && @.ticketnumber=="' +
item.title + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
eval: true, eval: true,
@@ -261,15 +261,15 @@ const SearchResults = (props) => {
<div></div> <div></div>
<Link <Link
href={ href={
router.locale == "cy" (router.locale == "cy"
? myportal == true ? myportal == true
? "/fymhorth/achos" ? "/fymhorth/achos"
: "/achos" : "/achos"
: myportal == true : myportal == true
? "/myportal/case/" + ? "/myportal/case"
item.ticketnumber : "/case") +
: "/case/" + "/" +
item.ticketnumber item.ticketnumber
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
+98 -22
View File
@@ -1,42 +1,118 @@
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import router from "next/router"; import router from "next/router";
import Link from "next/link"; import Link from "next/link";
import CaseNoticeBanner from "./case/caseNoticeBanner";
export default function ServiceBanner(props) { export default function ServiceBanner(props) {
let { t, lang } = useTranslation(); 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 = () => { const signInButton = () => {
router.push( router.push(
`${ `${
router.locale == "cy" ? "/awd/mewngofnodi" : "/auth/signin" router.locale == "cy" ? "/awd/mewngofnodi" : "/auth/signin"
}?callbackUrl=${encodeURIComponent( }?callbackUrl=${encodeURIComponent(
window.location.href window.location.href,
)}&error=EmailSignin` )}&error=EmailSignin`,
); );
}; };
return ( return (
<div className="servicebanner"> <>
<h1> <div className="servicebanner">
<img <h1>
className="govuk-!-margin-top-4" <img
src={ className={
router.locale == "cy" router.locale == "cy"
? "/assets/images/planning-casework-cy.svg" ? "govuk-!-margin-top-4 serviceTitle cy"
: "/assets/images/planning-casework-en.svg" : "govuk-!-margin-top-4 serviceTitle"
} }
alt="Planning casework" src={
/> router.locale == "cy"
</h1> ? "/assets/images/planning-casework-cy.svg"
{props.noSignin != true && ( : "/assets/images/planning-casework-en.svg"
<div className="serviceBanner_userDetails"> }
<button alt="Planning casework"
onClick={() => signInButton()} />
className="govuk-header__link " </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")} <strong className="govuk-warning-text__text">
</button> <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>
)} )}
</div> </>
); );
} }
+48
View File
@@ -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 };
}
+325
View File
@@ -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
View File
@@ -34,6 +34,15 @@ export const getFormCollectionByID = (appealTypeID) => {
return collectionName[0]; return collectionName[0];
}; };
export const getNavigationPropertyByPrimaryAttribute = (primaryAttribute) => {
const collectionName = jsonpath({
path: "$..[?(@ && @.PrimaryIdAttribute =='" + primaryAttribute + "')]",
json: data,
eval: true,
});
return collectionName[0];
};
export const getFormIDByLogicalName = (appealTypeLogicalName) => { export const getFormIDByLogicalName = (appealTypeLogicalName) => {
const collectionName = jsonpath({ const collectionName = jsonpath({
path: "$..[?(@ && @.LogicalName =='" + appealTypeLogicalName + "')]", path: "$..[?(@ && @.LogicalName =='" + appealTypeLogicalName + "')]",
@@ -115,17 +124,19 @@ export const getSearchDetails = async (searchResultsObj) => {
} }
); );
} else { } else {
detailsArr.push( formMeta?.LogicalCollectionName &&
getBasicSearchDetails( formMeta?.LogicalCollectionName != "pinswg_sipses" &&
formMeta.LogicalCollectionName, detailsArr.push(
searchDetail.title, getBasicSearchDetails(
formMeta.PrimaryIdAttribute, formMeta.LogicalCollectionName,
searchDetail.incidentid searchDetail.title,
) || { formMeta.PrimaryIdAttribute,
"@odata.count": 1, searchDetail.incidentid
"value": [{ "title": searchDetail.title }], ) || {
} "@odata.count": 1,
); "value": [{ "title": searchDetail.title }],
}
);
} }
}); });
// Promise.all(detailsArr).then((data) => { // Promise.all(detailsArr).then((data) => {
@@ -150,7 +161,7 @@ export const getPartSavedDetails = (searchResultsObj) => {
let formMeta = getFormCollectionByID( let formMeta = getFormCollectionByID(
searchDetail.pinswg_appealcasetype searchDetail.pinswg_appealcasetype
); );
console.log(formMeta); // console.log(formMeta);
detailsArr.push( detailsArr.push(
getBasicPartSavedDetails( getBasicPartSavedDetails(
formMeta.LogicalCollectionName, formMeta.LogicalCollectionName,
@@ -168,48 +179,146 @@ export const getPartSavedDetails = (searchResultsObj) => {
* Get the details of a case from the appeal type * Get the details of a case from the appeal type
* @param object searchResultsObj * @param object searchResultsObj
*/ */
export const getSearchDetailsPaged = (searchResultsObj) => { // export const getSearchDetailsPaged = (searchResultsObj) => {
let detailsArr = []; // let detailsArr = [];
searchResultsObj = searchResultsObj.value; // searchResultsObj = searchResultsObj.value;
const detailsObj = searchResultsObj.map((searchDetail, index) => { // const detailsObj = searchResultsObj.map((searchDetail, index) => {
if (searchDetail.pinswg_appealcasetype == null) { // if (searchDetail.pinswg_appealcasetype == null) {
console.log(searchDetail.title); // console.log(searchDetail.title);
} else { // } else {
let formMeta = getFormCollectionByID( // let formMeta = getFormCollectionByID(
searchDetail.pinswg_appealcasetype // searchDetail.pinswg_appealcasetype
); // );
// formMeta?.LogicalCollectionName &&
detailsArr.push( // formMeta?.LogicalCollectionName != "pinswg_sipses" &&
getBasicSearchDetailsPaged( // detailsArr.push(
formMeta.LogicalCollectionName, // getBasicSearchDetailsPaged(
searchDetail.title, // formMeta.LogicalCollectionName,
formMeta.PrimaryIdAttribute, // searchDetail.title,
searchDetail.incidentid // formMeta.PrimaryIdAttribute,
) // searchDetail.incidentid
); // )
} // );
}); // }
return Promise.all(detailsArr); // });
}; // 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 = 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 = ( export const getProgressObj = (
formObjXML, formObjXML,
titleList, titleList,
+11 -21
View File
@@ -47,27 +47,7 @@
"UrlName": "transportandworkact", "UrlName": "transportandworkact",
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c", "MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
"appealTypeID": "846040013", "appealTypeID": "846040013",
"NavigationProperty": "", "NavigationProperty": "pinswg_TransportandWorkActIds",
"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",
"value": "Transport and Works Act" "value": "Transport and Works Act"
}, },
{ {
@@ -370,6 +350,16 @@
"appealTypeID": "846040012", "appealTypeID": "846040012",
"NavigationProperty": "pinswg_ElectricityActIds", "NavigationProperty": "pinswg_ElectricityActIds",
"value": "Electricity Act" "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"
} }
] ]
} }
+8 -2
View File
@@ -20,7 +20,12 @@ module.exports = {
"/myportal/searchresults": ["search", "myportal", "case"], "/myportal/searchresults": ["search", "myportal", "case"],
"/myportal/case": ["case"], "/myportal/case": ["case"],
"/myportal/case/[ticketnumber]": ["case"], "/myportal/case/[ticketnumber]": ["case"],
"/myportal/dnsapplications": ["search", "dnsCommon", "dnsApplications"], "/myportal/dnsapplications": [
"search",
"dnsCommon",
"dnsApplications",
"case",
],
"/myportal/dnsdetails": [ "/myportal/dnsdetails": [
"case", "case",
"search", "search",
@@ -59,7 +64,7 @@ module.exports = {
"/dns": ["dnsCommon", "dnsHome"], "/dns": ["dnsCommon", "dnsHome"],
"/dns/applications": ["dnsCommon", "dnsApplications"], "/dns/applications": ["dnsCommon", "dnsApplications"],
"/dns/application-view": ["dnsCommon", "dnsApplicationView"], "/dns/application-view": ["dnsCommon", "dnsApplicationView"],
"/dnsapplications": ["search", "dnsCommon", "dnsApplications"], "/dnsapplications": ["search", "dnsCommon", "dnsApplications", "case"],
"/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"], "/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"],
"/help/cookies": ["common", "cookies"], "/help/cookies": ["common", "cookies"],
"/account/register": ["common", "account"], "/account/register": ["common", "account"],
@@ -70,5 +75,6 @@ module.exports = {
"/auth/signin": ["common", "common", "auth"], "/auth/signin": ["common", "common", "auth"],
"/auth/verify-request": ["common", "common", "auth"], "/auth/verify-request": ["common", "common", "auth"],
"/auth/error": ["common", "common", "auth"], "/auth/error": ["common", "common", "auth"],
"/admin": ["case"],
}, },
}; };
+7 -1
View File
@@ -96,8 +96,14 @@
"trying-to-watch-case-redirect-label": "Fe'ch anogir nawr i fewngofnodi", "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 ", "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-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.", "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-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,", "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
View File
@@ -1,8 +1,8 @@
{ {
"login-card-title-temp": "Apeliadau neu geisiadau newydd", "login-card-title-temp": "Cyflwyno apêl newydd",
"login-comingsoon-temp-1": "Mae'r gwasanaeth hwn yn cael ei ddatblygu i gefnogi apeliadau a cheisiadau ar-lein.", "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-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 ddatblygur 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-link-1": "https://llyw.cymru/ffurflenni-apelio",
"login-comingsoon-forms-label-1": "ffurflenni apêl cynllunio a ffurflenni cais cynllunio", "login-comingsoon-forms-label-1": "ffurflenni apêl cynllunio a ffurflenni cais cynllunio",
"login-comingsoon-forms-link-2": "https://llyw.cymru/trwyddedau-amgylcheddol", "login-comingsoon-forms-link-2": "https://llyw.cymru/trwyddedau-amgylcheddol",
@@ -32,19 +32,25 @@
"casesearch-card-advanced-link": "Chwiliad uwch", "casesearch-card-advanced-link": "Chwiliad uwch",
"casesearch-search-validation-required": "Angenrheidiol", "casesearch-search-validation-required": "Angenrheidiol",
"casesearch-search-validation-minlength": "Rhaid iddo gynnwys 4 nod neu fwy", "casesearch-search-validation-minlength": "Rhaid iddo gynnwys 4 nod neu fwy",
"casescomment-card-title": "Rhowch sylwadau ar apêl", "casescomment-card-title": "Sylwadau ar apeliadau neu geisiadau",
"casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl (ac eithrio apêl deiliaid tai neu fasnachol) drwy e-bostio ", "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": "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-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-label": "Ymweld â'r Arolygiaeth Gynllunio",
"inspectorate-card-visit-link": "Hafan", "inspectorate-card-visit-link": "Hafan",
"inspectorate-card-alt-text": "Yr Arolygiaeth Gynllunio", "inspectorate-card-alt-text": "Yr Arolygiaeth Gynllunio",
"dns-card-title": "Gweld yr holl Ddatblygiadau o Arwyddocâd Cenedlaethol", "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-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 cais", "dns-card-button": "Gweld pob rhaglen DNS",
"logging-in-heading": "Rydym yn dilysu eich cyfrif. Arhoswch a pheidiwch ag adnewyddu'r dudalen", "logging-in-heading": "Rydym yn dilysu eich cyfrif. Arhoswch a pheidiwch ag adnewyddu'r dudalen",
"logging-in-paragraph": "Arhoswch os gwelwch yn dda...", "logging-in-paragraph": "Arhoswch os gwelwch yn dda...",
"uploading-files-progress-label": "Wrthi'n llwytho i fyny...", "uploading-files-progress-label": "Wrthi'n llwytho i fyny...",
"uploading-files-label": "Wrthi'n uwchlwytho {{number}} ffeil", "uploading-files-label": "Wrthi'n uwchlwytho {{number}} ffeil",
"completed-uploading-files-label": "{{number}} ffeil wedi'u huwchlwytho", "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:"
} }
+2 -1
View File
@@ -51,5 +51,6 @@
"date-raised": "Dyddiad codi", "date-raised": "Dyddiad codi",
"representation-submitted": "Cyflwynwyd y sylw", "representation-submitted": "Cyflwynwyd y sylw",
"submission-processing-label": "Prosesu cyflwyniad", "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."
} }
+1 -1
View File
@@ -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", "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", "add-files-label": "Ychwanegwch eich ffeiliau",
"fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.", "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-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-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
"fileupload-file-error-invalid-label": "yn annilys", "fileupload-file-error-invalid-label": "yn annilys",
+1 -1
View File
@@ -82,7 +82,7 @@
"new-appeal-procedure-option-inperson": "Wyneb yn wyneb", "new-appeal-procedure-option-inperson": "Wyneb yn wyneb",
"new-appeal-procedure-option-hybrid": "Hybrid", "new-appeal-procedure-option-hybrid": "Hybrid",
"new-appeal-fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.", "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-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-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
"new-appeal-fileupload-file-error-invalid-label": "yn annilys", "new-appeal-fileupload-file-error-invalid-label": "yn annilys",
+3 -1
View File
@@ -66,5 +66,7 @@
"searchresults-show-records-label-a": "Dangos", "searchresults-show-records-label-a": "Dangos",
"searchresults-show-records-label-b": "cofnodion", "searchresults-show-records-label-b": "cofnodion",
"searchresults-created-on-label": "Crëwyd ar", "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"
} }
+7 -1
View File
@@ -96,8 +96,14 @@
"trying-to-watch-case-redirect-label": "You will now be prompted to sign in", "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 ", "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-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.", "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-label": "The representation period for this appeal is between {{startDate}} and {{endDate}}",
"representation-date-passed-additional-label": "You can make a representation by emailing,", "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
View File
@@ -1,8 +1,8 @@
{ {
"login-card-title-temp": "New appeals or applications", "login-card-title-temp": "Submit a new appeal",
"login-comingsoon-temp-1": "This service is being developed to support online appeals and applications.", "login-comingsoon-temp-1": "against your Local Planning Authoritys 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-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-link-1": "https://gov.wales/planning-appeal-forms",
"login-comingsoon-forms-label-1": "planning appeal and application forms", "login-comingsoon-forms-label-1": "planning appeal and application forms",
"login-comingsoon-forms-link-2": "https://gov.wales/environmental-permits", "login-comingsoon-forms-link-2": "https://gov.wales/environmental-permits",
@@ -32,19 +32,25 @@
"casesearch-card-advanced-link": "Advanced search", "casesearch-card-advanced-link": "Advanced search",
"casesearch-search-validation-required": "Required", "casesearch-search-validation-required": "Required",
"casesearch-search-validation-minlength": "Must be 4 characters or more", "casesearch-search-validation-minlength": "Must be 4 characters or more",
"casescomment-card-title": "Comment on an appeal ", "casescomment-card-title": "Comment on appeals or applications",
"casescomment-card-paragraph-one": "Comment on an appeal (excluding householder or commercial) by emailing ", "casescomment-card-paragraph-one": "Alternatively, you can request forms or comment on an appeal during the representation period 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-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-label": "Visit the Planning Inspectorate",
"inspectorate-card-visit-link": "Home", "inspectorate-card-visit-link": "Home",
"inspectorate-card-alt-text": "The Planning Inspectorate", "inspectorate-card-alt-text": "The Planning Inspectorate",
"dns-card-title": "View all Developments of National Significance ", "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-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 applications", "dns-card-button": "View all DNS applications",
"logging-in-heading": "We are authenticating your account please wait and don't refresh", "logging-in-heading": "We are authenticating your account please wait and don't refresh",
"logging-in-paragraph": "Please wait...", "logging-in-paragraph": "Please wait...",
"uploading-files-progress-label": "Uploading...", "uploading-files-progress-label": "Uploading...",
"uploading-files-label": "Uploading {{number}} files", "uploading-files-label": "Uploading {{number}} files",
"completed-uploading-files-label": "{{number}} files uploaded", "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:"
} }
+2 -1
View File
@@ -51,5 +51,6 @@
"date-raised": "Date raised", "date-raised": "Date raised",
"representation-submitted": "Representation submitted", "representation-submitted": "Representation submitted",
"submission-processing-label": "Submission processing", "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."
} }
+1 -1
View File
@@ -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", "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", "add-files-label": "Add your files",
"fileupload-drop-label": "Drag and drop your files here.", "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-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-type-label": "has an invalid type. Please upload an allowed type.",
"fileupload-file-error-invalid-label": "is invalid", "fileupload-file-error-invalid-label": "is invalid",
+1 -1
View File
@@ -82,7 +82,7 @@
"new-appeal-procedure-option-inperson": "In person", "new-appeal-procedure-option-inperson": "In person",
"new-appeal-procedure-option-hybrid": "Hybrid", "new-appeal-procedure-option-hybrid": "Hybrid",
"new-appeal-fileupload-drop-label": "Drag and drop your files here.", "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-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-type-label": "has an invalid type. Please upload an allowed type.",
"new-appeal-fileupload-file-error-invalid-label": "is invalid", "new-appeal-fileupload-file-error-invalid-label": "is invalid",
+3 -1
View File
@@ -66,5 +66,7 @@
"searchresults-show-records-label-a": "Show", "searchresults-show-records-label-a": "Show",
"searchresults-show-records-label-b": "records", "searchresults-show-records-label-b": "records",
"searchresults-created-on-label": "Created on", "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"
} }
+1 -2
View File
@@ -1,6 +1,5 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited // 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.
-588
View File
@@ -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
View File
@@ -146,17 +146,21 @@ module.exports = {
destination: "/case", destination: "/case",
}, },
{ {
source: "/achos/id/:slug", source: "/achos/:slug",
destination: "/case/id/:slug", destination: "/case/:slug",
}, },
// {
// source: "/achos/id/:slug",
// destination: "/case/id/:slug",
// },
{ {
source: "/fymhorth/achos", source: "/fymhorth/achos",
destination: "/myportal/case", destination: "/myportal/case",
}, },
{ // {
source: "/fymhorth/achos/id/:slug", // source: "/fymhorth/achos/id/:slug",
destination: "/myportal/case/id/:slug", // destination: "/myportal/case/id/:slug",
}, // },
{ {
source: "/fymhorth/achos/:slug", source: "/fymhorth/achos/:slug",
destination: "/myportal/case/:slug", destination: "/myportal/case/:slug",
+11285
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -7,9 +7,10 @@
"debugdev": "NODE_OPTIONS='--inspect' next dev", "debugdev": "NODE_OPTIONS='--inspect' next dev",
"dev:app": "node ./server/server.js", "dev:app": "node ./server/server.js",
"build": "NODE_ENV=production node_modules/next/dist/bin/next build", "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", "start": "NODE_ENV=production node_modules/next/dist/bin/next start",
"lint": "next lint" "lint": "next lint",
"prisma:generate": "prisma generate"
}, },
"browser": { "browser": {
"child_process": false "child_process": false
@@ -48,8 +49,7 @@
"moment": "^2.29.4", "moment": "^2.29.4",
"multiparty": "^4.2.3", "multiparty": "^4.2.3",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"nanoid": "^3.2.0", "next": "^14.2.28",
"next": "14.1.2",
"next-auth": "^4.24.4", "next-auth": "^4.24.4",
"next-build-id": "^3.0.0", "next-build-id": "^3.0.0",
"next-connect": "^0.12.2", "next-connect": "^0.12.2",
@@ -104,4 +104,4 @@
"eslint-plugin-jsdoc": "^48.2.3", "eslint-plugin-jsdoc": "^48.2.3",
"prisma": "^5.0.0" "prisma": "^5.0.0"
} }
} }
+3 -3
View File
@@ -1,7 +1,7 @@
import Document, { Html, Head, Main, NextScript } from "next/document"; import Document, { Html, Head, Main, NextScript } from "next/document";
import SkipLink from "../components/skiplink"; import SkipLink from "../components/skiplink";
import { Tracking, TrackingNoScript } from "../components/tracking"; import { Tracking, TrackingNoScript } from "../components/tracking";
import { nanoid } from "nanoid"; //import { nanoid } from "nanoid";
import { setCookie } from "nookies"; import { setCookie } from "nookies";
import Script from "next/script"; import Script from "next/script";
@@ -23,7 +23,7 @@ class MyDocument extends Document {
const cookieObj = ctx.req.cookies.CookiePolicy || {}; const cookieObj = ctx.req.cookies.CookiePolicy || {};
console.log("useGATracking: ", useGATracking); //console.log("useGATracking: ", useGATracking);
setCookie(ctx, "pedw_locale", ctx.locale, { setCookie(ctx, "pedw_locale", ctx.locale, {
path: "/", path: "/",
}); });
@@ -41,7 +41,7 @@ class MyDocument extends Document {
//const generatedNonce = nanoid(); //const generatedNonce = nanoid();
const generatedNonce = this.props.generatedNonce; const generatedNonce = this.props.generatedNonce;
console.log("this is the nonce:", generatedNonce); //console.log("this is the nonce:", generatedNonce);
let csp = ``; let csp = ``;
csp += `base-uri 'self';`; csp += `base-uri 'self';`;
+216
View File
@@ -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);
+3 -3
View File
@@ -124,8 +124,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
// "=============================== Advanced Search results:", // "=============================== Advanced Search results:",
// searchResultsObj // searchResultsObj
// ); // );
const searchDetailsObj = // const searchDetailsObj =
(await getSearchDetails(searchResultsObj)) || null; // (await getSearchDetails(searchResultsObj)) || null;
// console.log( // console.log(
// "=============================== Advanced Search results details:", // "=============================== Advanced Search results details:",
// searchDetailsObj // searchDetailsObj
@@ -136,7 +136,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setShowReps(showReps, showLoginCheck)); store.dispatch(setShowReps(showReps, showLoginCheck));
store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj)); // store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(Object.entries(query))); store.dispatch(setSearch(Object.entries(query)));
return { return {
props: { props: {
-102
View File
@@ -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;
+180
View File
@@ -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;
}
+90
View File
@@ -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;
}
+194 -101
View File
@@ -1,110 +1,203 @@
/** // /**
* @swagger // * @swagger
* /api/documents/download/{id}: // * /api/documents/download/{id}:
* get: // * get:
* tags: // * tags:
* - Documents // * - Documents
* description: Get document // * description: Get document
* parameters: // * parameters:
* - name: id // * - name: id
* in: path // * in: path
* description: iShare ID // * description: iShare ID
* type: string // * type: string
* required: true // * required: true
* default: A41567436 // * default: A41567436
* - name: hash // * - name: hash
* in: query // * in: query
* description: Hash string // * description: Hash string
* default: e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71 // * default: e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71
* responses: // * responses:
* 200: // * 200:
* description: Success // * 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 axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, consoleLogger } from "../../../../actions"; 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 = const WEBAPI_URL =
process.env.RELAY_ROOT || process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => { // Retry utility with logging
var hashlink = CryptoJS.HmacSHA256( async function retry(fn, retries = 3, delay = 1000) {
queryPath, for (let attempt = 1; attempt <= retries; attempt++) {
CryptoJS.enc.Hex.parse(WORDKEY) try {
); return { response: await fn(), attempts: attempt };
hashlink = hashlink.toString(CryptoJS.enc.Hex); } catch (err) {
if (attempt === retries) throw err;
//return "&hash=" + hashlink; console.log(`Retry ${attempt} failed, retrying in ${delay}ms...`);
await new Promise((res) => setTimeout(res, delay));
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; delay *= 2; // exponential backoff
}; }
}
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");
});
} }
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;
+10 -2
View File
@@ -35,11 +35,19 @@ export default async function ApiProxy(req, res) {
var token = await getToken(); var token = await getToken();
var queryUrl = 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 '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"; //"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 return axios
.get( .get(
+5 -1
View File
@@ -49,7 +49,11 @@ export default async function ApiProxy(req, res) {
searchString + searchString +
"') or contains(ticketnumber, '" + "') or contains(ticketnumber, '" +
searchString + 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( console.log(
"\n==========================================\n", "\n==========================================\n",
@@ -33,7 +33,7 @@ import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders, consoleLogger, getToken } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getSelectQuery } from "../../../actions/selectQueryTypes";
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL = const WEBAPI_URL =
@@ -55,21 +55,25 @@ export default async function ApiProxy(req, res) {
var incidentID = req.query.incidentID; var incidentID = req.query.incidentID;
var token = await getToken(); var token = await getToken();
let navigationProperty =
getNavigationPropertyByPrimaryAttribute(
primaryIdAttribute
).NavigationProperty;
var queryUrl = var queryUrl =
appealTypeName + appealTypeName +
"?$filter=_" + "?$filter=_" +
primaryIdAttribute + primaryIdAttribute +
"s_value eq " + "s_value eq " +
incidentID + incidentID +
"&$count=true"; "&$count=true" +
"&$expand=" +
navigationProperty +
"($select=ticketnumber)";
//" and statuscode eq 1&$count=true"; //" and statuscode eq 1&$count=true";
queryUrl = queryUrl = queryUrl + getSelectQuery(appealTypeName);
queryUrl +
getSelectQuery(appealTypeName) +
",_" +
primaryIdAttribute +
"s_value";
console.log( console.log(
"\n==========================================\n", "\n==========================================\n",
@@ -86,6 +90,13 @@ export default async function ApiProxy(req, res) {
azureHeaders(token.access_token) azureHeaders(token.access_token)
) )
.then(({ data }) => { .then(({ data }) => {
let flattened = data.value.map((r) => ({
...r,
ticketnumber: r[navigationProperty]?.ticketnumber || null,
}));
data.value = flattened;
res.status(200).json(data); res.status(200).json(data);
}) })
.catch((error) => { .catch((error) => {
@@ -34,7 +34,7 @@ import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getSelectQuery } from "../../../actions/selectQueryTypes";
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL = const WEBAPI_URL =
@@ -59,18 +59,25 @@ export default async function ApiProxy(req, res) {
var incidentID = req.query.incidentID; var incidentID = req.query.incidentID;
var token = await getToken(); var token = await getToken();
let navigationProperty =
getNavigationPropertyByPrimaryAttribute(
primaryIdAttribute
).NavigationProperty;
var queryUrl = var queryUrl =
appealTypeName + appealTypeName +
"?$filter=_" + "?$filter=" +
primaryIdAttribute +
"s_value eq " +
incidentID + incidentID +
"&$count=true"; "&$count=true" +
"&$expand=" +
navigationProperty +
"($select=ticketnumber)";
//" and statuscode eq 1&$count=true"; //" and statuscode eq 1&$count=true";
queryUrl = queryUrl + getSelectQuery(appealTypeName); queryUrl = queryUrl + getSelectQuery(appealTypeName);
//console.log("query: ", queryUrl, "<<<<end query"); console.log("query: ", queryUrl, "<<<<end query");
return axios return axios
.get( .get(
@@ -78,10 +85,18 @@ export default async function ApiProxy(req, res) {
azureHeadersPaged(token.access_token) azureHeadersPaged(token.access_token)
) )
.then(({ data }) => { .then(({ data }) => {
let flattened = data.value.map((r) => ({
...r,
ticketnumber: r[navigationProperty]?.ticketnumber || null,
}));
data.value = flattened;
var dataStr; var dataStr;
_.has(data, "@odata.nextLink") == true && _.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])), ((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data); return res.status(200).json(data);
}) })
.catch((error) => { .catch((error) => {
@@ -83,7 +83,11 @@ export default async function ApiProxy(req, res) {
searchString + searchString +
"') or contains(ticketnumber, '" + "') or contains(ticketnumber, '" +
searchString + 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 + orderby +
" " + " " +
fieldSort + fieldSort +
+28 -1
View File
@@ -43,7 +43,7 @@ export default async function ApiProxy(req, res) {
var queryUrl = var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " + "pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId + 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 return axios
.get( .get(
@@ -51,6 +51,33 @@ export default async function ApiProxy(req, res) {
azureHeaders(token.access_token) azureHeaders(token.access_token)
) )
.then(({ data }) => { .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); res.status(200).json(data);
}) })
.catch((error) => { .catch((error) => {
+3 -1
View File
@@ -43,9 +43,11 @@ export default async function ApiProxy(req, res) {
console.log(req.body, queryUrl); console.log(req.body, queryUrl);
var crmUrl = "https://" + process.env.CRMURL; var crmUrl = "https://" + process.env.CRMURL;
var crmVersion = process.env.CRMURL_VERSION;
var data = { var data = {
"@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")", "@odata.id":
crmUrl + "/api/data/" + crmVersion + "/contacts(" + contactid + ")",
}; };
var config = { var config = {
+2 -5
View File
@@ -17,12 +17,9 @@ ApiProxy.get(async (req, res) => {
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blobName; encodeURIComponent(blobName);
//console.log(hashAPIPath(checkquerypath), checkHash);
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await deleteBlob( await deleteBlob(
+6 -3
View File
@@ -20,14 +20,17 @@ ApiProxy.get(async (req, res) => {
"/api/file/downloadblob?container=" + "/api/file/downloadblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
blobName.trim(); encodeURIComponent(blobName.trim());
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const bloblocation =
casefolderID + (blobName.indexOf(".json") > 0 ? "/" : "/files/");
const downloaded = await downloadFile( const downloaded = await downloadFile(
containerName, containerName,
casefolderID + "/files/" + decodeURI(blobName) bloblocation + decodeURI(blobName)
); );
res.setHeader( res.setHeader(
+83
View File
@@ -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);
});
}
+1 -1
View File
@@ -166,7 +166,7 @@ export default async function handler(req, res) {
var containerID = reqBodyobj.containerID; var containerID = reqBodyobj.containerID;
var casefolderID = reqBodyobj.casefolderID; var casefolderID = reqBodyobj.casefolderID;
var caseRef = reqBodyobj.caseRef; var caseRef = reqBodyobj.ticketnumber;
var representationType = reqBodyobj.representationType; var representationType = reqBodyobj.representationType;
var repRaiser = reqBodyobj.lastname; var repRaiser = reqBodyobj.lastname;
var localeSelect = reqBodyobj.locale; var localeSelect = reqBodyobj.locale;
+10 -8
View File
@@ -53,7 +53,9 @@ const SignIn = (props) => {
<div className="govuk-body-m"> <div className="govuk-body-m">
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l"> <legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 className="govuk-fieldset__heading govuk-heading-m"> <h1 className="govuk-fieldset__heading govuk-heading-m">
{t("auth:auth-page-title")}{" "} {t(
"auth:auth-page-title",
)}{" "}
</h1> </h1>
</legend> </legend>
@@ -91,7 +93,7 @@ const SignIn = (props) => {
htmlFor="email" htmlFor="email"
> >
{t( {t(
"auth:auth-email-label" "auth:auth-email-label",
)} )}
</label> </label>
@@ -111,7 +113,7 @@ const SignIn = (props) => {
} }
> >
{t( {t(
"auth:auth-signin-button-label" "auth:auth-signin-button-label",
)} )}
</button> </button>
</div> </div>
@@ -132,10 +134,10 @@ const SignIn = (props) => {
}; };
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
if (process.env.SHOWLOGIN == false) { if (process.env.SHOWLOGIN === "false" || process.env.SHOWLOGIN === false) {
return { return {
redirect: { redirect: {
destination: "/404", destination: "/status",
permanent: false, permanent: false,
}, },
}; };
@@ -146,7 +148,7 @@ export async function getServerSideProps(context) {
"\n//////////////////////\n", "\n//////////////////////\n",
"Sign in callbackurl: " + context.query.callbackUrl, "Sign in callbackurl: " + context.query.callbackUrl,
context.locale, context.locale,
"\n//////////////////////\n" "\n//////////////////////\n",
); );
let formURL = context.req.headers.host; let formURL = context.req.headers.host;
//console.log("formUrl:", formURL); //console.log("formUrl:", formURL);
@@ -176,7 +178,7 @@ export async function getServerSideProps(context) {
// Append the query parameters to the new URL // Append the query parameters to the new URL
params.forEach((value, key) => 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 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" && typeof context.query.callbackUrl != "undefined" &&
(formURL = appendParamsAndPathToNewUrl( (formURL = appendParamsAndPathToNewUrl(
context.query.callbackUrl, context.query.callbackUrl,
formURL formURL,
)); ));
//formURL = appendParamsAndPathToNewUrl(context.query.callbackUrl, formURL); //formURL = appendParamsAndPathToNewUrl(context.query.callbackUrl, formURL);

Some files were not shown because too many files have changed in this diff Show More