From f9f7b777e72013e03012b249b1a0ad390c274508 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Fri, 19 Nov 2021 09:30:04 +0000 Subject: [PATCH] updated translations and oauth --- .env.local | 31 +- actions/index.js | 708 +++++++++--------- components/accessibility.js | 31 + components/account/personaldetailsComplete.js | 5 +- components/account/registerform.js | 7 +- components/breadcrumbs.js | 47 +- components/case.js | 16 +- components/case/documents.js | 42 +- components/case/pagination.js | 10 +- components/case/representationList.js | 234 +++++- components/case/summary.js | 24 +- .../case/summaryTypes/pinswg_advertsid.js | 44 +- .../case/summaryTypes/pinswg_callinss77id.js | 53 +- .../case/summaryTypes/pinswg_commonlandid.js | 48 +- .../pinswg_communityinfrastructurelevyid.js | 44 +- .../pinswg_compulsorypurchaseordersid.js | 48 +- components/case/summaryTypes/pinswg_dnsid.js | 58 +- .../summaryTypes/pinswg_electricityactid.js | 44 +- ...pinswg_enforcementlistedbuildingconseid.js | 48 +- .../pinswg_enforcementnoticeappeals174id.js | 48 +- .../pinswg_environmentalpermittingid.js | 48 +- .../pinswg_harbourrevisionorderid.js | 44 +- ...pinswg_hedgeshedgerowstreepreservatioid.js | 48 +- .../pinswg_householderappealhasid.js | 44 +- ...pinswg_lawfuldevelopmentcertificatappid.js | 48 +- components/case/summaryTypes/pinswg_ldpid.js | 48 +- ...pinswg_listedbuildingandconservationrid.js | 48 +- .../pinswg_maintenanceoflands217id.js | 48 +- .../pinswg_miscellaneouscasewordid.js | 48 +- .../pinswg_planningappeals78id.js | 48 +- .../pinswg_planningconditionss73s79id.js | 48 +- .../pinswg_planningobligationappeals106id.js | 48 +- components/case/summaryTypes/pinswg_rowid.js | 48 +- .../case/summaryTypes/pinswg_wayleaveid.js | 48 +- components/cookieBanner.js | 15 +- components/cookiePolicy.js | 192 +++++ components/cookiemanager/index.js | 56 +- components/footer.js | 77 +- components/homepage/casesearch.js | 20 +- components/homepage/dns.js | 22 +- components/homepage/login.js | 35 +- components/myportal/searchcases.js | 18 +- components/myportal/topthree.js | 4 +- components/newappeal/complete.js | 1 + components/privacy.js | 31 + components/search/advancedsearch.js | 24 +- components/search/dnssearchresults.js | 20 +- components/search/pagination.js | 12 +- components/search/searchresults.js | 28 +- components/tandc.js | 31 + data/lookuptranslations.json | 5 - i18n.js | 2 + locales/cy/common.json | 12 +- locales/cy/cookies.json | 43 +- locales/cy/dnsApplications.json | 4 +- locales/cy/home.json | 4 +- locales/cy/newappeal.json | 4 +- locales/cy/search.json | 2 +- locales/en/common.json | 10 +- locales/en/cookies.json | 43 +- locales/en/dnsApplications.json | 4 +- locales/en/home.json | 6 +- locales/en/newappeal.json | 2 +- locales/en/search.json | 2 +- next.config.js | 45 ++ package.json | 2 + pages/_document.js | 59 +- pages/accessibility.js | 91 +++ pages/advancedsearch.js | 5 +- pages/advancedsearchresults.js | 9 +- pages/api/proxy/[...route].js | 213 +++--- pages/case/index.js | 3 + pages/details-about-cookies.js | 91 +++ pages/dnsapplications.js | 9 +- pages/help/cookies.js | 1 + pages/myportal/advancedsearch.js | 5 +- pages/myportal/advancedsearchresults.js | 5 +- pages/myportal/case.js | 21 +- pages/myportal/index.js | 10 +- pages/myportal/searchresults.js | 5 +- pages/newappeal/[appealtypes].js | 5 +- pages/newappeal/index.js | 5 +- pages/newappeal/planningappeal.js | 3 +- pages/privacy.js | 91 +++ pages/searchresults.js | 5 +- pages/terms-and-conditions.js | 91 +++ public/assets/images/planning-casework-cy.svg | 8 +- public/assets/images/planning-casework-en.svg | 8 +- store/searchOutput/action.js | 8 + store/searchOutput/reducer.js | 6 + styles/sass/welshgov/_application.scss | 7 +- 91 files changed, 2519 insertions(+), 1275 deletions(-) create mode 100644 components/accessibility.js create mode 100644 components/cookiePolicy.js create mode 100644 components/privacy.js create mode 100644 components/tandc.js create mode 100644 pages/accessibility.js create mode 100644 pages/details-about-cookies.js create mode 100644 pages/privacy.js create mode 100644 pages/terms-and-conditions.js diff --git a/.env.local b/.env.local index 4e27b1d5..c3a7589c 100644 --- a/.env.local +++ b/.env.local @@ -1,9 +1,24 @@ // dev -RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ -RELAYURI = "dev-pedw-ns.servicebus.windows.net" -RELAYPATH = "dev-pedw-hc" -SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=" -SASKEYNAME = "devpedwnspolicy" +//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ +//RELAYURI = "dev-pedw-ns.servicebus.windows.net" +//RELAYPATH = "dev-pedw-hc" +//SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=" +//SASKEYNAME = "devpedwnspolicy" + + + +ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/ +TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502 +GRANT_TYPE = "client_credentials" + +//Dev oauth +CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015 +CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY + + +//Test Oauth +//CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015 +//CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY PORT= "3000" @@ -32,3 +47,9 @@ I18N_DOMAIN = "cymru.local" GOOGLE_TAG_MANAGER = GTM-T78CBC3 SHOWLOGIN = "true" +SHOWREPRESENTATIONS = "false" +BASIC_AUTH_CREDENTIALS,, = pinswg:password|pinswg2:password2 + +HASHKEY = "028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c" + +NEXT_PUBLIC_HASHKEY = "028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c" diff --git a/actions/index.js b/actions/index.js index 4b5be744..04dc85d4 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1,10 +1,8 @@ import axios from "axios"; import https from "https"; import CryptoJS from "crypto-js"; - -//import {XMLHttpRequest} from 'xmlhttprequest'; - -//process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; +import HmacSHA256 from "crypto-js/hmac-sha256"; +import { has, indexOf } from "lodash"; let BASE_URL; const port = parseInt(process.env.PORT, 10) || 3000; @@ -14,9 +12,14 @@ if (process.browser) { } else { BASE_URL = process.env.API_ROOT || `http://localhost:${port}`; } +const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY; +const cache = {}; const API_PATH = "/api/data/v8.2/"; +const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; +const tenantId = process.env.TENANT; + //const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH; const WEBAPI_URL = @@ -27,84 +30,48 @@ const agent = new https.Agent({ rejectUnauthorized: false, }); -export const getSASToken = () => { - var m_ResourceURI = - process.env.RELAYURI || "dev-pedw-ns.servicebus.windows.net"; - var m_Path = process.env.RELAYPATH || "dev-pedw-hc"; - var m_SasKey = - process.env.SASKEY || "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="; - var m_SasKeyName = process.env.SASKEYNAME || "devpedwnspolicy"; - - var encodedResourceUri = encodeURIComponent( - "https://" + m_ResourceURI + "/" + m_Path + "/" - ); - - var t0 = new Date(1970, 1, 1, 0, 0, 0, 0); - var t1 = new Date(); - var expireInSeconds = - +(31 * 24 * 3600) + 3600 + (((t1.getTime() - t0.getTime()) / 1000) | 0); - - //the line below is a hack that converts to UTF8 - var plainSignature = JSON.parse( - JSON.stringify(encodedResourceUri + "\n" + expireInSeconds) - ); - - var hash = CryptoJS.HmacSHA256(plainSignature, m_SasKey); - var base64HashValue = CryptoJS.enc.Base64.stringify(hash); - - var token = - "SharedAccessSignature sr=" + - encodedResourceUri + - "&sig=" + - encodeURIComponent(base64HashValue) + - "&se=" + - expireInSeconds + - "&skn=" + - m_SasKeyName; - - // console.log("///////////////////////"); - // console.log( - // "encodedURI:" + "https://" + m_ResourceURI + "/" + m_Path + "/" - // ); - // console.log("WEBAPI_URL: " + WEBAPI_URL); - // console.log("m_ResourceURI: " + m_ResourceURI); - // console.log("m_Path: " + m_Path); - // console.log("m_SasKey: " + m_SasKey); - // console.log("m_SasKeyName: " + m_SasKeyName); - // console.log("token: " + token); - // console.log("///////////////////////"); - return token; +export const getToken = () => { + if (cache.tokenResponse) { + return cache.tokenResponse; + } else { + return axios + .post( + `${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`, + tokenBody, + tokenConfig + ) + .then((res) => res.data) + .then((data) => { + cache.tokenResponse = data; + return data; + }) + .catch((error) => { + console.log("error :", error.response); + // return error; + }); + } }; -const accessToken = - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSIsImtpZCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSJ9.eyJhdWQiOiJodHRwczovL2RldmNybTIwMTYubGxjZHQuZ292LndhbGVzLyIsImlzcyI6Imh0dHA6Ly9mcy50ZXN0Lmdvdi53YWxlcy9hZGZzL3NlcnZpY2VzL3RydXN0IiwiaWF0IjoxNjMyMTIxMjkxLCJuYmYiOjE2MzIxMjEyOTEsImV4cCI6MTYzMjE1MDA5MSwidXBuIjpbIlJvYmVydC5Cb25kQHRlc3QuZ292LndhbGVzIiwicm9iZXJ0LmJvbmRAdGVzdC5nb3Yud2FsZXMiXSwicHJpbWFyeXNpZCI6IlMtMS01LTIxLTE4MDA4NDIwNzYtMjQ1NTYwNjU5LTQyMTU3NzU0NjktMTY2MjgiLCJ1bmlxdWVfbmFtZSI6IlhNXFxCb25kUiIsImFwcHR5cGUiOiJQdWJsaWMiLCJhcHBpZCI6IjQyN2ZhNzljLWI1ZmMtNDJhZC04M2Q0LTQxMGIwMzk0OGFiNiIsImF1dGhtZXRob2QiOiJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvYXV0aGVudGljYXRpb25tZXRob2Qvd2luZG93cyIsImF1dGhfdGltZSI6IjIwMjEtMDktMjBUMDc6MDE6MzEuNDYzWiIsInZlciI6IjEuMCJ9.W0ID2nCBYVxh8T1eQqWKk2Wh45kRbRzCICfzrZNAs-4u54yl0UJUcVihyI8EBmQeALCEc5eY99DjK0gaqzCdJqxbxol8yk5LrFvhV5UkCiZ7SO2Wq1cLReWHVsgz39qBtrZ8vlqqZsv7DsEaRJQbtj8Djnx26Wb_kcNu-tuXwUBF0uR5GLFFvJfM3PzkRCY-ZPOTbvPTb73oN_NKe6BrsVjyaR9xSXsRJjgHPmJgWgnvq-2X0Dj7LCwXSEygDDOGlF1yqqN0Lv6qplhQoH-heZlC1K6qe_92nHPswXag6uN5nxTmk1Qw6zJt_aHMnXdwa18ghh4hGx5R0Jz53X113Q"; +const tokenBody = + "grant_type=" + + process.env.GRANT_TYPE + + "&client_id=" + + process.env.CLIENT_ID + + "&client_secret=" + + process.env.CLIENT_SECRET + + "&scope=" + + "https://" + + process.env.RELAYURI + + "/.default"; -//const SASToken = getSASToken(); - -const crmHeaders = { - withCredentials: true, +const tokenConfig = { headers: { - "Content-Type": "application/json; charset=utf-8", - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json", - "Prefer": 'odata.include-annotations="*",return=representation', - "Authorization": "Bearer " + accessToken, + "Content-Type": "application/x-www-form-urlencoded", + "Cache-Control": "no-cache", }, }; -const crmHeadersReturn = { - headers: { - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json", - "Prefer": "return=representation", - "Content-Type": "application/json", - "Authorization": "Bearer " + accessToken, - }, -}; - -const azureHeaders = (SASToken) => { +const azureHeaders = (access_token) => { return { headers: { "OData-MaxVersion": "4.0", @@ -112,12 +79,12 @@ const azureHeaders = (SASToken) => { "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": SASToken, + "Authorization": "Bearer " + access_token, }, }; }; -const azureHeadersPaged = (SASToken) => { +const azureHeadersPaged = (access_token) => { return { headers: { "OData-MaxVersion": "4.0", @@ -126,56 +93,66 @@ const azureHeadersPaged = (SASToken) => { "Prefer": 'odata.include-annotations="*",return=representation, odata.maxpagesize=10', "Content-Type": "application/json", - "ServiceBusAuthorization": SASToken, + "Authorization": "Bearer " + access_token, }, }; }; +const hashAPIPath = (queryPath) => { + var hashPath = + queryPath.indexOf("/api/proxy/") == -1 + ? queryPath + : queryPath.split("/api/proxy/")[1]; + + var hashlink = CryptoJS.HmacSHA256( + hashPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + return "&hash=" + hashlink; +}; + export const getBasicSearch = (token, searchString) => { //console.log("\n\n", token, searchString); + var queryUrl = + "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" + + searchString + + "') or contains(ticketnumber, '" + + searchString + + "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; return axios .get( - WEBAPI_URL + - "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" + - searchString + - "') or contains(ticketnumber, '" + - searchString + - "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true", + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => { - // console.log(" "); - // console.log("/////////////////////"); - // console.log("data:" + res.data.value); - // console.log("/////////////////////"); - // console.log(" "); return res.data; }) .catch((error) => { - //console.log("thiserror", error); return error.response; }); }; export const getBasicSearchPaged = (searchString, pageNumber) => { //console.log("\n\n", token, searchString); - var token = getSASToken(); - console.log(typeof pageNumber != "undefined"); + //console.log(typeof pageNumber != "undefined"); + + var queryUrl = + "/api/proxy/incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" + + searchString + + "') or contains(ticketnumber, '" + + searchString + + "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + '' + : ""); + + //console.log(queryUrl); return axios - .get( - "/api/proxy/incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" + - searchString + - "') or contains(ticketnumber, '" + - searchString + - "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : ""), - azureHeadersPaged(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => { // console.log(" "); // console.log("/////////////////////"); @@ -191,10 +168,12 @@ export const getBasicSearchPaged = (searchString, pageNumber) => { }; export const getBasicDNSSearch = (token, searchString) => { + var queryUrl = + "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; + return axios .get( - WEBAPI_URL + - "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true", + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => res.data) @@ -204,17 +183,16 @@ export const getBasicDNSSearch = (token, searchString) => { }; export const getBasicDNSSearchPaged = (pageNumber) => { - var token = getSASToken(); + var token = getToken(); + + var queryUrl = + "/api/proxy/incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + '' + : ""); return axios - .get( - "/api/proxy/incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : ""), - azureHeadersPaged(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { return error.response; @@ -251,13 +229,13 @@ export const getAdvancedSearch = (token, searchString) => { searchString.apt : ""; + var queryUrl = + "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" + + queryString + + " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; return axios .get( - WEBAPI_URL + - "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" + - queryString + - " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true", - + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => res.data) @@ -274,7 +252,7 @@ export const getAdvancedSearch = (token, searchString) => { export const getAdvancedSearchPaged = (searchString, pageNumber) => { //console.log(searchString); - var token = getSASToken(); + var token = getToken(); var queryString = ""; @@ -303,18 +281,16 @@ export const getAdvancedSearchPaged = (searchString, pageNumber) => { searchString.apt : ""; - return axios - .get( - "/api/proxy/incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" + - queryString + - " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : ""), + var queryUrl = + "/api/proxy/incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" + + queryString + + " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + ('') + : ""); - azureHeadersPaged(token) - ) + return axios + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { let ErrResponse = { @@ -334,15 +310,17 @@ export const getBasicSearchDetails = ( incidentID ) => { //console.log("check appealtype:", appealType, caseReference); + + var queryUrl = + appealTypeName + + "?$filter=_" + + primaryIdAttribute + + "s_value eq " + + incidentID + + "&$count=true"; return axios .get( - WEBAPI_URL + - appealTypeName + - "?$filter=_" + - primaryIdAttribute + - "s_value eq " + - incidentID + - "&$count=true", + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => res.data) @@ -358,19 +336,18 @@ export const getBasicSearchDetailsPaged = ( incidentID ) => { //console.log("check appealtype:", appealType, caseReference); - var token = getSASToken(); + + var queryUrl = + "/api/proxy/" + + appealTypeName + + "?$filter=_" + + primaryIdAttribute + + "s_value eq " + + incidentID + + "&$count=true"; return axios - .get( - "/api/proxy/" + - appealTypeName + - "?$filter=_" + - primaryIdAttribute + - "s_value eq " + - incidentID + - "&$count=true", - azureHeaders(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("this error", error); @@ -379,12 +356,13 @@ export const getBasicSearchDetailsPaged = ( export const getSearchDocumentDetails = (token, incidentID) => { console.log(incidentID); + var queryUrl = + "pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " + + incidentID + + " and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference"; return axios .get( - WEBAPI_URL + - "pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " + - incidentID + - " and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference", + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => res.data) @@ -394,11 +372,12 @@ export const getSearchDocumentDetails = (token, incidentID) => { }; export const getSearchDocumentHistory = (token, documentID) => { + var queryUrl = + "pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + + documentID; return axios .get( - WEBAPI_URL + - "pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + - documentID, + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => res.data) @@ -409,19 +388,19 @@ export const getSearchDocumentHistory = (token, documentID) => { export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => { console.log(incidentID); - var token = getSASToken(); + var token = getToken(); + + var queryUrl = + "/api/proxy/pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " + + incidentID + + " and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + + encodeURI('') + : ""); return axios - .get( - "/api/proxy/pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " + - incidentID + - " and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : ""), - azureHeadersPaged(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -429,18 +408,16 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => { }; export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => { - var token = getSASToken(); + var token = getToken(); + var queryUrl = + "/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + + documentID + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + ('') + : ""); return axios - .get( - "/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + - documentID + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : ""), - azureHeadersPaged(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -448,32 +425,28 @@ export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => { }; export const getSearchDocumentDetails1 = (incidentID) => { - //console.log(incidentID); - var token = getSASToken(); + var queryUrl = + "/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " + + incidentID + + "&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference"; return axios - .get( - "/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " + - incidentID + - "&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); }); }; + export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => { - //console.log(incidentID); - var token = getSASToken(); + var queryUrl = + "/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " + + incidentID + + "&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + ('') + : ""); return axios - .get( - "/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " + - incidentID + - "&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : "") - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -481,13 +454,11 @@ export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => { }; export const getSearchDocumentHistory1 = (documentID) => { - //console.log(documentID); - var token = getSASToken(); + var queryUrl = + "/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + + documentID; return axios - .get( - "/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + - documentID - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => { return res.data; }) @@ -497,17 +468,14 @@ export const getSearchDocumentHistory1 = (documentID) => { }; export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => { - //console.log(documentID); - var token = getSASToken(); + var queryUrl = + "/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + + documentID + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + ('') + : ""); return axios - .get( - "/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " + - documentID + - (typeof pageNumber != "undefined" - ? "&$skiptoken=" + - encodeURI('') - : "") - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => { return res.data; }) @@ -517,12 +485,13 @@ export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => { }; export const getBasicDNSSearchDetails = (token, appealType, caseReference) => { + var queryUrl = + "pinswg_dnses?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; return axios .get( - WEBAPI_URL + - "pinswg_dnses?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true", + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeadersPaged(token) ) .then((res) => res.data) @@ -532,15 +501,15 @@ export const getBasicDNSSearchDetails = (token, appealType, caseReference) => { }; export const getBasicDNSSearchDetailsPaged = (caseReference) => { - var token = getSASToken(); + var token = getToken(); + + var queryUrl = + "/api/proxy/pinswg_dnses?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; return axios - .get( - "/api/proxy/pinswg_dnses?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true", - azureHeadersPaged(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -549,14 +518,12 @@ export const getBasicDNSSearchDetailsPaged = (caseReference) => { export const getLinkedCases = (parentIncidentid) => { //console.log(parentIncidentid); - var token = getSASToken(); - + var queryUrl = + "/api/proxy/incidents?$count=true&$filter=_parentcaseid_value eq " + + parentIncidentid + + " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid"; return axios - .get( - "/api/proxy/incidents?$count=true&$filter=_parentcaseid_value eq " + - parentIncidentid + - " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid," - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => { //console.log(" linked date", res.data); return res.data; @@ -567,16 +534,12 @@ export const getLinkedCases = (parentIncidentid) => { }; export const getFormData = (token, whichForm) => { - //console.log("got to axios", whichForm); - //console.log("api_root: ", BASE_URL); + var queryUrl = + "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" + + whichForm + + "%27and%20type%20eq%202)&$count=true&$top=201"; return axios - .get( - WEBAPI_URL + - "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" + - whichForm + - "%27and%20type%20eq%202)&$count=true&$top=201", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -584,14 +547,12 @@ export const getFormData = (token, whichForm) => { }; export const getMandatoryFields = (token, whichForm) => { + var queryUrl = + "EntityDefinitions(LogicalName='pinswg_" + + whichForm + + "')/Attributes?$count=true&$select=LogicalName,RequiredLevel"; return axios - .get( - WEBAPI_URL + - "EntityDefinitions(LogicalName='pinswg_" + - whichForm + - "')/Attributes?$count=true&$select=LogicalName,RequiredLevel", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -599,14 +560,12 @@ export const getMandatoryFields = (token, whichForm) => { }; export const getPickLists = (token, whichForm) => { + var queryUrl = + "EntityDefinitions(LogicalName='pinswg_" + + whichForm + + "')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true"; return axios - .get( - WEBAPI_URL + - "EntityDefinitions(LogicalName='pinswg_" + - whichForm + - "')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -614,12 +573,10 @@ export const getPickLists = (token, whichForm) => { }; export const getAppealsTypes = (token) => { + var queryUrl = + "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; return axios - .get( - WEBAPI_URL + - "stringmaps?$filter=attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log(error); @@ -635,12 +592,10 @@ export const getAppealsTypes = (token) => { export const getLPA = (token) => { // console.log("api_root: ", BASE_URL); + var queryUrl = + "accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc"; return axios - .get( - WEBAPI_URL + - "accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => { //console.log(res.data); return res.data; @@ -657,15 +612,13 @@ export const getLPA = (token) => { }; export const getPersonalAccount = (token, contactid) => { - //console.log("getting personal details:", contactid); + var queryUrl = + "contacts(" + + contactid + + ")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true"; + return axios - .get( - WEBAPI_URL + - "contacts(" + - contactid + - ")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => { console.log(res.data); return res.data; @@ -686,7 +639,7 @@ export const getAppealID = ( updateFormCollection, primaryAttribute ) => { - const weburl = + const queryUrl = "/api/proxy/" + updateFormCollection + "?$count=true&$select=_" + @@ -695,9 +648,12 @@ export const getAppealID = ( caseReference + "'"; - console.log("proxy url ", weburl); + console.log("proxy url ", queryUrl); return axios - .get(weburl, azureHeaders(getSASToken())) + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(getToken()) + ) .then((res) => { var appealID = res.data.value[0][primaryAttribute]; return appealID; @@ -708,14 +664,15 @@ export const getAppealID = ( }; export const getLogin = (emailAddress, pwd) => { + var queryUrl = + "/api/proxy/contacts?$filter=emailaddress1 eq '" + + emailAddress + + "' and pinswg_custom_password eq '" + + pwd + + "'&$count=true&$select=emailaddress1,%20contactid,pinswg_custom_password, yomifullname, firstname, lastname"; + return axios - .get( - "/api/proxy/contacts?$filter=emailaddress1 eq '" + - emailAddress + - "' and pinswg_custom_password eq '" + - pwd + - "'&$count=true&$select=emailaddress1,%20contactid,pinswg_custom_password, yomifullname, firstname, lastname" - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -724,6 +681,8 @@ export const getLogin = (emailAddress, pwd) => { export const createCase = (token, appealTypeId, lpaID, contactid) => { appealTypeId = parseInt(appealTypeId); + + var queryUrl = "incidents"; var data = JSON.stringify({ "title": "insertion test case", "caseorigincode": 3, @@ -734,7 +693,7 @@ export const createCase = (token, appealTypeId, lpaID, contactid) => { var config = { method: "post", - url: WEBAPI_URL + "incidents", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -773,17 +732,18 @@ export const updateCase = async ( console.log("appeal obj ", appealObj); + var queryUrl = "/api/proxy/" + updateFormCollection + "(" + appealObj + ")"; var config = { method: "patch", - //url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")", - url: "/api/proxy/" + updateFormCollection + "(" + appealObj + ")", + //url: updateFormCollection + "(" + incidentId + ")", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": getSASToken(), + "Authorization": getToken(), }, data: data, }; @@ -801,14 +761,12 @@ export const updateCase = async ( export const getMyCases = (token, loggedInUserId) => { //console.log("in action ", loggedInUserId); + var queryUrl = + "incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " + + loggedInUserId + + " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3"; return axios - .get( - WEBAPI_URL + - "incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " + - loggedInUserId + - " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => { return res.data; }) @@ -818,14 +776,12 @@ export const getMyCases = (token, loggedInUserId) => { }; export const getMyRepresentations = (token, loggedInUserId) => { + var queryUrl = + "pinswg_representationses?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; return axios - .get( - WEBAPI_URL + - "pinswg_representationses?$filter= _pinswg_contact_value eq " + - loggedInUserId + - "&$count=true&$orderby=createdon desc", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log("this serror", error); @@ -833,13 +789,64 @@ export const getMyRepresentations = (token, loggedInUserId) => { }; export const getMyRepresentationsProxy = (token, loggedInUserId) => { + var queryUrl = + "/api/proxy/pinswg_representationses?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; return axios - .get( - "/api/proxy/pinswg_representationses?$filter= _pinswg_contact_value eq " + - loggedInUserId + - "&$count=true&$orderby=createdon desc", - azureHeaders(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const deleteMyRepresentations = (myRepresentationsID) => { + var queryUrl = + "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")"; + var config = { + method: "delete", + url: queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*",return=representation', + "Content-Type": "application/json", + "Authorization": getToken(), + }, + }; + // console.log(config); + return axios(config) + .then((res) => { + //console.log("deleted ", res.data); + return res.data; + }) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getRepresentations = (incidentID) => { + var queryUrl = + "/api/proxy/pinswg_representationses?$filter= _pinswg_case_value eq " + + incidentID + + " and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc"; + return axios + .get(queryUrl + hashAPIPath(queryUrl)) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getRepresentationsProxy = (token, incidentID) => { + var queryUrl = + "/api/proxy/pinswg_representationses?$filter= _pinswg_case_value eq " + + incidentID + + "&$count=true&$orderby=createdon desc"; + return axios + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("this serror", error); @@ -847,14 +854,12 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => { }; export const getWatchedCases = (token, loggedInUserId) => { + var queryUrl = + "pinswg_watchlists?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; return axios - .get( - WEBAPI_URL + - "pinswg_watchlists?$filter= _pinswg_contact_value eq " + - loggedInUserId + - "&$count=true&$orderby=createdon desc", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log("this serror", error); @@ -862,13 +867,12 @@ export const getWatchedCases = (token, loggedInUserId) => { }; export const getWatchedCasesProxy = (token, loggedInUserId) => { + var queryUrl = + "/api/proxy/pinswg_watchlists?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; return axios - .get( - "/api/proxy/pinswg_watchlists?$filter= _pinswg_contact_value eq " + - loggedInUserId + - "&$count=true&$orderby=createdon desc", - azureHeaders(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("this serror", error); @@ -877,17 +881,18 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => { export const createWatchedCases = (formValues) => { var data = JSON.stringify(formValues); + var queryUrl = "/api/proxy/pinswg_watchlists"; var config = { method: "post", - url: "/api/proxy/pinswg_watchlists", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": getSASToken(), + "Authorization": getToken(), }, data: data, }; @@ -903,16 +908,17 @@ export const createWatchedCases = (formValues) => { }; export const deleteWatchedCases = (watchedCaseID) => { + var queryUrl = "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")"; var config = { method: "delete", - url: "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": getSASToken(), + "Authorization": getToken(), }, }; // console.log(config); @@ -938,15 +944,13 @@ export const getAwaitingSubmission = (token) => { }; export const getPortalModuleDetails = (token, appealType, caseReference) => { + var queryUrl = + appealType + + "?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; return axios - .get( - WEBAPI_URL + - appealType + - "?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true", - azureHeaders(token) - ) + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -958,15 +962,14 @@ export const getPortalModuleDetailsProxy = ( appealType, caseReference ) => { + var queryUrl = + "/api/proxy/" + + appealType + + "?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; return axios - .get( - "/api/proxy/" + - appealType + - "?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true", - azureHeaders(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -974,13 +977,12 @@ export const getPortalModuleDetailsProxy = ( }; export const getEmailAccountCheck = (emailAddress) => { - let token = getSASToken(); + var queryUrl = + "/api/proxy/contacts?$filter=emailaddress1 eq '" + + emailAddress + + "'&$count=true&$select=emailaddress1, contactid"; return axios - .get( - "/api/proxy/contacts?$filter=emailaddress1 eq '" + - emailAddress + - "'&$count=true&$select=emailaddress1, contactid" - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("thiserror", error); @@ -989,17 +991,17 @@ export const getEmailAccountCheck = (emailAddress) => { export const createAccount = (formValues) => { var data = JSON.stringify(formValues); - + var queryUrl = "/api/proxy/contacts"; var config = { method: "post", - url: "/api/proxy/contacts", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": getSASToken(), + "Authorization": getToken(), }, data: data, }; @@ -1016,17 +1018,17 @@ export const createAccount = (formValues) => { export const updateAccount = (contactId, updateBody) => { var data = JSON.stringify(updateBody); - + var queryUrl = "/api/proxy/contacts(" + contactId + ")"; var config = { method: "patch", - url: "/api/proxy/contacts(" + contactId + ")", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": getSASToken(), + "Authorization": getToken(), }, data: data, }; @@ -1044,17 +1046,17 @@ export const updateAccount = (contactId, updateBody) => { export const updatePassword = (contactId, newpassword) => { let updateBody = { "pinswg_custom_password": newpassword }; var data = JSON.stringify(updateBody); - + var queryUrl = "/api/proxy/contacts(" + contactId + ")"; var config = { method: "patch", - url: "/api/proxy/contacts(" + contactId + ")", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", "Accept": "application/json", "Prefer": 'odata.include-annotations="*",return=representation', "Content-Type": "application/json", - "ServiceBusAuthorization": getSASToken(), + "Authorization": getToken(), }, data: data, }; diff --git a/components/accessibility.js b/components/accessibility.js new file mode 100644 index 00000000..8bc96a23 --- /dev/null +++ b/components/accessibility.js @@ -0,0 +1,31 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; + +const AccessibilityStatement = (props) => { + let { t } = useTranslation(); + + const { whichError } = props; + + const router = useRouter(); + const { locale } = router; + + return ( +
+
+
+

