From bca85d36bc6f58fb9d2f75478bd2671e0d02fb1d Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 29 Sep 2021 14:16:58 +0100 Subject: [PATCH 1/2] defect fixes --- .env.local | 20 ++++++------ actions/index.js | 15 ++++----- data/lookuptranslations.json | 50 ++++++++++++++--------------- locales/cy/case.json | 2 +- locales/cy/home.json | 12 +++---- locales/en/home.json | 10 +++--- pages/advancedsearchresults.js | 57 ---------------------------------- pages/api/proxy/[...route].js | 21 ++++--------- 8 files changed, 61 insertions(+), 126 deletions(-) diff --git a/.env.local b/.env.local index 74e6fb27..4600c635 100644 --- a/.env.local +++ b/.env.local @@ -1,8 +1,8 @@ -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" PORT= "3000" @@ -14,8 +14,8 @@ I18N_DOMAIN = "cymru.local" //I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" -//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ -//RELAYURI = "test-pedw-ns.servicebus.windows.net" -//RELAYPATH = "test-pedw-hc" -//SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" -//SASKEYNAME = "testpedwhcpolicy" +RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ +RELAYURI = "test-pedw-ns.servicebus.windows.net" +RELAYPATH = "test-pedw-hc" +SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" +SASKEYNAME = "testpedwhcpolicy" diff --git a/actions/index.js b/actions/index.js index 86a6e9e9..58ae4cb7 100644 --- a/actions/index.js +++ b/actions/index.js @@ -166,7 +166,7 @@ export const getBasicDNSSearch = (token, searchString) => { return axios .get( WEBAPI_URL + - "incidents?$select=_accountid_value,_customerid_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", + "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", azureHeaders(token) ) .then((res) => res.data) @@ -209,7 +209,7 @@ export const getAdvancedSearch = (token, searchString) => { return axios .get( WEBAPI_URL + - "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=" + + "incidents?$select=_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&$top=201", @@ -238,6 +238,7 @@ export const getBasicSearchDetails = (token, appealType, caseReference) => { }; export const getSearchDocumentDetails = (token, incidentID) => { + console.log(incidentID); return axios .get( WEBAPI_URL + @@ -267,13 +268,13 @@ export const getSearchDocumentHistory = (token, documentID) => { }; export const getSearchDocumentDetails1 = (incidentID) => { + //console.log(incidentID); var token = getSASToken(); return axios .get( - "/api/proxy/pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " + + "/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _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", - azureHeaders(token) + "&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" ) .then((res) => res.data) .catch((error) => { @@ -282,12 +283,12 @@ export const getSearchDocumentDetails1 = (incidentID) => { }; export const getSearchDocumentHistory1 = (documentID) => { + console.log(documentID); var token = getSASToken(); 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, - azureHeaders(token) + documentID ) .then((res) => { return res.data; diff --git a/data/lookuptranslations.json b/data/lookuptranslations.json index c5a76e08..06ad0297 100644 --- a/data/lookuptranslations.json +++ b/data/lookuptranslations.json @@ -2,19 +2,19 @@ "appealTypes": [ { "value": "Planning Appeal - S78", - "value_cy": "Apêl Cynllunio - S78", + "value_cy": "Apêl Gynllunio - A78", "stringmapid": "cb4aa9f2-e275-eb11-aabd-00224800be9c", "attributevalue": 846040000 }, { "value": "Planning Conditions - S73 + S79", - "value_cy": "Amodau Cynllunio - S73 + S79", + "value_cy": "Amodau Cynllunio - A73 + A79", "stringmapid": "cc4aa9f2-e275-eb11-aabd-00224800be9c", "attributevalue": 846040001 }, { "value": "Planning Obligation Appeal - S106", - "value_cy": "Apêl Rhwymedigaeth Cynllunio - S106", + "value_cy": "Apêl Rhwymedigaeth Gynllunio - A106", "stringmapid": "ce4aa9f2-e275-eb11-aabd-00224800be9c", "attributevalue": 846040003 }, @@ -26,43 +26,43 @@ }, { "value": "Enforcement Notice Appeal - S174", - "value_cy": "Apêl Rhybudd Gorfodi - S174", + "value_cy": "Apêl Hysbysiad Gorfodi - A174", "stringmapid": "b656f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040005 }, { "value": "Enforcement Listed Building and Conservation Appeal - S39", - "value_cy": "Apêl Adeiladu a Chadwraeth Rhestredig Gorfodi - S39", + "value_cy": "Apêl Gorfodi Adeilad Rhestredig ac Ardal Gadwraeth - A39", "stringmapid": "b756f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040006 }, { "value": "Maintenance of Land - S217", - "value_cy": "Cynnal a Chadw Tir - S217", + "value_cy": "Cynnal a Chadw Tir - A217", "stringmapid": "b856f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040007 }, { "value": "Lawful Development Certificate Appeal - S194 + 195", - "value_cy": "Apêl Tystysgrif Datblygu Cyfreithlon - S194 + 195", + "value_cy": "Apêl Tystysgrif Datblygiad Cyfreithlon - A194 + 195", "stringmapid": "b956f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040008 }, { "value": "Community Infrastructure Levy - S117, 118, & 119", - "value_cy": "Ardoll Seilwaith Cymunedol - S117, 118, & 119", + "value_cy": "Ardoll Seilwaith Cymunedol - A117 , 118 & 119", "stringmapid": "ba56f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040009 }, { "value": "Call-Ins - S77", - "value_cy": "Galw-i-Mewn - S77", + "value_cy": "Galwadau i Mewn - A77", "stringmapid": "bb56f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040010 }, { "value": "DNS", - "value_cy": "DNS", + "value_cy": "Datblygiadau o Arwyddocâd Cenedlaethol", "stringmapid": "bc56f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040011 }, @@ -74,31 +74,31 @@ }, { "value": "Transport and Works Act", - "value_cy": "Deddf Trafnidiaeth a Gwaith", + "value_cy": "Deddf Trafnidiaeth a Gweithfeydd", "stringmapid": "be56f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040013 }, { "value": "Harbour Revision Order", - "value_cy": "Gorchymyn Adolygu'r Harbwr", + "value_cy": "Gorchymyn Diwygio Harbwr", "stringmapid": "bf56f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040014 }, { "value": "ROW", - "value_cy": "ROW", + "value_cy": "Hawliau Tramwy", "stringmapid": "c056f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040015 }, { "value": "Common Land", - "value_cy": "Tir Cyffredin", + "value_cy": "Tir Comin", "stringmapid": "c156f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040016 }, { "value": "High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice.", - "value_cy": "Gwrychoedd Uchel, Gorchmynion Cadw Coed, Gwrychoedd, Rhybudd Amnewid Coed.", + "value_cy": "Gwrychoedd neu Berthi Uchel, Gorchmynion Cadw Coed, Perthi/Gwrychoedd, Hysbysiadau Ailblannu Coed", "stringmapid": "c256f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040017 }, @@ -116,13 +116,13 @@ }, { "value": "Environmental Permitting", - "value_cy": "Caniatáu Amgylcheddol", + "value_cy": "Trwyddedu Amgylcheddol", "stringmapid": "c556f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040020 }, { "value": "Wayleave", - "value_cy": "Wayleave", + "value_cy": "Fforddfreintiau", "stringmapid": "c656f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040021 }, @@ -134,19 +134,19 @@ }, { "value": "LDP", - "value_cy": "LDP", + "value_cy": "Cynlluniau Datblygu Lleol", "stringmapid": "c856f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040023 }, { "value": "Non-Validation", - "value_cy": "Peidio â dilysu", + "value_cy": "Barnu’n Annilys", "stringmapid": "c956f05c-7f90-eb11-aac2-00224800be9c", "attributevalue": 846040024 }, { "value": "Listed Building and Conservation Area Consent S73 + S79", - "value_cy": "Cydsyniad Ardal Adeiladu a Chadwraeth Rhestredig S73 + S79", + "value_cy": "Caniatâd Adeilad Rhestredig ac Ardal Gadwraeth - A20", "stringmapid": "977522df-8aef-eb11-aac7-00224800be9c", "attributevalue": 846040025 } @@ -154,17 +154,17 @@ "statusCodes": [ { "value": "Active", - "value_cy": "Egnïol", + "value_cy": "Gweithredol", "statuscode": 1 }, { "value": "In Progress", - "value_cy": "Ar y gweill", + "value_cy": "Ar Waith", "statuscode": 2 }, { "value": "On Hold", - "value_cy": "Ar Ddal", + "value_cy": "Wedi’i Ohirio", "statuscode": 3 }, { @@ -179,14 +179,14 @@ }, { "value": "Problem Solved", - "value_cy": "Datrys Problemau", + "value_cy": "Problem wedi’i Datrys", "statuscode": 6 } ], "pinswg_decision": [ { "value": "Dismissed", - "value_cy": "Diswyddo", + "value_cy": "Gwrthodwyd", "pinswg_decision": 846040001 }, { diff --git a/locales/cy/case.json b/locales/cy/case.json index 2f6e0bfd..503fcbb6 100644 --- a/locales/cy/case.json +++ b/locales/cy/case.json @@ -15,7 +15,7 @@ "summary-status-label": "Statws", "summary-decision-label": "Penderfyniad a chanlyniad", "summary-case-link-status-label": "Statws cysylltiad yr Achos", - "summary-case-link-status-not-linked": "Heb gysylltiad", + "summary-case-link-status-not-linked": "Heb ei Gysylltu", "summary-linked-cases-label": "Achosion cysylltiedig", "summary-dates-label": "Dyddiadau", "summary-no-date-entered-label": "dim dyddiad wedi'i nodi", diff --git a/locales/cy/home.json b/locales/cy/home.json index 1e9d4bbc..516fcf8c 100644 --- a/locales/cy/home.json +++ b/locales/cy/home.json @@ -1,7 +1,7 @@ { "login-card-title-temp": "Croeso", - "login-comingsoon-temp-1": "Mae'r wefan hon yn dal i gael ei datblygu, os ydych am gyflwyno apêl neu gais newydd, cyflwynwch hi, ynghyd ag unrhyw ddogfennaeth berthnasol, i ", - "login-comingsoon-temp-2": "Gellir gofyn am ffurflenni apelio a chais trwy e-bost neu eu lawrlwytho gan ddilyn y ddolen isod.", + "login-comingsoon-temp-1": "Mae’r wefan hon yn cael ei datblygu o hyd. Os hoffech gyflwyno apêl neu gais newydd, neu wneud sylwadau ar un sydd eisoes yn bodoli, cyflwynwch yr apêl, y cais neu’r sylwadau, ynghyd ag unrhyw ddogfennau cysylltiedig perthnasol, i ", + "login-comingsoon-temp-2": "Gellir gofyn am ffurflenni apelio a ffurflenni cais trwy e-bost neu gellir eu lawrlwytho trwy ddilyn y ddolen isod. ", "login-card-title": "Mewngofnodi i apelio yn erbyn penderfyniad cynllunio", "login-card-id-label": "Dynodydd Defnyddiwr (ID) Porth y Llywodraeth", "login-card-id-hint": "Gallai hyn fod hyd at 12 o gymeriadau.", @@ -11,16 +11,16 @@ "login-card-register-link": "Gofrestru", "login-card-forgotten-label": "Rwyf wedi anghofio fy nghyfrinair", "login-card-forgotten-link": "Cliciwch yma", - "casesearch-card-title": "Chwilio am achos", + "casesearch-card-title": "Chwilio am ddogfennau apêl", "casesearch-card-search-hint": "Chwiliwch drwy roi cyfeirnod 7 digid yr achos", "casesearch-card-search-example-label": "Enghraifft:", "casesearch-card-button": "Cyflwyno chwiliad", "casesearch-card-advanced-link": "Fel arall, gallwch chwilio gan ddefnyddio ein meini prawf eraill gyda'n chwiliad uwch", "casesearch-search-validation-required": "Angenrheidiol", "casesearch-search-validation-minlength": "Rhaid bod yn 4 nod neu fwy", - "casescomment-card-title": "Gwneud sylw ar achos", - "casescomment-card-paragraph-one": "Yn syml, chwiliwch am eich achos i weld y ddogfennaeth sy'n gysylltiedig â'r achos. Yna cyflwynwch eich cynrychiolaeth i ", - "casescomment-card-paragraph-two": "Ar gyfer apeliadau Deiliaid Tai a Masnachol, ni all partïon â diddordeb gyflwyno 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.", + "casescomment-card-title": "Cyflwyno neu Wneud Sylwadau ar Apêl/Cais", + "casescomment-card-paragraph-one": "Os hoffech gyflwyno apêl neu gais newydd, neu wneud sylwadau ar un sydd eisoes yn bodoli, cyflwynwch yr apêl, y cais neu’r sylwadau, ynghyd ag unrhyw ddogfennau cysylltiedig perthnasol, i ", + "casescomment-card-paragraph-two": "O ran apeliadau Deiliaid Tai a Masnachol, ni all partïon â buddiant wneud sylwadau yn ystod y cam apêl. Bydd unrhyw sylwadau a wnaed yn ystod y cam ymgeisio’n 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", "dns-card-title": "Datblygiadau o Arwyddocâd Cenedlaethol", diff --git a/locales/en/home.json b/locales/en/home.json index 977abe48..394217e9 100644 --- a/locales/en/home.json +++ b/locales/en/home.json @@ -1,7 +1,7 @@ { "login-card-title-temp": "Welcome", - "login-comingsoon-temp-1": "This website is still in development, if you wish to submit a new appeal or application please submit it, along with any relevant documentation, to ", - "login-comingsoon-temp-2": "Appeal and application forms can be requested by email or downloaded following the below link.", + "login-comingsoon-temp-1": "This website is still in development, if you wish to submit a new appeal or application please submit it, along with any relevant associated documentation, to ", + "login-comingsoon-temp-2": "Appeal and application forms can be requested by e-mail or downloaded following the below link.", "login-card-title": "Sign in to appeal a planning decision", "login-card-id-label": "Government Gateway user ID", "login-card-id-hint": "This could be up to 12 characters.", @@ -11,15 +11,15 @@ "login-card-register-link": "Register", "login-card-forgotten-label": "I have forgotten my password", "login-card-forgotten-link": "Click here", - "casesearch-card-title": "Search for a case", + "casesearch-card-title": "Appeal documentation search", "casesearch-card-search-hint": "Search by entering the 7 digit case reference number", "casesearch-card-search-example-label": "Example:", "casesearch-card-button": "Submit search", "casesearch-card-advanced-link": "Advanced search", "casesearch-search-validation-required": "Required", "casesearch-search-validation-minlength": "Must be 4 characters or more", - "casescomment-card-title": "Comment on a case", - "casescomment-card-paragraph-one": "Simply search for your case to view the documentation associated to the case. Then submit your representation to ", + "casescomment-card-title": "Lodge or Comment on an Appeal/Application", + "casescomment-card-paragraph-one": "If you wish to submit a new appeal or application, or comment on an existing one, please submit it, along with any relevant associated documentation, to ", "casescomment-card-paragraph-two": "For Householder and Commercial appeals, interested parties are unable to make representations at appeal stage. Any representations 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/pages/advancedsearchresults.js b/pages/advancedsearchresults.js index fd16a2d1..2a456ea3 100644 --- a/pages/advancedsearchresults.js +++ b/pages/advancedsearchresults.js @@ -78,21 +78,9 @@ export const getServerSideProps = wrapper.getServerSideProps( token, searchResultsObj ); - const searchDocumentResultsObj = await getDocumentDetails( - token, - searchResultsObj - ); - - const searchDocumentHistoryObj = await getDocumentHistory( - token, - searchDocumentResultsObj - ); - //console.log(searchDocumentHistoryObj); store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchDetails(searchDetailsObj)); - store.dispatch(setDocumentDetails(searchDocumentResultsObj)); - store.dispatch(setDocumentHistory(searchDocumentHistoryObj)); } ); @@ -136,51 +124,6 @@ const getSearchDetails = (token, searchResultsObj) => { return Promise.all(detailsArr); }; -const getDocumentDetails = (token, searchResultsObj) => { - //console.log(searchResultsObj); - - let detailsArr = []; - //console.log("search results", searchResultsObj); - searchResultsObj = searchResultsObj.value; - const detailsObj = searchResultsObj.map((searchDetail, index) => { - if (searchDetail.pinswg_appealcasetype == null) { - console.log(searchDetail.incidentid); - } else { - detailsArr.push( - getSearchDocumentDetails(token, searchDetail.incidentid) - ); - } - }); - //console.log(detailsArr); - return Promise.all(detailsArr); -}; - -const getDocumentHistory = (token, searchDocumentDetailsObj) => { - //console.log(searchResultsObj); - - let historyArr = []; - //console.log("search results", searchDocumentDetailsObj); - searchDocumentDetailsObj = searchDocumentDetailsObj[0].value; - - //console.log(searchDocumentDetailsObj); - const detailsObj = searchDocumentDetailsObj.map((historyDetail, index) => { - //console.log(historyDetail); - if (historyDetail.pinswg_publishtoweb != true) { - console.log(historyDetail.pinswg_documentid); - } else { - // console.log( - // "history detail documentid:", - // historyDetail.pinswg_documentid - // ); - historyArr.push( - getSearchDocumentHistory(token, historyDetail.pinswg_documentid) - ); - } - }); - console.log(historyArr); - return Promise.all(historyArr); -}; - const mapStateToProps = (state) => { return { currentView: state.currentView, diff --git a/pages/api/proxy/[...route].js b/pages/api/proxy/[...route].js index 444dfdcb..54052bdd 100644 --- a/pages/api/proxy/[...route].js +++ b/pages/api/proxy/[...route].js @@ -2,18 +2,9 @@ import axios from "axios"; import https from "https"; import CryptoJS from "crypto-js"; -const WEBAPI_URL = "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; - -// const azureHeaders = { -// headers: { -// "OData-MaxVersion": "4.0", -// "OData-Version": "4.0", -// "Accept": "application/json", -// "Prefer": 'odata.include-annotations="*",return=representation', -// "Content-Type": "application/json", -// "ServiceBusAuthorization": SASToken, -// }, -// }; +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; const getSASToken = () => { var m_ResourceURI = "dev-pedw-ns.servicebus.windows.net"; @@ -52,7 +43,7 @@ const getSASToken = () => { }; export default async function ApiProxy(req, res) { - // console.log(req.method); + console.log(req.method); var updateBody = { "pinswg_areaofsiteinhectaresdec": 21, @@ -104,14 +95,14 @@ export default async function ApiProxy(req, res) { console.log(req.url.split("/api/proxy/")[1]); return new Promise((resolve, reject) => { - // console.log(config); + //console.log(config); axios(req.method == "GET" ? configNoData : config) .then((response) => { res.statusCode = 200; res.setHeader("Content-Type", "application/json"); res.setHeader("Cache-Control", "max-age=1800000"); res.end(JSON.stringify(response.data)); - // console.log("response data", response.data); + //console.log("response data", response.data); resolve(); }) .catch((error) => { From c2aea1e9d812ac4952bfd834c1ad5fa186990700 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 29 Sep 2021 16:45:56 +0100 Subject: [PATCH 2/2] updated language fix and proxy config --- .env.local | 20 ++++---- actions/index.js | 11 +++-- components/banner.js | 22 +++++---- components/case/documents.js | 23 +++++++-- components/case/summary.js | 56 +++++++++++++++++++--- components/cookieBanner.js | 37 +++++++++----- components/header.js | 1 + locales/cy/common.json | 14 +++++- locales/en/common.json | 14 +++++- next.config.js | 4 ++ pages/404.js | 7 +-- pages/api/proxy/[...route].js | 45 +++++++++++------ pages/logout.js | 4 +- styles/sass/components/_cookie-banner.scss | 38 ++++++++------- 14 files changed, 214 insertions(+), 82 deletions(-) diff --git a/.env.local b/.env.local index 4600c635..74e6fb27 100644 --- a/.env.local +++ b/.env.local @@ -1,8 +1,8 @@ -//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" PORT= "3000" @@ -14,8 +14,8 @@ I18N_DOMAIN = "cymru.local" //I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" -RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ -RELAYURI = "test-pedw-ns.servicebus.windows.net" -RELAYPATH = "test-pedw-hc" -SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" -SASKEYNAME = "testpedwhcpolicy" +//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ +//RELAYURI = "test-pedw-ns.servicebus.windows.net" +//RELAYPATH = "test-pedw-hc" +//SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" +//SASKEYNAME = "testpedwhcpolicy" diff --git a/actions/index.js b/actions/index.js index 58ae4cb7..0fd38d3f 100644 --- a/actions/index.js +++ b/actions/index.js @@ -166,7 +166,7 @@ export const getBasicDNSSearch = (token, searchString) => { return axios .get( WEBAPI_URL + - "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", + "incidents?$select=_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", azureHeaders(token) ) .then((res) => res.data) @@ -188,7 +188,7 @@ export const getAdvancedSearch = (token, searchString) => { queryString += searchString.lpa != null ? (typeof searchString.q == "undefined" ? "" : " and ") + - "_customerid_value eq " + + "_pinswg_associatedlpa_value eq " + searchString.lpa : ""; queryString += @@ -268,8 +268,13 @@ export const getSearchDocumentHistory = (token, documentID) => { }; export const getSearchDocumentDetails1 = (incidentID) => { - //console.log(incidentID); + console.log(incidentID); var token = getSASToken(); + console.log( + "/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 " + diff --git a/components/banner.js b/components/banner.js index 3736061e..7a2a557a 100644 --- a/components/banner.js +++ b/components/banner.js @@ -1,12 +1,18 @@ import Link from "next/link"; +import useTranslation from "next-translate/useTranslation"; export default function Banner() { - return ( -
-

