diff --git a/.env.local b/.env.local index 75c94ee7..dd47b0b2 100644 --- a/.env.local +++ b/.env.local @@ -2,6 +2,7 @@ ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/ TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502 +//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5 GRANT_TYPE = "client_credentials" HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c @@ -11,44 +12,34 @@ NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459 //Dev oauth //CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015 //CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY - -// dev //RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ //RELAYURI = "dev-pedw-ns.servicebus.windows.net" //RELAYPATH = "dev-pedw-hc" -//SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=" -//SASKEYNAME = "devpedwnspolicy" //Test Oauth -//CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa -//CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj- +CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa +CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj- +RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ +RELAYURI = "test-pedw-ns.servicebus.windows.net" +RELAYPATH = "test-pedw-hc" -//test -//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" //Preprod Oauth -CLIENT_ID = 75594242-8773-45c7-a3da-85e62485b2f3 -CLIENT_SECRET = UDF7Q~OwTLIV7LXPHlIYHSWbJunlBD53ieLt- +//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a +//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF +//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/ +//RELAYURI = "pp-pedw-ns.servicebus.windows.net" +//RELAYPATH = "pp-pedw-hc" -//preprod -RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/ -RELAYURI = "pp-pedw-ns.servicebus.windows.net" -RELAYPATH = "pp-pedw-hc" -//SASKEY = "JzrOYfMTsGBD1cZHH2nkzqsbfDCqg0brO6jyiIDNVPo=" -//SASKEYNAME = "pppedwnspolicy" - //Prod Oauth //CLIENT_ID = 01904c07-9035-4cf9-a535-3945f6e470d2 //CLIENT_SECRET = PRo7Q~GQoKSdARRqF-NOXQDx2Ka8UCINyvagk - - +//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/ +//RELAYURI = "prod-pedw-ns.servicebus.windows.net" +//RELAYPATH = "prod-pedw-hc" GOOGLE_TAG_MANAGER = GTM-T78CBC3 @@ -63,4 +54,18 @@ I18N_DOMAIN = "cymru.local" //I18N_DOMAIN ="dev-gwaithcynllunio.gwasanaeth.llyw.cymru" //I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru" //I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s -//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" \ No newline at end of file +//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" + + +//gov gateway +GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration" +GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ +GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS +GG_REDIRECT_URI = "http://localhost:3000" + +NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ +NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000" + +API_ROOT = "http://localhost:3000" + + diff --git a/actions/govgateway.js b/actions/govgateway.js new file mode 100644 index 00000000..034f90a5 --- /dev/null +++ b/actions/govgateway.js @@ -0,0 +1,191 @@ +import axios from "axios"; +import { hashAPIPath } from "./"; + +const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT; +const ggClientID = process.env.GG_CLIENT_ID; +const ggClientSecret = process.env.GG_CLIENT_SECRET; +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +export const getProviderConfig = () => { + return axios + .get(configEndpoint) + .then((res) => res.data) + .catch((error) => { + console.log("error :", error.response); + // return error; + }); +}; + +export const getGGToken = (tokenURL, authCode, redirectUri) => { + const tokenBody = + "grant_type=authorization_code" + + "&code=" + + authCode + + "&redirect_uri=" + + redirectUri; + + const basicAuthBase64 = (ggClientID + ":" + ggClientSecret).toString(); + //console.log("base64 " + Base64.encode(basicAuthBase64)); + + const tokenConfig = { + headers: { + "Content-Type": "application/x-www-form-urlencoded", + "Authorization": "Basic " + Base64.encode(basicAuthBase64), + }, + }; + + return axios + .post(tokenURL, tokenBody, tokenConfig) + .then((res) => res.data) + .catch((error) => { + // if (error.response) { + // console.log(error.response.data); + // console.log(error.response.status); + // console.log(error.response.headers); + // } + return error.response; + }); +}; + +export const getUserInfo = (userInfoURL, authToken) => { + const tokenConfig = { + headers: { + "Authorization": "Bearer " + authToken, + }, + }; + + return axios + .get(userInfoURL, tokenConfig) + .then((res) => res) + .catch((error) => { + //console.log(`Error: ${err?.response?.data}`); + //return error; + }); +}; + +export const getPortalLogin = (emailAddress, token) => { + var queryUrl = + "contacts?$filter=emailaddress1 eq '" + + emailAddress + + "'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname"; + return axios + .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) + .then((res) => res.data) + .catch((error) => { + console.log("thiserror", error); + }); +}; + +const azureHeaders = (access_token) => { + return { + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json;odata.metadata=none", + "Prefer": 'odata.include-annotations="*",return=representation', + "Content-Type": "application/json", + "Authorization": "Bearer " + access_token, + }, + }; +}; + +var Base64 = { + _keyStr: + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + encode: function (e) { + var t = ""; + var n, r, i, s, o, u, a; + var f = 0; + e = Base64._utf8_encode(e); + while (f < e.length) { + n = e.charCodeAt(f++); + r = e.charCodeAt(f++); + i = e.charCodeAt(f++); + s = n >> 2; + o = ((n & 3) << 4) | (r >> 4); + u = ((r & 15) << 2) | (i >> 6); + a = i & 63; + if (isNaN(r)) { + u = a = 64; + } else if (isNaN(i)) { + a = 64; + } + t = + t + + this._keyStr.charAt(s) + + this._keyStr.charAt(o) + + this._keyStr.charAt(u) + + this._keyStr.charAt(a); + } + return t; + }, + decode: function (e) { + var t = ""; + var n, r, i; + var s, o, u, a; + var f = 0; + //e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + while (f < e.length) { + s = this._keyStr.indexOf(e.charAt(f++)); + o = this._keyStr.indexOf(e.charAt(f++)); + u = this._keyStr.indexOf(e.charAt(f++)); + a = this._keyStr.indexOf(e.charAt(f++)); + n = (s << 2) | (o >> 4); + r = ((o & 15) << 4) | (u >> 2); + i = ((u & 3) << 6) | a; + t = t + String.fromCharCode(n); + if (u != 64) { + t = t + String.fromCharCode(r); + } + if (a != 64) { + t = t + String.fromCharCode(i); + } + } + t = Base64._utf8_decode(t); + return t; + }, + _utf8_encode: function (e) { + e = e.replace(/\r\n/g, "\n"); + var t = ""; + for (var n = 0; n < e.length; n++) { + var r = e.charCodeAt(n); + if (r < 128) { + t += String.fromCharCode(r); + } else if (r > 127 && r < 2048) { + t += String.fromCharCode((r >> 6) | 192); + t += String.fromCharCode((r & 63) | 128); + } else { + t += String.fromCharCode((r >> 12) | 224); + t += String.fromCharCode(((r >> 6) & 63) | 128); + t += String.fromCharCode((r & 63) | 128); + } + } + return t; + }, + _utf8_decode: function (e) { + var t = ""; + var n = 0; + var r = (c1 = c2 = 0); + while (n < e.length) { + r = e.charCodeAt(n); + if (r < 128) { + t += String.fromCharCode(r); + n++; + } else if (r > 191 && r < 224) { + c2 = e.charCodeAt(n + 1); + t += String.fromCharCode(((r & 31) << 6) | (c2 & 63)); + n += 2; + } else { + c2 = e.charCodeAt(n + 1); + c3 = e.charCodeAt(n + 2); + t += String.fromCharCode( + ((r & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63) + ); + n += 3; + } + } + return t; + }, +}; diff --git a/actions/index.js b/actions/index.js index b5d8a3a1..98e0e574 100644 --- a/actions/index.js +++ b/actions/index.js @@ -2,7 +2,6 @@ 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; @@ -12,7 +11,7 @@ if (process.browser) { } else { BASE_URL = process.env.API_ROOT || `http://localhost:${port}`; } -const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY; +const WORDKEY = process.env.HASHKEY; const cache = {}; const API_PATH = "/api/data/v8.2/"; @@ -20,8 +19,6 @@ const API_PATH = "/api/data/v8.2/"; const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; const tenantId = process.env.TENANT; -//const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH; - const WEBAPI_URL = process.env.RELAY_ROOT || "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; @@ -67,7 +64,7 @@ const tokenConfig = { }, }; -const azureHeaders = (access_token) => { +export const azureHeaders = (access_token) => { return { headers: { "OData-MaxVersion": "4.0", @@ -80,7 +77,7 @@ const azureHeaders = (access_token) => { }; }; -const azureHeadersPaged = (access_token) => { +export const azureHeadersPaged = (access_token) => { return { headers: { "OData-MaxVersion": "4.0", @@ -94,86 +91,66 @@ const azureHeadersPaged = (access_token) => { }; }; -const hashAPIPath = (queryPath) => { - var hashPath = - queryPath.indexOf("/api/proxy/") == -1 - ? queryPath - : queryPath.split("/api/proxy/")[1]; - +export const hashAPIPath = (queryPath) => { var hashlink = CryptoJS.HmacSHA256( - hashPath, + queryPath, CryptoJS.enc.Hex.parse(WORDKEY) ); hashlink = hashlink.toString(CryptoJS.enc.Hex); - //return "&hash=" + hashlink; - - return (hashPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; }; -export const getBasicSearch = (token, searchString) => { - //console.log("\n\n", token, searchString); +export const hashString = (stringToHash) => { + console.log("string to hash", stringToHash); + let hashedStr = CryptoJS.AES.encrypt(stringToHash, "pedw"); + console.log("hashed String", hashedStr.toString()); + return hashedStr.toString(); +}; - 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"; +export const dehashString = (stringToDeHash) => { + console.log("string to dehash", stringToDeHash); + let dehashedStr = CryptoJS.AES.decrypt(decodeURI(stringToDeHash), "pedw"); + console.log("dehshed string:", dehashedStr.toString(CryptoJS.enc.Utf8)); + return dehashedStr.toString(CryptoJS.enc.Utf8); +}; + +export const getBasicSearch = (searchString) => { return axios .get( - WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) + BASE_URL + + "/api/endpoint/getbasicsearch_api?searchString=" + + searchString ) .then((res) => { return res.data; }) .catch((error) => { + console.log(error); return error.response; }); }; export const getBasicSearchPaged = (searchString, pageNumber) => { - //console.log("\n\n", token, searchString); - - //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(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getbasicsearchpaged_api?searchString=" + + searchString + + "&pageNumber=" + + pageNumber + ) .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 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"; - +export const getBasicDNSSearch = (searchString) => { return axios - .get( - WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) - ) + .get(BASE_URL + "/api/endpoint/getbasicdnssearch_api") .then((res) => res.data) .catch((error) => { return error.response; @@ -181,59 +158,22 @@ export const getBasicDNSSearch = (token, searchString) => { }; export const getBasicDNSSearchPaged = (pageNumber) => { - 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(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getbasicdnssearchpaged_api?pageNumber=" + pageNumber + ) .then((res) => res.data) .catch((error) => { return error.response; }); }; -export const getAdvancedSearch = (token, searchString) => { - console.log("debug showing token: ", token); - console.log(searchString.caseReference); - - var queryString = ""; - - queryString += - searchString.q != null - ? "(contains(title, '" + - searchString.q + - "') or contains(ticketnumber,'" + - searchString.q + - "'))" - : ""; - - queryString += - searchString.lpa != null - ? (typeof searchString.q == "undefined" ? "" : " and ") + - "_pinswg_associatedlpa_value eq " + - searchString.lpa - : ""; - queryString += - searchString.apt != null - ? (typeof searchString.q == "undefined" && - typeof searchString.lpa == "undefined" - ? "" - : " and ") + - "pinswg_appealcasetype eq " + - 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"; +export const getAdvancedSearch = (searchString) => { return axios .get( - WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) + BASE_URL + + "/api/endpoint/getadvancedsearch_api?searchstring=" + + JSON.stringify(searchString) ) .then((res) => res.data) .catch((error) => { @@ -248,44 +188,13 @@ export const getAdvancedSearch = (token, searchString) => { }; export const getAdvancedSearchPaged = (searchString, pageNumber) => { - //console.log(searchString); - var queryString = ""; - - queryString += - searchString.q != null - ? "(contains(title, '" + - searchString.q + - "') or contains(ticketnumber,'" + - searchString.q + - "'))" - : ""; - - queryString += - searchString.lpa != null - ? (typeof searchString.q == "undefined" ? "" : " and ") + - "_pinswg_associatedlpa_value eq " + - searchString.lpa - : ""; - queryString += - searchString.apt != null - ? (typeof searchString.q == "undefined" && - typeof searchString.lpa == "undefined" - ? "" - : " and ") + - "pinswg_appealcasetype eq " + - searchString.apt - : ""; - - 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=" + ('') - : ""); - return axios - .get(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getadvancedsearchpaged_api?searchstring=" + + JSON.stringify(searchString) + + "&pageNumber=" + + pageNumber + ) .then((res) => res.data) .catch((error) => { let ErrResponse = { @@ -297,26 +206,22 @@ export const getAdvancedSearchPaged = (searchString, pageNumber) => { return ErrResponse; }); }; + export const getBasicSearchDetails = ( - token, appealTypeName, caseReference, primaryIdAttribute, incidentID ) => { - //console.log("check appealtype:", appealType, caseReference); - - var queryUrl = - appealTypeName + - "?$filter=_" + - primaryIdAttribute + - "s_value eq " + - incidentID + - "&$count=true"; return axios .get( - WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) + BASE_URL + + "/api/endpoint/getbasicsearchdetails_api?appealTypeName=" + + appealTypeName + + "&primaryIdAttribute=" + + primaryIdAttribute + + "&incidentID=" + + incidentID ) .then((res) => res.data) .catch((error) => { @@ -332,241 +237,96 @@ export const getBasicSearchDetailsPaged = ( ) => { //console.log("check appealtype:", appealType, caseReference); - var queryUrl = - "/api/proxy/" + - appealTypeName + - "?$filter=_" + - primaryIdAttribute + - "s_value eq " + - incidentID + - "&$count=true"; - return axios - .get(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=" + + appealTypeName + + "&primaryIdAttribute=" + + primaryIdAttribute + + "&incidentID=" + + incidentID + ) .then((res) => res.data) .catch((error) => { console.log("this error", error); }); }; -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"; +export const getSearchDocumentDetails = (incidentID) => { return axios .get( - WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) + "/api/endpoint/getsearchdocumentdetails_api?incidentid=" + + incidentID ) .then((res) => res.data) .catch((error) => { - console.log("thiserror", error); - }); -}; - -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 + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) - ) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); + console.log("API call error", error); }); }; export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => { - console.log(incidentID); - - 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(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getsearchdocumentdetailspaged_api?incidentid=" + + incidentID + + "&pageNumber=" + + pageNumber + ) .then((res) => res.data) .catch((error) => { - console.log("thiserror", error); + console.log("API call error", error); + }); +}; + +export const getSearchDocumentHistory = (documentID) => { + return axios + .get( + "/api/endpoint/getsearchdocumenthistory_api?documentid=" + + documentID + ) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log("API call error", error); }); }; export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => { - 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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getSearchDocumentDetails1 = (incidentID) => { - 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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => { - 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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getSearchDocumentHistory1 = (documentID) => { - 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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => { - return res.data; - }) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => { - 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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => { - return res.data; - }) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getBasicDNSSearchDetails = (token, appealType, caseReference) => { - var queryUrl = - "pinswg_dnses?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true"; return axios .get( - WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - azureHeadersPaged(token) + "/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" + + documentID + + "&pageNumber=" + + pageNumber ) - .then((res) => res.data) + .then((res) => { + return res.data; + }) .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getBasicDNSSearchDetailsPaged = (caseReference) => { - var queryUrl = - "/api/proxy/pinswg_dnses?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true"; - - return axios - .get(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); + console.log("API call error", error); }); }; export const getLinkedCases = (parentIncidentid) => { - //console.log(parentIncidentid); - 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(queryUrl + hashAPIPath(queryUrl)) + .get( + BASE_URL + + "/api/endpoint/getlinkedcases_api?parentincidentid=" + + parentIncidentid + ) .then((res) => { //console.log(" linked date", res.data); return res.data; }) .catch((error) => { - console.log("thiserror", error); + console.log("API call error", error); }); }; -export const getFormData = (token, whichForm) => { - var queryUrl = - "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" + - whichForm + - "' and type eq 2)&$count=true&$top=201"; +export const getAppealsTypes = () => { return axios - .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getMandatoryFields = (token, whichForm) => { - var queryUrl = - "EntityDefinitions(LogicalName='pinswg_" + - whichForm + - "')/Attributes?$count=true&$select=LogicalName,RequiredLevel"; - return axios - .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -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 + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -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 + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) + .get(BASE_URL + "/api/endpoint/getappealtypes_api") .then((res) => res.data) .catch((error) => { console.log(error); @@ -580,12 +340,9 @@ 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"; +export const getLPA = () => { return axios - .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) + .get(BASE_URL + "/api/endpoint/getlpa_api") .then((res) => { //console.log(res.data); return res.data; @@ -601,26 +358,60 @@ export const getLPA = (token) => { }); }; -export const getPersonalAccount = (token, contactid) => { - var queryUrl = - "contacts(" + - contactid + - ")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true"; +// iteration 2 methods +export const getFormData = (whichForm) => { return axios - .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) + .get(BASE_URL + "/api/endpoint/getformdata_api?whichForm=" + whichForm) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getMandatoryFields = (whichForm) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getmandatoryfields_api?whichForm=" + + whichForm + ) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getPickLists = (whichForm) => { + return axios + .get(BASE_URL + "/api/endpoint/getpicklists_api?whichForm=" + whichForm) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getPersonalAccount = (contactid) => { + console.log(contactid); + return axios + .get( + BASE_URL + + "/api/endpoint/getpersonalaccount_api?contactid=" + + contactid + ) .then((res) => { console.log(res.data); return res.data; }) .catch((error) => { - let ErrResponse = { - value: [], - errorCode: error.response.status, - errorMsg: error.response.statusText, - }; + console.log("returned:", error); + // let ErrResponse = { + // value: [], + // errorCode: error.response.status, + // errorMsg: error.response.statusText, + // }; - return ErrResponse; + // return ErrResponse; }); }; @@ -629,72 +420,255 @@ export const getAppealID = ( updateFormCollection, primaryAttribute ) => { - const queryUrl = - "/api/proxy/" + - updateFormCollection + - "?$count=true&$select=_" + - primaryAttribute + - "s_value&$filter=pinswg_name eq '" + - caseReference + - "'"; - - console.log("proxy url ", queryUrl); return axios - .get(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getappealid_api?updateFormCollection=" + + updateFormCollection + + "&primaryAttribute=" + + primaryAttribute + + "&caseReference=" + + caseReference + ) .then((res) => { var appealID = res.data.value[0][primaryAttribute]; return appealID; }) .catch((error) => { - console.log("thi serror", error); + console.log("API call error", error); }); }; export const getLogin = (emailAddress, pwd) => { - var queryUrl = - "/api/proxy/contacts?$filter=emailaddress1 eq '" + - emailAddress + - "' and pinswg_custom_password eq '" + - pwd + - "'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname"; - return axios - .get(queryUrl + hashAPIPath(queryUrl)) + .get( + "/api/endpoint/getlogin_api?emailAddress=" + + emailAddress + + "&pwd=" + + pwd + ) .then((res) => res.data) .catch((error) => { - console.log("thiserror", error); + console.log("API call error", error); }); }; -export const createCase = (token, appealTypeId, lpaID, contactid) => { +export const createCase = (appealTypeId, lpaID, contactid) => { appealTypeId = parseInt(appealTypeId); - var queryUrl = "incidents"; - var data = JSON.stringify({ - "title": "insertion test case", - "caseorigincode": 3, - "customerid_contact@odata.bind": "/contacts(" + contactid + ")", - "pinswg_appealcasetype": appealTypeId, - "pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")", - }); + var queryUrl = + "/api/endpoint/createcase_api?appealTypeId=" + + appealTypeId + + "&lpaID=" + + lpaID + + "&contactid=" + + contactid; var config = { method: "post", - url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), - headers: { - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json;odata.metadata=none", - "Prefer": 'odata.include-annotations="*",return=representation', - "Content-Type": "application/json", - "Authorization": "Bearer " + token, - }, - data: data, + url: BASE_URL + queryUrl, }; - // console.log(config); + + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getMyCases = (loggedInUserId) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getmycases_api?loggedInUserId=" + + loggedInUserId + ) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getMyRepresentations = (loggedInUserId) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getmyrepresentations_api?loggedInUserId=" + + loggedInUserId + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getMyRepresentationsProxy = (loggedInUserId) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" + + loggedInUserId + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getRepresentations = (incidentID) => { + return axios + .get("/api/endpoint/getrepresentations_api?incidentID=" + incidentID) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getRepresentationsProxy = (incidentID) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getrepresentationsproxy_api?incidentID=" + + incidentID + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getWatchedCases = (loggedInUserId) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getwatchedcases_api?loggedInUserId=" + + loggedInUserId + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getWatchedCasesProxy = (loggedInUserId) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" + + loggedInUserId + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getAwaitingSubmission = () => { + return axios + .get(BASE_URL + "/api/lookups/awaitingSubmission", { + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + }) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getPortalModuleDetails = (appealType, caseReference) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getportalmoduledetails_api?appealType=" + + appealType + + "&caseReference=" + + caseReference + ) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getPortalModuleDetailsProxy = (appealType, caseReference) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getportalmoduledetailsproxy_api?appealType=" + + appealType + + "&caseReference=" + + caseReference + ) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +export const getEmailAccountCheck = (emailAddress) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getemailaccountcheck_api?emailAddress=" + + emailAddress + ) + .then((res) => res.data) + .catch((error) => { + console.log("API call error", error); + }); +}; + +//uses more than get methods + +export const updatePassword = (contactId, newpassword) => { + var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId; + var data = { "pinswg_custom_password": newpassword }; + var config = { + method: "post", + url: queryUrl, + data: data, + }; + + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const updateAccount = async (contactId, updateBody) => { + var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId; + var data = updateBody; + var config = { + method: "post", + url: queryUrl, + data: data, + }; + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log("this error:", error); + }); +}; + +export const createWatchedCases = (formValues) => { + var data = formValues; + var queryUrl = window.apiRoot + "/api/endpoint/createwatchedcases_api"; + + var config = { + method: "post", + url: queryUrl, + data: data, + }; + return axios(config) .then((res) => { - // console.log("posted ", res.data); return res.data; }) .catch((error) => { @@ -717,79 +691,32 @@ export const updateCase = async ( primaryAttribute ); - console.log("appeal obj ", appealObj); + var queryUrl = + "/api/endpoint/updatecase_api?updateFormCollection=" + + updateFormCollection + + "&appealObj=" + + appealObj; - var queryUrl = "/api/proxy/" + updateFormCollection + "(" + appealObj + ")"; var config = { - method: "patch", - //url: updateFormCollection + "(" + incidentId + ")", + method: "post", url: queryUrl + hashAPIPath(queryUrl), - headers: { - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json;odata.metadata=none", - "Prefer": 'odata.include-annotations="*",return=representation', - "Content-Type": "application/json", - }, data: data, }; - //console.log(config); return axios(config) .then((res) => { - //console.log("patched ", res.data); return res.data; }) .catch((error) => { - console.log("thi serror", error); - }); -}; - -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 + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => { - return res.data; - }) - .catch((error) => { - console.log("thi serror", error); - }); -}; - -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 + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => res.data) - .catch((error) => { - console.log("this serror", error); - }); -}; - -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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("this serror", error); + console.log("API call error", error); }); }; export const deleteMyRepresentations = (myRepresentationsID) => { var queryUrl = - "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")"; + "/api/endpoint/deletemyrepresentations_api?myRepresentationsID=" + + myRepresentationsID; + var config = { method: "delete", url: queryUrl + hashAPIPath(queryUrl), @@ -812,99 +739,14 @@ 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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("this serror", error); - }); -}; - -export const getRepresentationsProxy = (token, incidentID) => { - var queryUrl = - "/api/proxy/pinswg_representationses?$filter= _pinswg_case_value eq " + - incidentID + - "&$count=true&$orderby=createdon desc"; - return axios - .get(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("this serror", error); - }); -}; - -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 + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => res.data) - .catch((error) => { - console.log("this serror", error); - }); -}; - -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(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("this serror", error); - }); -}; - -export const createWatchedCases = (formValues) => { - var data = JSON.stringify(formValues); - var queryUrl = "/api/proxy/pinswg_watchlists"; - - var config = { - method: "post", - url: queryUrl + hashAPIPath(queryUrl), - headers: { - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json;odata.metadata=none", - "Prefer": 'odata.include-annotations="*",return=representation', - "Content-Type": "application/json", - }, - data: data, - }; - // console.log(config); - return axios(config) - .then((res) => { - //console.log("posted ", res.data); - return res.data; - }) - .catch((error) => { - console.log("this serror", error); - }); -}; - export const deleteWatchedCases = (watchedCaseID) => { - var queryUrl = "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")"; + var queryUrl = + "/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID; var config = { method: "delete", - url: queryUrl + hashAPIPath(queryUrl), - headers: { - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json;odata.metadata=none", - "Prefer": 'odata.include-annotations="*",return=representation', - "Content-Type": "application/json", - }, + url: queryUrl, }; - // console.log(config); + return axios(config) .then((res) => { //console.log("deleted ", res.data); @@ -915,72 +757,15 @@ export const deleteWatchedCases = (watchedCaseID) => { }); }; -export const getAwaitingSubmission = (token) => { - return axios - .get(BASE_URL + "/api/lookups/awaitingSubmission", { - httpsAgent: new https.Agent({ rejectUnauthorized: false }), - }) - .then((res) => res.data) - .catch((error) => { - console.log("thi serror", error); - }); -}; - -export const getPortalModuleDetails = (token, appealType, caseReference) => { - var queryUrl = - appealType + - "?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true"; - return axios - .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getPortalModuleDetailsProxy = ( - token, - appealType, - caseReference -) => { - var queryUrl = - "/api/proxy/" + - appealType + - "?$filter=pinswg_name eq '" + - caseReference + - "'&$count=true"; - return axios - .get(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - -export const getEmailAccountCheck = (emailAddress) => { - var queryUrl = - "/api/proxy/contacts?$filter=emailaddress1 eq '" + - emailAddress + - "'&$count=true&$select=emailaddress1, contactid"; - return axios - .get(queryUrl + hashAPIPath(queryUrl)) - .then((res) => res.data) - .catch((error) => { - console.log("thiserror", error); - }); -}; - export const createAccount = (formValues) => { - var data = formValues; //JSON.stringify(formValues); - var queryUrl = "/api/proxy/contacts"; + var data = formValues; + var queryUrl = "/api/endpoint/createaccount_api"; var config = { method: "post", - url: queryUrl + hashAPIPath(queryUrl), + url: queryUrl, data: data, }; - // console.log(config); + return axios(config) .then((res) => { // console.log("posted ", res.data); @@ -990,42 +775,3 @@ export const createAccount = (formValues) => { console.log("this serror", error); }); }; - -export const updateAccount = async (contactId, updateBody) => { - var data = updateBody; //JSON.stringify(updateBody); - var queryUrl = "/api/proxy/contacts(" + contactId + ")"; - queryUrl = queryUrl + hashAPIPath(queryUrl); - var config = { - method: "patch", - url: queryUrl, - data: data, - }; - return axios(config) - .then((res) => { - return res.data; - }) - .catch((error) => { - console.log("this error:", error); - }); -}; - -export const updatePassword = (contactId, newpassword) => { - let updateBody = { "pinswg_custom_password": newpassword }; - var data = updateBody; //JSON.stringify(updateBody); - var queryUrl = "/api/proxy/contacts(" + contactId + ")"; - queryUrl = queryUrl + hashAPIPath(queryUrl); - var config = { - method: "patch", - url: queryUrl, - data: data, - }; - // console.log(config); - return axios(config) - .then((res) => { - //console.log("posted ", res.data); - return res.data; - }) - .catch((error) => { - console.log("this serror", error); - }); -}; diff --git a/actions/selectQueryTypes.js b/actions/selectQueryTypes.js new file mode 100644 index 00000000..e64a4086 --- /dev/null +++ b/actions/selectQueryTypes.js @@ -0,0 +1,50 @@ +export const getSelectQuery = (appealTypeName) => { + switch (appealTypeName) { + case "pinswg_advertses": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode"; + break; + case "pinswg_callinss77s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode"; + break; + case "pinswg_commonlands": + case "pinswg_environmentalpermittings": + case "pinswg_hedgeshedgerowstreepreservationreplacems": + case "pinswg_miscellaneouscaseworks": + case "pinswg_wayleaves": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode"; + break; + case "pinswg_communityinfrastructurelevys117118119s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_startdate,statuscode"; + break; + case "pinswg_compulsorypurchaseorderses": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode"; + case "pinswg_dnses": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectdescription,pinswg_projectlocation,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode"; + case "pinswg_electricityacts": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode"; + case "pinswg_householderappealhases": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_otherpartiesstatement,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_enforcementnoticeappeals174s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_enforcementlistedbuildingconservationaps": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode"; + case "pinswg_maintenanceoflands217s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode"; + case "pinswg_lawfuldevelopmentcertificates": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_listedbuildingandconservationareaconsens": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_planningappeals78s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_planningconditionss73s79s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_planningobligationappeals106s": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode"; + case "pinswg_rows": + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode"; + break; + default: + return ""; + break; + } +}; diff --git a/components/account/personaldetails.js b/components/account/personaldetails.js index 70f449db..85fd9da6 100644 --- a/components/account/personaldetails.js +++ b/components/account/personaldetails.js @@ -82,10 +82,11 @@ let PersonalDetails = (props) => { let errorsobj = {}; const required = (value) => (value ? undefined : "Is required"); + 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 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/account/registerform.js b/components/account/registerform.js index 0b350e15..bb05dffb 100644 --- a/components/account/registerform.js +++ b/components/account/registerform.js @@ -23,6 +23,7 @@ const RenderTextfield = ({ input, type, errorMsg, + disabled, meta: { touched, error }, ...custom }) => { @@ -39,6 +40,7 @@ const RenderTextfield = ({ name={name} id={id} type={type} + disabled={disabled} /> {touched && error && ( { value, setRegisterFormComplete, setAccountCreatedComplete, + loggedInUserEmail, + emailaddress1, } = props; let { t, lang } = useTranslation(); @@ -135,7 +139,8 @@ const RegisterForm = (props) => {