+ Accessibility Statement +

+

bkah blah

+
+
+
+ ); +}; + +export default AccessibilityStatement; diff --git a/components/account/personaldetailsComplete.js b/components/account/personaldetailsComplete.js index a3a3b01e..2740f5a8 100644 --- a/components/account/personaldetailsComplete.js +++ b/components/account/personaldetailsComplete.js @@ -35,7 +35,10 @@ const PersonalDetailsComplete = (props) => { let contactid = props.accountDetails.loggedinUserId; let updateBody = props.props.props.form.personalDetailsForm.values; updateAccount(contactid, updateBody); - }, []); + }, [ + props.accountDetails.loggedinUserId, + props.props.props.form.personalDetailsForm.values, + ]); return ( <> diff --git a/components/account/registerform.js b/components/account/registerform.js index 2d0fd4fb..63981f1f 100644 --- a/components/account/registerform.js +++ b/components/account/registerform.js @@ -77,11 +77,12 @@ const RegisterForm = (props) => { let errorsobj = {}; + const emailRegex = + /(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi; + const required = (value) => (value ? undefined : "Is required"); const email = (value) => - value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value) - ? "Invalid email address" - : undefined; + value && !emailRegex.test(value) ? "Invalid email address" : undefined; const phoneNumber = (value) => value && !/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test( diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 0d76a426..72570954 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -38,13 +38,13 @@ const Breadcrumbs = (props) => { } } - const [showSpinnerState, setShowSpinnerState] = useState(false); + // const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; return ( <> - + /> */} ); }; diff --git a/components/case.js b/components/case.js index 92d2f5e1..08973ff5 100644 --- a/components/case.js +++ b/components/case.js @@ -6,7 +6,8 @@ import Summary from "./case/summary"; import Documents from "./case/documents"; import RepresentationList from "./case/representationList"; -const CaseSummary = (props) => { +const Case = (props) => { + const { showRepresentations } = props; let { t } = useTranslation(); const router = useRouter(); @@ -43,12 +44,19 @@ const CaseSummary = (props) => { documentDetailsObj={props.documentDetailsObj} documentHistoryObj={props.documentHistoryObj} /> - - + {showRepresentations == "true" && ( + + )} ); }; -export default CaseSummary; +export default Case; diff --git a/components/case/documents.js b/components/case/documents.js index bfcc9a59..5746ec72 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -7,6 +7,7 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; import transLookup from "../../data/lookuptranslations.json"; import PaginationControl from "./pagination"; import LoadingOverlay from "react-loading-overlay"; +import CryptoJS from "crypto-js"; import { getBasicSearch, @@ -15,7 +16,7 @@ import { getSearchDocumentHistory1, getSearchDocumentHistory1Paged, getSearchDocumentDetails1Paged, - getSASToken, + getToken, } from "../../actions"; import { @@ -104,10 +105,9 @@ const DocumentDetails = (props) => { >
{t( @@ -184,13 +184,27 @@ const DocumentDetails = (props) => { ); }; + const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY; + + const encryptDocReference = (documentRef) => { + var hashlink = CryptoJS.HmacSHA256( + "documents/download/" + documentRef, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + return ( + "/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink + ); + }; + useEffect(() => { const docDetailsObj = async () => { let docObj = await getSearchDocumentDetails1(incidentid) @@ -249,7 +263,7 @@ const DocumentDetails = (props) => { //console.log("getting details", data); return getDocumentHistory(data.value).then((data) => { setDocumentHistory(data); - setShowSpinnerState(false); + //setShowSpinnerState(false); }); }); }; @@ -330,13 +344,13 @@ const DocumentDetails = (props) => { ) : pagesCount; - const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const [showDocumentSearchState, setDocumentSearchState] = useState(false); @@ -370,11 +384,11 @@ const DocumentDetails = (props) => { - + /> */} ); }; diff --git a/components/case/pagination.js b/components/case/pagination.js index 50b88581..41768f9b 100644 --- a/components/case/pagination.js +++ b/components/case/pagination.js @@ -81,8 +81,8 @@ const PaginationControl = (props) => { { - spinnerState(), - getDocumentResults(currentPage - 1); + // spinnerState(), + getDocumentResults(currentPage - 1); }} > {t("common:previous-link-button")} @@ -114,7 +114,7 @@ const PaginationControl = (props) => { className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem" key={i} onClick={() => { - spinnerState(); + // spinnerState(); console.log(i + 1); getDocumentResults(i + 1); }} @@ -129,8 +129,8 @@ const PaginationControl = (props) => { { - spinnerState(), - getDocumentResults(currentPage + 1); + // spinnerState(), + getDocumentResults(currentPage + 1); }} > {t("common:next-link-button")} diff --git a/components/case/representationList.js b/components/case/representationList.js index 065306a3..2e0b42f7 100644 --- a/components/case/representationList.js +++ b/components/case/representationList.js @@ -7,35 +7,249 @@ import jsonpath from "jsonpath"; import _ from "lodash"; import transLookup from "../../data/lookuptranslations.json"; import LoadingOverlay from "react-loading-overlay"; +import { getRepresentations } from "../../actions"; +import { setRepresentations } from "../../store/searchOutput/action"; +import PaginationControl from "./pagination"; const RepresentationList = (props) => { + const { incidentid, representationsObj, setRepresentations } = props; let { t } = useTranslation(); const router = useRouter(); const { locale } = router; - const [showSpinnerState, setShowSpinnerState] = useState(false); + // const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; + + var representationsArr = representationsObj || []; + + const RepresentationsView = (representationsArr) => { + //console.log(documentDetailsArr); + + representationsArr = representationsArr.value; + return ( + <> +

+ {representationsObj["@odata.count"] > 1 + ? t("case:documents-count-label-1") + : t("case:documents-count-label-1a")}{" "} + {representationsObj["@odata.count"]}{" "} + { + representationsObj["@odata.count"] > 1 + ? "representations " //t("case:documents-count-label-2") + : "representations " //t("case:documents-count-label-2a") + } +

+
+
+
+ { + "Type of representation" //t("case:documents-name-label") + } +
+
+ {t("case:documents-doc-type-label")} +
+
+ {t("case:documents-date-published-label")} +
+
+ + {representationsArr.map((item, key) => { + let detailsObj = jsonpath.query( + item, + "$..[?(@.pinswg_representationsid=='" + + incidentid + + "')]" + ); + detailsObj = item; + + console.log(detailsObj); + + return ( +
+
+ + + {t("case:documents-name-label")}: + + { + detailsObj[ + "pinswg_whatkind@OData.Community.Display.V1.FormattedValue" + ] + } + +
+
+ + {t("case:documents-doc-type-label")}: + + + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj[ + "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : detailsObj[ + "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-date-entered-label" + )} +
+
+ + {t( + "case:documents-date-published-label" + )} + : + + + {formatDates( + detailsObj[ + "createdon@OData.Community.Display.V1.FormattedValue" + ] + )} +
+ {/*
+ + {t("case:documents-size-label")}: + + 92 +
*/} +
+ ); + })} +
+ {/* */} + + ); }; + + useEffect(() => { + const representationDetailsObj = async () => { + let docObj = await getRepresentations(incidentid).then((data) => { + console.log(data); + setRepresentationSearchState(true); + setRepresentations(data); + return data; + }); + + return docObj; + }; + const representationResultsObj = representationDetailsObj(); + }, [incidentid, setRepresentations]); + + function formatDates(dateObj) { + var dateObj = new Date(dateObj); + var dd = String(dateObj.getDate()).padStart(2, "0"); + var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0! + var yyyy = dateObj.getFullYear(); + + return dd + "/" + mm + "/" + yyyy; + } + + const pagesCount = Math.ceil(representationsObj["@odata.count"] / 10); + + let currentPage = 0; + + currentPage = decodeURI(representationsObj["@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; + + //const [showSpinnerState, setShowSpinnerState] = useState(false); + + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; + + const [showReperesentationSearchState, setRepresentationSearchState] = + useState(false); + + let representationSearchState = () => { + showReperesentationSearchState == true + ? setRepresentationSearchState(false) + : setRepresentationSearchState(true); + }; + return ( <> -
-
+
+

Representations

+ {_.isEmpty(representationsObj) ? ( +
+
+

+ {showReperesentationSearchState == false + ? "Checking for representations " + : t( + "case:documents-non-available-label" + )} +

+
+
+ ) : ( + RepresentationsView(representationsArr) + )}
- + /> */} ); }; -export default RepresentationList; +const mapStateToProps = (state) => { + return { + ...state, + }; +}; + +const mapDispatchToProps = (dispatch) => { + return { + setRepresentations: (representationObj) => { + dispatch(setRepresentations(representationObj)); + }, + }; +}; + +export default connect(mapStateToProps, mapDispatchToProps)(RepresentationList); diff --git a/components/case/summary.js b/components/case/summary.js index 15067946..970f47e2 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -215,15 +215,15 @@ const CaseSummary = (props) => { )} - { - spinnerState(); + //spinnerState(); router.back(); }} className="govuk-button govuk-button--secondary" > {t("case:summary-back-button-label")} - + */}
@@ -257,7 +257,7 @@ const CaseSummary = (props) => { { - spinnerState(); + // spinnerState(); router.back(); }} className="govuk-button govuk-button--secondary" @@ -570,13 +570,13 @@ const CaseSummary = (props) => { const linkedCases = linkCaseObj(); }, [incidentid, setCurrentLinkedCases]); - const [showSpinnerState, setShowSpinnerState] = useState(false); + // const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; function formatDates(dateObj) { var dateObj = new Date(dateObj); @@ -631,11 +631,11 @@ const CaseSummary = (props) => { return ( <> {showDetailsBlock} - {" "} + /> */} ); }; diff --git a/components/case/summaryTypes/pinswg_advertsid.js b/components/case/summaryTypes/pinswg_advertsid.js index 297abb25..ac8e96c1 100644 --- a/components/case/summaryTypes/pinswg_advertsid.js +++ b/components/case/summaryTypes/pinswg_advertsid.js @@ -148,29 +148,31 @@ const Pinswg_advertsid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
diff --git a/components/case/summaryTypes/pinswg_callinss77id.js b/components/case/summaryTypes/pinswg_callinss77id.js index d2d93ff9..4015e18a 100644 --- a/components/case/summaryTypes/pinswg_callinss77id.js +++ b/components/case/summaryTypes/pinswg_callinss77id.js @@ -148,29 +148,31 @@ const Pinswg_callinss77id = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -232,7 +234,6 @@ const Pinswg_callinss77id = (props) => { )}
-
{t( @@ -258,7 +259,6 @@ const Pinswg_callinss77id = (props) => { )}
-
{t( @@ -284,7 +284,6 @@ const Pinswg_callinss77id = (props) => { )}
-
{t( @@ -323,7 +322,6 @@ const Pinswg_callinss77id = (props) => { )}
-
{t( @@ -349,7 +347,7 @@ const Pinswg_callinss77id = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +371,7 @@ const Pinswg_callinss77id = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} @@ -397,7 +395,6 @@ const Pinswg_callinss77id = (props) => { )}
-
{t("case:summary-decision-date-label")} diff --git a/components/case/summaryTypes/pinswg_commonlandid.js b/components/case/summaryTypes/pinswg_commonlandid.js index 3e4cb3db..5c736e43 100644 --- a/components/case/summaryTypes/pinswg_commonlandid.js +++ b/components/case/summaryTypes/pinswg_commonlandid.js @@ -148,29 +148,31 @@ const Pinswg_commonlandid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -369,7 +371,7 @@ const Pinswg_commonlandid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -393,7 +395,7 @@ const Pinswg_commonlandid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_communityinfrastructurelevyid.js b/components/case/summaryTypes/pinswg_communityinfrastructurelevyid.js index 1a396aef..57abd0e2 100644 --- a/components/case/summaryTypes/pinswg_communityinfrastructurelevyid.js +++ b/components/case/summaryTypes/pinswg_communityinfrastructurelevyid.js @@ -148,29 +148,31 @@ const Pinswg_communityinfrastructurelevyid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
diff --git a/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js b/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js index 70e66694..5ae074b6 100644 --- a/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js +++ b/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js @@ -130,29 +130,31 @@ const Pinswg_compulsorypurchaseordersid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -351,7 +353,7 @@ const Pinswg_compulsorypurchaseordersid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -375,7 +377,7 @@ const Pinswg_compulsorypurchaseordersid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_dnsid.js b/components/case/summaryTypes/pinswg_dnsid.js index c1d5e6b6..2602ff9b 100644 --- a/components/case/summaryTypes/pinswg_dnsid.js +++ b/components/case/summaryTypes/pinswg_dnsid.js @@ -189,29 +189,31 @@ const Pinswg_dnsid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -263,7 +265,19 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_webaddress + '")].value_cy' ) - : detailsObj.pinswg_webaddress || + : ( + + { + detailsObj.pinswg_webaddress + } + + ) || t( "case:summary-no-date-entered-label" )} diff --git a/components/case/summaryTypes/pinswg_electricityactid.js b/components/case/summaryTypes/pinswg_electricityactid.js index 60c7230f..f2446653 100644 --- a/components/case/summaryTypes/pinswg_electricityactid.js +++ b/components/case/summaryTypes/pinswg_electricityactid.js @@ -188,29 +188,31 @@ const Pinswg_electricityactid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
diff --git a/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js b/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js index 36fac0cb..e1f57f9a 100644 --- a/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js +++ b/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js @@ -148,29 +148,31 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js b/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js index 266f26e6..8471d5ca 100644 --- a/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js +++ b/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js @@ -148,29 +148,31 @@ const Pinswg_enforcementnoticeappeals174id = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_enforcementnoticeappeals174id = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_enforcementnoticeappeals174id = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_environmentalpermittingid.js b/components/case/summaryTypes/pinswg_environmentalpermittingid.js index ba96cf3d..46046924 100644 --- a/components/case/summaryTypes/pinswg_environmentalpermittingid.js +++ b/components/case/summaryTypes/pinswg_environmentalpermittingid.js @@ -148,29 +148,31 @@ const Pinswg_environmentalpermittingid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -369,7 +371,7 @@ const Pinswg_environmentalpermittingid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -393,7 +395,7 @@ const Pinswg_environmentalpermittingid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_harbourrevisionorderid.js b/components/case/summaryTypes/pinswg_harbourrevisionorderid.js index d645720b..e36f366f 100644 --- a/components/case/summaryTypes/pinswg_harbourrevisionorderid.js +++ b/components/case/summaryTypes/pinswg_harbourrevisionorderid.js @@ -188,29 +188,31 @@ const Pinswg_harbourrevisionorderid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
diff --git a/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js b/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js index 09c61e1a..f2d87455 100644 --- a/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js +++ b/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js @@ -148,29 +148,31 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -369,7 +371,7 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -393,7 +395,7 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_householderappealhasid.js b/components/case/summaryTypes/pinswg_householderappealhasid.js index 7d62464d..df418aa8 100644 --- a/components/case/summaryTypes/pinswg_householderappealhasid.js +++ b/components/case/summaryTypes/pinswg_householderappealhasid.js @@ -148,29 +148,31 @@ const Pinswg_householderappealhasid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
diff --git a/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js b/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js index 57b04ca5..1bcfeaa7 100644 --- a/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js +++ b/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js @@ -148,29 +148,31 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_ldpid.js b/components/case/summaryTypes/pinswg_ldpid.js index 1caf671e..40bda60f 100644 --- a/components/case/summaryTypes/pinswg_ldpid.js +++ b/components/case/summaryTypes/pinswg_ldpid.js @@ -148,29 +148,31 @@ const Pinswg_ldpid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_ldpid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_ldpid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js b/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js index 8444ee16..78cecdb4 100644 --- a/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js +++ b/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js @@ -148,29 +148,31 @@ const Pinswg_listedbuildingandconservationrid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_listedbuildingandconservationrid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_listedbuildingandconservationrid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_maintenanceoflands217id.js b/components/case/summaryTypes/pinswg_maintenanceoflands217id.js index ae194803..b22f5d55 100644 --- a/components/case/summaryTypes/pinswg_maintenanceoflands217id.js +++ b/components/case/summaryTypes/pinswg_maintenanceoflands217id.js @@ -148,29 +148,31 @@ const Pinswg_maintenanceoflands217id = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_maintenanceoflands217id = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_maintenanceoflands217id = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js b/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js index d28f633c..5a62e29c 100644 --- a/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js +++ b/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js @@ -148,29 +148,31 @@ const Pinswg_miscellaneouscasewordid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -369,7 +371,7 @@ const Pinswg_miscellaneouscasewordid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -393,7 +395,7 @@ const Pinswg_miscellaneouscasewordid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_planningappeals78id.js b/components/case/summaryTypes/pinswg_planningappeals78id.js index 5b153066..bc4d224b 100644 --- a/components/case/summaryTypes/pinswg_planningappeals78id.js +++ b/components/case/summaryTypes/pinswg_planningappeals78id.js @@ -148,29 +148,31 @@ const Pinswg_planningappeals78id = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_planningappeals78id = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_planningappeals78id = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_planningconditionss73s79id.js b/components/case/summaryTypes/pinswg_planningconditionss73s79id.js index 5da3352d..77b4699c 100644 --- a/components/case/summaryTypes/pinswg_planningconditionss73s79id.js +++ b/components/case/summaryTypes/pinswg_planningconditionss73s79id.js @@ -148,29 +148,31 @@ const Pinswg_planningconditionss73s79id = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_planningconditionss73s79id = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_planningconditionss73s79id = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_planningobligationappeals106id.js b/components/case/summaryTypes/pinswg_planningobligationappeals106id.js index 5473960d..0b315ebb 100644 --- a/components/case/summaryTypes/pinswg_planningobligationappeals106id.js +++ b/components/case/summaryTypes/pinswg_planningobligationappeals106id.js @@ -148,29 +148,31 @@ const Pinswg_planningobligationappeals106id = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -349,7 +351,7 @@ const Pinswg_planningobligationappeals106id = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -373,7 +375,7 @@ const Pinswg_planningobligationappeals106id = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_rowid.js b/components/case/summaryTypes/pinswg_rowid.js index 95cb8417..9167e86c 100644 --- a/components/case/summaryTypes/pinswg_rowid.js +++ b/components/case/summaryTypes/pinswg_rowid.js @@ -148,29 +148,31 @@ const Pinswg_rowid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -369,7 +371,7 @@ const Pinswg_rowid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -393,7 +395,7 @@ const Pinswg_rowid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/case/summaryTypes/pinswg_wayleaveid.js b/components/case/summaryTypes/pinswg_wayleaveid.js index 961ab7fa..206f7295 100644 --- a/components/case/summaryTypes/pinswg_wayleaveid.js +++ b/components/case/summaryTypes/pinswg_wayleaveid.js @@ -148,29 +148,31 @@ const Pinswg_wayleaveid = (props) => { */}
-
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t( + "case:summary-case-link-status-label" + )} +
+
+ {_.has(casesObj, [ + "numberofchildincidents", + ]) + ? casesObj.numberofchildincidents > + 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) : t( "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
+ )} + + + )} {casesObj.numberofchildincidents > 0 ? (
@@ -369,7 +371,7 @@ const Pinswg_wayleaveid = (props) => { )}
-
+ {/*
{t( "case:summary-inquiry-evidence-date-label" @@ -393,7 +395,7 @@ const Pinswg_wayleaveid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t("case:summary-event-date-label")} diff --git a/components/cookieBanner.js b/components/cookieBanner.js index 5a921075..fdd30e14 100644 --- a/components/cookieBanner.js +++ b/components/cookieBanner.js @@ -17,11 +17,22 @@ const CookieBanner = () => { let expDate = new Date(now); expDate.setDate(now.getDate() + 365); - - console.log(expDate); cookie.set("planning_casework", true, { expires: expDate, }); + + let cookieStr = { + "essential": "accepted", + "usage": "accepted", + "communications": "accepted", + "settings": "accepted", + }; + + cookie.set("CookiePolicy", JSON.stringify(cookieStr).toString(), { + expires: expDate, + path: "/", + }); + setBannerVisible(false); }; diff --git a/components/cookiePolicy.js b/components/cookiePolicy.js new file mode 100644 index 00000000..8aaed62e --- /dev/null +++ b/components/cookiePolicy.js @@ -0,0 +1,192 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; + +const CookiePolicy = (props) => { + let { t } = useTranslation(); + + const { whichError } = props; + + const router = useRouter(); + const { locale } = router; + + return ( +
+
+
+

+ {t("cookies:cookie-policy-title-heading")} +

+

+ {t("cookies:cookie-policy-intro-paragraph")} +

+

+ {t("cookies:cookie-policy-sub-heading-one")} +

+ +

+ {t("cookies:cookie-policy-paragraph-one")} +

+ +
+
+
+ {t("cookies:cookie-policy-list-heading-one")} +
+
+ {t("cookies:cookie-policy-list-heading-two")} +
+
+ {t("cookies:cookie-policy-list-heading-three")} +
+
+ {t("cookies:cookie-policy-list-heading-four")} +
+
+ +
+
+ + {t( + "cookies:cookie-policy-list-heading-one" + )} + : + + {t( + "cookies:cookie-policy-list-row-one-item-one" + )} +
+
+ + {t( + "cookies:cookie-policy-list-heading-two" + )} + : + + {t( + "cookies:cookie-policy-list-row-one-item-two" + )} +
+
+ + {t( + "cookies:cookie-policy-list-heading-three" + )} + : + + {t( + "cookies:cookie-policy-list-row-one-item-three" + )} +
+
+ + {t( + "cookies:cookie-policy-list-heading-four" + )} + : + + {t( + "cookies:cookie-policy-list-row-one-item-four" + )} +
+
+
+
+ + {t( + "cookies:cookie-policy-list-heading-one" + )} + : + + {t( + "cookies:cookie-policy-list-row-two-item-one" + )} +
+
+ + {t( + "cookies:cookie-policy-list-heading-two" + )} + : + + {t( + "cookies:cookie-policy-list-row-two-item-two" + )}{" "} +
+
+ + {t( + "cookies:cookie-policy-list-heading-three" + )} + : + + {t( + "cookies:cookie-policy-list-row-two-item-three" + )} +
+
+ + {t( + "cookies:cookie-policy-list-heading-four" + )} + : + + {t( + "cookies:cookie-policy-list-row-two-item-four" + )} +
+
+
+ +

+ {t("cookies:cookie-policy-browser-find-out-more")}{" "} + + {t( + "cookies:cookie-policy-browser-find-out-more-link" + )} + + . +

+ +

+ {t("cookies:cookie-policy-sub-heading-two")} +

+ +

+ {t("cookies:cookie-policy-paragraph-two")} +

+ +

+ {t("cookies:cookie-policy-paragraph-three")} + + {t("cookies:cookie-policy-paragraph-three-link-a")} + + , {t("cookies:cookie-policy-paragraph-three-a")}{" "} + + {t("cookies:cookie-policy-paragraph-three-link-b")} + {" "} + {t("cookies:cookie-policy-paragraph-three-b")} +

+ +

+ {t("cookies:cookie-policy-paragraph-four")} +

+ +

+ {t("cookies:cookie-policy-paragraph-five")} +

+
+
+
+ ); +}; + +export default CookiePolicy; diff --git a/components/cookiemanager/index.js b/components/cookiemanager/index.js index 49b8e2f7..226a7b6c 100644 --- a/components/cookiemanager/index.js +++ b/components/cookiemanager/index.js @@ -28,33 +28,47 @@ const CookieManagementMain = (props) => { let expDate = new Date(now); expDate.setDate(now.getDate() + 365); - cookie.set("pinsCookiePolicy", JSON.stringify(values).toString(), { + cookie.set("CookiePolicy", JSON.stringify(values).toString(), { expires: expDate, + path: "/", }); + + function delete_cookie(name, path, domain) { + document.cookie = + name + + "=" + + (path ? ";path=" + path : "") + + (domain ? ";domain=" + domain : "") + + ";expires=Thu, 01 Jan 1970 00:00:01 GMT"; + } + + usageState == "revoked" && delete_cookie("CookiePolicy", "/"), + delete_cookie("_ga", "/"), + delete_cookie("_gid", "/"); + cookie.set("planning_casework", true, { expires: expDate, + path: "/", }); }; let cookieCheck = parseCookies(); let cookieObj = - typeof cookieCheck.pinsCookiePolicy == "undefined" + typeof cookieCheck.CookiePolicy == "undefined" ? {} - : JSON.parse(cookieCheck.pinsCookiePolicy); + : JSON.parse(cookieCheck.CookiePolicy); const [usageState, setUsageState] = useState( - typeof cookieCheck.pinsCookiePolicy == "undefined" - ? null - : cookieObj.usage + typeof cookieCheck.CookiePolicy == "undefined" ? null : cookieObj.usage ); const [communicationsState, setCommunicationsState] = useState( - typeof cookieCheck.pinsCookiePolicy == "undefined" + typeof cookieCheck.CookiePolicy == "undefined" ? null : cookieObj.communications ); const [settingsState, setSettingsState] = useState( - typeof cookieCheck.pinsCookiePolicy == "undefined" + typeof cookieCheck.CookiePolicy == "undefined" ? null : cookieObj.settings ); @@ -78,17 +92,17 @@ const CookieManagementMain = (props) => { const CookieForm = () => { return (
-

+

{t("cookies:cookie-title-heading")}


- {typeof cookieCheck.pinsCookiePolicy == "undefined" ? ( + {typeof cookieCheck.CookiePolicy == "undefined" ? ( <>

@@ -107,8 +121,7 @@ const CookieManagementMain = (props) => {
{
-
+ {/*

{t( @@ -297,7 +310,7 @@ const CookieManagementMain = (props) => {

- + */}
@@ -399,16 +412,17 @@ const CookieManagementMain = (props) => { )}

- - {t( - "cookies:cookie-settings-essential-link-label" - )} - + + {t( + "cookies:cookie-settings-essential-link-label" + )} + +

diff --git a/components/footer.js b/components/footer.js index 11847158..6f371a24 100644 --- a/components/footer.js +++ b/components/footer.js @@ -167,17 +167,22 @@ export default function Footer(props) { id="footer_links" >
  • - - {t( - "common:footer-accessibility-link-label" - )} - + + {t( + "common:footer-accessibility-link-label" + )} + +
  • @@ -204,7 +209,7 @@ export default function Footer(props) { "common:footer-copyright-link" )} className="govuk-footer__link" - id="aAccess" + id="Access" > {t( "common:footer-copyright-link-label" @@ -213,31 +218,41 @@ export default function Footer(props) {
  • - - {t( - "common:footer-privacy-link-label" - )} - + + {t( + "common:footer-privacy-link-label" + )} + +
  • - - {t( - "common:footer-terms-conditions-link-label" - )} - + + {t( + "common:footer-terms-conditions-link-label" + )} + +
  • {/*
  • { const router = useRouter(); const { locale } = router; - const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const onHandleSubmit = (values) => { - spinnerState(); + // spinnerState(); router.replace({ pathname: router.locale == "cy" ? "/canlyniadauchwilio" : "/searchresults", - query: { q: values.basicSearch }, + query: { q: values.basicSearch.trim() }, shallow: true, }); }; @@ -151,11 +151,11 @@ let CaseSearch = (props) => {
  • - + /> */}
    ); diff --git a/components/homepage/dns.js b/components/homepage/dns.js index cd8fd796..8941107a 100644 --- a/components/homepage/dns.js +++ b/components/homepage/dns.js @@ -6,16 +6,16 @@ import LoadingOverlay from "react-loading-overlay"; export default function Dns() { let { t } = useTranslation(); - const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); const router = useRouter(); const { locale } = router; - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; return ( - + /> */} ); } diff --git a/components/homepage/login.js b/components/homepage/login.js index 82ae7bdd..08108f86 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -114,17 +114,22 @@ let Login = (props) => { const router = useRouter(); const { locale } = router; - const [showSpinnerState, setShowSpinnerState] = useState(false); + // const [showSpinnerState, setShowSpinnerState] = useState(false); const [validLoginID, setValidLoginID] = useState(null); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const onHandleSubmit = (values) => { - spinnerState(); + //spinnerState(); + + let now = new Date(); + let expDate = new Date(now); + + expDate.setDate(now.getDate() + 1); getLogin(values.loginUserID, values.loginUserPassword).then((data) => { data.value.length != 0 @@ -132,14 +137,16 @@ let Login = (props) => { setLoggedInUserId(data.value[0].contactid), setCookie(null, "pinsUser", data.value[0].contactid, { path: "/", + expires: expDate, }), - spinnerState(), + // spinnerState(), router.replace({ pathname: router.locale == "cy" ? "/fymhorth" : "/myportal", shallow: true, })) - : (setShowSpinnerState(false), setValidLoginID(false)); + : //setShowSpinnerState(false), + setValidLoginID(false); }); }; @@ -147,12 +154,12 @@ let Login = (props) => { useEffect(() => { cookies.pinsUser != null || typeof cookies.pinsUser != "undefined" - ? (spinnerState(), + ? // spinnerState(), router.replace("/myportal", null, { shallow: true, - })) + }) : ""; - }, []); + }, [cookies.pinsUser, router]); return (
    @@ -243,11 +250,11 @@ let Login = (props) => {
    - + /> */} ); }; diff --git a/components/myportal/searchcases.js b/components/myportal/searchcases.js index f43e5f3e..0668b7e5 100644 --- a/components/myportal/searchcases.js +++ b/components/myportal/searchcases.js @@ -71,16 +71,16 @@ let CaseSearch = (props) => { const router = useRouter(); const { locale } = router; - const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const onHandleSubmit = (values) => { - spinnerState(); + //spinnerState(); router.push({ pathname: router.locale == "cy" @@ -143,11 +143,11 @@ let CaseSearch = (props) => { - + /> */} ); diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 31a73064..408b07dd 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -6,7 +6,7 @@ import { setCurrentReference } from "../../store/currentView/action"; import { connect } from "react-redux"; import { parseCookies } from "nookies"; import { - getSASToken, + getToken, getWatchedCasesProxy, getPortalModuleDetailsProxy, deleteWatchedCases, @@ -37,7 +37,7 @@ const TopThree = (props) => { let showTopThreeArr = showTopThree.value; const deleteItem = (caseID, topThreeType) => { - let token = getSASToken(); + let token = getToken(); let cookies = parseCookies(); topThreeType == "watchedCases" && deleteWatchedCases(caseID) diff --git a/components/newappeal/complete.js b/components/newappeal/complete.js index e7ee1daa..1dced394 100644 --- a/components/newappeal/complete.js +++ b/components/newappeal/complete.js @@ -56,6 +56,7 @@ let CompleteAppeal = (props) => { props.props.form.appealForm.values, props.appealType.appealLPA, props.props.accountDetails.loggedinUserId, + props.appealType.appealTypeID, ]); const getFormCollection = (formtype) => { diff --git a/components/privacy.js b/components/privacy.js new file mode 100644 index 00000000..2941eb0b --- /dev/null +++ b/components/privacy.js @@ -0,0 +1,31 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; + +const PrivacyStatement = (props) => { + let { t } = useTranslation(); + + const { whichError } = props; + + const router = useRouter(); + const { locale } = router; + + return ( +
    +
    +
    +

    + Privacy Statement +

    +

    bkah blah

    +
    +
    +
    + ); +}; + +export default PrivacyStatement; diff --git a/components/search/advancedsearch.js b/components/search/advancedsearch.js index 0721210b..c9403d25 100644 --- a/components/search/advancedsearch.js +++ b/components/search/advancedsearch.js @@ -218,21 +218,22 @@ let AdvancedSearch = (props) => { const required = (value) => (value ? undefined : "Required"); - const [showSpinnerState, setShowSpinnerState] = useState(false); + // const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const onHandleSubmit = (values) => { event.preventDefault(); - spinnerState(); + //spinnerState(); var searchString = ""; - searchString += values.caseRef != null ? "?q=" + values.caseRef : ""; + searchString += + values.caseRef != null ? "?q=" + values.caseRef.trim() : ""; searchString += values.lpaTypes != null ? (typeof values.caseRef == "undefined" ? "?" : "&") + @@ -411,14 +412,11 @@ let AdvancedSearch = (props) => { - {/*
    - -
    */} - + /> */} ); }; diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index 7d24d8d6..6f839b64 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -38,13 +38,13 @@ const DNSSearchResults = (props) => { var resultsArr = searchResultsObj.value || []; - const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const ResultsView = (resultsArr) => { return ( @@ -226,7 +226,7 @@ const DNSSearchResults = (props) => { @@ -268,7 +268,7 @@ const DNSSearchResults = (props) => { //console.log("getting details", data); return getSearchDetailsPaged(data).then((data) => { setSearchDetails(data); - setShowSpinnerState(false); + //setShowSpinnerState(false); }); }); }; @@ -301,11 +301,11 @@ const DNSSearchResults = (props) => { )} - + /> */} ); }; diff --git a/components/search/pagination.js b/components/search/pagination.js index 2ac43e98..9a29050d 100644 --- a/components/search/pagination.js +++ b/components/search/pagination.js @@ -7,7 +7,7 @@ const PaginationControl = (props) => { searchString, searchResultsObj, currentPage, - spinnerState, + // spinnerState, getSearchPageResults, } = props; let { t } = useTranslation(); @@ -81,8 +81,8 @@ const PaginationControl = (props) => { { - spinnerState(), - getSearchPageResults(currentPage - 1); + // spinnerState(), + getSearchPageResults(currentPage - 1); }} > {t("common:previous-link-button")} @@ -114,7 +114,7 @@ const PaginationControl = (props) => { className="govuk-body govuk-link govuk-!-padding-2 govuk-!-font-weight-bold govuk-link--no-underline activePaginationItem" key={i} onClick={() => { - spinnerState(); + // spinnerState(); console.log(i + 1); getSearchPageResults(i + 1); }} @@ -129,8 +129,8 @@ const PaginationControl = (props) => { { - spinnerState(), - getSearchPageResults(currentPage + 1); + // spinnerState(), + getSearchPageResults(currentPage + 1); }} > {t("common:next-link-button")} diff --git a/components/search/searchresults.js b/components/search/searchresults.js index bd014c66..fad652de 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -39,7 +39,7 @@ import { import { createWatchedCases, - getSASToken, + getToken, getWatchedCasesProxy, getPortalModuleDetailsProxy, deleteWatchedCases, @@ -66,18 +66,18 @@ const SearchResults = (props) => { var resultsArr = searchResultsObj.value || []; - const [showSpinnerState, setShowSpinnerState] = useState(false); + // const [showSpinnerState, setShowSpinnerState] = useState(false); - let spinnerState = () => { - showSpinnerState == true - ? setShowSpinnerState(false) - : setShowSpinnerState(true); - }; + // let spinnerState = () => { + // showSpinnerState == true + // ? setShowSpinnerState(false) + // : setShowSpinnerState(true); + // }; const cookies = parseCookies(); const selectWatchedCase = (loggedInUser, incidentID, appealType) => { - let token = getSASToken(); + let token = getToken(); let updateBody = { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", @@ -109,7 +109,7 @@ const SearchResults = (props) => { }; const deleteItem = (caseID, topThreeType) => { - let token = getSASToken(); + let token = getToken(); let cookies = parseCookies(); topThreeType == "watchedCases" && deleteWatchedCases(caseID) @@ -430,7 +430,7 @@ const SearchResults = (props) => { @@ -476,7 +476,7 @@ const SearchResults = (props) => { //console.log("getting details", data); return getSearchDetailsPaged(data).then((data) => { setSearchDetails(data); - setShowSpinnerState(false); + //setShowSpinnerState(false); }); }); } else { @@ -490,7 +490,7 @@ const SearchResults = (props) => { //console.log("getting details", data); return getSearchDetailsPaged(data).then((data) => { setSearchDetails(data); - setShowSpinnerState(false); + //setShowSpinnerState(false); }); }); } @@ -535,11 +535,11 @@ const SearchResults = (props) => { )} - + /> */} ); }; diff --git a/components/tandc.js b/components/tandc.js new file mode 100644 index 00000000..3266e1d8 --- /dev/null +++ b/components/tandc.js @@ -0,0 +1,31 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; + +const TermsAndConditionsStatement = (props) => { + let { t } = useTranslation(); + + const { whichError } = props; + + const router = useRouter(); + const { locale } = router; + + return ( +
    +
    +
    +

    + {t("common:footer-terms-conditions-link-label")} +

    +

    bkah blah

    +
    +
    +
    + ); +}; + +export default TermsAndConditionsStatement; diff --git a/data/lookuptranslations.json b/data/lookuptranslations.json index c7b870a9..45d969b7 100644 --- a/data/lookuptranslations.json +++ b/data/lookuptranslations.json @@ -375,11 +375,6 @@ "value": "Snowdonia National Park Authority", "value_cy": "Parc Cenedlaethol Eryri", "pinswg_lpa": 0 - }, - { - "value": "Developments of National Significance", - "value_cy": "Datblygiad o Arwyddocâd Cenedlaethol", - "pinswg_lpa": 0 } ], "pinswg_procedure": [ diff --git a/i18n.js b/i18n.js index 1fa7971a..235a7ade 100644 --- a/i18n.js +++ b/i18n.js @@ -33,5 +33,7 @@ module.exports = { "/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"], "/help/cookies": ["common", "cookies"], "/account/register": ["common", "account"], + "/details-about-cookies": ["common", "cookies"], + "/terms-and-conditions": ["common"], }, }; diff --git a/locales/cy/common.json b/locales/cy/common.json index 0fa9fdc4..02e6139e 100644 --- a/locales/cy/common.json +++ b/locales/cy/common.json @@ -4,7 +4,7 @@ "gov-wales-link": "https://llyw.cymru", "gov-wales-label": "LLYW.CYMRU", "service-description": "Mae'r gwasanaeth hwn yn cael ei ddatblygu i gefnogi apeliadau a cheisiadau ar-lein.", - "service-name": "Gwaith achos cynllunio", + "service-name": "Gwaith Achos", "service-name-breadcrumb": "Hafan", "new-service-beta": "Mae hwn yn wasanaeth newydd", "breadcrumb-back-link": "Yn ôl", @@ -16,21 +16,21 @@ "search-button": "Chwilio", "submit-and-start": "Cyflwyno a dechrau'r cwrs", "footer-terms-conditions-link-label": "Telerau ac amodau", - "footer-terms-conditions-link": "https://llyw.cymru/telerau-ac-amodau", + "footer-terms-conditions-link": "/telerau-ac-amodau", "footer-privacy-link-label": "Preifatrwydd", - "footer-privacy-link": "https://llyw.cymru/help/polisi-preifatrwydd-wefan", + "footer-privacy-link": "/preifatrwydd", "footer-cookies-link": "Cwcis", "footer-accessibility-link-label": "Hygyrchedd", - "footer-accessibility-link": "https://llyw.cymru/datganiad-hygyrchedd-llywcymru", + "footer-accessibility-link": "/hygyrchedd", "footer-feedback-link": "Adborth", "footer-contact-us-link-label": "Cysylltu â ni", - "footer-contact-us-link": "https://llyw.cymru/cysylltu-ni", + "footer-contact-us-link": "https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/cysylltwch-ni", "footer-copyright-link-label": "Datganiad hawlfraint", "footer-copyright-link": "https://llyw.cymru/datganiad-hawlfraint", "footer-alternative-languages-link-label": "Ieithoedd amgen", "footer-alternative-languages-link": "https://llyw.cymru/ieithoedd-amgen", "footer-guidance-link-label": "Canllawiau a gwasanaethau Penderfyniadau Cynllunio ac Amgylchedd Cymru", - "footer-guidance-link": "https://gov.wales/planning-and-environment-decisions-wales/guidance-services", + "footer-guidance-link": "https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/canllawiau-gwasanaethau", "mobile-nav-label": "Dewislen", "signout-label": "Allgofnodwch", "back-to-top-link": "Nôl i dop y dudalen", diff --git a/locales/cy/cookies.json b/locales/cy/cookies.json index 4b660a4e..134bc5f0 100644 --- a/locales/cy/cookies.json +++ b/locales/cy/cookies.json @@ -1,22 +1,22 @@ { "cookie-breadcrumb": "Cwcis", - "cookie-title-heading": "Cwcis ar LLYW.CYMRU", + "cookie-title-heading": "Cwcis ar cynllunio gwaith achos", "cookie-not-saved-heading": "Nid yw eich dewisiadau cwcis wedi eu cadw eto", - "cookie-not-saved-paragraph": "Mae LLYW.CYMRU yn gosod cwcis pan fyddwch yn ymweld â'n gwefan. Gallwch newid y gosodiadau hyn i'ch dewis chi. Mae angen i chi gadw'r dudalen hon gyda'ch dewisiadau newydd.", + "cookie-not-saved-paragraph": "Mae y gwasanaeth gwaith achos cynllunio yn gosod cwcis pan fyddwch yn ymweld â'n gwefan. Gallwch newid y gosodiadau hyn i'ch dewis chi. Mae angen i chi gadw'r dudalen hon gyda'ch dewisiadau newydd.", "cookie-intro-paragraph-1": "Ffeiliau sy'n cael eu cadw ar eich ffôn, tabled neu gyfrifiadur pan fyddwch yn ymweld â gwefan yw cwcis.", - "cookie-intro-paragraph-2": "Rydym yn defnyddio cwcis i storio gwybodaeth ynghylch sut yr ydych yn defnyddio gwefan LLYW.CYMRU, megis y tudalennau yr ydych yn ymweld â nhw. Nid yw'r cwcis hyn yn cael eu defnyddio i'ch adnabod chi'n bersonol.", + "cookie-intro-paragraph-2": "Rydym yn defnyddio cwcis i storio gwybodaeth ynghylch sut yr ydych yn defnyddio gwefan y gwasanaeth gwaith achos cynllunio, megis y tudalennau yr ydych yn ymweld â nhw. Nid yw'r cwcis hyn yn cael eu defnyddio i'ch adnabod chi'n bersonol.", "cookie-intro-paragraph-3": "Rydym yn defnyddio 4 cwci gwahanol. Gallwch ddewis pa fath o gwcis rydych yn hapus i ni eu defnyddio.", "cookie-settings-heading": "Gosodiadau cwcis", "cookie-settings-usage-heading": "Cwcis sy'n mesur defnydd o'r wefan", "cookie-settings-usage-paragraph-1": "Rydym yn defnyddio Google Analytics i fesur sut rydych yn defnyddio’r wefan er mwyn i ni ei gwella yn seiliedig ar anghenion defnyddwyr. Mae Google Analytics yn gosod cwcis sy’n storio gwybodaeth wedi’i hanonymeiddio ynghylch:", "cookie-settings-usage-list-item-1": "sut daethoch chi i’r safle", - "cookie-settings-usage-list-item-2": "y tudalennau yr ydych yn ymweld â nhw ar LLYW.CYMRU a gwasanaethau digidol y llywodraeth, a pha mor hir yr ydych chi'n treulio ar bob tudalen", + "cookie-settings-usage-list-item-2": "y tudalennau yr ydych yn ymweld â nhw ar y gwasanaeth gwaith achos cynllunio a gwasanaethau digidol y llywodraeth, a pha mor hir yr ydych chi'n treulio ar bob tudalen", "cookie-settings-usage-list-item-3": "beth ydych chi'n clicio arno wrth ymweld â'r safle", "cookie-settings-usage-list-item-4": "Nid ydym yn caniatâu i Google ddefnyddio na rhannu'r data ynghylch sut yr ydych yn defnyddio'r safle.", "cookie-settings-usage-radio-1-label": "Peidiwch â defnyddio cwcis sy'n mesur fy nefnydd o'r wefan", "cookie-settings-usage-radio-2-label": "Defnyddiwch gwcis sy’n mesur fy nefnydd o’r wefan", "cookie-settings-communications-heading": "Cwcis sy'n helpu gyda chyfathrebu a marchnata", - "cookie-settings-communications-paragraph-1": "Gall y cwcis hyn gael eu gosod gan wefannau trydydd parti a gwneud pethau fel mesur sut rydych yn gwylio fideos YouTube ar LLYW.CYMRU.", + "cookie-settings-communications-paragraph-1": "Gall y cwcis hyn gael eu gosod gan wefannau trydydd parti a gwneud pethau fel mesur sut rydych yn gwylio fideos YouTube ar y gwasanaeth gwaith achos cynllunio.", "cookie-settings-communications-radio-1-label": "Peidiwch â defnyddio cwcis sy'n helpu gyda chyfathrebu a marchnata", "cookie-settings-communications-radio-2-label": "Defnyddiwch gwcis sy’n helpu gyda chyfathrebu a marchnata", "cookie-settings-settings-heading": "Cwcis sy'n cofio'ch gosodiadau", @@ -28,7 +28,34 @@ "cookie-settings-essential-list-item-1": "cofio'r hysbysiadau yr ydych wedi eu gweld fel ein bod ni ddim yn eu dangos i chi eto", "cookie-settings-essential-list-item-2": "cofio eich lle mewn ffurflen (er enghraifft cais am drwydded)", "cookie-settings-essential-paragraph-2": "Bydd angen i'r cwcis yma fod ymlaen drwy'r amser.", - "cookie-settings-essential-link": "https://llyw.cymru/manylion-am-gwcis-ar-llywcymru", - "cookie-settings-essential-link-label": "Mwy o wybodaeth am cwcis ar LLYW.CYMRU.", - "cookie-settings-save-button-label": "Cadw newidiadau" + "cookie-settings-essential-link": "/manylion-am-gwcis", + "cookie-settings-essential-link-label": "Mwy o wybodaeth am cwcis ar y gwasanaeth gwaith achos cynllunio.", + "cookie-settings-save-button-label": "Cadw newidiadau", + "cookie-policy-title-heading": "Manylion am gwcis ar y gwasanaeth gwaith achos Cynllunio", + "cookie-policy-intro-paragraph": "Yn rhestru'r cwcis ar y gwasanaeth gwaith achos cynllunio ac yn egluro eu pwrpas.", + "cookie-policy-sub-heading-one": "Defnydd o gwcis gan y gwasanaeth gwaith achos Cynllunio", + "cookie-policy-paragraph-one": "Ffeiliau testun bach yw cwcis a anfonir at eich cyfrifiadur neu ddyfais symudol gan y gwefannau rydych chi'n ymweld â nhw. Maent yn helpu i wneud i wefannau weithio'n well a darparu gwybodaeth i berchnogion y wefan. Er enghraifft cwcis Google Analytics i olrhain ymddygiad defnyddwyr tra ar y wefan. Trwy ddeall sut mae pobl yn defnyddio ein gwefan, gallwn wella'r llywio a'r cynnwys i ddiwallu anghenion pobl yn well. Mae'r wybodaeth a gasglwyd gan & nbsp; Cynllunio Gwaith Achos & nbsp; yn cynnwys cyfeiriad IP, tudalennau yr ymwelwyd â hwy, porwr a system weithredu. Ni fydd y data'n cael ei ddefnyddio i adnabod unrhyw ddefnyddiwr yn bersonol. Y cwcis rydyn ni'n eu defnyddio ar ein gwefan yw:", + "cookie-policy-list-heading-one": "Cwcis", + "cookie-policy-list-heading-two": "Enw", + "cookie-policy-list-heading-three": "Pwrpas", + "cookie-policy-list-heading-four": "Yn dod i ben", + "cookie-policy-list-row-one-item-one": "GoogleAnalytics", + "cookie-policy-list-row-one-item-two": "_ga,_gid", + "cookie-policy-list-row-one-item-three": "Defnyddir y cwci hwn i ddarganfod sut mae ymwelwyr yn defnyddio ein gwefan. Rydym yn defnyddio'r wybodaeth i'n helpu i wella'r wefan. Mae'r cwci yn casglu gwybodaeth ar ffurf anhysbys, gan gynnwys gwybodaeth ddemograffig, nifer yr ymwelwyr â'r wefan, p'un a ydynt wedi ymweld o'r blaen a'r tudalennau y maent yn ymweld â hwy.", + "cookie-policy-list-row-one-item-four": "2 flynedd", + "cookie-policy-list-row-two-item-one": "CookieControl", + "cookie-policy-list-row-two-item-two": "planning_casework, CookiePolicy", + "cookie-policy-list-row-two-item-three": "Mae'r cwci hwn yn cofnodi a yw defnyddiwr wedi derbyn y defnydd o gwcis ar ein gwefan,", + "cookie-policy-list-row-two-item-four": "10 awr", + "cookie-policy-browser-find-out-more": "Mae porwyr gwe yn caniatáu rhywfaint o reolaeth ar gwcis trwy osodiadau porwr. I ddarganfod mwy am gwcis a sut i'w rheoli, ewch i ", + "cookie-policy-browser-find-out-more-link": "http://www.allaboutcookies.org/", + "cookie-policy-sub-heading-two": "Pa wybodaeth ydyn ni'n ei chasglu?", + "cookie-policy-paragraph-two": "Rydym yn defnyddio cwcis Google Analytics i helpu i fonitro gweithgaredd defnyddwyr, ac i nodi lle y gellir gwneud gwelliannau i'r wefan. Nid ydym yn casglu unrhyw wybodaeth bersonol (e.e. eich enw neu gyfeiriad) a fyddai’n gallu eich adnabod chi.", + "cookie-policy-paragraph-three": "Mae cwcis Google Analytics yn wasanaeth gwe a ddarperir gan Google Inc. (‘Google’) ac maent yn helpu i gasglu a dadansoddi gweithgaredd defnyddwyr. Bydd y wybodaeth a gesglir am eich defnydd o'r wefan (gan gynnwys eich cyfeiriad IP dienw) yn cael ei throsglwyddo i weinyddion Google yn yr Unol Daleithiau, a'i storio arni. Gweler polisi preifatrwydd Google, a Thelerau Gwasanaeth Google i gael gwybodaeth fanwl.", + "cookie-policy-paragraph-three-link-a": "Polisi preifatrwydd Google", + "cookie-policy-paragraph-three-a": "y", + "cookie-policy-paragraph-three-link-b": "Telerau Gwasanaeth Google", + "cookie-policy-paragraph-three-b": "am wybodaeth fanwl.", + "cookie-policy-paragraph-four": "Bydd Google yn defnyddio'r wybodaeth hon i gynhyrchu adroddiadau gweithgaredd defnyddwyr ar gyfer y wefan hon. Gall Google hefyd drosglwyddo'r wybodaeth hon i drydydd partïon lle mae'n ofynnol iddynt wneud hynny yn ôl y gyfraith, neu lle mae trydydd partïon o'r fath yn prosesu'r wybodaeth ar ran Google.", + "cookie-policy-paragraph-five": "Ni fydd Google yn cysylltu eich cyfeiriad IP ag unrhyw ddata arall a gedwir yn flaenorol. Gallwch wrthod defnyddio cwcis trwy ddewis y gosodiadau priodol ar eich porwr. Sylwch, os yw cwcis yn anabl, efallai na fyddwch yn gallu defnyddio swyddogaeth lawn y wefan hon. Trwy ddefnyddio'r wefan hon, rydych yn cydsynio i Google brosesu data amdanoch yn y modd ac at y dibenion a nodir uchod." } \ No newline at end of file diff --git a/locales/cy/dnsApplications.json b/locales/cy/dnsApplications.json index 95906cd1..7d6bf108 100644 --- a/locales/cy/dnsApplications.json +++ b/locales/cy/dnsApplications.json @@ -1,8 +1,8 @@ { "page-title": "Ceisiadau Datblygiadau o Arwyddocâd Cenedlaethol", "page-intro-paragraph-1": "Y ceisiadau a restrir yw’r rhai:", - "page-intro-list-item-1": "Lle mae’r datblygwr wedi hysbysu’r Arolygiaeth Gynllunio yn ysgrifenedig ei fod yn bwriadu cyflwyno cais i ni yn y dyfodol", - "page-intro-list-item-2": "Lle cafodd cais ei wneud eisoes i’r Arolygiaeth Gynllunio ac mae’n mynd drwy’r broses archwilio", + "page-intro-list-item-1": "Lle mae’r datblygwr wedi hysbysu’r Penderfyniadau Cynllunio ac Amgylchedd Cymru yn ysgrifenedig ei fod yn bwriadu cyflwyno cais i ni yn y dyfodol", + "page-intro-list-item-2": "Lle cafodd cais ei wneud eisoes i’r Penderfyniadau Cynllunio ac Amgylchedd Cymru ac mae’n mynd drwy’r broses archwilio", "page-intro-list-item-3": "Lle penderfynwyd ar y cynnig.", "page-intro-paragraph-2": "Defnyddiwch y tabl isod i ddod o hyd i geisiadau fesul cam neu fath. Fel arall, defnyddiwch y map trwy glicio ar y marcwyr i fynd i’r dudalen geisiadau. Mae rhestr o ddigwyddiadau a therfynau amser allweddol ar gyfer pob cais ar gael ar ein ", "page-intro-paragraph-2-link": "tudalen galendr", diff --git a/locales/cy/home.json b/locales/cy/home.json index a73c668c..d553c16a 100644 --- a/locales/cy/home.json +++ b/locales/cy/home.json @@ -22,7 +22,7 @@ "login-card-forgotten-label": "Rwyf wedi anghofio fy nghyfrinair", "login-card-forgotten-link": "Cliciwch yma", "casesearch-card-title": "Chwilio apeliadau a Datblygiadau o Arwyddocâd Cenedlaethol", - "casesearch-card-search-hint": "Rhaid i chi ddefnyddio cyfeirnod yr achos i chwilio. Bydd hyn yn debyg i un o'r canlynol:", + "casesearch-card-search-hint": "Defnyddiwch gyfeimod yr achos neu deitl DAC i chwilio. Bydd cyfeirnod yr achos yn debyg i un o'r canlynol:", "casesearch-card-search-example-label-1": "APP-A12345-A-21-1234567", "casesearch-card-search-example-label-2": "CAS-12345-A1B2C3", "casesearch-card-button": "Cyflwyno chwiliad", @@ -30,7 +30,7 @@ "casesearch-search-validation-required": "Angenrheidiol", "casesearch-search-validation-minlength": "Rhaid bod yn 4 nod neu fwy", "casescomment-card-title": "Rhowch sylwadau ar apêl", - "casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl trwy e-bostio ", + "casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl (gan eithrio deiliad tai a masnachol) drwy ebostio", "casescomment-card-paragraph-two": "Ar gyfer apeliadau deiliaid tai a masnachol, ni all partïon â buddiant 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 Yr Arolygiaeth Gynllunio", "inspectorate-card-visit-link": "Hafan", diff --git a/locales/cy/newappeal.json b/locales/cy/newappeal.json index ef8951a9..88596748 100644 --- a/locales/cy/newappeal.json +++ b/locales/cy/newappeal.json @@ -4,8 +4,8 @@ "page-title": "Apêl newydd", "select-lpa-label": "Dewiswch eich awdurdod cynllunio lleol", "select-lpa-label-error-msg": "Mae angen awdurdod lleol", - "select-appeal-type-label": "Dewiswch fath o apêl", - "select-appeal-type-label-error-msg": "Mae angen math o apêl", + "select-appeal-type-label": "Dewiswch fath o achos", + "select-appeal-type-label-error-msg": "Mae angen math o achos", "select-default": "Dewiswch...", "change-link-label": "Newid", "submit-appeal-button": "Cyflwyno apêl" diff --git a/locales/cy/search.json b/locales/cy/search.json index 1f10fefb..e5fe91d1 100644 --- a/locales/cy/search.json +++ b/locales/cy/search.json @@ -9,7 +9,7 @@ "postcode-label": "Cod Post", "lpa-label": "Awdurdod Cynllunio Lleol", "lpa-reference-label": "Cyfeirnod yr Awdurdod Cynllunio Lleol", - "appealtype-label": "Dewiswch fath o apêl", + "appealtype-label": "Dewiswch fath o achos", "case-type-label": "Math o Achos", "case-type-option-1": "--Dewiswch--", "case-type-option-2": "Unrhyw fath/Pob math", diff --git a/locales/en/common.json b/locales/en/common.json index c452d1e5..a992be27 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -4,7 +4,7 @@ "gov-wales-link": "https://www.gov.wales", "gov-wales-label": "GOV.WALES", "service-description": "This service is being developed to support online appeals and applications.", - "service-name": "Planning casework", + "service-name": "Casework", "service-name-breadcrumb": "Home", "new-service-beta": "This is a new service", "breadcrumb-back-link": "Back", @@ -16,15 +16,15 @@ "search-button": "Search", "submit-and-start": "Submit and start course", "footer-terms-conditions-link-label": "Terms and conditions", - "footer-terms-conditions-link": "https://gov.wales/terms-and-conditions", + "footer-terms-conditions-link": "/terms-and-conditions", "footer-privacy-link-label": "Privacy", - "footer-privacy-link": "https://gov.wales/website-privacy-policy", + "footer-privacy-link": "/privacy", "footer-cookies-link": "Cookies", "footer-accessibility-link-label": "Accessibility", - "footer-accessibility-link": "https://gov.wales/accessibility-statement-govwales", + "footer-accessibility-link": "/accessibility", "footer-feedback-link": "Give feedback about this page", "footer-contact-us-link-label": "Contact us", - "footer-contact-us-link": "https://gov.wales/contact-us", + "footer-contact-us-link": "https://gov.wales/planning-and-environment-decisions-wales/contact-us", "footer-copyright-link-label": "Copyright statement", "footer-copyright-link": "https://gov.wales/copyright-statement", "footer-alternative-languages-link-label": "Alternative languages", diff --git a/locales/en/cookies.json b/locales/en/cookies.json index aa9b3771..13b349c0 100644 --- a/locales/en/cookies.json +++ b/locales/en/cookies.json @@ -1,22 +1,22 @@ { "cookie-breadcrumb": "Cookies", - "cookie-title-heading": "Cookies on GOV.WALES", + "cookie-title-heading": "Cookies on planning casework", "cookie-not-saved-heading": "Your cookie settings have not yet been saved", - "cookie-not-saved-paragraph": "GOV.WALES sets cookies when you visit our website. You can choose to change these settings to your own preferences. You need to save this page with your new choices.", + "cookie-not-saved-paragraph": "The planning casework service sets cookies when you visit our website. You can choose to change these settings to your own preferences. You need to save this page with your new choices.", "cookie-intro-paragraph-1": "Cookies are files saved on your phone, tablet or computer when you visit a website.", - "cookie-intro-paragraph-2": "We use cookies to store information about how you use the GOV.WALES website, such as the pages you visit. These cookies are not used to identify you personally.", + "cookie-intro-paragraph-2": "We use cookies to store information about how you use the the planning casework service website, such as the pages you visit. These cookies are not used to identify you personally.", "cookie-intro-paragraph-3": "We use 4 types of cookie. You can choose which cookies you're happy for us to use.", "cookie-settings-heading": "Cookie settings", "cookie-settings-usage-heading": "Cookies that measure website use", "cookie-settings-usage-paragraph-1": "We use Google Analytics to measure how you use the website so we can improve it based on user needs. Google Analytics sets cookies that store anonymised information about", "cookie-settings-usage-list-item-1": "how you got to the site", - "cookie-settings-usage-list-item-2": "the pages you visit on GOV.WALES and government digital services, and how long you spend on each page", + "cookie-settings-usage-list-item-2": "the pages you visit on the planning casework service and government digital services, and how long you spend on each page", "cookie-settings-usage-list-item-3": "what you click on while you're visiting the site", "cookie-settings-usage-list-item-4": "We do not allow Google to use or share the data about how you use this site.", "cookie-settings-usage-radio-1-label": "Do not use cookies that measure my website use", "cookie-settings-usage-radio-2-label": "Use cookies that measure my website use", "cookie-settings-communications-heading": "Cookies that help with communications and marketing", - "cookie-settings-communications-paragraph-1": "These cookies may be set by thirdparty websites and do things like measure how you view YouTube videos that are on GOV.WALES.", + "cookie-settings-communications-paragraph-1": "These cookies may be set by thirdparty websites and do things like measure how you view YouTube videos that are on the planning casework service.", "cookie-settings-communications-radio-1-label": "Do not use cookies that help with communications and marketing", "cookie-settings-communications-radio-2-label": "Use cookies that help with communications and marketing", "cookie-settings-settings-heading": "Cookies that remember your settings", @@ -28,7 +28,34 @@ "cookie-settings-essential-list-item-1": "remember the notifications you've seen so we do not show them to you again", "cookie-settings-essential-list-item-2": "remember your progress through a form (for example a licence application)", "cookie-settings-essential-paragraph-2": " These cookies always need to be on.", - "cookie-settings-essential-link": "https:gov.wales/details-about-cookies-govwales", - "cookie-settings-essential-link-label": "Find out more about cookies on GOV.WALES.", - "cookie-settings-save-button-label": "Save changes" + "cookie-settings-essential-link": "/details-about-cookies", + "cookie-settings-essential-link-label": "Find out more about cookies on the planning casework service.", + "cookie-settings-save-button-label": "Save changes", + "cookie-policy-title-heading": "Details about cookies on the Planning casework service", + "cookie-policy-intro-paragraph": "Lists the cookies on the planning casework service aand explains their purpose.", + "cookie-policy-sub-heading-one": "Use of cookies by the Planning casework service", + "cookie-policy-paragraph-one": "Cookies are small text files sent to your computer or mobile device by the websites that you visit. They help make websites work better and provide information to the owners of the site. For instance Google Analytics cookies to track users’ behaviour whilst on the site. By understanding how people use our site, we can improve the navigation and content to better meet people’s needs. The information collected by Planning Casework includes IP address, pages visited, browser and operating system. The data will not be used to identify any user personally. The cookies we use on our site are:", + "cookie-policy-list-heading-one": "Cookie", + "cookie-policy-list-heading-two": "Name", + "cookie-policy-list-heading-three": "Purpose", + "cookie-policy-list-heading-four": "Expires", + "cookie-policy-list-row-one-item-one": "GoogleAnalytics", + "cookie-policy-list-row-one-item-two": "_ga,_gid", + "cookie-policy-list-row-one-item-three": "This cookie is used to find out how visitors use our site. We use the information to help us improve the site. The cookie collects information in an anonymous form, including demographic information, the number of visitors to the site, whether they have visited before and the pages they visit.", + "cookie-policy-list-row-one-item-four": "2 years", + "cookie-policy-list-row-two-item-one": "CookieControl", + "cookie-policy-list-row-two-item-two": "planning_casework, CookiePolicy", + "cookie-policy-list-row-two-item-three": "This cookie records whether a user has accepted the use of cookies on our site.", + "cookie-policy-list-row-two-item-four": "10 hours", + "cookie-policy-browser-find-out-more": "Web browsers allow some control of cookies through browser settings. To find out more about cookies and how to manage them, visit ", + "cookie-policy-browser-find-out-more-link": "http://www.allaboutcookies.org/", + "cookie-policy-sub-heading-two": "What information do we collect?", + "cookie-policy-paragraph-two": "We use Google Analytics cookies to help monitor user activity, and to identify where improvements can be made to the site. We do not collect any personal information (e.g. your name or address) that would be able to identify you.", + "cookie-policy-paragraph-three": "Google Analytics cookies are a web service provided by Google Inc. (‘Google’) and help to gather and analyse user activity. The information gathered about your use of the web site (including your anonymised IP address) will be transmitted to, and stored on Google servers in the United States. Please see the Google privacy policy, and Google's Terms of Service for detailed information.", + "cookie-policy-paragraph-three-link-a": "Google privacy policy", + "cookie-policy-paragraph-three-a": "and", + "cookie-policy-paragraph-three-link-b": "Google's Terms of Service", + "cookie-policy-paragraph-three-b": "for detailed information.", + "cookie-policy-paragraph-four": "Google will use this information to produce user activity reports for this website. Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google's behalf.", + "cookie-policy-paragraph-five": "Google will not associate your IP address with any other data previously held. You may refuse the use of cookies by selecting the appropriate settings on your browser. Please note that if cookies are disabled, you may not be able to use the full functionality of this website. By using this website, you consent to the processing of data about you by Google in the manner and for the purposes set out above." } \ No newline at end of file diff --git a/locales/en/dnsApplications.json b/locales/en/dnsApplications.json index 94e7182b..4191565d 100644 --- a/locales/en/dnsApplications.json +++ b/locales/en/dnsApplications.json @@ -1,8 +1,8 @@ { "page-title": "Developments of National Significance Applications", "page-intro-paragraph-1": "The applications listed are those:", - "page-intro-list-item-1": "Where the developer has advised the Planning Inspectorate in writing that they intend to submit an application to us in the future", - "page-intro-list-item-2": "Where an application has already been made to the Planning Inspectorate and is undergoing the examination process", + "page-intro-list-item-1": "Where the developer has advised Planning and Environment Decisions Wales in writing that they intend to submit an application to us in the future", + "page-intro-list-item-2": "Where an application has already been made to Planning and Environment Decisions Wales and is undergoing the examination process", "page-intro-list-item-3": "Where a proposal has been decided.", "page-intro-paragraph-2": "Use the table below to find applications by stage or type. Alternatively, use the map by clicking on the markers to go to the applications page. A list of key events and deadlines for all applications is available on our ", "page-intro-paragraph-2-link": "calendar page", diff --git a/locales/en/home.json b/locales/en/home.json index cf3f17c6..16a07582 100644 --- a/locales/en/home.json +++ b/locales/en/home.json @@ -1,7 +1,7 @@ { "login-card-title-temp": "New appeals or applications", "login-comingsoon-temp-1": "This service is being developed to support online appeals and applications.", - "login-comingsoon-temp-2": "While we develop the online service find:", + "login-comingsoon-temp-2": "While we develop the online service, find:", "login-comingsoon-forms-link-1": "https://gov.wales/planning-appeal-forms", "login-comingsoon-forms-label-1": "planning appeal and application forms", "login-comingsoon-forms-link-2": "https://gov.wales/environmental-permits", @@ -22,7 +22,7 @@ "login-card-forgotten-label": "I have forgotten my password", "login-card-forgotten-link": "Click here", "casesearch-card-title": "Search appeals and Developments of National Significance", - "casesearch-card-search-hint": "You must use the case reference number to search. This will be similar to one of the following:", + "casesearch-card-search-hint": "Use the case reference or DNS title to search. Case reference will be similar to one of the following:", "casesearch-card-search-example-label-1": "APP-A12345-A-21-1234567", "casesearch-card-search-example-label-2": "CAS-12345-A1B2C3", "casesearch-card-button": "Submit search", @@ -30,7 +30,7 @@ "casesearch-search-validation-required": "Required", "casesearch-search-validation-minlength": "Must be 4 characters or more", "casescomment-card-title": "Comment on an appeal ", - "casescomment-card-paragraph-one": "Comment on an appeal by emailing ", + "casescomment-card-paragraph-one": "Comment on an appeal (excluding householder or commercial) by emailing ", "casescomment-card-paragraph-two": "For householder and commercial appeals, interested parties are unable to comment at appeal stage. Any comments made at application stage will be provided by the local planning authority and considered by the inspector.", "inspectorate-card-visit-label": "Visit the Planning Inspectorate", "inspectorate-card-visit-link": "Home", diff --git a/locales/en/newappeal.json b/locales/en/newappeal.json index 8651fab5..eaa6bc05 100644 --- a/locales/en/newappeal.json +++ b/locales/en/newappeal.json @@ -4,7 +4,7 @@ "page-title": "New appeal", "select-lpa-label": "Select your local planning authority", "select-lpa-label-error-msg": "Local authority is required", - "select-appeal-type-label": "Select an appeal type", + "select-appeal-type-label": "Select a case type", "select-appeal-type-label-error-msg": "Appeal type is required", "select-default": "Select...", "change-link-label": "Change", diff --git a/locales/en/search.json b/locales/en/search.json index 9187ae51..f4adff21 100644 --- a/locales/en/search.json +++ b/locales/en/search.json @@ -9,7 +9,7 @@ "postcode-label": "Postcode", "lpa-label": "Local Planning Authority", "lpa-reference-label": "LPA reference number", - "appealtype-label": "Select an appeal type", + "appealtype-label": "Select a case type", "case-type-label": "Case type", "case-type-option-1": "-- Select --", "case-type-option-2": "Any/All", diff --git a/next.config.js b/next.config.js index 0c1c7ee3..6137546c 100644 --- a/next.config.js +++ b/next.config.js @@ -17,7 +17,36 @@ module.exports = withStyles({ }, }, }); + +const securityHeaders = [ + { + key: "X-DNS-Prefetch-Control", + value: "on", + }, + { + key: "X-Frame-Options", + value: "SAMEORIGIN", + }, + { + key: "Strict-Transport-Security", + value: "max-age=63072000; includeSubDomains; preload", + }, + { + key: "Content-Security-Policy", + value: "frame-src 'self'; child-src 'self'", + }, +]; + module.exports = { + async headers() { + return [ + { + // Apply these headers to all routes in your application. + source: "/(.*)", + headers: securityHeaders, + }, + ]; + }, generateBuildId: async () => { // You can, for example, get the latest git commit hash here return "pinswg-build-id"; @@ -89,6 +118,22 @@ module.exports = { source: "/help/cwcis", destination: "/help/cookies", }, + { + source: "/hygyrchedd", + destination: "/accessibility", + }, + { + source: "/preifatrwydd", + destination: "/privacy", + }, + { + source: "/manylion-am-gwcis", + destination: "/details-about-cookies", + }, + { + source: "/telerau-ac-amodau", + destination: "/terms-and-conditions", + }, // { // source: "/cy:path*", diff --git a/package.json b/package.json index fec12116..092bca04 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "axios": "^0.21.1", "compression": "^1.7.4", "cookie-cutter": "^0.2.0", + "cookies": "^0.8.0", "crypto-js": "^4.1.1", "date-fns": "^2.25.0", "dom": "^0.0.3", @@ -29,6 +30,7 @@ "next": "^11.0.1", "next-redux-wrapper": "^7.0.2", "next-translate": "^1.0.7", + "nextjs-basic-auth-middleware": "^0.2.1", "nookies": "^2.5.2", "path": "^0.12.7", "pm2": "^5.1.0", diff --git a/pages/_document.js b/pages/_document.js index 1415e727..85f82767 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -1,35 +1,56 @@ import Document, { Html, Head, Main, NextScript } from "next/document"; import SkipLink from "../components/skiplink"; import { Tracking, TrackingNoScript } from "../components/tracking"; -//import basicAuthMiddleware from "nextjs-basic-auth-middleware"; +import basicAuthMiddleware from "nextjs-basic-auth-middleware"; class MyDocument extends Document { - // static async getInitialProps(ctx) { - // const initialProps = await Document.getInitialProps(ctx); - // if (ctx.req && ctx.res) { - // await basicAuthMiddleware(ctx.req, ctx.res, { - // users: [ - // { - // name: "rehab", - // password: "preventTesting", - // }, - // ], - // }); - // } - // return { ...initialProps }; - // } + static async getInitialProps(ctx) { + const initialProps = await Document.getInitialProps(ctx); + + let useGATracking = false; + + // remove this block when not need after softlaunch + let hasBasicAuth = + typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined"; + + console.log(hasBasicAuth); + + if (ctx.req && ctx.res) { + hasBasicAuth && + (await basicAuthMiddleware(ctx.req, ctx.res, { + users: process.env.BASIC_AUTH_CREDENTIALS, + })); + } + + if (ctx.req && ctx.req.headers.cookie) { + typeof ctx.req.cookies.CookiePolicy != "undefined" + ? JSON.parse(ctx.req.cookies.CookiePolicy).usage == "accepted" + ? (useGATracking = true) + : (useGATracking = false) + : (useGATracking = true); + } else { + useGATracking = false; + } + + return { ...initialProps, useGATracking }; + } render() { const googleTagManagerID = process.env.GOOGLE_TAG_MANAGER || null; - + const { useGATracking } = this.props; return ( - + {useGATracking && ( + + )} - - + {useGATracking && ( + + )} {!process.browser && (