diff --git a/.env.local b/.env.local index e6bf52e1..e277eea9 100644 --- a/.env.local +++ b/.env.local @@ -38,6 +38,8 @@ I18N_DOMAIN = "cymru.local" GOOGLE_TAG_MANAGER = GTM-T78CBC3 SHOWLOGIN = "true" SHOWREPRESENTATIONS = "false" -BASIC_AUTH_CREDENTIALS,,= pinswg:password|pinswg2:password2 +BASIC_AUTH_CREDENTIALS,, = pinswg:password|pinswg2:password2 -NEXT_PUBLIC_ISHARESECRETPHRASE = "Secret phrase" \ No newline at end of file +HASHKEY = "028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c" + +NEXT_PUBLIC_HASHKEY = "028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c" diff --git a/actions/index.js b/actions/index.js index 090ec96a..eaea16b2 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1,6 +1,8 @@ import axios from "axios"; import https from "https"; import CryptoJS from "crypto-js"; +import HmacSHA256 from "crypto-js/hmac-sha256"; +import { has, indexOf } from "lodash"; let BASE_URL; const port = parseInt(process.env.PORT, 10) || 3000; @@ -10,6 +12,7 @@ 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/"; @@ -145,51 +148,62 @@ const azureHeadersPaged = (SASToken) => { }; }; +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 = getToken(); - 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("/////////////////////"); @@ -205,10 +219,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) @@ -220,15 +236,14 @@ export const getBasicDNSSearch = (token, searchString) => { export const getBasicDNSSearchPaged = (pageNumber) => { 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; @@ -265,13 +280,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) @@ -317,18 +332,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 = { @@ -348,15 +361,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) @@ -372,19 +387,18 @@ export const getBasicSearchDetailsPaged = ( incidentID ) => { //console.log("check appealtype:", appealType, caseReference); - var token = getToken(); + + 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); @@ -392,12 +406,14 @@ 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) @@ -407,11 +423,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) @@ -424,17 +441,17 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => { console.log(incidentID); 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); @@ -444,16 +461,14 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => { export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => { 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); @@ -462,12 +477,13 @@ 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); @@ -476,16 +492,16 @@ export const getSearchDocumentDetails1 = (incidentID) => { 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); @@ -494,11 +510,12 @@ 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; }) @@ -509,15 +526,15 @@ 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; }) @@ -527,12 +544,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) @@ -544,13 +562,13 @@ export const getBasicDNSSearchDetails = (token, appealType, caseReference) => { export const getBasicDNSSearchDetailsPaged = (caseReference) => { 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); @@ -559,14 +577,12 @@ export const getBasicDNSSearchDetailsPaged = (caseReference) => { export const getLinkedCases = (parentIncidentid) => { //console.log(parentIncidentid); - //var token = getToken(); - + 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; @@ -577,16 +593,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); @@ -594,14 +606,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); @@ -609,14 +619,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); @@ -624,12 +632,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); @@ -645,12 +651,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; @@ -667,15 +671,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; @@ -696,7 +698,7 @@ export const getAppealID = ( updateFormCollection, primaryAttribute ) => { - const weburl = + const queryUrl = "/api/proxy/" + updateFormCollection + "?$count=true&$select=_" + @@ -705,9 +707,12 @@ export const getAppealID = ( caseReference + "'"; - console.log("proxy url ", weburl); + console.log("proxy url ", queryUrl); return axios - .get(weburl, azureHeaders(getToken())) + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(getSASToken()) + ) .then((res) => { var appealID = res.data.value[0][primaryAttribute]; return appealID; @@ -718,14 +723,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); @@ -734,6 +740,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, @@ -744,7 +752,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", @@ -783,10 +791,11 @@ 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", @@ -811,14 +820,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; }) @@ -828,14 +835,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); @@ -843,13 +848,12 @@ 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); @@ -857,9 +861,11 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => { }; export const deleteMyRepresentations = (myRepresentationsID) => { + var queryUrl = + "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")"; var config = { method: "delete", - url: "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")", + url: queryUrl + hashAPIPath(queryUrl), headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -881,13 +887,12 @@ export const deleteMyRepresentations = (myRepresentationsID) => { }; 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( - "/api/proxy/pinswg_representationses?$filter= _pinswg_case_value eq " + - incidentID + - " and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc", - azureHeaders(getToken()) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("this serror", error); @@ -895,13 +900,12 @@ export const getRepresentations = (incidentID) => { }; 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( - "/api/proxy/pinswg_representationses?$filter= _pinswg_case_value eq " + - incidentID + - "&$count=true&$orderby=createdon desc", - azureHeaders(token) - ) + .get(queryUrl + hashAPIPath(queryUrl)) .then((res) => res.data) .catch((error) => { console.log("this serror", error); @@ -909,14 +913,12 @@ export const getRepresentationsProxy = (token, incidentID) => { }; 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); @@ -924,13 +926,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); @@ -939,10 +940,11 @@ 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", @@ -965,9 +967,10 @@ 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", @@ -1000,15 +1003,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); @@ -1020,15 +1021,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); @@ -1036,13 +1036,13 @@ export const getPortalModuleDetailsProxy = ( }; export const getEmailAccountCheck = (emailAddress) => { - let token = getToken(); + 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); @@ -1051,10 +1051,10 @@ 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", @@ -1078,10 +1078,10 @@ 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", @@ -1106,10 +1106,10 @@ 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", 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/case/documents.js b/components/case/documents.js index 656b876e..5746ec72 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -105,12 +105,9 @@ const DocumentDetails = (props) => { >
{t( @@ -194,15 +191,18 @@ const DocumentDetails = (props) => { ); }; - const encryptDocReference = (documentRef) => { - var encrypted = encodeURIComponent( - CryptoJS.AES.encrypt( - documentRef, - process.env.NEXT_PUBLIC_ISHARESECRETPHRASE - ) - ); + const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY; - return encrypted; + 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(() => { 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/homepage/casesearch.js b/components/homepage/casesearch.js index aeb487cd..b8675b73 100644 --- a/components/homepage/casesearch.js +++ b/components/homepage/casesearch.js @@ -91,7 +91,7 @@ let CaseSearch = (props) => { router.locale == "cy" ? "/canlyniadauchwilio" : "/searchresults", - query: { q: values.basicSearch }, + query: { q: values.basicSearch.trim() }, shallow: true, }); }; diff --git a/components/search/advancedsearch.js b/components/search/advancedsearch.js index e9ff67df..94daa7bc 100644 --- a/components/search/advancedsearch.js +++ b/components/search/advancedsearch.js @@ -232,7 +232,8 @@ let AdvancedSearch = (props) => { var searchString = ""; - searchString += values.caseRef != null ? "?q=" + values.caseRef : ""; + searchString += + values.caseRef.trim() != null ? "?q=" + values.caseRef.trim() : ""; searchString += values.lpaTypes != null ? (typeof values.caseRef == "undefined" ? "?" : "&") + diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index 007c1109..6f839b64 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -268,7 +268,7 @@ const DNSSearchResults = (props) => { //console.log("getting details", data); return getSearchDetailsPaged(data).then((data) => { setSearchDetails(data); - setShowSpinnerState(false); + //setShowSpinnerState(false); }); }); }; 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/locales/cy/common.json b/locales/cy/common.json index c1c50d62..6ba8ba67 100644 --- a/locales/cy/common.json +++ b/locales/cy/common.json @@ -30,7 +30,7 @@ "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/next.config.js b/next.config.js index e3e0aaa9..169a2b4e 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"; diff --git a/pages/api/proxy/[...route].js b/pages/api/proxy/[...route].js index 21900fec..aa099a0c 100644 --- a/pages/api/proxy/[...route].js +++ b/pages/api/proxy/[...route].js @@ -1,8 +1,8 @@ import axios from "axios"; import https from "https"; import CryptoJS from "crypto-js"; -import { response } from "express"; import HmacSHA256 from "crypto-js/hmac-sha256"; +import { rest } from "lodash"; const PROXY_RELAY_URL = "https://" + @@ -49,16 +49,46 @@ const getSASToken = () => { return token; }; -export default async function ApiProxy(req, res) { - //console.log(req.method); +function checkProxyPath(queryPath) { + const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY; + var hashPath = + queryPath.indexOf("/api/proxy/") == -1 + ? queryPath + : queryPath.split("/api/proxy/")[1]; + + const wordKey = WORDKEY; + var hashlink = CryptoJS.HmacSHA256( + decodeURI(hashPath), + CryptoJS.enc.Hex.parse(wordKey) + ); + + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + return hashlink; +} + +export default async function ApiProxy(req, res) { var data = JSON.stringify(req.body); const SASToken = getSASToken(); + const isDocument = req.url.indexOf("/documents/download") > -1; + + let hashCheckPath = isDocument + ? req.url.split("?hash=")[0] + : req.url.split("&hash=")[0]; + let hashCheckValue = isDocument + ? req.url.split("?hash=")[1] + : req.url.split("&hash=")[1]; + let hashFromRequest = checkProxyPath(hashCheckPath); var configNoData = { method: req.method, //url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")", - url: PROXY_RELAY_URL + req.url.split("/api/proxy/")[1], + url: + PROXY_RELAY_URL + + req.url.split("&hash=")[0].split("/api/proxy/")[1] + + "&hash=" + + req.url.split("&hash=")[1], headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -72,7 +102,11 @@ export default async function ApiProxy(req, res) { var config = { method: req.method, - url: PROXY_RELAY_URL + req.query.route[0], + url: + PROXY_RELAY_URL + + req.query.route[0] + + "&hash=" + + req.url.split("&hash=")[1], headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -86,7 +120,11 @@ export default async function ApiProxy(req, res) { var configDocument = { method: req.method, - url: PROXY_RELAY_URL + req.url.split("/api/proxy/")[1], + url: + PROXY_RELAY_URL + + req.url.split("?hash=")[0].split("/api/proxy/")[1] + + "?hash=" + + req.url.split("?hash=")[1], headers: { "OData-MaxVersion": "4.0", "OData-Version": "4.0", @@ -98,46 +136,45 @@ export default async function ApiProxy(req, res) { responseType: "arraybuffer", }; - return new Promise((resolve, reject) => { - let apiPath = req.url.split("/api/proxy/")[1]; - let hasDocument = apiPath.indexOf("/download") > 0 ? true : false; - // console.log( - // "//////////////", - // req.url.split("/api/proxy/")[1], - // PROXY_RELAY_URL + req.query.route[0], - // req.method, - // hasDocument - // ); - axios( - req.method == "GET" - ? hasDocument - ? configDocument - : configNoData - : config - ) - .then((response) => { - res.statusCode = 200; - if (hasDocument) { - res.setHeader( - "Content-disposition", - "attachment; filename=" + - response.headers["content-disposition"].split( - "filename=" - )[1] - ); - res.end(response.data); - } else { - res.setHeader("Content-Type", "application/json"); - // res.setHeader("Cache-Control", "max-age=1800000"); - res.end(JSON.stringify(response.data)); - } - resolve(); - }) - .catch((error) => { - console.log("proxy response error", error); - res.json(error); - res.status(405).end(); - return resolve(); - }); - }); + if (hashCheckValue == hashFromRequest) { + return new Promise((resolve, reject) => { + let hasDocument = + hashCheckPath.indexOf("/download") > 0 ? true : false; + + axios( + req.method == "GET" + ? hasDocument + ? configDocument + : configNoData + : config + ) + .then((response) => { + res.statusCode = 200; + if (hasDocument) { + res.setHeader( + "Content-disposition", + "attachment; filename=" + + response.headers["content-disposition"].split( + "filename=" + )[1] + ); + res.end(response.data); + } else { + res.setHeader("Content-Type", "application/json"); + // res.setHeader("Cache-Control", "max-age=1800000"); + res.end(JSON.stringify(response.data)); + } + resolve(); + }) + .catch((error) => { + console.log("proxy response error", error); + // res.json(error); + res.status(405).end(); + return resolve(); + }); + }); + } else { + res.status(405).end(); + return resolve(); + } } diff --git a/styles/sass/welshgov/_application.scss b/styles/sass/welshgov/_application.scss index 1e593aa6..d6490458 100644 --- a/styles/sass/welshgov/_application.scss +++ b/styles/sass/welshgov/_application.scss @@ -232,7 +232,7 @@ a.longLinkBreak { textarea, .react-datepicker__input-container input { border: 1px solid $darkgrey; - padding: 10px 15px; + padding: 7px 15px; } .govuk-radios__label:before { @@ -315,7 +315,7 @@ textarea, background-repeat: no-repeat; background-position: 98% 15px; background-color: #fff; - padding: 10px 15px; + padding: 7px 15px; border: 1px solid #666666; &:focus {