{t( "account:register-new-account-sub-heading-1" - )} + )}{" "} + {loggedInUserEmail}

{ label={t( "account:register-new-account-email-address-label" )} + disabled /> { ); }; -const mapStateToProps = (state) => { +const mapStateToProps = (state, props) => { return { search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, //form: state.form, + initialValues: { + emailaddress1: props.loggedInUserEmail, + }, }; }; @@ -353,6 +362,7 @@ export default connect( )( reduxForm({ form: "accountRegisterForm", + enableReinitialize: true, destroyOnUnmount: false, })(RegisterForm) ); diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 72570954..d8f46e54 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -107,10 +107,7 @@ const Breadcrumbs = (props) => { ) : ( "" )} - {router.pathname == - (router.locale == "cy" - ? "/canlyniadauchwilio" - : "/searchresults") ? ( + {router.pathname == "/searchresults" ? ( <>
  • {t("common:breadcrumb-search-results")} @@ -128,6 +125,28 @@ const Breadcrumbs = (props) => { ) : ( "" )} + {router.pathname == "/myportal/advancedsearch" ? ( + <> +
  • + + + {t("common:breadcrumb-my-portal")} + + +
  • +
  • + {t("common:breadcrumb-advanced-search")} +
  • + + ) : ( + "" + )} {router.pathname == "/advancedsearchresults" ? ( <> {" "} @@ -156,6 +175,47 @@ const Breadcrumbs = (props) => { ) : ( "" )} + {router.pathname == + "/myportal/advancedsearchresults" ? ( + <> +
  • + + + {t("common:breadcrumb-my-portal")} + + +
  • +
  • + + + {t( + "common:breadcrumb-advanced-search" + )} + + +
  • +
  • + {t( + "common:breadcrumb-advanced-search-results" + )} +
  • + + ) : ( + "" + )} {router.pathname == "/newappeal" ? ( <>
  • @@ -442,10 +502,7 @@ const Breadcrumbs = (props) => { ) : ( "" )} - {router.pathname == - (router.locale == "cy" - ? "/manyliondns" - : "/dnsdetails") ? ( + {router.pathname == "/dnsdetails" ? ( <>
  • { >
    {t( @@ -191,23 +190,9 @@ const DocumentDetails = (props) => { ); }; - const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY; - - const encryptDocReference = (documentRef) => { - var hashlink = CryptoJS.HmacSHA256( - "documents/download/" + documentRef, - CryptoJS.enc.Hex.parse(WORDKEY) - ); - hashlink = hashlink.toString(CryptoJS.enc.Hex); - - return ( - "/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink - ); - }; - useEffect(() => { const docDetailsObj = async () => { - let docObj = await getSearchDocumentDetails1(incidentid) + let docObj = await getSearchDocumentDetails(incidentid) .then((data) => { //console.log(data); setDocumentDetails(data); @@ -239,7 +224,7 @@ const DocumentDetails = (props) => { console.log(historyDetail.pinswg_documentid); } else { historyArr.push( - getSearchDocumentHistory1( + getSearchDocumentHistory( historyDetail.pinswg_documentid ) ); @@ -252,8 +237,7 @@ const DocumentDetails = (props) => { }, [incidentid, setDocumentHistory, setDocumentDetails]); const getDocumentResults = (pageNumber) => { - //console.log(advancedSearch, searchString, pageNumber); - getSearchDocumentDetails1Paged(incidentid, pageNumber) + getSearchDocumentDetailsPaged(incidentid, pageNumber) .then((data) => { //console.log(data); setDocumentDetails(data); @@ -269,10 +253,7 @@ const DocumentDetails = (props) => { }; const getDocumentDetails = async () => { - let docObj = await getSearchDocumentDetails1Paged( - incidentid, - pageNumber - ) + let docObj = await getSearchDocumentDetailsPaged(incidentid, pageNumber) .then((data) => { //console.log(data); setDocumentDetails(data); @@ -303,7 +284,7 @@ const DocumentDetails = (props) => { console.log(historyDetail.pinswg_documentid); } else { historyArr.push( - getSearchDocumentHistory1Paged( + getSearchDocumentHistoryPaged( historyDetail.pinswg_documentid, pageNumber ) diff --git a/components/case/representationList.js b/components/case/representationList.js index 2e0b42f7..da22ec6e 100644 --- a/components/case/representationList.js +++ b/components/case/representationList.js @@ -73,12 +73,7 @@ const RepresentationList = (props) => { return (
    - + {t("case:documents-name-label")}: diff --git a/components/case/summary.js b/components/case/summary.js index 970f47e2..6a597d12 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -121,23 +121,28 @@ const CaseSummary = (props) => { ] || "not entered"}
    - {_.has(detailsObj, "pinswg_agentcontactname") ? ( -
    -
    - {t("case:summary-agent-label")} -
    -
    - {_.has( - detailsObj, - "pinswg_agentcontactname" - ) - ? detailsObj.pinswg_agentcontactname - : ""} -
    -
    - ) : ( - "" - )} + + {detailsObj.pinswg_agentcontactname != null && + (_.has( + detailsObj, + "pinswg_agentcontactname" + ) ? ( +
    +
    + {t("case:summary-agent-label")} +
    +
    + {_.has( + detailsObj, + "pinswg_agentcontactname" + ) + ? detailsObj.pinswg_agentcontactname + : ""} +
    +
    + ) : ( + "" + ))}
  • ); diff --git a/components/case/summaryTypes/pinswg_dnsid.js b/components/case/summaryTypes/pinswg_dnsid.js index 2602ff9b..b27dc1be 100644 --- a/components/case/summaryTypes/pinswg_dnsid.js +++ b/components/case/summaryTypes/pinswg_dnsid.js @@ -128,12 +128,12 @@ const Pinswg_dnsid = (props) => { transLookup, '$..[?(@.value=="' + detailsObj[ - "pinswg_procedure@OData.Community.Display.V1.FormattedValue" + "pinswg_choiceofprocedure@OData.Community.Display.V1.FormattedValue" ] + '")].value_cy' ) : detailsObj[ - "pinswg_procedure@OData.Community.Display.V1.FormattedValue" + "pinswg_choiceofprocedure@OData.Community.Display.V1.FormattedValue" ] || ""} @@ -245,44 +245,49 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_recommendation + '")].value_cy' ) - : detailsObj.pinswg_recommendation || - t( - "case:summary-no-date-entered-label" - )} - - -
    -
    - {t( - "case:summary-case-website-label" - )} -
    -
    - {router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - detailsObj.pinswg_webaddress + - '")].value_cy' - ) - : ( - - { - detailsObj.pinswg_webaddress - } - - ) || - t( - "case:summary-no-date-entered-label" - )} + : detailsObj.pinswg_recommendation}
    + + {detailsObj.pinswg_webaddress != null && ( +
    +
    + {t( + "case:summary-case-website-label" + )} +
    +
    + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj.pinswg_webaddress + + '")].value_cy' + ) + : ( + + { + 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 f2446653..8ae9f2a7 100644 --- a/components/case/summaryTypes/pinswg_electricityactid.js +++ b/components/case/summaryTypes/pinswg_electricityactid.js @@ -250,26 +250,28 @@ const Pinswg_electricityactid = (props) => { )} -
    -
    - {t( - "case:summary-case-website-label" - )} -
    -
    - {router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - detailsObj.pinswg_webaddress + - '")].value_cy' - ) - : detailsObj.pinswg_webaddress || - t( - "case:summary-no-date-entered-label" - )} -
    -
    + {detailsObj.pinswg_webaddress != null && ( +
    +
    + {t( + "case:summary-case-website-label" + )} +
    +
    + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj.pinswg_webaddress + + '")].value_cy' + ) + : detailsObj.pinswg_webaddress || + t( + "case:summary-no-date-entered-label" + )} +
    +
    + )} diff --git a/components/case/summaryTypes/pinswg_harbourrevisionorderid.js b/components/case/summaryTypes/pinswg_harbourrevisionorderid.js index e36f366f..3e963283 100644 --- a/components/case/summaryTypes/pinswg_harbourrevisionorderid.js +++ b/components/case/summaryTypes/pinswg_harbourrevisionorderid.js @@ -250,26 +250,28 @@ const Pinswg_harbourrevisionorderid = (props) => { )} -
    -
    - {t( - "case:summary-case-website-label" - )} -
    -
    - {router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - detailsObj.pinswg_webaddress + - '")].value_cy' - ) - : detailsObj.pinswg_webaddress || - t( - "case:summary-no-date-entered-label" - )} -
    -
    + {detailsObj.pinswg_webaddress != null && ( +
    +
    + {t( + "case:summary-case-website-label" + )} +
    +
    + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj.pinswg_webaddress + + '")].value_cy' + ) + : detailsObj.pinswg_webaddress || + t( + "case:summary-no-date-entered-label" + )} +
    +
    + )} diff --git a/components/case/summaryTypes/pinswg_transportandworkactid.js b/components/case/summaryTypes/pinswg_transportandworkactid.js index 346b38a4..0f38e6e1 100644 --- a/components/case/summaryTypes/pinswg_transportandworkactid.js +++ b/components/case/summaryTypes/pinswg_transportandworkactid.js @@ -102,26 +102,28 @@ const Pinswg_transportandworkactid = (props) => { )} -
    -
    - {t( - "case:summary-case-website-label" - )} -
    -
    - {router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - detailsObj.pinswg_webaddress + - '")].value_cy' - ) - : detailsObj.pinswg_webaddress || - t( - "case:summary-no-date-entered-label" - )} -
    -
    + {detailsObj.pinswg_webaddress != null && ( +
    +
    + {t( + "case:summary-case-website-label" + )} +
    +
    + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj.pinswg_webaddress + + '")].value_cy' + ) + : detailsObj.pinswg_webaddress || + t( + "case:summary-no-date-entered-label" + )} +
    +
    + )} diff --git a/components/cookiemanager/index.js b/components/cookiemanager/index.js index 226a7b6c..93c01dbb 100644 --- a/components/cookiemanager/index.js +++ b/components/cookiemanager/index.js @@ -20,7 +20,7 @@ const CookieManagementMain = (props) => { Object.assign(values, { "essential": "accepted", "usage": usageState, - "communications": communicationsState, + // "communications": communicationsState, "settings": settingsState, }); @@ -42,14 +42,15 @@ const CookieManagementMain = (props) => { ";expires=Thu, 01 Jan 1970 00:00:01 GMT"; } - usageState == "revoked" && delete_cookie("CookiePolicy", "/"), - delete_cookie("_ga", "/"), + usageState == "revoked" && delete_cookie("_ga", "/"), delete_cookie("_gid", "/"); cookie.set("planning_casework", true, { expires: expDate, path: "/", }); + + setSavedState(true); }; let cookieCheck = parseCookies(); @@ -59,14 +60,16 @@ const CookieManagementMain = (props) => { ? {} : JSON.parse(cookieCheck.CookiePolicy); + const [savedState, setSavedState] = useState(false); + const [usageState, setUsageState] = useState( typeof cookieCheck.CookiePolicy == "undefined" ? null : cookieObj.usage ); - const [communicationsState, setCommunicationsState] = useState( - typeof cookieCheck.CookiePolicy == "undefined" - ? null - : cookieObj.communications - ); + // const [communicationsState, setCommunicationsState] = useState( + // typeof cookieCheck.CookiePolicy == "undefined" + // ? null + // : cookieObj.communications + // ); const [settingsState, setSettingsState] = useState( typeof cookieCheck.CookiePolicy == "undefined" ? null @@ -78,9 +81,9 @@ const CookieManagementMain = (props) => { case "usage": setUsageState(value); break; - case "communications": - setCommunicationsState(value); - break; + // case "communications": + // setCommunicationsState(value); + // break; case "settings": setSettingsState(value); break; @@ -102,6 +105,22 @@ const CookieManagementMain = (props) => { {t("cookies:cookie-title-heading")}
    + + {savedState && ( +
    +

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

    +

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

    +
    + )} {typeof cookieCheck.CookiePolicy == "undefined" ? ( <>
    @@ -455,7 +474,7 @@ const mapStateToProps = (state) => { return { initialValues: { usage: state.accountDetails.cookieObj.usage, - communications: state.accountDetails.cookieObj.communications, + //communications: state.accountDetails.cookieObj.communications, settings: state.accountDetails.cookieObj.settings, }, }; diff --git a/components/footer.js b/components/footer.js index 715c1345..40f0b312 100644 --- a/components/footer.js +++ b/components/footer.js @@ -219,11 +219,9 @@ export default function Footer(props) {
  • Anfonwch neges e-bost at:{" "} PEDW.GwaithAchos@llyw.cymru @@ -110,7 +110,7 @@ export default function AccessibilityCY() {
  • Ffoniwch:{" "} 03000 604400 @@ -128,7 +128,7 @@ export default function AccessibilityCY() { ffoniwch ni neu anfonwch neges e-bost atom i gael cyfarwyddiadau;{" "} Cysylltwch â Ni @@ -174,9 +174,14 @@ export default function AccessibilityCY() {

    Statws cydymffurfio

    - Mae’r wefan hon yn cydymffurfio’n rhannol â Chanllawiau - Hygyrchedd Cynnwys y We (WCAG) fersiwn 2.1 – safon Lefel AA, - o ganlyniad i’r ‘achosion o ddiffyg + Mae’r wefan hon yn cydymffurfio’n rhannol â{" "} + + Chanllawiau Hygyrchedd Cynnwys y We (WCAG) fersiwn 2.1 + {" "} + – safon Lefel AA, o ganlyniad i’r ‘achosion o ddiffyg cydymffurfio’/’eithriadau’ neu’r ‘achosion o ddiffyg cydymffurfio ac eithriadau’] a restrir isod.

    @@ -184,26 +189,23 @@ export default function AccessibilityCY() {

    Diffyg cydymffurfio â’r rheoliadau hygyrchedd

    - Nid oes testun amgen ar gyfer rhai delweddau, felly ni all - pobl sy’n defnyddio rhaglen darllen sgrin gael at y - wybodaeth. Mae hyn yn methu maen prawf llwyddiant 1.1.1 - (cynnwys nad yw’n destun). -

    -

    - Bwriadwn ychwanegu testun amgen at yr holl ddelweddau erbyn - mis Medi 2020. Pan fyddwn yn cyhoeddi cynnwys newydd, byddwn - yn sicrhau bod ein defnydd o ddelweddau’n bodloni safonau - hygyrchedd. + Mae rhai o’r dogfennau a gyhoeddir ar-lein trwy’r gwasanaeth + hwn yn cynnwys diagramau cynllunio sy’n dechnegol eu natur i + raddau helaeth. Er y cydnabyddwn efallai na fydd pob agwedd + ar gynnwys o’r fath yn gwbl hygyrch, rydym wedi ceisio eu + gwella trwy gynyddu maint y testun sylfaenol lle y bo’n + bosibl, ac ychwanegu disgrifiadau testun ystyrlon i ategu + unrhyw wybodaeth weledol bwysig.

    Paratoi’r datganiad hygyrchedd hwn

    - Paratowyd y datganiad hwn ar [TBC]. Fe’i hadolygwyd - ddiwethaf ar [TBC when signed off]. + Paratowyd y datganiad hwn ar 22/11/2021. Fe’i hadolygwyd + ddiwethaf ar 02/12/2021.

    -

    + {/*

    Profwyd y wefan hon ddiwethaf ar [TBC]. Cynhaliwyd y prawf gan [add name of organisation that carried out test, or indicate that you did your own testing]. @@ -217,8 +219,8 @@ export default function AccessibilityCY() {

    Gallwch ddarllen yr adroddiad llawn ar y prawf hygyrchedd - [add link to report]. -

    + [add link to report]. +

    */}
  • ); diff --git a/components/footerDocs/accessibility_en.js b/components/footerDocs/accessibility_en.js index f01a939b..e3cdf56b 100644 --- a/components/footerDocs/accessibility_en.js +++ b/components/footerDocs/accessibility_en.js @@ -96,7 +96,7 @@ export default function AccessibilityEN() {
  • Email:{" "} PEDW.Casework@gov.wales @@ -105,7 +105,7 @@ export default function AccessibilityEN() {
  • Call:{" "} 03000 604400 @@ -150,7 +150,7 @@ export default function AccessibilityEN() {

    Find out how to{" "} contact us @@ -171,33 +171,37 @@ export default function AccessibilityEN() {

    Compliance status

    - This website is partially compliant with the Web Content - Accessibility Guidelines version 2.1 – Level AA standard, - due to the non-compliances’/‘the exemptions’ or ‘the - non-compliances and exemptions’] listed below. + This website is partially compliant with the{" "} + + Web Content Accessibility Guidelines version 2.1 + + – Level AA standard, due to the non-compliances listed + below.

    Non-compliance with the accessibility regulations

    - Some images do not have a text alternative, so people using - a screen reader cannot access the information. This fails - WCAG 2.1 success criterion 1.1.1 (non-text content). -

    -

    - We plan to add text alternatives for all images by September - 2020. When we publish new content we’ll make sure our use of - images meets accessibility standards. + Some documents published online via this service contain + planning diagrams that are largely technical in nature. + While we acknowledge that all aspects of such content may + not be fully accessible, we have endeavoured to improve them + by increasing the base text size where possible, and adding + meaningful text descriptions to supplement any important + visual information.

    Preparation of this accessibility statement

    - This statement was prepared on [TBC]. It was last reviewed - on [TBC when signed off]. + This statement was prepared on 22/11/2021. It was last + reviewed on 02/12/2021.

    -

    + {/*

    This website was last tested on [TBC]. The test was carried out by [add name of organisation that carried out test, or indicate that you did your own testing]. @@ -212,7 +216,7 @@ export default function AccessibilityEN() {

    You can read the full accessibility test report [add link to report]. -

    +

    */} ); diff --git a/components/footerDocs/privacy_cy.js b/components/footerDocs/privacy_cy.js index 1a60d7c6..bb8ef82a 100644 --- a/components/footerDocs/privacy_cy.js +++ b/components/footerDocs/privacy_cy.js @@ -11,1112 +11,1144 @@ export default function PrivacyCY() {

    - Privacy Statement CY + Datganiad Preifatrwydd

    -

    Purpose of this privacy notice

    +

    Diben yr hysbysiad preifatrwydd hwn

    - We are committed to ensuring that the personal data of our - customers is handled in accordance with the principles set - out in data protection laws. + Rydym wedi ymrwymo i sicrhau bod data personol ein + cwsmeriaid yn cael ei drin yn unol â’r egwyddorion a + amlinellir mewn deddfau diogelu data.

    - This privacy notice reflects the requirements of the UK - General Data Protection Regulation (GDPR) and Data - Protection Act 2018 and covers all types of casework handled - by Planning and Environment Decisions Wales.{" "} + Mae’r hysbysiad preifatrwydd hwn yn adlewyrchu gofynion + Rheoliad Cyffredinol ar Ddiogelu Data (GDPR) y Deyrnas + Unedig a Deddf Diogelu Data 2018, ac yn ymwneud â phob math + o waith achos sy’n cael ei drin gan Benderfyniadau Cynllunio + ac Amgylchedd Cymru.

    -

    It informs you about:

    +

    Mae’n rhoi gwybod i chi ynghylch:

    • - The specifics of the personal data handling practices - within Planning and Environment Decisions Wales (PEDW) - and what you can expect PEDW to do with the information - it collects.{" "} + Manylion penodol yr arferion trin data personol ym + Mhenderfyniadau Cynllunio ac Amgylchedd Cymru (PCAC) a’r + hyn y gallwch ddisgwyl i PCAC ei wneud â’r wybodaeth y + mae’n ei chasglu.
    • - What personal information we collect, how we collect it, - use it, store it, share it, and dispose of it. + Pa wybodaeth bersonol rydym ni’n ei chasglu, sut rydym + ni’n ei chasglu, ei defnyddio, ei storio, ei rhannu a’i + gwaredu.
    • - Personal information provided as part of all PEDW - casework that you can make, or comment on, or is - provided by other Government Departments and - Organisations using any of Planning and Environment - Decisions Wales’ Websites or other means.{" "} + Gwybodaeth bersonol a ddarperir yn rhan o holl waith + achos PCAC y gallwch ei gwneud, neu wneud sylwadau arni, + neu a ddarperir gan Adrannau a Sefydliadau eraill y + Llywodraeth gan ddefnyddio unrhyw un o wefannau + Penderfyniadau Cynllunio ac Amgylchedd Cymru neu + ddulliau eraill.
    • - How we process any personal information including - special category data you have voluntarily provided to - us relating directly to you or any other third-party - individual's information you may have provided - relating to PEDW casework. + Sut rydym yn prosesu unrhyw wybodaeth bersonol, gan + gynnwys data categori arbennig rydych wedi’i roi i ni’n + wirfoddol sy’n ymwneud yn uniongyrchol â chi neu + wybodaeth unrhyw unigolyn trydydd parti arall y gallech + fod wedi’i rhoi mewn perthynas â gwaith achos PCAC.
    • - Planning and Environment Decisions Wales handle a - variety of casework types which are submitted via the - PEDW Portal and a variety of other methods e.g. Post, - Digital Transfer and Email. + Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + ymdrin ag ystod o wahanol fathau o waith achos a + gyflwynir trwy Borth PCAC ac amrywiaeth o ddulliau + eraill e.e. post, trosglwyddiad digidol ac e-bost.

    - The PEDW Portal handles a range of casework (as documented - in Annex A).{" "} + Mae Porth PCAC yn ymdrin ag ystod o waith achos (fel y + cofnodir yn Atodiad A).

    - It also provides information about our processing of - personal information when dealing with complaints.{" "} + Mae hefyd yn rhoi gwybodaeth am sut rydym yn prosesu + gwybodaeth bersonol wrth ymdrin â chwynion.

    - This Privacy Notice may be updated and/or re-issued at any - time, and we will provide you with notice of any such - updates via the GOV.Wales and PEDW websites.{" "} + Gallai’r Hysbysiad Preifatrwydd hwn gael ei ddiweddaru a/neu + ei ailgyhoeddi unrhyw bryd, a byddwn yn rhoi gwybod i chi am + unrhyw ddiweddariadau o’r fath trwy wefan GOV.UK a gwefan + PCAC.

    - At our discretion, we may notify you by providing a ‘just in - time’ notice to cover any additional processing activities - not mentioned in this document.{" "} + Yn unol â’n disgresiwn, fe allem roi gwybod i chi trwy + ddarparu hysbysiad ‘mewn union bryd’ i ymdrin ag unrhyw + weithgareddau prosesu ychwanegol na chrybwyllir yn y ddogfen + hon.

    -

    Personal Data Definition

    +

    Diffiniad o Ddata Personol

    - The UKGDPR and Data Protection Act 2018 applies to the - processing of personal data relating to an individual (data - subject) who is the identified or identifiable person to - whom the personal data relates: + Mae GDPR y Deyrnas Unedig a Deddf Diogelu Data 2018 yn + berthnasol i brosesu data personol sy’n ymwneud ag unigolyn + (testun data) adnabyddedig neu adnabyddadwy y mae’r data + personol yn ymwneud ag ef:

    • - When the data subject can be directly or indirectly - identified from that information in combination with - other information.{" "} + Pan ellir adnabod testun y data yn uniongyrchol neu’n + anuniongyrchol o’r wybodaeth honno ar y cyd â gwybodaeth + arall.
    • - Wholly or partly by automated means the processing other - than by automated means of personal data which forms - part of, or is intended to form part of, a filing - system. + Yn gyfan gwbl neu’n rhannol trwy ddulliau awtomataidd, + prosesu heblaw trwy ddulliau awtomataidd ddata personol + sy’n ffurfio rhan o system ffeilio, neu y bwriedir iddo + ffurfio rhan o system ffeilio.
    • - Personal data only includes information relating to - natural persons who can be identified or who are - identifiable, directly from the information in question + Mae data personol dim ond yn cynnwys gwybodaeth sy’n + ymwneud â bod dynol y gellir ei adnabod neu sy’n + adnabyddadwy, yn uniongyrchol o’r wybodaeth dan sylw.
    • - Information about individuals acting as sole traders, - employees, partners, and company directors where they - are individually identifiable, and the information - relates to them as an individual may constitute personal - data. + Gallai gwybodaeth am unigolion sy’n gweithredu fel unig + fasnachwyr, cyflogeion, partneriaid a chyfarwyddwyr + cwmni lle y gellir eu hadnabod yn unigol, ac mae’r + wybodaeth yn ymwneud â nhw fel unigolyn, fod yn gyfystyr + â data personol.
    -

    It does not include:

    +

    Nid yw’n cynnwys:

    • - Where the identity of participants has been removed - (anonymised data). + Achosion lle mae hunaniaeth cyfranogwyr wedi cael ei + dileu (data dienw).
    • -
    • Information about a deceased person.
    • -
    • Companies or Public Authorities
    • +
    • Gwybodaeth am unigolyn sydd wedi marw.
    • +
    • Cwmnïau neu Awdurdodau Cyhoeddus

    - There are “special categories” of personal data (SCD) (this - was known as “sensitive personal data” in previous data - protection law), these are more sensitive in nature and - require specific handling under the legislation. + Mae “categorïau arbennig” o ddata personol (a adwaenwyd fel + “data personol sensitif” o dan y gyfraith diogelu data + flaenorol). Mae’r rhain yn fwy sensitif eu natur ac mae’n + rhaid eu trin mewn ffordd benodol o dan y ddeddfwriaeth.

    -

    Policy commitment to openness and transparency

    +

    Ymrwymiad polisi i fod yn agored ac yn dryloyw

    - One of the fundamental values of Planning and Environment - Decisions Wales is its commitment to openness and - transparency in respect of our statutory role processing and - deciding planning and all other related casework.{" "} + Un o werthoedd sylfaenol Penderfyniadau Cynllunio ac + Amgylchedd Cymru yw eu hymrwymiad i fod yn agored ac yn + dryloyw mewn perthynas â’n rôl statudol wrth brosesu a + phenderfynu ar waith achos cynllunio a’r holl waith achos + arall cysylltiedig.

    - In many instances in particular planning processes there are - obligations that require us to share the information that we - receive, and in some instances for this to be made publicly - available. We apply a general presumption in favour of - disclosure, but individual decisions will take into account - the statutory obligations on us, including under data - protection legislation. + Mewn llawer o achosion, yn enwedig prosesau cynllunio, ceir + rhwymedigaethau sy’n mynnu ein bod yn rhannu’r wybodaeth a + gawn ac, mewn rhai achosion, ein bod yn sicrhau bod y + wybodaeth honno ar gael i’r cyhoedd. Rydym yn rhagdybio’n + gyffredinol o blaid datgelu, ond bydd penderfyniadau unigol + yn ystyried ein rhwymedigaethau statudol, gan gynnwys o dan + ddeddfwriaeth diogelu data.

    -

    Data Controllers

    +

    Rheolwyr Data

    - The Welsh Government (WG) is the Data Controller for data - protection purposes (Planning and Environment Decisions - Wales is a division of WG). The address for WG is; Welsh - Government, Cathays Park, Cardiff, CF10 3NQ. + Llywodraeth Cymru (LlC) yw’r Rheolwr Data at ddibenion + diogelu data (mae Penderfyniadau Cynllunio ac Amgylchedd + Cymru yn un o is-adrannau LlC). Cyfeiriad LlC yw: + Llywodraeth Cymru, Parc Cathays, Caerdydd, CF10 3NQ.

    - Planning and Environment Decisions Wales is responsible for - deciding how we collect, store, and process your personal - information. This Privacy Notice explains in plain English - how we collect, use, and share your data. + Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn gyfrifol + am benderfynu sut rydym yn casglu, storio a phrosesu eich + gwybodaeth bersonol. Mae’r Hysbysiad Preifatrwydd hwn yn + esbonio’n syml sut rydym yn casglu, defnyddio a rhannu eich + data.

    - Planning and Environment Decisions Wales have appointed a - Senior Data Protection Manager to oversee our compliance - with data protection legislation. If you have any questions - about this Privacy Notice or on how we handle your personal - information, or believe we have not complied with your - rights as a data subject, please contact the Senior Data - Protection Manager (SDPM): + Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru wedi penodi + Uwch Reolwr Diogelu Data i sicrhau ein bod yn cydymffurfio â + deddfwriaeth diogelu data. Os oes gennych unrhyw gwestiynau + am yr Hysbysiad Preifatrwydd hwn neu sut rydym yn trin eich + gwybodaeth bersonol, neu’n credu nad ydym wedi cydymffurfio + â’ch hawliau fel testun data, cysylltwch â’r Uwch Reolwr + Diogelu Data:

    -

    By email to *** or;

    + +

    Trwy anfon neges e-bost at *** neu:

    +

    - In writing addressed to the Senior Data Protection Manager - (SDPM) at: Temple Quay House 2 The Square Temple Quay - Bristol BS1 6PN + Yn ysgrifenedig at yr Uwch Reolwr Diogelu Data/Senior Data + Protection Manager (SDPM) yn: Temple Quay House, 2 The + Square, Temple Quay, Bryste BS1 6PN

    - WG’s Data Protection Officer (DPO) formally oversees data - protection compliance for Planning and Environment Decisions - Wales. You may also contact the WG DPO: + Mae cydymffurfiaeth Penderfyniadau Cynllunio ac Amgylchedd + Cymru â diogelu data yn cael ei goruchwylio’n ffurfiol gan + Swyddog Diogelu Data LlC. Cewch gysylltu â Swyddog Diogelu + Data LlC:

    • - By e-mail to dataprotection@communities.gov.uk., or; + Trwy anfon neges e-bost at + dataprotection@communities.gov.uk, neu;
    • - In writing, addressed to the “Data Protection Officer” - at: Welsh Government, Cathays Park, Cardiff, CF10 3NQ + Yn ysgrifenedig at y “Swyddog Diogelu Data” yn: + Llywodraeth Cymru, Parc Cathays, Caerdydd, CF10 3NQ
    -

    - How to make a complaint about the processing of your - personal information{" "} -

    +

    Sut i gwyno am brosesu’ch gwybodaeth bersonol

    - When we process your personal information, we will comply - with the Data Protection Legislation/Regulations.{" "} + Pan fyddwn yn prosesu’ch gwybodaeth bersonol, byddwn yn + cydymffurfio â’r Ddeddfwriaeth/Rheoliadau Diogelu Data.

    - If you believe we have not complied with your rights as a - data subject, or our obligations, and you are you are - unhappy with the way Planning and Environment Decisions - Wales processes your personal information or you have any - questions about this Privacy Notice, or how we handle your - personal information, please contact us at ***. + Os credwch nad ydym wedi cydymffurfio â’ch hawliau fel + testun data, neu ein rhwymedigaethau, ac rydych yn anfodlon + â’r ffordd y mae Penderfyniadau Cynllunio ac Amgylchedd + Cymru yn prosesu’ch gwybodaeth bersonol, neu os oes gennych + unrhyw gwestiynau am yr Hysbysiad Preifatrwydd hwn neu sut + rydym yn trin eich gwybodaeth bersonol, cysylltwch â ni ar + ***.

    - Also for independent advice about data protection matters - you have the right to escalate any complaint at any time to - the Information Commissioner’s Office (the UK supervisory - authority for Data Protection issues) please see below for - their postal address, contact telephone number and website - link: + Hefyd, i gael cyngor annibynnol ar faterion diogelu data, + cewch uwchgyfeirio unrhyw gŵyn unrhyw bryd at Swyddfa’r + Comisiynydd Gwybodaeth (awdurdod goruchwyliol y Deyrnas + Unedig ar gyfer materion Diogelu Data). Gweler isod y + cyfeiriad post, y rhif ffôn a dolen i’r wefan:

    - Information Commissioner's Office
    + Swyddfa’r Comisiynydd Gwybodaeth
    1 Wycliffe House
    - Water Lane, Wilmslow
    - Cheshire
    + Water Lane, Wilmslow Swydd Gaer +
    SK9 5AF

    - Telephone helpline number:{" "} + Rhif llinell ffôn gymorth: - 0303 123 1113{" "} - {" "} + 0303 123 1113 +
    - https://ico.org.uk/ + https://ico.org.uk

    -

    1. Who are we?

    + +

    1. Pwy ydym ni?

    - Planning and Environment Decisions Wales is a division of - the Welsh Government. + Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn un o + is-adrannau Llywodraeth Cymru.

    • - Under data protection legislation, Planning and - Environment Decisions Wales is responsible for deciding - how we collect, store, and process your personal - information. + O dan ddeddfwriaeth diogelu data, mae Penderfyniadau + Cynllunio ac Amgylchedd Cymru yn gyfrifol am benderfynu + sut rydym yn casglu, storio a phrosesu’ch gwybodaeth + bersonol.
    • - Planning and Environment Decisions Wales deals with all - aspects of planning appeals, examinations of local plans - and any other planning-related and specialist casework.{" "} + Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + ymdrin â phob agwedd ar apeliadau cynllunio, + archwiliadau o gynlluniau lleol ac unrhyw waith achos + arall sy’n gysylltiedig â chynllunio a gwaith achos + arbenigol.
    • - These are undertaken by Planning and Environment - Decisions Wales or on behalf of relevant Welsh Minister.{" "} + Cynhelir y rhain gan Benderfyniadau Cynllunio ac + Amgylchedd Cymru neu ar ran Gweinidog perthnasol Cymru.
    • - For Community Infrastructure Levy Schedules (CILs), our - Inspectors are appointed by the Charging Authority to - examine their Charging Schedule. + Ar gyfer Atodlenni Ardoll Seilwaith Cymunedol (CILs), + penodir ein Harolygwyr gan yr Awdurdod Codi Tâl i + archwilio ei Atodlen Codi Tâl.
    -

    2. How do we collect personal information?

    +

    2. Sut rydym yn casglu gwybodaeth bersonol?

    • - You will have directly provided information to us, if - you make or take part, in a planning appeal, application - or examination as part of our planning processes.{" "} + Byddwch wedi rhoi gwybodaeth i ni’n uniongyrchol os + byddwch yn gwneud neu’n cymryd rhan mewn apêl gynllunio, + cais neu archwiliad yn rhan o’n prosesau cynllunio.
    • - You may also provide us indirectly with special category - information where you are providing information - regarding your personal circumstance (which may also - include personal and special category of other data - subjects) that you want to be considered within the - planning processes.{" "} + Fe allech hefyd roi gwybodaeth categori arbennig i ni’n + anuniongyrchol os ydych yn rhoi gwybodaeth am eich + amgylchiadau personol (a allai hefyd gynnwys gwybodaeth + categori personol ac arbennig am destunau data eraill) + yr ydych eisiau iddi gael ei hystyried yn y prosesau + cynllunio.
    • - Via our websites, e.g. connection data sent to our - webserver by your browser when you connect to our - website. + Trwy ein gwefannau e.e. data cysylltu a anfonir gan eich + porwr at ein gweinydd gwe pan fyddwch yn cysylltu â’n + gwefan.
    -

    3. Why do we process your personal information?

    +

    3. Pam rydym ni’n prosesu’ch gwybodaeth bersonol?

    - The information provided to us is used to determine appeals, - orders, applications and examinations. + Mae’r wybodaeth a roddir i ni yn cael ei defnyddio i + benderfynu ar apeliadau, gorchmynion, ceisiadau ac + archwiliadau.

    - PEDW Portal terms and conditions separately provide - information about how we use personal information we may - collect when and the types of personal data we may collect - when carrying out our duties under the Town and Country - Planning 1990 Legislation and other legislation in relation - to other casework. + Mae telerau ac amodau Porth PCAC yn darparu gwybodaeth ar + wahân am sut rydym yn defnyddio gwybodaeth bersonol y gallem + ei chasglu, pryd a’r mathau o ddata personol y gallem eu + casglu wrth gyflawni ein dyletswyddau o dan Ddeddfwriaeth + Cynllunio Gwlad a Thref 1990 a deddfwriaeth arall sy’n + ymwneud â gwaith achos arall.

    -

    PEDW PORTAL

    +

    +

    Porth PCAC

    - The information provided to us via the PEDW Portal is used - to process Planning and Enforcement Appeals cases. + Mae’r wybodaeth a roddir i ni trwy Borth PCAC yn cael ei + defnyddio i brosesu achosion Apeliadau Cynllunio a Gorfodi.

    • - Planning and Environment Decisions Wales will provide - guidance to making and taking part in casework types and - references to the statutory procedural rules that apply. + Bydd Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + rhoi arweiniad ar wneud a chymryd rhan mewn mathau o + waith achos a chyfeiriadau at y rheolau gweithdrefnol + statudol sy’n berthnasol.
    • - In accordance with the statutory rules, casework - representations are normally copied to the - appellant/applicant, the Local Authority (LA) and other - statutory parties to the case.{" "} + Yn unol â’r rheolau statudol, mae copi o + gynrychiolaethau gwaith achos fel arfer yn cael ei roi + i’r apelydd/ymgeisydd, yr awdurdod lleol (ALl) a + phartïon statudol eraill i’r achos.
    • - The LA is also required to make the casework - representations available to anyone who wishes to see - them.{" "} + Mae hefyd yn ofynnol i’r ALl sicrhau bod sylwadau ar y + gwaith achos ar gael i unrhyw un sy’n dymuno eu gweld.
    • - As they provide context to your representation and allow - for the effective running of the case e.g. allowing - parties with similar viewpoints to identify each other - and agree joint presentation of views at any hearing or - inquiry), the representations that we receive are - normally exchanged between the parties without redaction - of content or contact information, subject to the - condition that Planning and Environment Decisions Wales - determines that it is both necessary and proportionate - to do so.{" "} + Gan eu bod yn rhoi cyd-destun i’ch sylwadau ac yn + caniatáu i’r achos gael ei gynnal yn effeithiol e.e. yn + caniatáu i bartïon â safbwyntiau tebyg adnabod ei gilydd + a chytuno i gyflwyno safbwyntiau ar y cyd mewn unrhyw + wrandawiad neu ymchwiliad), mae’r sylwadau a gawn fel + arfer yn cael eu cyfnewid rhwng y partïon heb olygu + cynnwys na gwybodaeth gyswllt, ar yr amod bod + Penderfyniadau Cynllunio ac Amgylchedd Cymru o’r farn + bod hynny’n angenrheidiol ac yn gymesur.
    • - The information voluntarily provided can directly or - indirectly include personal information about other - individuals and can include special category data e.g. - medical information of other parties (please see Special - Category Data paragraph for further information). - Planning and Environment Decisions Wales will only - process such data where it is warranted and has the - appropriate legal basis to do so. + Gall y wybodaeth a roddir yn wirfoddol gynnwys + gwybodaeth bersonol am unigolion eraill yn uniongyrchol + neu’n anuniongyrchol, ac fe allai gynnwys gwybodaeth + categori arbennig e.e. gwybodaeth feddygol am bartïon + eraill (gweler y paragraff ynghylch Data Categori + Arbennig i gael rhagor o wybodaeth). Bydd Penderfyniadau + Cynllunio ac Amgylchedd Cymru yn prosesu data o’r fath + dim ond pan ellir ei gyfiawnhau a phan fydd ganddi sail + gyfreithiol briodol i wneud hynny.
    • - Please note that we do not accept anonymous or - confidential representations, however, you may comment - on a case and ask for your identity to be withheld. + Sylwer na fyddwn yn derbyn sylwadau dienw na + chyfrinachol, ond cewch wneud sylwadau ar achos a gofyn + i’ch hunaniaeth beidio â chael ei datgelu.
    • - If you request this then your representation will be - copied to the parties and provided to the Inspector - without your name and contact details, and your - representation may be given less weight by the Inspector - as a result. + Os byddwch yn gofyn am hyn, bydd eich sylwadau’n cael eu + copïo i’r partïon a’u rhoi i’r Arolygydd heb eich enw + a’ch manylion cyswllt, ac mae’n bosibl y bydd yr + Arolygydd yn rhoi llai o bwys i’ch sylwadau o ganlyniad.
    • - In the event that you do not want to be identifiable - from your representation you should avoid including - information which may identify you. + Os na fyddwch eisiau cael eich adnabod o’ch sylwadau, + dylech osgoi cynnwys gwybodaeth a allai ddatgelu pwy + ydych.

    - The appointed Inspector will consider the information - provided in the representations and reach their decision. - Their decision notice will provide the outcome for the case - and their reasoning + Bydd yr Arolygydd a benodwyd yn ystyried y wybodaeth a + roddwyd yn y sylwadau ac yn gwneud ei benderfyniad. Bydd ei + hysbysiad o benderfyniad yn rhoi’r canlyniad ar gyfer yr + achos a’i resymau drosto.

    -

    The information we publish on the PEDW Portal

    +

    Y wybodaeth rydym yn ei chyhoeddi ar Borth PCAC

    - We publish summary details of cases which we process on the - PEDW Portal.{" "} + Rydym yn cyhoeddi crynodeb o fanylion achosion rydym yn eu + prosesu ar Borth PCAC. +

    +
      +
    • Enw’r apelydd/ymgeisydd a chyfeiriad y safle.
    • +
    • Rydym hefyd yn cyhoeddi’r penderfyniad terfynol.
    • +
    • + Mae gennym bolisi golygu ac rydym yn dileu rhifau ffôn + personol, cyfeiriadau e-bost a llofnodion, yn ogystal â + gwybodaeth categori arbennig (fel gwybodaeth am iechyd + unigolyn). +
    • +
    • + Os oes gennych bryderon am gyhoeddi eich gwybodaeth, + dylech eu trafod gyda’r Swyddog Achos yn y lle cyntaf + cyn cyflwyno’ch sylwadau. +
    • +
    • + Fodd bynnag, os oes gennych bryderon pellach ynglŷn â + phrosesu neu drin eich data personol, cysylltwch â – I + assume WG DPO offices? +
    • +
    • + Er efallai na fyddwn yn cyhoeddi pob dogfen neu bob + achos, mae gennym rwymedigaeth statudol i anfon copi o + sylwadau at y partïon perthnasol. Mae’n ofynnol i’r ALl + sicrhau eu bod ar gael i unrhyw un a allai ddymuno eu + gweld, felly fe allech ddymuno cysylltu â’r ALl hefyd i + gadarnhau pa wybodaeth y mae’n ei chyhoeddi. +
    • +
    +

    Prosiectau Datblygiadau o Arwyddocâd Cenedlaethol

    +

    + O ran Datblygiad o Arwyddocâd Cenedlaethol (“DNS”) o dan + Ddeddf Cynllunio (Cymru) 2015, sy’n diwygio Deddf Cynllunio + Gwlad a Thref 1990 (“y Ddeddf”), mae Rheoliadau Datblygiadau + o Arwyddocâd Cenedlaethol (Cymru) 2016 (fel y’u diwygiwyd) a + Rheoliadau dilynol yn mynnu ein bod yn:

    • - The name of the appellant/applicant and the site - address.{" "} -
    • -
    • We also publish the final decision.
    • -
    • - We have a redaction policy and remove personal telephone - numbers, email addresses and signatures, and also - special category information (such as information about - an individual’s health). + Sicrhau bod mathau penodol o ddogfennau a gwybodaeth ar + gael yn fwy eang i gyfranogwyr eraill, a allai gynnwys + gwybodaeth bersonol, gan gynnwys sicrhau bod y rhain ar + gael i’r cyhoedd.
    • - If you have concerns about the publication of your - information, then you should discuss this with the Case - Officer in the first instance before submitting your - representation.{" "} + Rydym yn gwneud hyn trwy gyhoeddi dogfennau a gwybodaeth + ar Borth PCAC.
    • - However, if you have further concerns relating to the - processing or handling of your personal data please - contact … – I assume WG DPO offices? -
    • -
    • - Although we may not publish every document or every - case, we have a statutory obligation to copy - representations to the relevant parties. The LA is - obliged to make them available to anyone who may wish to - see them so you may also want to check with them what - information they publish. + Os oes gennych ymholiadau neu bryderon penodol ynglŷn â + phrosesu eich data personol yn y modd hwn, cysylltwch + â’r swyddog achos perthnasol yn y lle cyntaf i drafod yr + arweiniad a’ch pryderon.
    -

    Developments of National Significance Projects

    -

    - For the Development of National Significance (“DNS”) under - Planning (Wales) Act 2015, which amends the Town and County - Planning Act 1990 (“the Act”), the Developments of National - Significance (Wales) Regulations 2016 (as amended) and - subsequent Regulations which requires us to:{" "} -

    +

    Y wybodaeth a gyhoeddwn ar-lein

      +
    • Dogfennau cais
    • - Make certain documents and information more widely - available to other participants, which may include - personal information, publicly available.{" "} + Sylwadau Perthnasol, Sylwadau Ysgrifenedig, a dogfennau + eraill ar y wefan Datblygiadau o Arwyddocâd + Cenedlaethol.
    • - We do this by publishing documents and information on - the PEDW Portal. + Bydd y cofnodion cyhoeddedig hyn yn cynnwys enw’r + unigolyn sydd wedi cyflwyno’r ddogfen.
    • - If you have specific queries or concerns in respect of - this processing of your personal data, then please - contact the relevant case officer in the first instance - to discuss the guidance and your concerns. -
    • -
    -

    The Information we publish online

    -
      -
    • Application documents
    • -
    • - Relevant Representations, Written Representations, and - other documents on the Developments of National - Significance website.{" "} + Yr Arolygydd neu’r Arolygwyr a benodwyd i archwilio + cais.
    • - These published records will include the name of the - person that has submitted the document. + Cyn cyhoeddi unrhyw o ddogfennau, rydym yn golygu (neu’n + ‘tywyllu’) manylion personol penodol, e.e. rhifau ffôn; + cyfeiriadau; cyfeiriadau e-bost; llofnodion a gwybodaeth + bersonol sensitif (data categori arbennig).
    • - The Inspector or Inspectors appointed to carry out the - examination of an application{" "} + Rydym hefyd yn golygu unrhyw gynnwys yr ystyriwn y + gallai fod yn enllibus.
    • - Before publishing any documents, we redact (or ‘blank - out’) certain personal details e.g. telephone numbers; - addresses; email addresses; signatures and sensitive - personal information (special category data).{" "} + Ni fyddwn yn golygu unrhyw wybodaeth bersonol mewn + dogfennau a gynhyrchwyd gan ymgeiswyr lle y byddai hyn + yn atal archwilio cais yn effeithiol e.e. yn atal + Penderfyniadau Cynllunio ac Amgylchedd Cymru rhag + cyflawni ei thasg gyhoeddus. Er enghraifft, mae rhai + dogfennau sy’n cael eu cyhoeddi yn cynnwys enwau a + chyfeiriadau Partïon â Buddiant oherwydd byddai’r + Datblygiad Arfaethedig yn effeithio ar dir neu hawliau’r + Partïon â Buddiant hynny.
    • - We also redact any content that we consider to be - potentially libellous. -
    • -
    • - We don’t redact any personal information in documents - produced by applicants where this would hinder the - effective examination of an application e.g. Planning - and Environment Decisions Wales’s carrying out of its - public task. For example, certain documents that are - published which includes the names and addresses of - Interested Parties because the land or rights of those - Interested Parties would be affected by the Proposed - Development. -
    • -
    • - We also publish the Examining Authority’s Recommendation - Report and the decision of the Welsh Ministers, both of - which may contain personal information. + Rydym hefyd yn cyhoeddi Adroddiad Argymhelliad yr + Awdurdod Archwilio a phenderfyniad Gweinidogion Cymru, y + gallai’r ddau gynnwys gwybodaeth bersonol.

    - Alternatively where our sponsor departments are responsible - for making the decision on the case, the Inspector will - produce a report. The Inspectors report and the - representations provided to them will then be sent to our - sponsor department. + Fel arall, pan fydd ein hadrannau noddi’n gyfrifol am + benderfynu ar achos, bydd yr Arolygydd yn llunio adroddiad. + Yna, bydd adroddiad yr Arolygydd a’r sylwadau a roddwyd + iddo’n cael eu hanfon at ein hadran noddi.

    - 4. Under what Legal Basis do we process your personal - information?{" "} + 4. O dan ba Sail Gyfreithiol rydym yn prosesu’ch gwybodaeth + bersonol?

    - It is necessary for us to process your personal information - to enable us to facilitate the planning process under the - Town and Country Planning 1990, the Planning and Compulsory - Purchase Act 2004, the Planning Act 2008, the Planning Act - Wales 2015 and various other legislations e.g. Highway Act - 1980, for all Planning Inspectorate Casework + Mae angen i ni brosesu’ch gwybodaeth bersonol er mwyn i ni + allu hwyluso’r broses gynllunio o dan Ddeddf Cynllunio Gwlad + a Thref 1990, Deddf Cynllunio a Phrynu Gorfodol 2004, Deddf + Cynllunio 2008, Deddf Cynllunio (Cymru) 2015 ac amryw + ddeddfwriaethau eraill e.e. Deddf Priffyrdd 1980, ar gyfer + holl waith achos Penderfyniadau Cynllunio ac Amgylchedd + Cymru.

    - The lawful bases for processing are set out in Article 6 of - the UK GDPR. Planning and Environment Decisions Wales uses - the lawful basis detailed in: + Amlinellir y seiliau cyfreithlon ar gyfer prosesu yn Erthygl + 6 GDPR y Deyrnas Unedig. Mae Penderfyniadau Cynllunio ac + Amgylchedd Cymru yn defnyddio’r seiliau cyfreithlon a + fanylir yn: +

    + +

    + Erthygl 6(1)(a) Lle mae’r cwsmer wedi rhoi ei ganiatâd i + brosesu ei ddata personol at ddiben penodedig.

    - Article 6(1)(a)Where the customer has given their consent - for the processing of their personal data for a specified - purpose. + Erthygl 6(1)(c) Ar gyfer prosesu sylwadau ysgrifenedig a + dogfennau, y sail gyfreithlon sy’n ymwneud â phrosesu sy’n + angenrheidiol i gydymffurfio â rhwymedigaeth gyfreithiol y + mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + ddarostyngedig iddi.

    - Article 6(1)(c) For the processing of written - representations and documents, the lawful basis which - relates to processing that is necessary for compliance with - a legal obligation to which Planning and Environment - Decisions Wales is subject. + Erthygl 6(1)(e) Ar gyfer prosesu sy’n ofynnol i gyflawni + tasg a wneir er budd y cyhoedd neu wrth arfer awdurdod + swyddogol a roddwyd i Benderfyniadau Cynllunio ac Amgylchedd + Cymru.

    - Article 6(1)(e) For the processing required for the - performance of a task carried out in the public interest or - in exercise of official authority vested in Planning and - Environment Decisions Wales{" "} + Erthygl 9(2)(g) Ar gyfer prosesu Data Categori Arbennig, y + sail gyfreithlon yw pan fydd prosesu categorïau arbennig o + ddata personol yn angenrheidiol am resymau sydd o fudd + sylweddol i’r cyhoedd. Mae hefyd yn ymwneud â’n tasg + gyhoeddus a diogelu eich hawliau sylfaenol, ac Atodlen 1 + rhan 2(6) DPA2018 sy’n ymwneud â dibenion statudol a + llywodraeth.

    +

    5. Pa ddata personol rydym ni’n ei brosesu?

    - Article 9(2)(g) For the processing of Special Category Data - the lawful basis is where the processing of special - categories of personal data is necessary for reasons of - substantial public interest. It also relates to our public - task and the safeguarding of your fundamental rights, and - Schedule 1 part 2(6) of the DPA2018 which relates to - statutory and government.{" "} -

    -

    5. What personal data we process?

    -

    - We collect and process a range of information about you - including:{" "} + Rydym yn casglu a phrosesu amrywiaeth o wybodaeth amdanoch, + gan gynnwys:

    • - Any and all Personal Information you voluntarily provide - to us as part of one or more of the following processes: - planning and associated appeal types, Developments of - National Significance (DNS) Projects and Specialist - casework + Unrhyw a phob math o wybodaeth bersonol a roddoch i ni’n + wirfoddol yn rhan o un neu fwy o’r prosesau canlynol: + apêl gynllunio a mathau cysylltiedig o apeliadau, + Prosiectau Datblygiadau o Arwyddocâd Cenedlaethol (DNS) + a gwaith achos arbenigol.
    • - The information can directly or indirectly include - personal information about other individuals and can - include special category data e.g. medical information - of other parties (please see Special Category Data - paragraph below for further information). + Gall y wybodaeth gynnwys gwybodaeth bersonol am + unigolion eraill yn uniongyrchol neu’n anuniongyrchol, + ac fe all gynnwys data categori arbennig e.e. gwybodaeth + feddygol am bartïon eraill (gweler y paragraff isod + ynghylch Data Categori Arbennig i gael rhagor o + wybodaeth).
    • -
    • Your name
    • -
    • Address
    • +
    • Eich enw
    • +
    • Cyfeiriad
    • - Telephone Phone number (generally and if a participant - in a virtual event who joins by mobile phone or landline - phone) + Rhif ffôn (yn gyffredinol ac os yw’n gyfranogwr mewn + digwyddiad rhithwir sy’n ymuno trwy ffôn symudol neu + ffôn tirlinell)
    • -
    • E-Mail address
    • -
    • IP address
    • -
    • Electronic and hard copy correspondence
    • -
    • Application documents
    • +
    • Cyfeiriad e-bost
    • +
    • Cyfeiriad IP
    • +
    • Gohebiaeth ar ffurf electronig a chopi caled
    • +
    • Dogfennau cais
    • - Written submissions made by Interested Parties and - others involved in the planning appeal process + Cyflwyniadau ysgrifenedig a wnaed gan Bartïon â Buddiant + ac eraill sy’n ymwneud â phroses yr apêl gynllunio
    • -
    • Written notes
    • -
    • Hard copies of information
    • +
    • Nodiadau ysgrifenedig
    • +
    • Copïau caled o wybodaeth
    • - Information provided by other Government Departments and - Organisations + Gwybodaeth a roddwyd gan adrannau a sefydliadau eraill y + Llywodraeth
    -

    Special Category Data

    +

    Data Categori Arbennig

    - Special category data defined at Article 9 UK GDPR as - personal data is: + Data categori arbennig a ddiffinnir yn Erthygl 9 GDPR y + Deyrnas Unedig fel data personol yw:

      -
    • Racial or ethnic origin
    • -
    • Political opinions
    • -
    • Religious or philosophical beliefs
    • -
    • Trade union membership
    • -
    • Genetic data
    • +
    • Hiliol neu darddiad ethnig
    • +
    • Safbwyntiau gwleidyddol
    • +
    • Credoau crefyddol neu athronyddol
    • +
    • Aelodaeth o undeb llafur
    • +
    • Data genetig
    • - Biometric data for the purpose of uniquely identifying a - natural person + Data biometrig at ddiben adnabod bod dynol yn unigryw
    • -
    • Data concerning health or
    • +
    • Data yn ymwneud ag iechyd neu
    • - Data concerning a natural person’s sex life or sexual - orientation + Ddata yn ymwneud â bywyd rhywiol neu gyfeiriadedd + rhywiol bod dynol

    - This does not include personal data about criminal - allegations, proceedings or convictions, as separate rules - apply. For further information, please see the Information - Commissioners separate guidance on criminal offence data. + Nid yw hyn yn cynnwys data personol am honiadau, achosion + neu euogfarnau troseddol, gan fod rheolau ar wahân yn + berthnasol. I gael rhagor o wybodaeth, gweler canllawiau ar + wahân y Comisiynydd Gwybodaeth ar ddata troseddau.

    • - Planning and Environment Decisions Wales will not - routinely request special category data as part of our - processing activities. However, these may be provided as - part of the process. Please make sure that when you - submit special category data it is necessary and - relevant to the case.{" "} + Ni fydd Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + gofyn am ddata categori arbennig fel mater o drefn yn + rhan o’n gweithgareddau prosesu. Fodd bynnag, fe allai + gael ei ddarparu yn rhan o’r broses. Pan fyddwch yn + cyflwyno data categori arbennig, gwnewch yn siŵr ei fod + yn angenrheidiol ac yn berthnasol i’r achos.
    • - For certain cases we may need to collect some special - category data to the extent that this is relevant to the - case. This could for example include or relate to - information about status (family background, - relationships, and dependents), business and livelihood, - as well as accommodation, health and/or educational - needs.{" "} + Ar gyfer rhai achosion, efallai y bydd angen i ni gasglu + rhywfaint o ddata categori arbennig i’r graddau bod hyn + yn berthnasol i’r achos. Gallai hyn, er enghraifft, + gynnwys neu ymwneud â gwybodaeth am statws (cefndir + teuluol, perthnasoedd a dibynyddion), busnes a + bywoliaeth, yn ogystal â llety, iechyd a/neu anghenion + addysgol.
    • - The information voluntarily provided can directly or - indirectly include personal information about other - individuals and can include special category data e.g. - medical information of other parties. Planning and - Environment Decisions Wales will only process such data - where it is warranted and has the appropriate legal - basis to do so. Please make sure it is necessary and - relevant to the case when you provide it to Planning and - Environment Decisions Wales. + Gall y wybodaeth a roddir yn wirfoddol gynnwys + gwybodaeth bersonol am unigolion eraill yn uniongyrchol + neu’n anuniongyrchol, ac fe all gynnwys data categori + arbennig e.e. gwybodaeth feddygol am bartïon eraill. + Bydd Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + prosesu data o’r fath dim ond pan ellir ei gyfiawnhau a + phan fydd ganddi sail gyfreithiol briodol i wneud hynny. + Gwnewch yn siŵr ei bod yn angenrheidiol ac yn berthnasol + i’r achos pan fyddwch yn ei rhoi i Benderfyniadau + Cynllunio ac Amgylchedd Cymru.

    - We may process and store special categories of more - sensitive personal information relating to any individual - that is voluntarily provided by you as part of all the - Planning Casework Process that you wish to be considered. - e.g. Medical information relating to yourself, family member - and in some instances a child. The personal information - provided may be held on a computer system, or in a manual - record such as in a physical file. + Efallai y byddwn yn prosesu ac yn storio categorïau arbennig + o wybodaeth bersonol fwy sensitif sy’n ymwneud ag unrhyw + unigolyn a roddir yn wirfoddol gennych chi yn rhan o’r holl + broses gwaith achos cynllunio rydych eisiau iddi gael ei + hystyried e.e. gwybodaeth feddygol yn ymwneud â chi eich + hun, aelod o’r teulu ac, mewn rhai achosion, plentyn. + Gallai’r wybodaeth bersonol a roddir gael e ei dal ar system + gyfrifiadurol, neu ar gofnod papur fel mewn ffeil ffisegol.

    -

    +

    6. Beth yw canlyniadau peidio â darparu gwybodaeth?

    +
      +
    • + Os na fyddwch yn rhoi’r wybodaeth sy’n ofynnol i ni i + ddilysu eich achos, mae’n bosibl na fyddwn yn gallu ei + ystyried. Byddwn fel arfer yn rhoi gwybod i chi os bydd + hyn yn wir. +
    • +
    • + Nid oes rhwymedigaeth statudol ar bartïon â buddiant i + gymryd rhan mewn achos. +
    • +
    • + Os ydych yn apelydd/asiant nad yw’n rhoi’r wybodaeth + statudol sy’n angenrheidiol i ddilysu eich achos o fewn + y cyfnodau amser penodedig, ni fyddwn yn gallu ystyried + eich achos ac fe allai gael ei ystyried yn annilys. +
    • +
    • + Os ydych yn ymgeisydd nad yw’n rhoi’r wybodaeth statudol + sy’n angenrheidiol i ystyried eich cais, efallai na + fyddwn yn gallu derbyn eich cais i’w Archwilio o dan + adran 55 Deddf Cynllunio 2008. +
    • +
    • + O ran Cynlluniau Lleol, mae’n ofynnol i’r Arolygydd + archwilio p’un a yw’r cynllun yn gadarn ac yn + cydymffurfio’n gyfreithiol ac, wrth wneud hynny, mae’n + rhaid iddo ystyried unrhyw sylwadau a dogfennau eraill a + gyflwynwyd gan yr ALl. +
    • +
    • + Dylai’r rhai hynny sy’n cymryd rhan mewn archwiliad o + gynllun lleol nodi y bydd yr ALl yn sicrhau bod eu + sylwadau ‘ar gael’ yn unol â’r Rheoliadau, gan gynnwys + eu cyhoeddi ar wefan yr ALl. Fel Rheolwr Data, caiff yr + ALl olygu rhywfaint neu’r cyfan o’r wybodaeth bersonol a + gynhwysir mewn sylwadau a dogfennau eraill y sicrheir eu + bod ‘ar gael’, neu beidio. Er mwyn sicrhau archwiliad + agored a theg, mae’n bwysig bod yr Arolygydd a’r holl + gyfranogwyr eraill ym mhroses yr archwiliad yn gwybod + pwy sydd wedi gwneud sylwadau ynglŷn â’r cynllun a + chynnwys y sylwadau hynny. +
    • +
    • + Nid oes rhwymedigaeth statudol ar barti â buddiant i + gymryd rhan mewn archwiliad o gynllun lleol na darparu + unrhyw wybodaeth benodol os yw’n dewis peidio â gwneud + hynny. +
    • +
    • + Os ydych yn Barti â Buddiant arall ac nad ydych yn rhoi + eich enw a/neu enw’r sefydliad neu’r grŵp rydych yn ei + gynrychioli, efallai na fyddwn yn gallu derbyn eich + sylwadau. +
    • +
    • + Nid ydym yn derbyn sylwadau dienw neu gyfrinachol ar + gyfer unrhyw fath o waith achos Penderfyniadau Cynllunio + ac Amgylchedd Cymru. +
    • +
    +

    7. Gwybodaeth am blant

    +

    + Nid yw Penderfyniadau Cynllunio ac Amgylchedd Cymru yn + darparu gwasanaethau’n uniongyrchol i blant nac yn casglu eu + gwybodaeth bersonol yn rhagweithiol. Fodd bynnag, weithiau + rhoddir gwybodaeth i ni am blant yn wirfoddol yn rhan o’r + prosesau apeliadau, ceisiadau, gorchmynion ac archwiliadau. + Gall hyn gynnwys data categori arbennig a roddir mewn + sylwadau o bob agwedd ar waith achos. +

    +

    8. Am ba mor hir rydym ni’n cadw’ch data personol?

    +

    + Byddwn yn cadw gwybodaeth bersonol am gyhyd ag sy’n + angenrheidiol i ddarparu ein gwasanaethau a chyflawni ein + rhwymedigaethau cyfreithiol a rheoliadol yn unig. Mae gennym + bolisïau a gweithdrefnau penodol ynglŷn â rheoli a chadw + cofnodion, fel bod gwybodaeth bersonol yn cael ei hadolygu + a’i dileu ar ôl cyfnod rhesymol gan ddilyn y meini prawf + canlynol: +

    +
      +
    • + Y diben neu’r gweithgarwch busnes sy’n golygu bod angen + prosesu eich gwybodaeth. +
    • +
    • + P’un a oes gennym unrhyw rwymedigaeth gyfreithiol i + barhau i brosesu’ch gwybodaeth. +
    • +
    • + P’un a oes gennym unrhyw sail gyfreithiol o dan y + gyfraith diogelu data i barhau i brosesu’ch gwybodaeth + (e.e. Tasg Gyhoeddus). +
    • +
    • + Unrhyw arferion sector cytunedig perthnasol yn ymwneud â + pha mor hir y dylid cadw gwybodaeth. +
    • +
    • + I amddiffyn yn erbyn heriau cyfreithiol a rheoliadol. +
    • +
    +

    9. Gyda phwy rydym ni’n rhannu eich data?

    +

    + Yn unol â’r rheolau statudol a’r canllawiau perthnasol, mae + copi o sylwadau gwaith achos fel arfer yn cael ei anfon at: +

    +
      +
    • Apelyddion/Ymgeiswyr
    • +
    • Partïon â buddiant
    • +
    • Awdurdodau lleol
    • +
    • + Mae awdurdodau lleol hefyd yn gyfrifol am sicrhau bod y + sylwadau gwaith achos ar gael i unrhyw un sy’n dymuno eu + gweld. +
    • +
    • Swyddogion Rhaglen allanol
    • +
    • + Aelodau’r cyhoedd (byd-eang) pan fyddant wedi’u cyhoeddi + ar ein gwefannau +
    • +
    • Partïon statudol eraill i’r achos
    • +
    • Partïon statudol eraill fel rheoleiddwyr allanol.
    • +
    • + Rydym yn rhoi eich gwybodaeth i Weinidog perthnasol + Cymru sy’n gwneud y penderfyniad terfynol ar y ceisiadau + a’r apeliadau a archwiliwn trwy’r canlynol: +
        +
      • + Yr Adran Busnes, Ynni a Strategaeth Ddiwydiannol +
      • +
      • Yr Adran Drafnidiaeth
      • +
      • + Adran yr Amgylchedd, Bwyd a Materion Gwledig +
      • +
      • + Y Weinyddiaeth Tai, Cymunedau a Llywodraeth + Leol. +
      • +
      +
    • + +
    • + Er mwyn bod yn deg i bartïon eraill sydd â buddiant mewn + achos, mae angen i ni rannu’ch sylwadau fel y nodwyd + uchod. Mae hefyd yn rhoi cyd-destun ac yn caniatáu ar + gyfer cynnal ein prosesau gwaith achos yn effeithiol, + e.e. yn caniatáu i bartïon sydd â safbwyntiau tebyg i + adnabod ei gilydd a chytuno ar gyflwyno safbwyntiau ar y + cyd mewn unrhyw wrandawiad neu ymchwiliad, felly mae’r + sylwadau a gawn yn cael eu cyfnewid rhwng y partïon, ar + yr amod bod Penderfyniadau Cynllunio ac Amgylchedd Cymru + o’r farn bod hyn yn angenrheidiol ac yn gymesur, heb + olygu’r cynnwys na’r wybodaeth gyswllt. Byddwn yn trin + eich gwybodaeth yn gyfrinachol os byddwch yn gofyn i ni + wneud hynny, ond dylech fod yn ymwybodol y gallai’r + Arolygydd roi llai o bwys i’ch sylwadau oherwydd hynny. +
    • +
    +

    + Bydd yr Arolygydd neu’r unigolyn a benodwyd yn ystyried y + wybodaeth a a roddwyd yn y sylwadau ac yn gwneud ei + benderfyniad. Bydd ei hysbysiad o benderfyniad yn rhoi + canlyniad yr achos a’i resymau drosto. +

    +

    + Fel arall, pan fydd Gweinidogion Cymru ac adrannau a + sefydliadau eraill y Llywodraeth yn gyfrifol am benderfynu + ar yr achos, bydd yr Arolygydd yn llunio adroddiad + argymhelliad. Bydd adroddiad yr Arolygydd a’r sylwadau’n + cael eu darparu iddynt. +

    +

    + Mewn rhai amgylchiadau, fel o dan orchymyn llys, mae gennym + rwymedigaeth gyfreithiol i rannu gwybodaeth. Efallai y bydd + angen i ni rannu’ch gwybodaeth bersonol â’r canlynol hefyd: +

    +
      +
    • + Asiantaethau ac adrannau eraill y llywodraeth a gweision + sifil +
    • +
    • + Ein cynrychiolwyr cyfreithiol ni neu gynrychiolwyr + cyfreithiol eraill +
    • +
    • Archwilwyr, a
    • +
    • + Rheoleiddwyr, neu i gydymffurfio â’r gyfraith fel arall. +
    • +
    +

    + Mae’n bosibl y defnyddiwn ddarparwyr gwasanaeth trydydd + parti i brosesu gwybodaeth (gweler Atodiad B am restr lawn) + ar ein rhan mewn perthynas â’n gwaith achos e.e. darparu + gwasanaethau technoleg gwybodaeth. Pan fyddwn yn gwneud + hynny, bydd contractau’n cael eu llunio i sicrhau bod eich + gwybodaeth bersonol yn cael ei phrosesu yn unol â’n + cyfarwyddiadau ni yn unig (oni bai ei bod yn ofynnol fel + arall yn ôl y gyfraith), a bod mesurau priodol ar waith i + sicrhau diogelwch gwybodaeth. +

    +

    + Yn ogystal, mae’n ofynnol i ni, o dan Ddeddf Cofnodion + Cyhoeddus 1958 (fel y’i diwygiwyd), drosglwyddo cofnodion + i’r Archifau Cenedlaethol i’w cadw’n barhaol. Gallai rhai + o’r cofnodion hyn gynnwys data personol ein cwsmeriaid. +

    +

    Pwy fydd yn gallu cael at eich data?

    +

    + Rydym wedi ymrwymo i wneud popeth y gallwn i gadw’ch data’n + ddiogel. Rydym wedi sefydlu systemau a phrosesau i atal + mynediad at eich data neu ddatgelu eich data heb awdurdod + e.e. rydym yn diogelu eich data gan ddefnyddio lefelau + amrywiol o amgryptio, ac mae rheolaethau mynediad perthnasol + ar waith i reoli a thrin eich gwybodaeth bersonol yn + effeithiol. +

    +

    + Pan ddefnyddir darparwyr gwasanaeth trydydd parti, sefydlir + contractau a/neu drwyddedau i sicrhau bod eich gwybodaeth + bersonol yn cael ei phrosesu yn unol â’n cyfarwyddiadau ni + yn unig (oni bai ei bod yn ofynnol fel arall yn ôl y + gyfraith), a bod mesurau priodol ar waith i sicrhau + diogelwch y wybodaeth honno. +

    +

    + Pan fyddwch yn gwneud apêl/cais neu’n cyflwyno sylwadau ar + unrhyw ran o’n gwaith achos, dylech gofio bod gofynion + statudol arnom, mewn rhai achosion, i sicrhau bod y + wybodaeth hon ar gael yn ehangach. +

    +

    + Bydd hyn fel arfer yn cael ei amlinellu yn ein canllawiau, + ond os oes gennych ymholiadau neu bryderon penodol ynglŷn ag + achos penodol, cysylltwch â’r swyddog achos a fydd yn trafod + y mater gyda PCAC. +

    +

    10. A ydym ni’n defnyddio unrhyw brosesyddion data?

    +

    + Ydym - rhoddir rhestr o’n prosesyddion data presennol yn + Atodiad B. +

    +

    11. Eich hawliau mewn perthynas â phrosesu

    +

    + O dan y gyfraith diogelu data, mae gennych hawliau ynglŷn â + phrosesu eich data personol. Mae’r hawliau sydd ar gael i + chi yn dibynnu ar y rheswm pam rydym yn prosesu’ch + gwybodaeth. Nid oes rhaid i chi dalu am arfer eich hawliau. + Rhoddir mis i ni ymateb i chi. +

    +

    Eich hawliau o dan y GDPR (DU) yw’r hawl:

    +
      +
    • I gael gwybod
    • +
    • I gael mynediad
    • +
    • I gywiro
    • +
    • I ddileu
    • +
    • I gyfyngu ar brosesu
    • +
    • I gludadwyedd data
    • +
    • I wrthwynebu
    • +
    • + Hawliau yn ymwneud â gwneud penderfyniadau awtomataidd a + phroffilio. (Nid yw Penderfyniadau Cynllunio ac + Amgylchedd Cymru yn gwneud penderfyniadau awtomataidd + nac yn proffilio). +
    • +
    +

    + Nid yw pob un o’r hawliau hyn yn absoliwt, sy’n golygu + efallai y byddant yn berthnasol mewn rhai sefyllfaoedd yn + unig ac fe allent fod yn ddarostyngedig i eithriadau ac + esemptiadau cyfreithiol. +

    +

    + Mae rhagor o wybodaeth am eich hawliau ar gael ar wefan yr + ICO. +

    +

    12. Cofrestru am Gyfrif ar gyfer Porth PCAC

    +

    + Mae’n rhaid i ddefnyddwyr Porth PCAC greu cyfrif gyda ni er + mwyn cyflwyno apeliadau neu unrhyw sylwadau. Bydd cofrestru + gyda ni yn eich galluogi i ddefnyddio ein hystod lawn o + wasanaethau apeliadau, gan gynnwys tudalen hafan bersonol. +

    +

    + Hefyd, y ffordd orau o wneud sylwadau ar achos presennol yw + cofrestru gyda ni yn gyntaf, gan fod hynny’n hwyluso’r + broses o olrhain achosion a chyflwyno sylwadau. +

    + {/*

    Cyfleuster Mewngofnodi fel Gwestai ar Borth PCAC

    +

    + Mae gennym gyfleuster mewngofnodi fel gwestai os ydych + eisiau cyflwyno sylwadau heb greu cyfrif; chwiliwch am eich + achos a chliciwch ar y botwm ‘Cyflwyno Sylwadau’. +

    */}

    - 6. What are the consequences of failing to provide - information? -

    -
      -
    • - If you fail to provide us with information required to - validate your case then we may not be able to consider - it. We will normally let you know if this applies.{" "} -
    • -
    • - There is no statutory obligation on interested parties - to participate in a case. -
    • -
    • - If you are an appellant/agent and fail to provide the - statutory information needed to validate your case - within the set time periods, then we will not be able to - consider your case and it may be deemed invalid.{" "} -
    • -
    • - If you are an applicant and you fail to provide the - statutory information needed to consider your - application, we may not be able to accept your - application for Examination under s55 of the Planning - Act 2008.{" "} -
    • -
    • - For Local Plans the Inspector is required to examine - whether the plan is sound and legally compliant and in - doing so they must consider any representations and - other documentation submitted by the LA.{" "} -
    • -
    • - Those participating in a local plan examination should - note that their representations will be ‘made available’ - by the LA in line with the Regulations including - publication on the LA’s website. As a Data Controller - the LA may or may not redact some or all personal - information included in representations and other - documentation which is ‘made available’. To ensure an - open and fair examination, it is important that the - Inspector and all other participants in the examination - process know who has made representations on the plan - and the content of those representations. -
    • -
    • - There is no statutory obligation on an interested party - to participate in a Local plan examination or to provide - any particular information if they choose to not do so. -
    • -
    • - If you are another Interested Party and you fail to - provide your name and/or the name of the organisation or - group that you represent, we may be unable to accept - your representation.{" "} -
    • -
    • - We do not accept anonymous or confidential - representations for any types of Planning Inspectorate - casework -
    • -
    -

    7. Children’s Information

    -

    - Planning and Environment Decisions Wales do not provide - services directly to children or proactively collect their - personal information. However, we are sometimes voluntarily - given information about children as part of the appeals, - applications, orders & examination processes. This can - include special category data provided in representations - from all aspects of casework.{" "} -

    -

    8. How long we keep your personal data?

    -

    - We will retain our personal information only for as long as - is necessary to deliver our services and to meet our legal - and regulatory obligations. We maintain specific records - management and retention policies and procedures, so that - personal information is reviewed and deleted after a - reasonable time with the following criteria:{" "} -

    -
      -
    • - The purpose or business activity requiring the - processing of your information.{" "} -
    • -
    • - Whether we have any legal obligation to continue to - process your information. -
    • -
    • - Whether we have any legal basis under data protection - law to continue to process your information (e.g. Public - Task). -
    • -
    • - Any relevant agreed sector practices on how long - information should be retained. -
    • -
    • - For the purpose of defending against legal and - regulatory challenges. -
    • -
    -

    9. Who do we share your data with?

    -

    - In accordance with the statutory rules and relevant - guidance. Casework representations are normally copied to:{" "} -

    -
      -
    • Appellants/Applicants
    • -
    • Interested Parties
    • -
    • Local Authorities
    • -
    • - Local Authorities are also responsible to make the - casework representations available to anyone who wishes - to see them. -
    • -
    • External Programme Officers
    • -
    • - Members of the Public (Worldwide) when published on our - website -
    • -
    • Other Statutory Parties to the case
    • -
    • - Other Statutory Parties such as external Regulators.{" "} -
    • -
    • - We provide your information to the relevant Welsh - Minister who make the final decision on the applications - and appeals we examine via: -
    • -
    • - The Department for Business, Energy, and Industrial - Strategy -
    • -
    • The Department for Transport
    • -
    • - The Department for Environment, Food and Rural Affairs - and -
    • -
    • - The Ministry of Housing, Communities and Local - Government. -
    • -
    • - For fairness to the other parties interested in a case, - we need to share your representations as indicated - above. It also provides context and allows for the - effective running of our casework processes e.g. - allowing parties with similar viewpoints to identify - each other and agree joint presentation of views at any - hearing or inquiry, the representations that we receive - are therefore exchanged between the parties, subject to - the condition that Planning Inspectorate determine that - it is both necessary and proportionate, without - redaction of content or contact information. We will - treat your information in confidence if you request it, - however you should be aware that your representation may - be given less weight by the Inspector. -
    • -
    -

    - The appointed Inspector or person will consider the - information provided in the representations and reach their - decision. Their decision notice will provide the outcome for - the case and their reasoning for this. -

    -

    - Alternatively, where Welsh Ministers, other Government - Departments and Organisations are responsible for making the - decision on the case, the Inspector will produce a - recommendation report. The Inspector’s report and the - representations are provided to them. -

    -

    - In some circumstances, such as under a court order, we are - legally obliged to share information. We may also need to - share your personal information with: -

    -
      -
    • - Other government agencies, departments, and civil - servants -
    • -
    • Our or other legal representatives
    • -
    • Auditors, and
    • -
    • Regulators or to otherwise comply with the law.
    • -
    -

    - We may use third party service providers to process - information (see Annex B for full list) on our behalf in - respect of our casework e.g. the provision of information - technology services). Where we do so, contracts will be put - in place to ensure that your personal information is - processed only as instructed by us (unless otherwise - required by law), and that appropriate measures are in place - to ensure the security of information. -

    -

    - Additionally, we are required under the Public Records Act - 1958 (as amended) to transfer records to the National - Archives (TNA) for permanent preservation. Some of these - records may include the personal data of our customers.{" "} -

    -

    Who will have access to your data?

    -

    - We are committed to doing all that we can to keep your data - secure. We have set up systems and processes to prevent - unauthorised access or disclosure of your data e.g. we - protect your data using varying levels of encryption, and - relevant access controls are in place to effectively manage - and handle your personal information.{" "} -

    -

    - Where third party service providers are used, contracts and - or licences are put in place to ensure that your personal - information is processed only as instructed by us (unless - otherwise required by law), and that appropriate measures - are in place to ensure the security of that information. -

    -

    - When making an appeal/application or commenting on any of - our casework, you should keep in mind that in some instances - there are statutory requirements on us to make this - information more widely available.{" "} -

    -

    - This will normally be set out in our guidance, but if you - have specific queries or concerns in respect of a particular - case then please contact the case officer who, if necessary, - will discuss the matter with … - process to be established, - can this be internal to PEDW or should it be sent up the - line?. -

    -

    10. Do we use any data processors?

    -

    - Yes - a list of our current data processors is provided at - Annex B. -

    -

    11. Your rights in relation to this processing?

    -

    - Under data protection law, you have rights regarding the - processing of your personal data. The rights available to - you depend on our reason for processing your information. - You are not required to pay any charge for exercising your - rights. We have one month to respond to you.{" "} -

    -

    Your rights under UK GDPR are the right:

    -
      -
    • To be informed
    • -
    • Of access
    • -
    • To rectification
    • -
    • To erasure
    • -
    • To restrict processing
    • -
    • To data portability
    • -
    • To object
    • -
    • - Rights in relation to automated decision making and - profiling. (Planning and Environment Decisions Wales - does not use automated decision making or profiling). -
    • -
    -

    - Not all of these rights are absolute, which means that they - may only apply in certain situations and may be subject to - legal exceptions and exemptions.{" "} -

    -

    - Further information regarding your rights can be found on - the ICO Website.{" "} -

    -

    12. Registering for an Account for PEDW Portal

    -

    - PEDW Portal users must create an account with us in order to - submit appeals or any representations. Registering with us - will enable you to access our full range of appeals - services, including a personal homepage.{" "} -

    -

    - Also, the best way to comment on an existing case is to - register with us first as that makes it easier to track - cases and submit comments.{" "} -

    - {/*

    Guest Log in Facility on the PEDW Portal

    -

    - We have a guest log in facility if you do wish to submit - comments without creating an account; simply search for - your case and click on the ‘Make Representation’ button. -

    */} -

    - 13. Freedom of Information (FOIs) Requests, Subject Access - Requests (SARs) and Environment Information Regulations - (EIRs){" "} + 13. Ceisiadau Rhyddid Gwybodaeth (FOI), Ceisiadau Mynediad + at Ddata gan y Testun (SAR) a Rheoliadau Gwybodaeth + Amgylcheddol (EIR)

    - Planning and Environment Decisions Wales is a public body - and we have a legal duty to respond to requests made under - these legislations. This will sometimes mean that your - personal data could be used for the purpose of responding to - these requests. In the event that you are an applicant - making a request for information under one of these access - regimes we will use your information for the purpose of - complying with such a request. This will include information - for the purpose of corresponding with you and in order to - send our response. If you make a request for your own - personal data (subject access request) we may also require - evidence to verify your identity. + Mae Penderfyniadau Cynllunio ac Amgylchedd Cymru yn gorff + cyhoeddus ac mae’n ddyletswydd gyfreithiol arnom i ymateb i + geisiadau a wneir o dan y deddfwriaethau hyn. Weithiau, bydd + hyn yn golygu y gallai eich data personol gael ei ddefnyddio + i ymateb i’r ceisiadau hyn. Os ydych yn ymgeisydd sy’n + gwneud cais am wybodaeth o dan un o’r cyfundrefnau mynediad + hyn, byddwn yn defnyddio’ch gwybodaeth i gydymffurfio â + chais o’r fath. Bydd hyn yn cynnwys gwybodaeth er mwyn + gohebu â chi ac er mwyn anfon ein hymateb. Os byddwch yn + gwneud cais am eich data personol eich hun (cais mynediad at + ddata gan y testun), efallai y bydd angen i ni gael + tystiolaeth hefyd i gadarnhau pwy ydych.

    - 14. Annex A: Types of Casework undertaken by Planning and - Environment Decisions Wales{" "} + 14. Atodiad A – Mathau o Waith Achos a gynhelir gan + Benderfyniadau Cynllunio ac Amgylchedd Cymru

    - A full list of Appeals, Applications, Examinations and - Orders that this Privacy Notice covers: all types of PEDW - casework. + Rhestr lawn o Apeliadau, Ceisiadau, Archwiliadau a + Gorchmynion y mae’r Hysbysiad Preifatrwydd hwn yn ymdrin â + nhw: pob math o Waith Achos PCAC.

    +

    - Provided/Made Available via Website & - Other Means + Darperir/Ar Gael trwy’r Wefan a Dulliau + Eraill

    - Casework Type + Math o Waith Achos

    - Purpose of Processing + Diben Prosesu

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Enforcement Listed Building Notice

    +

    Hysbysiad Gorfodi Adeilad Rhestredig

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Enforcement Conservation Area Notice

    +

    Hysbysiad gorfodi Ardal Gadwraeth

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Enforcement Notice

    +

    Hysbysiad Gorfodi

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    +
    +
    +

    Gorfodi Tystysgrif Datblygiad Cyfreithlon

    +
    +
    +
    +
    +

    + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol +

    +
    +
    +

    Apeliadau

    +
    +
    +

    Cynllunio – Dirwyn Hysbyseb i Ben

    +
    +
    +
    +
    +

    + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol +

    +
    +
    +

    Apeliadau

    +
    +
    +

    Cynllunio – Apêl Hysbyseb

    +
    +
    +
    +
    +

    + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol +

    +
    +
    +

    Apeliadau

    - Enforcement Lawful Development Certificate + Cynllunio – Gwasanaeth Apeliadau Masnachol + (CAS)

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Planning Advert Discontinuance

    +

    + Cynllunio – Gwasanaeth Apeliadau gan + Ddeiliaid Tai (HAS) +

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Planning Advertisement Appeal

    +

    Cymeradwyaeth o Flaen Llaw

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Planning Commercial Appeal Service (CAS)

    +

    Cynllunio – Cytundeb Adran 106

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    -
    -
    -

    Planning Householder Appeal Service (HAS)

    -
    -
    -
    -
    -

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties -

    -
    -
    -

    Appeals

    -
    -
    -

    Prior Approval

    -
    -
    -
    -
    -

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties -

    -
    -
    -

    Appeals

    -
    -
    -

    Planning Section 106 Agreement

    -
    -
    -
    -
    -

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties -

    -
    -
    -

    Appeals

    +

    Apeliadau

    @@ -1128,808 +1160,686 @@ export default function PrivacyCY() {

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Non-Validation Appeals

    +

    Apeliadau Barnu’n Annilys

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Applications made during PEDW processing

    +

    Ceisiadau yn ystod proses brosesu PCAC

    -

    Costs Decisions

    +

    Penderfyniadau ar Gostau

    - Welsh Appeals via the Appeals portal (PEDW - Portal)/Email/Post/External Third Parties + Apeliadau Cymru trwy’r porth Gwaith Achos + Apeliadau (Porth PCAC)/ E-bost/ Post/ + Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau     

    -

    Planning Appeal

    +

    Apêl Gynllunio

    - Developments of National Significance (DNS) - Website for DNS Case Types or  - Email/Post/External Third Parties + Gwefan Datblygiadau o Arwyddocâd + Cenedlaethol (DNS) ar gyfer Mathau o + Achosion DNS neu E-bost/ Post/ Trydydd + Partïon Allanol

    -

    Applications

    +

    Ceisiadau

    - Development of National Significance - Applications + Ceisiadau Datblygiad o Arwyddocâd + Cenedlaethol

    -

    - Email/Post/External Third - Parties   -

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Specialist Purchase Notices

    +

    Hysbysiadau Prynu Arbenigol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    - Sustainable Drainage System (SUDS) Appeals + Apeliadau System Ddraenio Gynaliadwy (SUDS)

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    - Community Infrastructure Levy (CIL) Appeals + Apeliadau Ardoll Seilwaith Cymunedol (CIL)

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Specialist High Hedges

    +

    Gwrychoedd Uchel Arbenigol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Specialist Tree Preservation Order

    +

    Gorchymyn Diogelu Coed Arbenigol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Specialist Tree Replacement Notices

    +

    Hysbysiadau Amnewid Coed Arbenigol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Environmental Permitting Regulations

    +

    Rheoliadau Trwyddedu Amgylcheddol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    SSSI Appeals

    +

    Apeliadau SoDdGA

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Contaminated Land

    +

    Tir Halogedig

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Marine Licensing

    +

    Trwyddedu Morol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Waste Management

    +

    Rheoli Gwastraff

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Water Abstraction

    +

    Tynnu Dŵr

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Hazardous Substances Appeals

    +

    Apeliadau Sylweddau Peryglus

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Notice Appeals

    +

    Apeliadau Hysbysiad

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Specialist Hedgerows

    +

    Gwrychoedd Arbenigol

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Appeals

    +

    Apeliadau

    -

    Restriction Appeals 

    +

    Apeliadau Cyfyngiad 

    -

    Email/Post/External Third Parties Appeals

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Specialist

    +

    Arbenigol

    -

    Rights of Way - Schedule 14

    +

    Hawliau Tramwy - Atodlen 14

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications

    +

    Ceisiadau

    +
    +
    +
      +
    • + Tir Comin Arbenigol o dan y + deddfwriaethau isod: +
    • +
    • Deddf Tiroedd Comin 2006: Adran 16
    • +
    • Deddf Tiroedd Comin 2006: Adran 38
    • +
    • Deddf Tiroedd Comin 2006: Rhan 1
    • +
    • + Deddf Caffael Tir 1981: Adran 19 ac + Atodlen 1 +
    • +
    • + Deddf yr Ymddiriedolaeth Genedlaethol + 1971: Adran 23 +
    • +
    • Adran 15 Mesur Plwyfi Newydd 1943
    • +
    • Adran 193 Deddf Cyfraith Eiddo 1925
    • +
    • + Cynlluniau rheoli o dan Ddeddf Tiroedd + Comin 1899 +
    • +
    • Adran 9 Deddf Cefn Gwlad 1968
    • +
    • Adran 9 Deddf Cefn Gwlad 1968
    • +
    • Deddfau Cau Tir
    • +
    • + Amryw Ddeddfau lleol a Deddfau Cadarnhau + Gorchymyn Dros Dro (sy’n cynnwys gosod + ardrethi stint) +
    • +
    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Ceisiadau

    - Specialist Common Land under the below - legislations: -

    -

    - ·      Commons Act - 2006: Section 16 -

    -

    - ·      Commons Act - 2006: Section 38 -

    -

    - ·      Commons Act - 2006: Part 1 -

    -

    - ·      Acquisition - of Land Act 1981: Section 19 and Schedule 1 -

    -

    - ·      National - Trust Act 1971: Section 23 -

    -

    - ·      Section 15 - of the New Parishes Measure 1943 -

    -

    - ·      Section 193 - of the Law of Property Act 1925 -

    -

    - ·      Schemes of - management under the Commons Act 1899 -

    -

    - ·      Section 9 of - the Countryside Act 1968 -

    -

    - ·      Section 9 of - the Countryside Act 1968 -

    -

    - ·      Inclosure - Acts -

    -

    - ·      Various - local Acts and Provisional Order - Confirmation Acts (which includes levying of - stint rates) + Hawliau Tramwy Arbenigol – Cyfeiriadau + Atodlen 14

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications

    +

    Ceisiadau

    +
    +
    +

    Meysydd Pentref Arbenigol

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Ceisiadau

    +
    +
    +

    Ceisiadau A 36 (Deddf Trydan 1989)

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Ceisiadau – Argymhellion

    +
    +
    +

    Trwyddedau Sychder

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Ceisiadau

    - Specialist Rights of Way - Schedule 14 - Directions + Fforddfreintiau Angenrheidiol Arbenigol a + Thocio Coed

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications

    +

    Ceisiadau

    -

    Specialist Village Green

    +

    Tynnu Dŵr

    -

    Email/Post/External Third Parties

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications

    +

    Archwiliadau

    -

    S36 Applications (Electricity Act 1989)

    +

    Cynlluniau Rheoli Adnodd Dŵr

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications - Recommendations

    +

    Archwiliadau

    -

    Drought

    -

    Permits

    -

     

    +

    Cynlluniau Datblygu Lleol

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications

    +

    Archwiliadau

    +
    +
    +

    Ardoll Seilwaith Cymunedol (CIL)

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Gorchmynion

    +
    +
    +

    Gorchmynion Diwygio Harbwr Orders

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Gorchmynion

    +
    +
    +

    Gorchmynion Sychder

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Gorchmynion

    - Specialist Necessary Wayleaves and Tree - Lopping + Gorchmynion y Ddeddf Trafnidiaeth a + Gweithfeydd

    -

    - Email/Post/External Third Parties -     -

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Applications

    +

    Gorchmynion

    -

    Water Abstraction

    +

    Gorchmynion y Ddeddf Priffyrdd

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Examinations

    -
    -
    -

    Water Resource Management Plans

    -
    -
    -
    -
    -

    - Email/Post/External Third Parties -     -

    -

     

    -
    -
    -

    Examinations

    -
    -
    -

    Local Development Plans

    -
    -
    -
    -
    -

    - Email/Post/External Third - Parties      -

    -

     

    -
    -
    -

    Examinations

    -
    -
    -

    Community Infrastructure Levy (CIL)

    -
    -
    -
    -
    -

    - Email/Post/External Third Parties -     -

    -

     

    -
    -
    -

    Orders

    -
    -
    -

    Harbour Revision Orders

    -
    -
    -
    -
    -

    - Email/Post/External Third Parties -     -

    -

     

    -
    -
    -

    Orders

    -
    -
    -

    Drought Orders

    -
    -
    -
    -
    -

    - Email/Post/External Third Parties -     -

    -

     

    -
    -
    -

    Orders

    -
    -
    -

    Transport & Works Act Orders

    -
    -
    -
    -
    -

    - Email/Post/External Third Parties -     -

    -

     

    -
    -
    -

    Orders

    -
    -
    -

    Highways Act Orders

    -
    -
    -
    -
    -

    - Email/Post/External Third Parties -     -

    -

     

    -
    -
    -

    Orders

    +

    Gorchmynion

    - Local Authority (LA) Traffic Regulation - Orders + Gorchmynion Rheoleiddio Traffig Awdurdod + Lleol (ALl)

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    -

    Ferry and Bridge Toll Orders

    +

    Gorchmynion Tollau Fferïau a Phontydd

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    -

    Cycle Tracks Orders

    +

    Gorchmynion Llwybrau Beiciau

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    -

    Stopping Up Orders

    +

    Gorchmynion Cau

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    - Department for Transport (WG) Compulsory - Purchase Order (CPO) + Gorchymyn Prynu Gorfodol (CPO) yr Adran + Drafnidiaeth (LlC)

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    -

    Side Road Orders

    +

    Gorchmynion Ffyrdd Ymyl

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    - Department for Environment, Food & Rural - Affairs (DEFRA ) Compulsory Purchase Order - (CPO) + Gorchymyn Prynu Gorfodol (CPO) Adran yr + Amgylchedd, Bwyd a Materion Gwledig (DEFRA)

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    - Department for Environment, Food & Rural - Affairs (DEFRA ) Compulsory Purchase Order - (CPO) + Gorchymyn Prynu Gorfodol (CPO) Adran yr + Amgylchedd, Bwyd a Materion Gwledig (DEFRA)

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    - Review of Old Mineral Permissions (ROMPs) - and Ad-hoc Minerals + Adolygiad o Hen Ganiatadau Mwynau (ROMPs) a + Mwynau Ad-hoc

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    -

    Adverts Welsh Ministers (WM) Cases

    +

    Hysbysebion – Achosion Gweinidogion Cymru

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    +
    +
    +

    Addasu a Dirymu Caniatâd Cynllunio

    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Gorchmynion

    - Modifications and Revocation of Planning - Permission + Gorchmynion Prynu Gorfodol (CPO) yr Adran + Busnes, Ynni a Strategaeth Ddiwydiannol + (BEIS)

    -

    - Email/Post/External Third Parties -     -

    -

     

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    -

    Orders

    +

    Gorchmynion

    - Business, Energy & Industrial Strategy - (BEIS) Compulsory Purchase Orders + Gorchmynion Prynu Gorfodol (CPO) y + Weinyddiaeth Tai, Cymunedau a Llywodraeth + Leol (MHCLG)

    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +
    +
    +

    Gorchmynion

    +
    +
    +
      +
    • + Gorchmynion Hawliau Tramwy o dan y + Deddfwriaethau isod: +
    • +
    • + Deddf Bywyd Gwyllt a Chefn Gwlad 1981 +
    • +
    • Deddf Priffyrdd 1980
    • +
    • Deddf Cynllunio Gwlad a Thref 1990
    • +
    • Deddf Caffael Tir 1981
    • +
    +
    +
    +
    +
    +

    E-bost/ Post/ Trydydd Partïon Allanol

    +

    - Email/Post/External Third Parties -     + Amrywiol – Archwiliadau, Gorchmynion a + Cheisiadau

    -

     

    -
    -
    -

    Orders

    - Ministry of Housing, Communities & Local - Government (MHCLG) Planning Compulsory - Purchase Orders + Ceisiadau Ad-hoc gan Lywodraeth Cymru (LlC)

    -

    Email/Post/External Third Parties

    -
    -
    -

    Orders

    +

    E-bost/ Post/ Trydydd Partïon Allanol

    - Rights of Way Orders under the below - Legislations: -

    -

    - ·      Wildlife and - Countryside Act 1981 -

    -

    - ·      Highways Act - 1980 -

    -

    - ·      Town & - Country Planning Act 1990 -

    -

    - ·      Acquisition - of Land Act 1981 -

    -
    -
    -
    -
    -

    Email/Post/External Third Parties

    -
    -
    -

    - Various - Examinations & Orders & - Applications + Amrywiol – Archwiliadau, Gorchmynion a + Cheisiadau

    -

    Welsh Government (WG) Ad-hoc Requests

    -
    -
    -
    -
    -

    Email/Post/External Third Parties

    -
    -
    -

    - Various - Examinations & Orders & - Applications -

    -
    -
    -

    Department for Transport (DfT) Airports

    +

    Yr Adran Drafnidiaeth (DfT) Meysydd Awyr

    - -

    15. Annex B – List of Data Processors

    -

    Data Processor List

    +

    +

    15. Atodiad B – Rhestr o Brosesyddion Data

    +

    Rhestr o Brosesyddion Data

    - Data Processor + Prosesydd Data

    - Purpose + Diben

    @@ -1942,7 +1852,10 @@ export default function PrivacyCY() {

    GoPro

    -

    Platform for Planning Appeal Processing

    +

    + Platfform ar gyfer Prosesu Apeliadau + Cynllunio +

    @@ -1954,7 +1867,7 @@ export default function PrivacyCY() {

    UK.Gov Notify

    -

    Communications with External Parties

    +

    Cyfathrebu â Phartïon Allanol

    @@ -1965,7 +1878,7 @@ export default function PrivacyCY() {

    Google Analytics

    -

    Monitoring Web Activity

    +

    Monitro Gweithgarwch ar y We

    diff --git a/components/footerDocs/privacy_en.js b/components/footerDocs/privacy_en.js index faa90e2a..8e58c81f 100644 --- a/components/footerDocs/privacy_en.js +++ b/components/footerDocs/privacy_en.js @@ -757,20 +757,23 @@ export default function PrivacyEN() { We provide your information to the relevant Welsh Minister who make the final decision on the applications and appeals we examine via: +
      +
    • + The Department for Business, Energy, and + Industrial Strategy +
    • +
    • The Department for Transport
    • +
    • + The Department for Environment, Food and Rural + Affairs and +
    • +
    • + The Ministry of Housing, Communities and Local + Government. +
    • +
  • -
  • - The Department for Business, Energy, and Industrial - Strategy -
  • -
  • The Department for Transport
  • -
  • - The Department for Environment, Food and Rural Affairs - and -
  • -
  • - The Ministry of Housing, Communities and Local - Government. -
  • +
  • For fairness to the other parties interested in a case, we need to share your representations as indicated @@ -857,9 +860,7 @@ export default function PrivacyEN() { This will normally be set out in our guidance, but if you have specific queries or concerns in respect of a particular case then please contact the case officer who, if necessary, - will discuss the matter with … - process to be established, - can this be internal to PEDW or should it be sent up the - line?. + will discuss the matter with PEDW.

    10. Do we use any data processors?

    diff --git a/components/header.js b/components/header.js index fe9f7e84..228df3e4 100644 --- a/components/header.js +++ b/components/header.js @@ -30,6 +30,9 @@ const Header = (props) => { "/dnsdetails", "/404", "/account/register", + "/myportal/error", + "/accessibility", + "/details-about-cookies", ]; const hasContactLink = [ "/dns", diff --git a/components/homepage/casesearch.js b/components/homepage/casesearch.js index b8675b73..1448217a 100644 --- a/components/homepage/casesearch.js +++ b/components/homepage/casesearch.js @@ -92,7 +92,6 @@ let CaseSearch = (props) => { ? "/canlyniadauchwilio" : "/searchresults", query: { q: values.basicSearch.trim() }, - shallow: true, }); }; diff --git a/components/homepage/login.js b/components/homepage/login.js index 08108f86..df25d4d2 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -108,8 +108,15 @@ const RenderPasswordfield = ({ let Login = (props) => { let { t } = useTranslation(); - const { handleSubmit, pristine, reset, submitting, setLoggedInUserId } = - props; + const { + handleSubmit, + pristine, + reset, + submitting, + setLoggedInUserId, + GG_CLIENT_ID, + GG_REDIRECT_URI, + } = props; const router = useRouter(); const { locale } = router; @@ -117,6 +124,17 @@ let Login = (props) => { // const [showSpinnerState, setShowSpinnerState] = useState(false); const [validLoginID, setValidLoginID] = useState(null); + // console.log( + // "built login url path:", + // props.govGateway.config.authorization_endpoint + + // "?response_type=code&scope=openid&client_id=" + + // GG_CLIENT_ID + + // "&redirect_uri=" + + // GG_REDIRECT_URI + + // "&ui_locales=" + + // (router.locale == "cy" ? "cy" : "en-GB") + // ); + // let spinnerState = () => { // showSpinnerState == true // ? setShowSpinnerState(false) @@ -161,13 +179,35 @@ let Login = (props) => { : ""; }, [cookies.pinsUser, router]); + const govGatwayLoginRedirect = () => { + let ggUrl = + props.govGateway.config.authorization_endpoint + + "?response_type=code&scope=openid&client_id=" + + GG_CLIENT_ID + + "&redirect_uri=" + + GG_REDIRECT_URI + + "&ui_locales=" + + (router.locale == "cy" ? "cy" : "en-GB"); + + console.log("login Url:", ggUrl); + + router.replace(ggUrl); + }; + + const govGatwayForgottenLink = () => { + let ggUrl = + props.govGateway.config.authorization_endpoint + + "/login/forgot-password"; + router.replace(ggUrl); + }; + return (

    -
    -
    -

    - {t("home:login-card-title")} -

    +
    +

    + {t("home:login-card-title")} +

    {" "} + {validLoginID == false && (
    Incorrect username or password @@ -210,46 +250,109 @@ let Login = (props) => { />
    - {/* - - {t("home:login-card-button")} - - */}
    -
  • +
  • + {" "} + + {t("home:login-comingsoon-forms-label-2")} + +
  • +
  • + {" "} + + {t("home:login-comingsoon-forms-label-3")} + +
  • +
  • + {" "} + + {t("home:login-comingsoon-forms-label-4")} + +
  • + +
    + +

    + {t("home:login-comingsoon-email-link-label")}{" "} + + {t("home:login-contact-email")} + +

    - + + {/* { watchedCases: state.watchedCases, myRepresentations: state.myRepresentations, awaitingSubmission: state.awaitingSubmission, + govGateway: state.govGateway, }; }; diff --git a/components/main.js b/components/main.js index 0e9ecb03..b74b3eae 100644 --- a/components/main.js +++ b/components/main.js @@ -9,9 +9,10 @@ import Inspectorate from "./homepage/inspectorate"; import CaseComment from "./homepage/casecomment"; import Dns from "./homepage/dns"; -export default function MainHome({ children, pages, showLogin }) { +const MainHome = (props) => { let { t } = useTranslation(); + const { showLogin, GG_REDIRECT_URI, GG_CLIENT_ID } = props; const router = useRouter(); const { locale } = router; @@ -28,11 +29,18 @@ export default function MainHome({ children, pages, showLogin }) { - {showLogin == "true" && } + {showLogin == "true" && ( + + )} {/* */} ); -} +}; + +export default MainHome; diff --git a/components/myportal.js b/components/myportal.js index 63a7d9e5..1cefd9cf 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -9,6 +9,11 @@ import AwaitingSubmission from "./myportal/awaitingsubmission"; import MyRepresentations from "./myportal/myrepresentations"; import WatchedCases from "./myportal/watchedcases"; import YourAccount from "./myportal/youraccount"; +import { parseCookies, setCookie, destroyCookie } from "nookies"; + +import IdleTimer from "react-idle-timer"; +import TimeoutModal from "../components/timeoutmodal"; +import { useState } from "react"; const MyPortal = (props) => { let { t } = useTranslation(); @@ -16,49 +21,127 @@ const MyPortal = (props) => { const router = useRouter(); const { locale } = router; + const [showModal, setShowModal] = useState(false); + const inactiveTimeOut = 12000; // in seconds + const reminderTimeout = 60; // in seconds + + let idleTimer = null; + let logoutTimer = null; + + let onIdle = () => { + togglePopup(); + logoutTimer = setTimeout(() => { + handleLogout(); + }, 1000 * reminderTimeout * 1); + }; + + let togglePopup = () => { + showModal == true ? setShowModal(false) : setShowModal(true); + }; + + let handleStayLoggedIn = () => { + if (logoutTimer) { + clearTimeout(logoutTimer); + logoutTimer = null; + } + idleTimer.reset(); + togglePopup(); + }; + + const handleLogout = () => { + console.log("////////////", "\n", "logout", "\n", "//////////"); + destroyCookie({}, "pinsUser"), + window.localStorage.clear(), + router.replace(props.ggLogout); + }; + return ( -
    -
    -

    - {router.locale - { -

    -
    -
    -
    -
    - - - - +
    +
    +

    + { - - -

    -
    - + + +
    + {router.locale{" "} +
    + {props.accountDetails.accountDetails.firstname}{" "} + {props.accountDetails.accountDetails.lastname} +
    +
    -
    -
    +
    +
    +
    + + + + + + +
    +
    + +
    +
    +
    + + { + idleTimer = ref; + }} + element={document} + stopOnIdle={true} + onActive={console.log(" bbis active", idleTimer)} + onIdle={onIdle} + timeout={1000 * inactiveTimeOut * 1} + /> + + + ); }; diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index a77252e8..1a15d62a 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -6,7 +6,6 @@ import { setCurrentReference } from "../../store/currentView/action"; import { connect } from "react-redux"; import { parseCookies } from "nookies"; import { - getToken, getWatchedCasesProxy, getPortalModuleDetailsProxy, deleteWatchedCases, @@ -37,26 +36,21 @@ const TopThree = (props) => { let showTopThreeArr = showTopThree.value; const deleteItem = (caseID, topThreeType) => { - let token = getToken(); let cookies = parseCookies(); topThreeType == "watchedCases" && deleteWatchedCases(caseID) .then((data) => data) .then(() => { - getWatchedCasesProxy(token, cookies.pinsUser).then( - (data) => { - setWatchedCases(data), - getDetails(token, data, "myWatchedCases").then( - (data) => { - setWatchedCasesDetails(data); - } - ); - } - ); + getWatchedCasesProxy(cookies.pinsUser).then((data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + }); }); }; - const getDetails = (token, resultsObj, detailsType) => { + const getDetails = (resultsObj, detailsType) => { //console.log(resultsObj); let detailsArr = []; resultsObj = resultsObj.value; @@ -72,7 +66,6 @@ const TopThree = (props) => { } else { detailsArr.push( getPortalModuleDetailsProxy( - token, getFormCollectionByID( searchDetail.pinswg_appealcasetype ).LogicalCollectionName, @@ -89,6 +82,24 @@ const TopThree = (props) => { return Promise.all(detailsArr); }; + const getIncidentId = (topThreeType, objArr) => { + switch (topThreeType) { + case "myCases": + return objArr.incidentid; + break; + case "watchedCases": + return objArr._pinswg_watchedcase_value; + break; + case "myRepresentations": + return objArr.ticketnumber; + break; + case "awaitingSubmission": + break; + default: + // code block + } + }; + let topThreeOnlyArr = showTopThreeArr.slice(0, 3); Object.keys(topThreeOnlyArr).map((key, index) => { topthreeRow.push( @@ -126,18 +137,10 @@ const TopThree = (props) => { ], "currentType": topThreeType, - "incidentid": - topThreeType != "watchedCases" - ? topThreeType != - "myRepresentations" - ? showTopThreeArr[key] - ._pinswg_case_value - : showTopThreeArr[key][ - " _pinswg_watchedcase_value" - ] - : showTopThreeArr[key][ - " _pinswg_watchedcase_value" - ], + "incidentid": getIncidentId( + topThreeType, + showTopThreeArr[key] + ), "appealType": showTopThreeArr[key] diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index f285b9a7..abea855a 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -29,10 +29,10 @@ const ViewAllResults = (props) => { (value) => + value || typeof value === "number" ? undefined : errorMsg; + +export const minLength = (errorMsg) => (value) => + value && value.length < 4 + ? errorMsg //`Must be ${min} characters or more` + : undefined; + let AdvancedSearch = (props) => { let { t } = useTranslation(); @@ -37,6 +45,53 @@ let AdvancedSearch = (props) => { ? [{}] : props.LPAData.LPAData.value; + const RenderTextfield = ({ + id, + className, + rows, + datafieldname, + name, + label, + input, + hint1, + hint2, + hint3, + meta: { touched, error }, + ...custom + }) => { + return ( + <> +
    +
    + +
    + +
    + + {touched && error && ( + + + Error: + {" "} + {error} + + )} +
    +
    + + ); + }; + const RenderLPAList = ({ name, id, @@ -216,8 +271,6 @@ let AdvancedSearch = (props) => { ); }; - const required = (value) => (value ? undefined : "Required"); - // const [showSpinnerState, setShowSpinnerState] = useState(false); // let spinnerState = () => { @@ -252,8 +305,8 @@ let AdvancedSearch = (props) => { router.replace( (router.locale == "cy" - ? "/canlyniadauchwiliouwch" - : "/advancedsearchresults") + searchString, + ? "/fymhorth/canlyniadauchwiliouwch" + : "/myportal/advancedsearchresults") + searchString, null, { shallow: true, @@ -275,27 +328,31 @@ let AdvancedSearch = (props) => { {t("search:search-title-label")} -
    - - -
    + { getBasicDNSSearchPaged(pageNumber) .then((data) => { - //console.log(data); setSearchResults(data); return data; }) diff --git a/components/search/searchresults.js b/components/search/searchresults.js index fad652de..0436111d 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -39,7 +39,6 @@ import { import { createWatchedCases, - getToken, getWatchedCasesProxy, getPortalModuleDetailsProxy, deleteWatchedCases, @@ -58,6 +57,7 @@ const SearchResults = (props) => { watchedCases, setWatchedCases, setWatchedCasesDetails, + isLinkedCase, } = props; let { t } = useTranslation(); @@ -77,8 +77,6 @@ const SearchResults = (props) => { const cookies = parseCookies(); const selectWatchedCase = (loggedInUser, incidentID, appealType) => { - let token = getToken(); - let updateBody = { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", @@ -88,13 +86,11 @@ const SearchResults = (props) => { createWatchedCases(updateBody) .then((data) => data) .then(() => { - getWatchedCasesProxy(token, cookies.pinsUser).then((data) => { + getWatchedCasesProxy(cookies.pinsUser).then((data) => { setWatchedCases(data), - getDetails(token, data, "myWatchedCases").then( - (data) => { - setWatchedCasesDetails(data); - } - ); + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); }); }); }; @@ -109,26 +105,21 @@ const SearchResults = (props) => { }; const deleteItem = (caseID, topThreeType) => { - let token = getToken(); let cookies = parseCookies(); topThreeType == "watchedCases" && deleteWatchedCases(caseID) .then((data) => data) .then(() => { - getWatchedCasesProxy(token, cookies.pinsUser).then( - (data) => { - setWatchedCases(data), - getDetails(token, data, "myWatchedCases").then( - (data) => { - setWatchedCasesDetails(data); - } - ); - } - ); + getWatchedCasesProxy(cookies.pinsUser).then((data) => { + setWatchedCases(data), + getDetails(data, "myWatchedCases").then((data) => { + setWatchedCasesDetails(data); + }); + }); }); }; - const getDetails = (token, resultsObj, detailsType) => { + const getDetails = (resultsObj, detailsType) => { //console.log(resultsObj); let detailsArr = []; resultsObj = resultsObj.value; @@ -144,7 +135,6 @@ const SearchResults = (props) => { } else { detailsArr.push( getPortalModuleDetailsProxy( - token, getFormCollectionByID( searchDetail.pinswg_appealcasetype ).LogicalCollectionName, @@ -184,7 +174,7 @@ const SearchResults = (props) => {
    {t("search:searchresults-status-label")}
    - {myportal == "true" && ( + {myportal == true && (
    )} @@ -201,10 +191,10 @@ const SearchResults = (props) => { { "statuscode@OData.Community.Display.V1.FormattedValue" ] || "N/A"} - {myportal == "true" && ( + {myportal == true && (
    {isWatchedCase(item.incidentid).length > 0 == @@ -501,27 +491,34 @@ const SearchResults = (props) => {

    - {t("search:searchresults-title-label")} + {isLinkedCase + ? t("search:searchresults-title-label-linked-case") + : t("search:searchresults-title-label")}

    -

    - {resultsArr.length > 200 - ? t("search:searchresults-max-count-label") - : t("search:searchresults-count-label", { - count: searchResultsObj["@odata.count"], - })} - . - {advancedSearch != true ? ( - <> - - {t("search:searchresults-case-count-label")}{" "} - {" "} - "{searchString}" - - - ) : ( - "" - )} -

    + + {!isLinkedCase && ( +

    + {resultsArr.length > 200 + ? t("search:searchresults-max-count-label") + : t("search:searchresults-count-label", { + count: searchResultsObj["@odata.count"], + })} + . + {advancedSearch != true ? ( + <> + + {t( + "search:searchresults-case-count-label" + )}{" "} + {" "} + "{searchString}" + + + ) : ( + "" + )} +

    + )} {resultsArr.length > 0 ? ( ResultsView(resultsArr) ) : ( diff --git a/components/searchresults.js b/components/searchresults.js index 0d8de4b1..7381390f 100644 --- a/components/searchresults.js +++ b/components/searchresults.js @@ -13,6 +13,7 @@ export default function Search(props) { advancedSearch, myportal, watchedCases, + isLinkedCase, } = props; let { t } = useTranslation(); @@ -48,6 +49,7 @@ export default function Search(props) { } myportal={myportal} watchedCases={watchedCases} + isLinkedCase={isLinkedCase} />
    diff --git a/components/servicebanner.js b/components/servicebanner.js index d963c7c3..0ae55c1a 100644 --- a/components/servicebanner.js +++ b/components/servicebanner.js @@ -9,6 +9,7 @@ export default function ServiceBanner() {

    Planning casework - { + /> */}

    ); diff --git a/components/timeoutmodal.js b/components/timeoutmodal.js new file mode 100644 index 00000000..4b60749f --- /dev/null +++ b/components/timeoutmodal.js @@ -0,0 +1,29 @@ +import React from "react"; +import { useState, useEffect } from "react"; + +const TimeoutModal = (props) => { + const { showModal, handleStayLoggedIn, remainingCountdown } = props; + + return ( +
    +
    +
    +

    + Your session is about to expire in {remainingCountdown}{" "} + seconds due to inactivity. You will be redirected to the + login page. +

    + +
    +
    +
    +
    + ); +}; + +export default TimeoutModal; diff --git a/components/tracking/index.js b/components/tracking/index.js index 637f10b9..4ade8ccb 100644 --- a/components/tracking/index.js +++ b/components/tracking/index.js @@ -1,8 +1,9 @@ import React, { Fragment } from "react"; -export const Tracking = ({ googleTagManagerID }) => ( +export const Tracking = ({ googleTagManagerID, nonce }) => ( + <> + + + )}
    diff --git a/pages/_error.js b/pages/_error.js index 974cdb3d..a478361e 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -1,10 +1,9 @@ -import Link from "next/link"; -import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; import useTranslation from "next-translate/useTranslation"; +import Head from "next/head"; +import Link from "next/link"; +import CookieBanner from "../components/cookieBanner"; import Footer from "../components/footer"; +import Header from "../components/header"; function Error({ statusCode }, props) { let { t, lang } = useTranslation(); diff --git a/pages/accessibility.js b/pages/accessibility.js index 096d803d..18cacf99 100644 --- a/pages/accessibility.js +++ b/pages/accessibility.js @@ -1,26 +1,17 @@ -import _ from "lodash"; -import { useState, useEffect, useRef } from "react"; +import useTranslation from "next-translate/useTranslation"; import Head from "next/head"; +import { useRouter } from "next/router"; +import AccessibilityStatement from "../components/accessibility"; +import Breadcrumbs from "../components/breadcrumbs"; +import CookieBanner from "../components/cookieBanner"; +import Footer from "../components/footer"; import Header from "../components/header"; import ServiceBanner from "../components/servicebanner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import Main from "../components/main"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; -import { useRouter } from "next/router"; -import useTranslation from "next-translate/useTranslation"; -import { getIncidents } from "../actions"; -import { parseCookies } from "nookies"; -import AccessibilityStatement from "../components/accessibility"; const Accessibility = (props) => { const { footerLinks, pages, showLogin } = props; let { t, lang } = useTranslation(); - + ß; const router = useRouter(); const { locale } = router; diff --git a/pages/account/register.js b/pages/account/register.js index 3981a80b..821be29e 100644 --- a/pages/account/register.js +++ b/pages/account/register.js @@ -17,9 +17,10 @@ import jsonpath from "jsonpath"; import { reduxForm, formValueSelector } from "redux-form"; import RegisterForm from "../../components/account/registerform"; +import { dehashString, hashAPIPath } from "../../actions"; const Home = (props) => { - const { footerLinks, formData } = props; + const { footerLinks, formData, loggedInUserEmail } = props; let { t, lang } = useTranslation(); const router = useRouter(); @@ -97,6 +98,9 @@ const Home = (props) => { setAccountCreatedComplete={ setAccountCreatedComplete } + loggedInUserEmail={ + loggedInUserEmail + } /> {registerFormComplete != true || @@ -151,17 +155,31 @@ const Home = (props) => { ); }; -// export const getServerSideProps = wrapper.getServerSideProps( -// (store) => -// async ({ query, req, res }) => { -// const appealTypeData = await getAppealsTypes(); -// const lpaData = await getLPA(); -// console.log("appeal types", appealTypeData); -// console.log("lpa typeswwwww", lpaData); -// store.dispatch(setAppealType(appealTypeData)); -// store.dispatch(setLPA(lpaData)); -// } -// ); +export const getServerSideProps = wrapper.getServerSideProps( + (store) => + async ({ query, req, res }) => { + // const appealTypeData = await getAppealsTypes(); + // const lpaData = await getLPA(); + // console.log("appeal types", appealTypeData); + // console.log("lpa typeswwwww", lpaData); + // store.dispatch(setAppealType(appealTypeData)); + // store.dispatch(setLPA(lpaData)); + + let hasRegistrationEmail = typeof query.id != "undefined"; + let loginEmailStr = ""; + + if (hasRegistrationEmail == true) { + loginEmailStr = dehashString(query.id); + + console.log(loginEmailStr); + } + return { + props: { + loggedInUserEmail: loginEmailStr, + }, + }; + } +); const mapStateToProps = (state) => { return { diff --git a/pages/advancedsearch.js b/pages/advancedsearch.js index ec940206..d2065015 100644 --- a/pages/advancedsearch.js +++ b/pages/advancedsearch.js @@ -1,36 +1,18 @@ import _ from "lodash"; -import { useState } from "react"; -import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import Search from "../components/search"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; - -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; +import Head from "next/head"; +import { useRouter } from "next/router"; +import { connect } from "react-redux"; +import { getAppealsTypes, getLPA } from "../actions"; +import Breadcrumbs from "../components/breadcrumbs"; +import CookieBanner from "../components/cookieBanner"; import CRMError from "../components/crmError"; - -import { - setAppealType, - setAppealTypeTitle, - setAppealTypeID, - setAppealLPA, - getAppealTypeObj, -} from "../store/appealType/action"; -import { - getAppealsTypes, - getLPA, - updateCase, - createCase, - getToken, -} from "../actions"; +import Footer from "../components/footer"; +import Header from "../components/header"; +import Search from "../components/search"; +import { setAppealType } from "../store/appealType/action"; import { setLPA } from "../store/lpa/action"; +import { wrapper } from "../store/store"; const Home = (props) => { const { footerLinks, pages } = props; @@ -40,7 +22,6 @@ const Home = (props) => { const { locale } = router; const { appealtypes } = router.query; - //console.log(props, props.LPAData); var hasError = _.has(props.LPAData.LPAData, "errorCode") || _.has(props.appealType.appealType, "errorCode") @@ -139,27 +120,9 @@ const Home = (props) => { export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ query, req, res }) => { - let token = await getToken(); - - var tokenIssuedAt = new Date(); - var tokenExpiryTimeAt = new Date(); - tokenExpiryTimeAt.setSeconds( - tokenExpiryTimeAt.getSeconds() + token.expires_in - ); - - console.log( - "token issued:", - tokenIssuedAt.toUTCString(), - "\n", - "token expires:", - tokenExpiryTimeAt.toUTCString() - ); - console.log(token); - token = token.access_token; - const [appealTypeData, lpaData] = await Promise.all([ - await getAppealsTypes(token), - await getLPA(token), + await getAppealsTypes(), + await getLPA(), ]); store.dispatch(setAppealType(appealTypeData)); diff --git a/pages/advancedsearchresults.js b/pages/advancedsearchresults.js index 48805787..e50fa3a6 100644 --- a/pages/advancedsearchresults.js +++ b/pages/advancedsearchresults.js @@ -1,28 +1,20 @@ -import _ from "lodash"; -import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import SearchResults from "../components/searchresults"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; - -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import jsonpath from "jsonpath"; -import data from "../data/collections.json"; +import Head from "next/head"; +import { useRouter } from "next/router"; +import { connect } from "react-redux"; +import { getAdvancedSearch } from "../actions"; +import Breadcrumbs from "../components/breadcrumbs"; +import CookieBanner from "../components/cookieBanner"; +import Footer from "../components/footer"; +import Header from "../components/header"; +import SearchResults from "../components/searchresults"; import { getSearchDetails } from "../components/utils"; -import { setSearch, getSearchObj } from "../store/search/action"; +import { setSearch } from "../store/search/action"; import { - setSearchResults, setSearchDetails, - getSearchResultsObj, + setSearchResults, } from "../store/searchOutput/action"; -import { getAdvancedSearch, getBasicSearchDetails, getToken } from "../actions"; +import { wrapper } from "../store/store"; const Home = (props) => { const { footerLinks, pages } = props; @@ -123,14 +115,8 @@ export const getServerSideProps = wrapper.getServerSideProps( console.log("query-", query); //console.log("search array:", Object.entries(query)); - let token = await getToken(); - token = token.access_token; - - const searchResultsObj = await getAdvancedSearch(token, query); - const searchDetailsObj = await getSearchDetails( - token, - searchResultsObj - ); + const searchResultsObj = await getAdvancedSearch(query); + const searchDetailsObj = await getSearchDetails(searchResultsObj); store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchDetails(searchDetailsObj)); diff --git a/pages/api/documents/download/[id].js b/pages/api/documents/download/[id].js new file mode 100644 index 00000000..2d740e8c --- /dev/null +++ b/pages/api/documents/download/[id].js @@ -0,0 +1,70 @@ +import axios from "axios"; +import https from "https"; +import CryptoJS from "crypto-js"; +import { getToken } from "../../../../actions"; + +const WORDKEY = process.env.HASHKEY; +const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; +const tenantId = process.env.TENANT; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +const azureHeadersPaged = (access_token) => { + return { + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json;odata.metadata=none", + "Prefer": + 'odata.include-annotations="*",return=representation, odata.maxpagesize=10', + "Content-Type": "application/json", + "Authorization": "Bearer " + access_token, + }, + }; +}; + +export default async function ApiProxy(req, res) { + var token = await getToken(); + + var docRef = req.query; + + console.log(docRef.id); + + var queryUrl = "documents/download/" + docRef.id + "?hash=" + docRef.hash; + + console.log(WEBAPI_URL + queryUrl); + return axios + .get( + WEBAPI_URL + queryUrl, // + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then((response) => { + console.log(response.headers); + res.status(200); + res.setHeader( + "Content-disposition", + "attachment; filename=" + + response.headers["content-disposition"].split( + "filename=" + )[1] + ); + res.end(response.data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/createaccount_api.js b/pages/api/endpoint/createaccount_api.js new file mode 100644 index 00000000..2d87ccc1 --- /dev/null +++ b/pages/api/endpoint/createaccount_api.js @@ -0,0 +1,49 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var token = await getToken(); + var queryUrl = "contacts"; + var data = JSON.stringify(req.body); + + var config = { + method: "post", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*",return=representation', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + data: data, + }; + + return axios(config) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/createcase_api.js b/pages/api/endpoint/createcase_api.js new file mode 100644 index 00000000..74d5fc86 --- /dev/null +++ b/pages/api/endpoint/createcase_api.js @@ -0,0 +1,65 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var contactid = req.query.contactid; + var appealTypeId = req.query.appealTypeId; + var lpaID = req.query.lpaID; + var queryUrl = "incidents"; + var token = await getToken(); + + var data = JSON.stringify({ + "title": "insertion test case", + "caseorigincode": 3, + "customerid_contact@odata.bind": "/contacts(" + contactid + ")", + "pinswg_appealcasetype": appealTypeId, + "pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")", + }); + + var config = { + method: "post", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*",return=representation', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + data: data, + }; + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : axios(config) + .then(({ data }) => { + console.log(data); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); + + return apiResponse; +} diff --git a/pages/api/endpoint/createwatchedcases_api.js b/pages/api/endpoint/createwatchedcases_api.js new file mode 100644 index 00000000..b5d13835 --- /dev/null +++ b/pages/api/endpoint/createwatchedcases_api.js @@ -0,0 +1,49 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var token = await getToken(); + var data = JSON.stringify(req.body); + var queryUrl = "pinswg_watchlists"; + + var config = { + method: "post", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*"', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + data: data, + }; + + return axios(config) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/deletemyrepresentations_api.js b/pages/api/endpoint/deletemyrepresentations_api.js new file mode 100644 index 00000000..e2bd4586 --- /dev/null +++ b/pages/api/endpoint/deletemyrepresentations_api.js @@ -0,0 +1,49 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var myRepresentationsID = req.query.myRepresentationsID; + var token = await getToken(); + var queryUrl = "pinswg_representationses(" + myRepresentationsID + ")"; + + var config = { + method: "delete", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*"', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + }; + + return axios(config) + .then(({ data }) => { + console.log("deleted "); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/deletewatchedcases_api.js b/pages/api/endpoint/deletewatchedcases_api.js new file mode 100644 index 00000000..836678d7 --- /dev/null +++ b/pages/api/endpoint/deletewatchedcases_api.js @@ -0,0 +1,49 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var watchedCaseID = req.query.watchedCaseID; + var token = await getToken(); + var queryUrl = "pinswg_watchlists(" + watchedCaseID + ")"; + + var config = { + method: "delete", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*"', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + }; + + return axios(config) + .then(({ data }) => { + //console.log("deleted watched case - " + watchedCaseID); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getadvancedsearch_api.js b/pages/api/endpoint/getadvancedsearch_api.js new file mode 100644 index 00000000..59b35ddd --- /dev/null +++ b/pages/api/endpoint/getadvancedsearch_api.js @@ -0,0 +1,83 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var searchString = req.query.searchstring; + var token = await getToken(); + + searchString = _.isEmpty(searchString) + ? searchString + : JSON.parse(decodeURI(searchString)); + + var queryString = ""; + + queryString += + _.has(searchString, "q") && searchString.q != null + ? "(contains(title, '" + + searchString.q + + "') or contains(ticketnumber,'" + + searchString.q + + "'))" + : ""; + + queryString += + _.has(searchString, "lpa") && searchString.lpa != null + ? (typeof searchString.q == "undefined" ? "" : " and ") + + "_pinswg_associatedlpa_value eq " + + searchString.lpa + : ""; + queryString += + _.has(searchString, "apt") && searchString.apt != null + ? (typeof searchString.q == "undefined" && + typeof searchString.lpa == "undefined" + ? "" + : " and ") + + "pinswg_appealcasetype eq " + + 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"; + + var apiResponse = _.isEmpty(searchString) + ? res.status(400).json() + : axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); + + return apiResponse; +} diff --git a/pages/api/endpoint/getadvancedsearchpaged_api.js b/pages/api/endpoint/getadvancedsearchpaged_api.js new file mode 100644 index 00000000..8e979332 --- /dev/null +++ b/pages/api/endpoint/getadvancedsearchpaged_api.js @@ -0,0 +1,87 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var searchString = req.query.searchstring; + var pageNumber = req.query.pageNumber; + var token = await getToken(); + + searchString = _.isEmpty(searchString) + ? searchString + : JSON.parse(decodeURI(searchString)); + + var queryString = ""; + + queryString += + _.has(searchString, "q") && searchString.q != null + ? "(contains(title, '" + + searchString.q + + "') or contains(ticketnumber,'" + + searchString.q + + "'))" + : ""; + + queryString += + _.has(searchString, "lpa") && searchString.lpa != null + ? (typeof searchString.q == "undefined" ? "" : " and ") + + "_pinswg_associatedlpa_value eq " + + searchString.lpa + : ""; + queryString += + _.has(searchString, "apt") && searchString.apt != null + ? (typeof searchString.q == "undefined" && + typeof searchString.lpa == "undefined" + ? "" + : " and ") + + "pinswg_appealcasetype eq " + + 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" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + ('') + : ""); + + var apiResponse = _.isEmpty(searchString) + ? res.status(400).json() + : axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); + + return apiResponse; +} diff --git a/pages/api/endpoint/getappealid_api.js b/pages/api/endpoint/getappealid_api.js new file mode 100644 index 00000000..989c6ee6 --- /dev/null +++ b/pages/api/endpoint/getappealid_api.js @@ -0,0 +1,45 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var caseReference = req.query.caseReference; + var updateFormCollection = req.query.updateFormCollection; + var primaryAttribute = req.query.primaryAttribute; + var token = await getToken(); + + const queryUrl = + updateFormCollection + + "?$count=true&$select=_" + + primaryAttribute + + "s_value&$filter=pinswg_name eq '" + + caseReference + + "'"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getappealtypes_api.js b/pages/api/endpoint/getappealtypes_api.js new file mode 100644 index 00000000..a809c7ca --- /dev/null +++ b/pages/api/endpoint/getappealtypes_api.js @@ -0,0 +1,50 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions"; +/** + * @swagger + * /api/endpoint/getappealtypes_api: + * get: + * description: Returns appeal types + * responses: + * 200: + * description: + * + */ + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var token = await getToken(); + + 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 + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getbasicdnssearch_api.js b/pages/api/endpoint/getbasicdnssearch_api.js new file mode 100644 index 00000000..564e8609 --- /dev/null +++ b/pages/api/endpoint/getbasicdnssearch_api.js @@ -0,0 +1,45 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var token = await getToken(); + + 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 + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getbasicdnssearchdetails_api.js b/pages/api/endpoint/getbasicdnssearchdetails_api.js new file mode 100644 index 00000000..f07eaa41 --- /dev/null +++ b/pages/api/endpoint/getbasicdnssearchdetails_api.js @@ -0,0 +1,53 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; +import { getSelectQuery } from "../../../actions/selectQueryTypes"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var caseReference = req.query.caseReference; + var token = await getToken(); + + var queryUrl = + "pinswg_dnses?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; + + queryUrl = queryUrl + getSelectQuery("pinswg_dnses"); + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : typeof caseReference != "undefined" && caseReference.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js b/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js new file mode 100644 index 00000000..74b05bf5 --- /dev/null +++ b/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js @@ -0,0 +1,57 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; +import { getSelectQuery } from "../../../actions/selectQueryTypes"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var caseReference = req.query.caseReference; + var token = await getToken(); + + var queryUrl = + "pinswg_dnses?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; + + queryUrl = queryUrl + getSelectQuery("pinswg_dnses"); + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : typeof caseReference != "undefined" && caseReference.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + return res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getbasicdnssearchpaged_api.js b/pages/api/endpoint/getbasicdnssearchpaged_api.js new file mode 100644 index 00000000..da246154 --- /dev/null +++ b/pages/api/endpoint/getbasicdnssearchpaged_api.js @@ -0,0 +1,49 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + //console.log(hashlink); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var pageNumber = req.query.pageNumber; + var token = await getToken(); + + 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" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + '' + : ""); + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + return res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getbasicsearch_api.js b/pages/api/endpoint/getbasicsearch_api.js new file mode 100644 index 00000000..7f0df321 --- /dev/null +++ b/pages/api/endpoint/getbasicsearch_api.js @@ -0,0 +1,56 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var searchString = req.query.searchString; + var token = await getToken(); + + 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"; + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : searchString.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getbasicsearchdetails_api.js b/pages/api/endpoint/getbasicsearchdetails_api.js new file mode 100644 index 00000000..7998860e --- /dev/null +++ b/pages/api/endpoint/getbasicsearchdetails_api.js @@ -0,0 +1,53 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; +import { getSelectQuery } from "../../../actions/selectQueryTypes"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var appealTypeName = req.query.appealTypeName; + var primaryIdAttribute = req.query.primaryIdAttribute; + var incidentID = req.query.incidentID; + var token = await getToken(); + + var queryUrl = + appealTypeName + + "?$filter=_" + + primaryIdAttribute + + "s_value eq " + + incidentID + + "&$count=true"; + + queryUrl = queryUrl + getSelectQuery(appealTypeName); + + console.log("query: ", queryUrl, "<<< { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getbasicsearchdetailspaged_api.js b/pages/api/endpoint/getbasicsearchdetailspaged_api.js new file mode 100644 index 00000000..561a5d6c --- /dev/null +++ b/pages/api/endpoint/getbasicsearchdetailspaged_api.js @@ -0,0 +1,58 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; +import { getSelectQuery } from "../../../actions/selectQueryTypes"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var appealTypeName = req.query.appealTypeName; + var primaryIdAttribute = req.query.primaryIdAttribute; + var incidentID = req.query.incidentID; + var token = await getToken(); + + var queryUrl = + appealTypeName + + "?$filter=_" + + primaryIdAttribute + + "s_value eq " + + incidentID + + "&$count=true"; + + queryUrl = queryUrl + getSelectQuery(appealTypeName); + + console.log("query: ", queryUrl, "<<< { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + return res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getbasicsearchpaged_api.js b/pages/api/endpoint/getbasicsearchpaged_api.js new file mode 100644 index 00000000..5b43a393 --- /dev/null +++ b/pages/api/endpoint/getbasicsearchpaged_api.js @@ -0,0 +1,58 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var searchString = req.query.searchString; + var pageNumber = req.query.pageNumber; + var token = await getToken(); + + 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" + + (typeof pageNumber != "undefined" + ? "&$skiptoken=" + '' + : ""); + + var apiResponse = + searchString.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = + dataStr.split("/v8.2/")[1])); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getemailaccountcheck_api.js b/pages/api/endpoint/getemailaccountcheck_api.js new file mode 100644 index 00000000..8cb1cbba --- /dev/null +++ b/pages/api/endpoint/getemailaccountcheck_api.js @@ -0,0 +1,47 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var emailAddress = req.query.emailAddress; + var token = await getToken(); + + var queryUrl = + "contacts?$filter=emailaddress1 eq '" + + emailAddress + + "'&$count=true&$select=emailaddress1, contactid"; + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : typeof emailAddress != "undefined" && emailAddress.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getformdata_api.js b/pages/api/endpoint/getformdata_api.js new file mode 100644 index 00000000..4efb97f6 --- /dev/null +++ b/pages/api/endpoint/getformdata_api.js @@ -0,0 +1,43 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var whichForm = req.query.whichForm; + var token = await getToken(); + + var queryUrl = + "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" + + whichForm + + "' and type eq 2)&$count=true&$top=201"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getlinkedcases_api.js b/pages/api/endpoint/getlinkedcases_api.js new file mode 100644 index 00000000..dc2d370f --- /dev/null +++ b/pages/api/endpoint/getlinkedcases_api.js @@ -0,0 +1,43 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var parentIncidentid = req.query.parentincidentid; + var token = await getToken(); + + var queryUrl = + "incidents?$count=true&$filter=_parentcaseid_value eq " + + parentIncidentid + + " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getlogin_api.js b/pages/api/endpoint/getlogin_api.js new file mode 100644 index 00000000..1cb25461 --- /dev/null +++ b/pages/api/endpoint/getlogin_api.js @@ -0,0 +1,55 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var emailAddress = req.query.emailAddress; + var pwd = req.query.pwd; + var token = await getToken(); + + var queryUrl = + "contacts?$filter=emailaddress1 eq '" + + emailAddress + + "' and pinswg_custom_password eq '" + + pwd + + "'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname"; + + console.log(_.isEmpty(req.query)); + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : typeof emailAddress != "undefined" && + emailAddress.length > 0 && + typeof pwd != "undefined" && + pwd.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getlpa_api.js b/pages/api/endpoint/getlpa_api.js new file mode 100644 index 00000000..a04bd51a --- /dev/null +++ b/pages/api/endpoint/getlpa_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var token = await getToken(); + + var queryUrl = + "accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getmandatoryfields_api.js b/pages/api/endpoint/getmandatoryfields_api.js new file mode 100644 index 00000000..c363fc46 --- /dev/null +++ b/pages/api/endpoint/getmandatoryfields_api.js @@ -0,0 +1,43 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var whichForm = req.query.whichForm; + var token = await getToken(); + + var queryUrl = + "EntityDefinitions(LogicalName='pinswg_" + + whichForm + + "')/Attributes?$count=true&$select=LogicalName,RequiredLevel"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getmycases_api.js b/pages/api/endpoint/getmycases_api.js new file mode 100644 index 00000000..9870fb5f --- /dev/null +++ b/pages/api/endpoint/getmycases_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + 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 + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getmyrepresentations_api.js b/pages/api/endpoint/getmyrepresentations_api.js new file mode 100644 index 00000000..398ea8dc --- /dev/null +++ b/pages/api/endpoint/getmyrepresentations_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + var queryUrl = + "pinswg_representationses?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getmyrepresentationsproxy_api.js b/pages/api/endpoint/getmyrepresentationsproxy_api.js new file mode 100644 index 00000000..398ea8dc --- /dev/null +++ b/pages/api/endpoint/getmyrepresentationsproxy_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + var queryUrl = + "pinswg_representationses?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getpersonalaccount_api.js b/pages/api/endpoint/getpersonalaccount_api.js new file mode 100644 index 00000000..16743aae --- /dev/null +++ b/pages/api/endpoint/getpersonalaccount_api.js @@ -0,0 +1,45 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var contactid = req.query.contactid; + var token = await getToken(); + + var queryUrl = + "contacts(" + + contactid + + ")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true"; + + var apiResponse = + contactid.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getpicklists_api.js b/pages/api/endpoint/getpicklists_api.js new file mode 100644 index 00000000..5b54ff63 --- /dev/null +++ b/pages/api/endpoint/getpicklists_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var whichForm = req.query.whichForm; + var token = await getToken(); + + var queryUrl = + "EntityDefinitions(LogicalName='pinswg_" + + whichForm + + "')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getportalmoduledetails_api.js b/pages/api/endpoint/getportalmoduledetails_api.js new file mode 100644 index 00000000..943ab28b --- /dev/null +++ b/pages/api/endpoint/getportalmoduledetails_api.js @@ -0,0 +1,42 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var appealType = req.query.appealType; + var caseReference = req.query.caseReference; + var token = await getToken(); + + var queryUrl = + appealType + + "?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getportalmoduledetailsproxy_api.js b/pages/api/endpoint/getportalmoduledetailsproxy_api.js new file mode 100644 index 00000000..943ab28b --- /dev/null +++ b/pages/api/endpoint/getportalmoduledetailsproxy_api.js @@ -0,0 +1,42 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var appealType = req.query.appealType; + var caseReference = req.query.caseReference; + var token = await getToken(); + + var queryUrl = + appealType + + "?$filter=pinswg_name eq '" + + caseReference + + "'&$count=true"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getrepresentations_api.js b/pages/api/endpoint/getrepresentations_api.js new file mode 100644 index 00000000..84653594 --- /dev/null +++ b/pages/api/endpoint/getrepresentations_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + var queryUrl = + "pinswg_representationses?$filter= _pinswg_case_value eq " + + incidentID + + " and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getrepresentationsproxy_api.js b/pages/api/endpoint/getrepresentationsproxy_api.js new file mode 100644 index 00000000..0367f052 --- /dev/null +++ b/pages/api/endpoint/getrepresentationsproxy_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var incidentID = req.query.incidentID; + var token = await getToken(); + + var queryUrl = + "pinswg_representationses?$filter= _pinswg_case_value eq " + + incidentID + + "&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getsearchdocumentdetails_api.js b/pages/api/endpoint/getsearchdocumentdetails_api.js new file mode 100644 index 00000000..10039332 --- /dev/null +++ b/pages/api/endpoint/getsearchdocumentdetails_api.js @@ -0,0 +1,67 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +const encryptDocReference = (documentRef) => { + var hashlink = CryptoJS.HmacSHA256( + "documents/download/" + documentRef, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + var hashStr = + "/api/documents/download/" + documentRef + "?hash=" + hashlink; + + return hashStr; +}; + +export default async function ApiProxy(req, res) { + var incidentID = req.query.incidentid; + var token = await getToken(); + + var queryUrl = + "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( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + data.value.forEach(function (element) { + element.pinswg_hashlink = encryptDocReference( + element.pinswg_isharedocumentreference + ); + }); + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getsearchdocumentdetailspaged_api.js b/pages/api/endpoint/getsearchdocumentdetailspaged_api.js new file mode 100644 index 00000000..b95c4084 --- /dev/null +++ b/pages/api/endpoint/getsearchdocumentdetailspaged_api.js @@ -0,0 +1,70 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +const encryptDocReference = (documentRef) => { + var hashlink = CryptoJS.HmacSHA256( + "documents/download/" + documentRef, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + var hashStr = + "/api/documents/download/" + documentRef + "?hash=" + hashlink; + + return hashStr; +}; + +export default async function ApiProxy(req, res) { + var pageNumber = req.query.pageNumber; + var incidentID = req.query.incidentid; + var token = await getToken(); + + var queryUrl = + "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( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + data.value.forEach(function (element) { + element.pinswg_hashlink = encryptDocReference( + element.pinswg_isharedocumentreference + ); + }); + var dataStr; + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + return res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getsearchdocumenthistory_api.js b/pages/api/endpoint/getsearchdocumenthistory_api.js new file mode 100644 index 00000000..2f2c5a5b --- /dev/null +++ b/pages/api/endpoint/getsearchdocumenthistory_api.js @@ -0,0 +1,42 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var documentID = req.query.documentid; + var token = await getToken(); + + 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 + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getsearchdocumenthistorypaged_api.js b/pages/api/endpoint/getsearchdocumenthistorypaged_api.js new file mode 100644 index 00000000..6d098214 --- /dev/null +++ b/pages/api/endpoint/getsearchdocumenthistorypaged_api.js @@ -0,0 +1,47 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var documentID = req.query.documentid; + var pageNumber = req.query.pageNumber; + var token = await getToken(); + + 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; + // + + // (typeof pageNumber != "undefined" + // ? "&$skiptoken=" + ('') + // : ""); + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getwatchedcases_api copy 2.js b/pages/api/endpoint/getwatchedcases_api copy 2.js new file mode 100644 index 00000000..a7763975 --- /dev/null +++ b/pages/api/endpoint/getwatchedcases_api copy 2.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + var queryUrl = + "pinswg_watchlists?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getwatchedcases_api.js b/pages/api/endpoint/getwatchedcases_api.js new file mode 100644 index 00000000..a7763975 --- /dev/null +++ b/pages/api/endpoint/getwatchedcases_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeaders } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + var queryUrl = + "pinswg_watchlists?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getwatchedcasesproxy_api.js b/pages/api/endpoint/getwatchedcasesproxy_api.js new file mode 100644 index 00000000..47106318 --- /dev/null +++ b/pages/api/endpoint/getwatchedcasesproxy_api.js @@ -0,0 +1,40 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { azureHeaders, getToken } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var loggedInUserId = req.query.loggedInUserId; + var token = await getToken(); + + var queryUrl = + "pinswg_watchlists?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc"; + + return axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeaders(token.access_token) + ) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/updateaccount_api.js b/pages/api/endpoint/updateaccount_api.js new file mode 100644 index 00000000..8eea133a --- /dev/null +++ b/pages/api/endpoint/updateaccount_api.js @@ -0,0 +1,50 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var contactId = req.query.contactId; + var token = await getToken(); + var data = JSON.stringify(req.body); + var queryUrl = "contacts(" + contactId + ")"; + + var config = { + method: "patch", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*"', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + data: data, + }; + + return axios(config) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/updatecase_api.js b/pages/api/endpoint/updatecase_api.js new file mode 100644 index 00000000..03074357 --- /dev/null +++ b/pages/api/endpoint/updatecase_api.js @@ -0,0 +1,52 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var data = JSON.stringify(req.body); + var appealObj = rea.query.appealObj; + var updateFormCollection = req.query.updateFormCollection; + var queryUrl = updateFormCollection + "(" + appealObj + ")"; + + var token = await getToken(); + + var config = { + method: "patch", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*"', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + data: data, + }; + + return axios(config) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/updatepassword_api.js b/pages/api/endpoint/updatepassword_api.js new file mode 100644 index 00000000..8eea133a --- /dev/null +++ b/pages/api/endpoint/updatepassword_api.js @@ -0,0 +1,50 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var contactId = req.query.contactId; + var token = await getToken(); + var data = JSON.stringify(req.body); + var queryUrl = "contacts(" + contactId + ")"; + + var config = { + method: "patch", + url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + headers: { + "OData-MaxVersion": "4.0", + "OData-Version": "4.0", + "Accept": "application/json", + "Prefer": 'odata.include-annotations="*"', + "Authorization": "Bearer " + token.access_token, + "Content-Type": "application/json", + }, + data: data, + }; + + return axios(config) + .then(({ data }) => { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/details-about-cookies.js b/pages/details-about-cookies.js index b88fd89d..25f4ceea 100644 --- a/pages/details-about-cookies.js +++ b/pages/details-about-cookies.js @@ -1,21 +1,12 @@ -import _ from "lodash"; -import { useState, useEffect, useRef } from "react"; +import useTranslation from "next-translate/useTranslation"; import Head from "next/head"; +import { useRouter } from "next/router"; +import Breadcrumbs from "../components/breadcrumbs"; +import CookieBanner from "../components/cookieBanner"; +import CookiePolicy from "../components/cookiePolicy"; +import Footer from "../components/footer"; import Header from "../components/header"; import ServiceBanner from "../components/servicebanner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import Main from "../components/main"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; -import { useRouter } from "next/router"; -import useTranslation from "next-translate/useTranslation"; -import { getIncidents } from "../actions"; -import { parseCookies } from "nookies"; -import CookiePolicy from "../components/cookiePolicy"; const CookieDetails = (props) => { const { footerLinks, pages, showLogin } = props; diff --git a/pages/dnsapplications.js b/pages/dnsapplications.js index 3174cdab..7eae2e97 100644 --- a/pages/dnsapplications.js +++ b/pages/dnsapplications.js @@ -1,30 +1,20 @@ -import _ from "lodash"; +import useTranslation from "next-translate/useTranslation"; import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; +import { useRouter } from "next/router"; +import { connect } from "react-redux"; +import { getBasicDNSSearch } from "../actions"; import Breadcrumbs from "../components/breadcrumbs"; +import CookieBanner from "../components/cookieBanner"; import DNSSearchResults from "../components/dnssearchresults"; import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; - -import { useRouter } from "next/router"; -import useTranslation from "next-translate/useTranslation"; -import jsonpath from "jsonpath"; -import data from "../data/collections.json"; - +import Header from "../components/header"; import { getSearchDetails } from "../components/utils"; - -import { setSearch, getSearchObj } from "../store/search/action"; +import { setSearch } from "../store/search/action"; import { - setSearchResults, setSearchDetails, - getSearchResultsObj, + setSearchResults, } from "../store/searchOutput/action"; -import { getBasicDNSSearch, getBasicSearchDetails, getToken } from "../actions"; +import { wrapper } from "../store/store"; const Home = (props) => { const { footerLinks, pages } = props; @@ -128,26 +118,7 @@ export const getServerSideProps = wrapper.getServerSideProps( "public, s-maxage=10, stale-while-revalidate=59" ); - let token = await getToken(); - - var tokenIssuedAt = new Date(); - var tokenExpiryTimeAt = new Date(); - tokenExpiryTimeAt.setSeconds( - tokenExpiryTimeAt.getSeconds() + token.expires_in - ); - - console.log( - "token issued:", - tokenIssuedAt.toUTCString(), - "\n", - "token expires:", - tokenExpiryTimeAt.toUTCString() - ); - console.log(token); - - token = token.access_token; - - let searchResultsObj = await getBasicDNSSearch(token); + let searchResultsObj = await getBasicDNSSearch(); searchResultsObj = searchResultsObj.status == 502 ? { @@ -157,11 +128,7 @@ export const getServerSideProps = wrapper.getServerSideProps( } : searchResultsObj; - const searchDetailsObj = await getSearchDetails( - token, - searchResultsObj - ); - //console.log(searchDetailsObj); + const searchDetailsObj = await getSearchDetails(searchResultsObj); store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchDetails(searchDetailsObj)); store.dispatch(setSearch("DNS")); diff --git a/pages/dnsdetails.js b/pages/dnsdetails.js index ebe94a33..38c29962 100644 --- a/pages/dnsdetails.js +++ b/pages/dnsdetails.js @@ -1,19 +1,12 @@ -import _ from "lodash"; -import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import CaseSummary from "../components/case"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; - -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; +import Head from "next/head"; +import { useRouter } from "next/router"; +import { connect } from "react-redux"; +import Breadcrumbs from "../components/breadcrumbs"; import Case from "../components/case"; +import CookieBanner from "../components/cookieBanner"; +import Footer from "../components/footer"; +import Header from "../components/header"; const Home = (props) => { const { footerLinks, pages } = props; diff --git a/pages/index.js b/pages/index.js index 18cfcd8c..deb4674e 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,28 +1,71 @@ import _ from "lodash"; -import { useState, useEffect, useRef } from "react"; -import Head from "next/head"; -import Header from "../components/header"; -import ServiceBanner from "../components/servicebanner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import Main from "../components/main"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import { getIncidents } from "../actions"; -import { parseCookies } from "nookies"; +import Head from "next/head"; +import { useRouter } from "next/router"; +import { setCookie } from "nookies"; +import { connect } from "react-redux"; +import { getToken, hashString } from "../actions"; +import { + getGGToken, + getPortalLogin, + getProviderConfig, + getUserInfo, +} from "../actions/govgateway"; +import CookieBanner from "../components/cookieBanner"; +import Footer from "../components/footer"; +import Header from "../components/header"; +import Main from "../components/main"; +import ServiceBanner from "../components/servicebanner"; +import { setAccountDetails } from "../store/accountDetails/action"; +import { getGovGatewayConfig } from "../store/govgateway/action"; +import { wrapper } from "../store/store"; const Home = (props) => { - const { footerLinks, pages, showLogin } = props; + const { + footerLinks, + pages, + showLogin, + loggedInUserId, + hasGGCode, + loginEmailStr, + loggedInUserEmail, + ggLocale, + } = props; let { t, lang } = useTranslation(); const router = useRouter(); const { locale } = router; + let now = new Date(); + let expDate = new Date(now); + expDate.setDate(now.getDate() + 1); + + //console.log("hashed email str", loginEmailStr); + _.isEmpty(loggedInUserId) != false && !hasGGCode + ? console.log("no ggcode") + : _.has(loggedInUserId, "value") + ? _.isEmpty(loggedInUserId.value) + ? router.replace({ + pathname: + router.locale == "cy" + ? "/account/register" + : "/account/register", + query: { + id: encodeURI(loggedInUserEmail), + }, + }) + : (setCookie(null, "pinsUser", loggedInUserId.value[0].contactid, { + path: "/", + expires: expDate, + }), + router.replace({ + pathname: + router.locale == "cy" || ggLocale == "cy" + ? "/cy/fymhorth" + : "/myportal", + })) + : console.log("no value in user id"); + return (
    @@ -77,8 +120,32 @@ const Home = (props) => {
    - -
    + {hasGGCode ? ( + <> +

    + {ggLocale == "cy" + ? "Mewngofnodi" + : "Logging in"} +

    +

    + {ggLocale == "cy" + ? "Arhoswch os gwelwch yn dda..." + : "Please wait..."} +

    + + ) : ( + <> + +
    + + )}
    @@ -90,13 +157,97 @@ export const getServerSideProps = wrapper.getServerSideProps( (store) => async (ctx) => { const { query, req, res } = ctx; + var relayToken = await getToken(); + relayToken = relayToken.access_token; + + console.log("gg code:", query.code); + console.log("gg local", query.ui_locales); + const showLoginCheck = process.env.SHOWLOGIN || false; - console.log("Show login module: ", showLoginCheck); + const hasLoginCode = typeof query.code != "undefined"; + let providerConfig = await getProviderConfig(); + let ggLocale = + typeof query.ui_locales != "undefined" && query.ui_locales; - return { - props: { showLogin: showLoginCheck }, - }; + console.log( + "endpoint: ", + providerConfig.token_endpoint, + "\n", + "hasloginCode:", + hasLoginCode, + "\n", + "redirect:", + process.env.GG_REDIRECT_URI + ); + + store.dispatch(getGovGatewayConfig(providerConfig)); + + let ggToken = {}; + let ggUserInfo = {}; + let portalUserObj = {}; + let loginEmailStr = ""; + + if (hasLoginCode == true) { + ggToken = await getGGToken( + providerConfig.token_endpoint, + query.code, + process.env.GG_REDIRECT_URI + ); + + _.has(ggToken, "access_token") + ? ((ggUserInfo = await getUserInfo( + providerConfig.userinfo_endpoint, + ggToken.access_token + )), + (loginEmailStr = hashString(ggUserInfo.data.email)), + (portalUserObj = await getPortalLogin( + ggUserInfo.data.email, + relayToken + )), + console.log("loggin user stuff: ", portalUserObj), + store.dispatch(setAccountDetails(portalUserObj))) + : console.log( + ggToken.status + " " + ggToken.data.error_description + ); + } + + if (ggToken.status == 400) { + return { + redirect: { + destination: "/myportal/error", + permanent: false, + }, + }; + } else { + return { + props: { + ggLocale: ggLocale, + showLogin: showLoginCheck, + hasGGCode: hasLoginCode, + loggedInUserId: portalUserObj, + loggedInUserEmail: loginEmailStr, + GG_REDIRECT_URI: process.env.GG_REDIRECT_URI, + GG_CLIENT_ID: process.env.GG_CLIENT_ID, + }, + }; + } } ); -export default Home; //connect(mapStateToProps)(Home); + +const mapStateToProps = (state) => { + return { + currentView: state.currentView, + search: state.search, + searchResultsObj: state.searchResultsObj, + formData: state.formData, + appealType: state.appealType, + form: state.form, + myCases: state.myCases, + watchedCases: state.watchedCases, + myRepresentations: state.myRepresentations, + awaitingSubmission: state.awaitingSubmission, + govGateway: state.govGateway, + }; +}; +export default connect(mapStateToProps)(Home); diff --git a/pages/logout.js b/pages/logout.js index 3e802678..a2563358 100644 --- a/pages/logout.js +++ b/pages/logout.js @@ -1,16 +1,13 @@ -import _ from "lodash"; -import Link from "next/link"; -import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; - -import Footer from "../components/footer"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import { setLogout } from "../store/accountDetails/action"; +import Head from "next/head"; +import Link from "next/link"; +import { useRouter } from "next/router"; import { useEffect } from "react"; +import { connect } from "react-redux"; +import CookieBanner from "../components/cookieBanner"; +import Footer from "../components/footer"; +import Header from "../components/header"; +import { setLogout } from "../store/accountDetails/action"; const LogOut = (props) => { const { footerLinks, pages, setLogout } = props; diff --git a/pages/myportal/advancedsearch.js b/pages/myportal/advancedsearch.js index 35d10f5b..8564bee8 100644 --- a/pages/myportal/advancedsearch.js +++ b/pages/myportal/advancedsearch.js @@ -1,36 +1,18 @@ import _ from "lodash"; -import { useState } from "react"; -import Head from "next/head"; -import Header from "../../components/header"; -import Banner from "../../components/banner"; -import CookieBanner from "../../components/cookieBanner"; -import Breadcrumbs from "../../components/breadcrumbs"; -import Search from "../../components/search"; -import Footer from "../../components/footer"; -import Errorpage from "../../components/errorpage"; -import styles from "../../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../../store/store"; - -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; +import Head from "next/head"; +import { useRouter } from "next/router"; +import { connect } from "react-redux"; +import { getAppealsTypes, getLPA } from "../../actions"; +import Breadcrumbs from "../../components/breadcrumbs"; +import CookieBanner from "../../components/cookieBanner"; import CRMError from "../../components/crmError"; - -import { - setAppealType, - setAppealTypeTitle, - setAppealTypeID, - setAppealLPA, - getAppealTypeObj, -} from "../../store/appealType/action"; -import { - getAppealsTypes, - getLPA, - updateCase, - createCase, - getToken, -} from "../../actions"; +import Footer from "../../components/footer"; +import Header from "../../components/header"; +import Search from "../../components/search"; +import { setAppealType } from "../../store/appealType/action"; import { setLPA } from "../../store/lpa/action"; +import { wrapper } from "../../store/store"; const Home = (props) => { const { footerLinks, pages } = props; @@ -40,7 +22,6 @@ const Home = (props) => { const { locale } = router; const { appealtypes } = router.query; - console.log(props, props.LPAData); var hasError = _.has(props.LPAData.LPAData, "errorCode") || _.has(props.appealType.appealType, "errorCode") @@ -77,12 +58,9 @@ const Home = (props) => { export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ query, req, res }) => { - let token = await getToken(); - token = token.access_token; - const [appealTypeData, lpaData] = await Promise.all([ - await getAppealsTypes(token), - await getLPA(token), + await getAppealsTypes(), + await getLPA(), ]); store.dispatch(setAppealType(appealTypeData)); diff --git a/pages/myportal/advancedsearchresults.js b/pages/myportal/advancedsearchresults.js index b850c053..3dbfc3e4 100644 --- a/pages/myportal/advancedsearchresults.js +++ b/pages/myportal/advancedsearchresults.js @@ -1,31 +1,33 @@ -import _ from "lodash"; -import Head from "next/head"; -import Header from "../../components/header"; -import Banner from "../../components/banner"; -import CookieBanner from "../../components/cookieBanner"; -import Breadcrumbs from "../../components/breadcrumbs"; -import SearchResults from "../../components/searchresults"; -import Footer from "../../components/footer"; -import Errorpage from "../../components/errorpage"; -import styles from "../../styles/Home.module.css"; -import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../../store/store"; - -import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import jsonpath from "jsonpath"; -import data from "../../data/collections.json"; - -import { getSearchDetails } from "../../components/utils"; -import { setSearch, getSearchObj } from "../../store/search/action"; +import Head from "next/head"; +import { useRouter } from "next/router"; +import { connect } from "react-redux"; +import { + getAdvancedSearch, + getPortalModuleDetails, + getWatchedCases, +} from "../../actions"; +import Breadcrumbs from "../../components/breadcrumbs"; +import CookieBanner from "../../components/cookieBanner"; +import Footer from "../../components/footer"; +import Header from "../../components/header"; +import SearchResults from "../../components/searchresults"; +import { + getFormCollectionByID, + getSearchDetails, +} from "../../components/utils"; import { - setSearchResults, setSearchDetails, + setSearchResults, } from "../../store/searchOutput/action"; -import { getAdvancedSearch, getToken } from "../../actions"; +import { wrapper } from "../../store/store"; +import { + setWatchedCases, + setWatchedCasesDetails, +} from "../../store/watchedCases/action"; const Home = (props) => { - const { footerLinks, pages } = props; + const { footerLinks, pages, watchedCases } = props; let { t, lang } = useTranslation(); const router = useRouter(); @@ -48,6 +50,8 @@ const Home = (props) => { searchString={props.search.searchString} searchResultsObj={props.searchResultsObj} advancedSearch={true} + watchedCases={watchedCases} + myportal={true} />