- beta - This is a new service -

-
- ); + let { t, lang } = useTranslation(); + return ( +
+

+ + beta + + + {t("common:new-service-beta")} + +

+
+ ); } diff --git a/components/case/documents.js b/components/case/documents.js index 70c62373..09cf7c27 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -4,6 +4,7 @@ import useTranslation from "next-translate/useTranslation"; import jsonpath from "jsonpath"; import { useState, useEffect, useRef } from "react"; import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; +import transLookup from "../../data/lookuptranslations.json"; import { getBasicSearch, @@ -111,11 +112,22 @@ const DocumentDetails = (props) => { {t("case:documents-doc-type-label")} : - { - detailsObj[ - "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" - ] - } + + {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" + )}
@@ -156,6 +168,7 @@ const DocumentDetails = (props) => { const docDetailsObj = async () => { let docObj = await getSearchDocumentDetails1(incidentid) .then((data) => { + console.log(data); setDocumentDetails(data); return data; }) diff --git a/components/case/summary.js b/components/case/summary.js index 5ad6d5c5..bfdaf26a 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -366,9 +366,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_startdate" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_startdate ) + ? formatDates( + detailsObj.pinswg_startdate + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} @@ -386,9 +392,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_questionnaireduedate" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_questionnaireduedate ) + ? formatDates( + detailsObj.pinswg_questionnaireduedate + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} @@ -406,9 +418,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_statementduedate" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_statementduedate ) + ? formatDates( + detailsObj.pinswg_statementduedate + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} @@ -426,9 +444,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_otherpartiesstatement" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_otherpartiesstatement ) + ? formatDates( + detailsObj.pinswg_otherpartiesstatement + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} @@ -446,9 +470,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_finalcommentsduedate" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_finalcommentsduedate ) + ? formatDates( + detailsObj.pinswg_finalcommentsduedate + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} @@ -465,9 +495,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_dateeventrequested" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_dateeventrequested ) + ? formatDates( + detailsObj.pinswg_dateeventrequested + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} @@ -485,9 +521,15 @@ const CaseSummary = (props) => { detailsObj, "pinswg_dateoflpadecision" ) - ? formatDates( + ? !_.isEmpty( detailsObj.pinswg_dateoflpadecision ) + ? formatDates( + detailsObj.pinswg_dateoflpadecision + ) + : t( + "case:summary-no-date-entered-label" + ) : t( "case:summary-no-date-entered-label" )} diff --git a/components/cookieBanner.js b/components/cookieBanner.js index 1666cb40..986f11e8 100644 --- a/components/cookieBanner.js +++ b/components/cookieBanner.js @@ -1,7 +1,9 @@ import CookieConsent from "react-cookie-consent"; import Link from "next/link"; +import useTranslation from "next-translate/useTranslation"; const CookieBanner = () => { + let { t, lang } = useTranslation(); return ( { buttonClasses="govuk-button" buttonWrapperClasses="govuk-width-container consentBanner" declineButtonClasses="govuk-button" - buttonText="Accept all cookies" + buttonText={t("common:cookie-banner-accept")} + declineButtonText={t("common:cookie-banner-decline")} disableStyles={true} enableDeclineButton={true} flipButtons={true} @@ -33,18 +36,30 @@ const CookieBanner = () => {
-

- Tell us whether you accept cookies -

- GOV.UK uses cookies which are essential - for the site to work. We also use - non-essential cookies to help us improve - government digital services. Any data - collected is anonymised. By continuing - to use this site, you agree to our use - of cookies. + {t("common:cookie-banner-line-1")}

+
    +
  • + {" "} + {t( + "common:cookie-banner-list-item-1" + )} +
  • +
+

{t("common:cookie-banner-line-2")}

+
    +
  • + {t( + "common:cookie-banner-list-item-2" + )} +
  • +
  • + {t( + "common:cookie-banner-list-item-3" + )} +
  • +
diff --git a/components/header.js b/components/header.js index 0f351435..1ce19ecc 100644 --- a/components/header.js +++ b/components/header.js @@ -24,6 +24,7 @@ const Header = (props) => { "/advancedsearchresults", "/dnsapplications", "/dnsdetails", + "/404", ]; const hasContactLink = [ "/dns", diff --git a/locales/cy/common.json b/locales/cy/common.json index d32f97d1..92af5164 100644 --- a/locales/cy/common.json +++ b/locales/cy/common.json @@ -2,6 +2,7 @@ "gov-wales-link": "https://llyw.cymru", "gov-wales-label": "LLYW.CYMRU", "service-name": "Cynllunio gwaith achos", + "new-service-beta": "Mae hwn yn wasanaeth newydd", "breadcrumb-back-link": "Yn ôl", "error-radio": "Dewiswch opsiwn", "error-checkbox": "Enter a value", @@ -25,5 +26,16 @@ "breadcrumb-my-portal": "Fy mhorth", "breadcrumb-case-reference": "Cyfeirnod Achos", "spinner-loading": "Llwytho...", - "spinner-searching": "Chwilio..." + "spinner-searching": "Chwilio...", + "logged-out-title": "Rydych chi wedi allgofnodi", + "logged-out-link": "Dychwelwch i'r porth Gwaith Achos Cynllunio", + "404-not-found-title": "404 - heb ei ddarganfod", + "404-not-found-link": "Ewch yn ôl adref", + "cookie-banner-line-1": "Ry'n ni wedi cadw ffeiliau a elwir yn cwcis ar eich dyfais. Mae'r cwcis hyn:", + "cookie-banner-list-item-1": "yn hanfodol i'r safle weithio", + "cookie-banner-line-2": "Byddem hefyd yn hoffi cadw rhai cwcis i'n helpu ni:", + "cookie-banner-list-item-2": "i wella'n gwefan drwy gasglu ac adrodd gwybodaeth ar sut yr ydych yn defnyddio'r safle", + "cookie-banner-list-item-3": "i deilwra cyfathrebu", + "cookie-banner-decline": "Rwy'n dirywio", + "cookie-banner-accept": "Derbyn cwcis" } \ No newline at end of file diff --git a/locales/en/common.json b/locales/en/common.json index c351dc59..a7921911 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -2,6 +2,7 @@ "gov-wales-link": "https://www.gov.wales", "gov-wales-label": "GOV.WALES", "service-name": "Planning casework", + "new-service-beta": "This is a new service", "breadcrumb-back-link": "Back", "error-radio": "Choose an option", "error-checkbox": "Choose an option", @@ -25,5 +26,16 @@ "breadcrumb-my-portal": "My portal", "breadcrumb-case-reference": "Case Reference", "spinner-loading": "Loading...", - "spinner-searching": "Searching..." + "spinner-searching": "Searching...", + "logged-out-title": "You have been logged out", + "logged-out-link": "Return to Planning Casework portal", + "404-not-found-title": "404 - not found", + "404-not-found-link": "Go back home", + "cookie-banner-line-1": "We've saved some files called cookies on your device. These cookies are:", + "cookie-banner-list-item-1": "essential for the site to work", + "cookie-banner-line-2": "We would also like to save some cookies to help:", + "cookie-banner-list-item-2": "improve our website by collecting and reporting information on how you use it", + "cookie-banner-list-item-3": "tailor communications", + "cookie-banner-decline": "I decline", + "cookie-banner-accept": "Accept cookies" } \ No newline at end of file diff --git a/next.config.js b/next.config.js index 5f422840..628fbe5b 100644 --- a/next.config.js +++ b/next.config.js @@ -41,6 +41,10 @@ module.exports = { source: "/achos", destination: "/case", }, + { + source: "/allgofnodi", + destination: "/logout", + }, { source: "/cy:path*", destination: "http://cyrmu.local/:path*", diff --git a/pages/404.js b/pages/404.js index 0741e8ec..fdf40808 100644 --- a/pages/404.js +++ b/pages/404.js @@ -15,7 +15,8 @@ const FourOhFour = (props) => {
- {t("case:page-title")} - {t("common:service-name")} + {t("common:404-not-found-title")} -{" "} + {t("common:service-name")}
@@ -25,9 +26,9 @@ const FourOhFour = (props) => {
-

404 - Page Not Found

+

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

- Go back home + {t("common:404-not-found-link")}
diff --git a/pages/api/proxy/[...route].js b/pages/api/proxy/[...route].js index 54052bdd..ce28bc48 100644 --- a/pages/api/proxy/[...route].js +++ b/pages/api/proxy/[...route].js @@ -2,15 +2,32 @@ import axios from "axios"; import https from "https"; import CryptoJS from "crypto-js"; -const WEBAPI_URL = - process.env.RELAY_ROOT || - "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; +const PROXY_RELAY_URL = + "https://" + + (process.env.RELAYURI || "dev-pedw-ns.servicebus.windows.net") + + "/" + + (process.env.RELAYPATH || "dev-pedw-hc") + + "/"; +//"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +// const azureHeaders = { +// headers: { +// "OData-MaxVersion": "4.0", +// "OData-Version": "4.0", +// "Accept": "application/json", +// "Prefer": 'odata.include-annotations="*",return=representation', +// "Content-Type": "application/json", +// "ServiceBusAuthorization": SASToken, +// }, +// }; const getSASToken = () => { - var m_ResourceURI = "dev-pedw-ns.servicebus.windows.net"; - var m_Path = "dev-pedw-hc"; - var m_SasKey = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="; - var m_SasKeyName = "devpedwnspolicy"; + 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 + "/" @@ -43,7 +60,7 @@ const getSASToken = () => { }; export default async function ApiProxy(req, res) { - console.log(req.method); + // console.log(req.method); var updateBody = { "pinswg_areaofsiteinhectaresdec": 21, @@ -65,8 +82,8 @@ export default async function ApiProxy(req, res) { var configNoData = { method: req.method, - //url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")", - url: WEBAPI_URL + req.url.split("/api/proxy/")[1], + //url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")", + url: PROXY_RELAY_URL + req.url.split("/api/proxy/")[1], headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -79,8 +96,8 @@ export default async function ApiProxy(req, res) { var config = { method: req.method, - //url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")", - url: WEBAPI_URL + req.query.route[0], + //url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")", + url: PROXY_RELAY_URL + req.query.route[0], headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -95,14 +112,14 @@ export default async function ApiProxy(req, res) { console.log(req.url.split("/api/proxy/")[1]); return new Promise((resolve, reject) => { - //console.log(config); + // console.log(config); axios(req.method == "GET" ? configNoData : config) .then((response) => { res.statusCode = 200; res.setHeader("Content-Type", "application/json"); res.setHeader("Cache-Control", "max-age=1800000"); res.end(JSON.stringify(response.data)); - //console.log("response data", response.data); + // console.log("response data", response.data); resolve(); }) .catch((error) => { diff --git a/pages/logout.js b/pages/logout.js index 21fd1d78..d633a3bd 100644 --- a/pages/logout.js +++ b/pages/logout.js @@ -28,9 +28,9 @@ const LogOut = (props) => {
-

You have been logged out

+

{t("common:logged-out-title")}

- Return to Planning Casework portal + {t("common:logged-out-link")}