From 2a6cd32452ff4b68b6a41e614a230f7438fc7f01 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 5 Jun 2024 19:50:56 +0100 Subject: [PATCH 1/3] console log tidying --- actions/azurestorage.js | 80 +++---- actions/govgateway.js | 147 ------------ actions/index.js | 220 +++++++++--------- actions/selectQueryTypes.js | 2 +- components/case/summary.js | 4 +- components/cookiemanager/index.js | 7 +- pages/account/register.js | 2 +- pages/advancedsearch.js | 4 +- .../getbasicsearch_by_address_api copy.js | 2 +- .../endpoint/getbasicsearch_by_address_api.js | 2 +- pages/api/endpoint/getmylpacases_api.js | 14 +- pages/api/endpoint/getpersonalaccount_api.js | 2 +- .../file/createappealcompletemessage_api.js | 4 +- .../createappealcompletemessageproxy_api.js | 4 +- .../api/file/createrepcompletemessage_api.js | 4 +- .../file/deleteawaitingsubmissionfromblob.js | 4 +- pages/api/file/deleteblob.js | 4 +- pages/api/file/deleteblobcase.js | 4 +- pages/api/file/deleteblobrep.js | 4 +- pages/api/file/generateappealpdf.js | 2 +- pages/api/file/generatepdf.js | 6 +- .../api/file/getawaitingsubmissionfromblob.js | 12 +- pages/api/file/getbloblist.js | 4 +- pages/api/file/getprogressobjblob.js | 2 +- pages/api/file/getrepsblob.js | 32 +-- pages/api/file/setupcontainer.js | 4 +- pages/api/file/upload.js | 10 +- pages/case/[ticketnumber].js | 22 +- pages/case/id/[incident].js | 4 +- pages/dns/[developmentName].js | 4 +- pages/dns/application-view.js | 2 +- pages/dns/applications.js | 2 +- pages/myportal/[appealtypes].js | 2 +- pages/myportal/advancedsearch.js | 4 +- pages/myportal/case/[ticketnumber].js | 28 +-- pages/myportal/case/id/[incident].js | 6 +- pages/myportal/index.js | 6 +- pages/newappeal/[appealtypes].js | 2 +- pages/newappeal/index.js | 4 +- pages/storage.js | 10 +- server/server.js | 45 ++-- store/govgateway/action.js | 10 - store/govgateway/reducer.js | 17 -- styles/sass/patterns/_step-by-step-nav.scss | 2 +- 44 files changed, 290 insertions(+), 466 deletions(-) delete mode 100644 actions/govgateway.js delete mode 100644 store/govgateway/action.js delete mode 100644 store/govgateway/reducer.js diff --git a/actions/azurestorage.js b/actions/azurestorage.js index d08e4ecc..ea65db7b 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -130,7 +130,7 @@ export const createContainer = async (containerName) => { //containerName = containerName.toLowerCase(); - // console.log( + //console.log( // "container name:", // containerName, // STORAGE_PATH + "/" + containerName @@ -145,11 +145,11 @@ export const createContainer = async (containerName) => { const createContainerResponse = await containerClient.createIfNotExists(); - console.log( - "\n//////////////////\n container name :", - containerName, - "\n//////////////////\n" - ); + //console.log( + // "\n//////////////////\n container name :", + // containerName, + // "\n//////////////////\n" + // ); return containerName; }; @@ -158,7 +158,7 @@ export const getContainers = async () => { const creds = new DefaultAzureCredential(); const blobServiceClient = new BlobServiceClient(`${STORAGE_PATH}`, creds); - console.log("Containers:"); + //console.log("Containers:"); for await (const container of blobServiceClient.listContainers()) { console.log(`- ${container.name}`); } @@ -486,7 +486,7 @@ export const deleteBlobCase = async (containerName, blobName) => { containerClient.deleteBlob(blob.name); } - // containerClient.deleteBlob(blobName); + //containerClient.deleteBlob(blobName); console.log(`deleted blob ${blobName}`); for await (const blob of containerClient.listBlobsFlat()) { console.log(" ------ :", blob.name); @@ -521,8 +521,8 @@ export const deleteBlobRep = async (containerName, blobName) => { //containerClient.deleteBlob(blob.name); } - // containerClient.deleteBlob(blobName); - // console.log(`deleted blob ${blobName}`); + //containerClient.deleteBlob(blobName); + //console.log(`deleted blob ${blobName}`); // for await (const blob of containerClient.listBlobsFlat()) { // console.log(" ------ :", blob.name); // } @@ -669,7 +669,7 @@ export const uploadPDFRepFiles = async ( foldername ); - // console.log(`files[${prop}] = ${files[prop][0].size}`); + //console.log(`files[${prop}] = ${files[prop][0].size}`); console.log(foldername + "/files/" + formContent.split("tmp/")[1]); const blobName = foldername + "/" + formContent.split("tmp/")[1]; @@ -707,14 +707,14 @@ export const uploadPDFAppealFiles = async ( const files = formContent; - // console.log( + //console.log( // "///////////////////////////// \n", // formContent, // containerName, // foldername, // "\n///////////////////////////// \n" // ); - // console.log( + //console.log( // "///////////////////////////// \n", // "appeal pdf files...", // files, @@ -723,7 +723,7 @@ export const uploadPDFAppealFiles = async ( // "\n///////////////////////////// \n" // ); - // console.log(`files[${prop}] = ${files[prop][0].size}`); + //console.log(`files[${prop}] = ${files[prop][0].size}`); console.log(foldername + "/files/" + formContent.split("tmp/")[1]); const blobName = foldername + "/files/" + formContent.split("tmp/")[1]; @@ -823,7 +823,7 @@ export const downloadAllProgressFiles = async ( containerName, progressBlobObj ) => { - // console.log( + //console.log( // "/////////////////////////\n downloading files: " + // JSON.stringify(progressBlobObj) + // "\n/////////////////////////\n" @@ -899,11 +899,11 @@ export const downloadRepFile = async ( }; export const downloadAllRepsFiles = async (containerName, repsBlobObj) => { - console.log( - "/////////////////////////\n downloading files: " + - JSON.stringify(repsBlobObj) + - "\n/////////////////////////\n" - ); + //console.log( + // "/////////////////////////\n downloading files: " + + // JSON.stringify(repsBlobObj) + + // "\n/////////////////////////\n" + // ); const containerToken = await createContainerSas(containerName); const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; @@ -922,7 +922,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => { console.log("is empt and an array"); for (const prop in repsBlobObj) { - console.log(`Progress - ${prop}: ${repsBlobObj[prop].path}`); + //console.log(`Progress - ${prop}: ${repsBlobObj[prop].path}`); blobClient = containerClient.getBlobClient(repsBlobObj[prop].path); downloadedBlob = await blobClient.download(0); let repBlobObj = await streamToBuffer( @@ -940,7 +940,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => { } //downloaded = downloaded.substring(0, downloaded.length - 1); - // console.log( + //console.log( // "/////////////////////////\n downloaded : " + // JSON.stringify( // '{ "@odata.count": ' + @@ -1029,11 +1029,11 @@ export const getProgressBlobs = async (containerName, caseReference) => { blobCount++; } - console.log( - "this is the casefolder and blobcount:", - caseReference, - blobCount - ); + //console.log( + // "this is the casefolder and blobcount:", + // caseReference, + // blobCount + // ); let blobObj = []; for await (const blob of containerClient.listBlobsFlat({ @@ -1114,12 +1114,12 @@ export const getAllProgressBlobs = async (containerName) => { }); } - console.log( - "\n////////////////////////////\n", - "blobObj:", - blobObj, - "\n////////////////////////////" - ); + //console.log( + // "\n////////////////////////////\n", + // "blobObj:", + // blobObj, + // "\n////////////////////////////" + // ); return blobObj; }; @@ -1135,15 +1135,15 @@ export const getRepsBlobs = async (containerName) => { for await (const blob of containerClient.findBlobsByTags( "blobType='Representation'" )) { - console.log(`-----Get Rep Blob ${blobCount++}: ${blob.name}`); + //console.log(`-----Get Rep Blob ${blobCount++}: ${blob.name}`); blobCount++; } - console.log( - "this is the casefolder and blobcount:", - //caseReference, - blobCount - ); + //console.log( + // "this is the casefolder and blobcount:", + // //caseReference, + // blobCount + // ); const listOptions = { includeMetadata: true, @@ -1158,7 +1158,7 @@ export const getRepsBlobs = async (containerName) => { listOptions )) { const blobClient = containerClient.getBlobClient(blob.name); - console.log("getreps blob:", blob); + //console.log("getreps blob:", blob); blob.name.split("/")[2].indexOf("_rep.json") > 0 && blob.name.split("/")[2].indexOf("undefined") < 0 && blobObj.push({ diff --git a/actions/govgateway.js b/actions/govgateway.js deleted file mode 100644 index 59f35458..00000000 --- a/actions/govgateway.js +++ /dev/null @@ -1,147 +0,0 @@ -import axios from "axios"; -import { hashAPIPath, consoleLogger } 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/"; - -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, - }, - }; -}; - -export const getProviderConfig = () => { - return axios - .get(configEndpoint) - .then((res) => res.data) - .catch((error) => { - console.log("error :", error.response); - // return error; - }); -}; - -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; - }); -}; - -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 a2f1abdd..1f6e5566 100644 --- a/actions/index.js +++ b/actions/index.js @@ -32,7 +32,7 @@ export const getIP = (req) => { ? forwarded.split(/, /)[0] : req.socket.remoteAddress; - console.log( + console.info( "\n====================\n Client IP address: " + ip, "\n=====================\n" ); @@ -462,7 +462,7 @@ export const getBasicSearchDetails = ( ) .then((res) => res.data) .catch((error) => { - console.log("this error", error); + consoleLogger(error); }); }; @@ -472,7 +472,7 @@ export const getBasicPartSavedDetails = ( primaryIdAttribute, incidentID ) => { - // console.log( + //console.log( // "///////api call: ", // BASE_URL + // "/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" + @@ -517,7 +517,7 @@ export const getBasicSearchDetailsPaged = ( ) .then((res) => res.data) .catch((error) => { - console.log("this error", error); + consoleLogger(error); }); }; @@ -674,7 +674,6 @@ export const getPickLists = (whichForm) => { }; export const getPersonalAccount = (contactid) => { - console.log(contactid); return axios .get( BASE_URL + @@ -702,7 +701,7 @@ export const getAppealID = ( updateFormCollection, primaryAttribute ) => { - // console.log( + //console.log( // "is this the collection?:", // getFormCollection(updateFormCollection) // ) @@ -722,12 +721,12 @@ export const getAppealID = ( const result = Object.entries(res.data.value[0]).filter( ([key]) => !key.startsWith("_") )[0][1]; - console.log("result:", res.data); + // console.log("result:", res.data); var appealID = result; return appealID; }) .catch((error) => { - console.log("API call error", error); + consoleLogger(error); }); }; @@ -780,7 +779,7 @@ export const getMyRepresentations = (loggedInUserId) => { ) .then((res) => res.data) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -793,7 +792,7 @@ export const getMyRepresentationsProxy = (loggedInUserId) => { ) .then((res) => res.data) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -802,7 +801,7 @@ export const getRepresentations = (incidentID) => { .get("/api/endpoint/getrepresentations_api?incidentID=" + incidentID) .then((res) => res.data) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -815,7 +814,7 @@ export const getRepresentationsProxy = (incidentID) => { ) .then((res) => res.data) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -828,7 +827,7 @@ export const getWatchedCases = (loggedInUserId) => { ) .then((res) => res.data) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -840,7 +839,7 @@ export const getWatchedCasesProxy = (loggedInUserId) => { ) .then((res) => res.data) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -873,18 +872,18 @@ export const getAwaitingSubmission = (loggedInUserId) => { }; export const getAwaitingSubmissionFromBlob = (containerName) => { - console.log( - "///////////////////////\ngetAwaitingSubmissionFromBlob: " + - containerName, - BASE_URL + - "/api/file/getawaitingsubmissionfromblob?container=" + - containerName + - hashAPIPath( - "/api/file/getawaitingsubmissionfromblob?container=" + - containerName - ), - "\n///////////////////////\n" - ); + //console.log( + // "///////////////////////\ngetAwaitingSubmissionFromBlob: " + + // containerName, + // BASE_URL + + // "/api/file/getawaitingsubmissionfromblob?container=" + + // containerName + + // hashAPIPath( + // "/api/file/getawaitingsubmissionfromblob?container=" + + // containerName + // ), + // "\n///////////////////////\n" + // ); return axios .get( BASE_URL + @@ -904,15 +903,15 @@ export const getAwaitingSubmissionFromBlob = (containerName) => { }; export const getRepsFromBlob = (containerName) => { - console.log( - "///////////////////////\ngetRepsFromBlob function: " + - containerName + - "\n///////////////////////\n", - BASE_URL + - "/api/file/getrepsblob?container=" + - containerName + - hashAPIPath("/api/file/getrepsblob?container=" + containerName) - ); + //console.log( + // "///////////////////////\ngetRepsFromBlob function: " + + // containerName + + // "\n///////////////////////\n", + // BASE_URL + + // "/api/file/getrepsblob?container=" + + // containerName + + // hashAPIPath("/api/file/getrepsblob?container=" + containerName) + // ); return axios .get( @@ -925,22 +924,23 @@ export const getRepsFromBlob = (containerName) => { return res.data; }) .catch((error) => { - console.log( - "///////////////////////\ngetRepsFromBlob error response: " + - error + - "\n///////////////////////\n" - ); - console.log("API call error", error); + //console.log( + // "///////////////////////\ngetRepsFromBlob error response: " + + // error + + // "\n///////////////////////\n" + // ); + console.log(consoleLogger(error)); + //console.log("API call error", error); }); }; export const getRepsFromBlobProxy = (containerName) => { - console.log( - "///////////////////////getRepsFromBlobProxy: " + containerName, - "/api/file/getawaitingsubmissionfromblobproxy?container=" + - containerName, - "\n///////////////////////\n" - ); + //console.log( + // "///////////////////////getRepsFromBlobProxy: " + containerName, + // "/api/file/getawaitingsubmissionfromblobproxy?container=" + + // containerName, + // "\n///////////////////////\n" + // ); return axios .get( @@ -1052,7 +1052,7 @@ export const updatePassword = (contactId, newpassword) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1089,7 +1089,7 @@ export const createWatchedCases = (formValues) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1125,7 +1125,7 @@ export const createNewCase = ( return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1171,14 +1171,14 @@ export const createNewCaseBlob = ( data: data, }; - console.log("the query url for crearte csase:", queryUrl); + //console.log("the query url for crearte csase:", queryUrl); return axios(config) .then((res) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1275,7 +1275,7 @@ export const patchCase = async (incidentid) => { }; export const getCase = (incidentID) => { - // console.log( + //console.log( // "////////////// ------" + // BASE_URL + // "/api/endpoint/getcase_api?incidentID=" + @@ -1288,7 +1288,7 @@ export const getCase = (incidentID) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1315,7 +1315,7 @@ export const deleteMyRepresentations = (myRepresentationsID) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1334,7 +1334,7 @@ export const deleteAwaitingSubmissions = (incidentID) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1359,7 +1359,7 @@ export const deleteAwaitingSubmissionsFromBlob = ( return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1387,7 +1387,7 @@ export const deleteMyRepresentationsFromBlob = ( return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1405,7 +1405,7 @@ export const deleteWatchedCases = (watchedCaseID) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1424,7 +1424,7 @@ export const createAccount = (formValues) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1446,7 +1446,7 @@ export const uploadFiles = async ( for (let i = 0; i < files.length; i++) { for (let j = 0; j < files[i].length; j++) { - console.log("upload files:", files[i][j].name); + //console.log("upload files:", files[i][j].name); formData.append(files[i][j].name, files[i][j]); } } @@ -1467,7 +1467,7 @@ export const uploadFiles = async ( const res = await axios(config); return res.data; } catch (error) { - console.log("this serror", error); + consoleLogger(error); } }; @@ -1490,7 +1490,7 @@ export const uploadRepFiles = async ( for (let i = 0; i < files.length; i++) { for (let j = 0; j < files[i].length; j++) { - console.log("upload rep files:", files[i][j].name); + //console.log("upload rep files:", files[i][j].name); formData.append(files[i][j].name, files[i][j]); } } @@ -1511,7 +1511,7 @@ export const uploadRepFiles = async ( const res = await axios(config); return res.data; } catch (error) { - console.log("this serror", error); + consoleLogger(error); } }; @@ -1543,7 +1543,7 @@ export const generateRepPDF = async (formValues, containerID, casefolderID) => { const res = await axios(config); return res.data; } catch (error) { - console.log("this serror", error); + consoleLogger(error); } }; @@ -1580,25 +1580,25 @@ export const generateAppealPDF = async ( const res = await axios(config); return res.data; } catch (error) { - console.log("this serror", error); + consoleLogger(error); } }; export const getFilesFromBlob = (containerName, casefolderID) => { - console.log( - " get files from blob", - BASE_URL + - "/api/file/getbloblist?container=" + - containerName + - "&casefolderID=" + - casefolderID + - hashAPIPath( - "/api/file/getbloblist?container=" + - containerName + - "&casefolderID=" + - casefolderID - ) - ); + //console.log( + // " get files from blob", + // BASE_URL + + // "/api/file/getbloblist?container=" + + // containerName + + // "&casefolderID=" + + // casefolderID + + // hashAPIPath( + // "/api/file/getbloblist?container=" + + // containerName + + // "&casefolderID=" + + // casefolderID + // ) + // ); return axios .get( BASE_URL + @@ -1618,7 +1618,7 @@ export const getFilesFromBlob = (containerName, casefolderID) => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1640,7 +1640,7 @@ export const getFilesFromBlobHashed = ( return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1662,7 +1662,7 @@ export const deleteBlob = async ( ); return res.data; } catch (error) { - console.log("this serror", error); + consoleLogger(error); } }; @@ -1683,30 +1683,30 @@ export const downloadBlob = (containerName, blobName) => { "content-disposition", "attachment; filename=" + blobName ); - console.log("has downloaded"); + //console.log("has downloaded"); return res.status(200).send(response.data); }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; export const getProgressFromBlob = async (containerName, casereference) => { - console.log( - /////////////////\ngetProgressFromBlob", - BASE_URL + - "/api/file/getprogressobjblob?container=" + - containerName + - "&casefolderID=" + - casereference + - hashAPIPath( - "/api/file/getprogressobjblob?container=" + - containerName + - "&casefolderID=" + - casereference - ) - ); + //console.log( + // /////////////////\ngetProgressFromBlob", + // BASE_URL + + // "/api/file/getprogressobjblob?container=" + + // containerName + + // "&casefolderID=" + + // casereference + + // hashAPIPath( + // "/api/file/getprogressobjblob?container=" + + // containerName + + // "&casefolderID=" + + // casereference + // ) + // ); try { const res = await axios.get( BASE_URL + @@ -1723,7 +1723,7 @@ export const getProgressFromBlob = async (containerName, casereference) => { ); return res.data; } catch (error) { - console.log("this serror", error); + consoleLogger(error); } }; @@ -1740,7 +1740,7 @@ export const sendEmail = async ( "personalisation": personalisation, }; - // console.log( + //console.log( // "hwewwew: ", // templateId, // emailAddress, @@ -1761,7 +1761,7 @@ export const sendEmail = async ( return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1773,7 +1773,7 @@ export const getNotice = () => { return res.data; }) .catch((error) => { - console.log("this serror", error); + consoleLogger(error); }); }; @@ -1786,7 +1786,7 @@ export const getPortalLogin = async (emailAddress) => { .then((res) => res.data) .catch((error) => { console.log(consoleLogger(error)); - console.log("thiserror", error); + return JSON.stringify(error); }); }; @@ -1801,8 +1801,8 @@ export const createContainerProxy = (containerName) => { .get(BASE_URL + queryUrl) .then((res) => res.data) .catch((error) => { - //console.log(consoleLogger(error)); - console.log("thiserror", error); + console.log(consoleLogger(error)); + return JSON.stringify(error); }); }; @@ -1890,10 +1890,10 @@ export const getAddressSearch = async (searchString) => { const params = new URLSearchParams(searchString); const str = params.toString(); - console.log( - "the url", - BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str - ); + //console.log( + // "the url", + // BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str + // ); try { const res = await axios.get( BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str diff --git a/actions/selectQueryTypes.js b/actions/selectQueryTypes.js index bdaf55c3..39a7ef3f 100644 --- a/actions/selectQueryTypes.js +++ b/actions/selectQueryTypes.js @@ -50,7 +50,7 @@ export const getSelectQuery = (appealTypeName) => { return "&$select=modifiedon,_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,pinswg_starttimeofevent,pinswg_typeofevent"; break; case "pinswg_planningappeals78s": - // console.log( + //console.log( // "///////////////\n path:", // process.env.RELAYPATH == "test-pedw-hc" // ); diff --git a/components/case/summary.js b/components/case/summary.js index 223cee32..ec468796 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -114,7 +114,7 @@ const CaseSummary = (props) => { }; const getDetails = (resultsObj, detailsType) => { - console.log(resultsObj); + //console.log(resultsObj); let detailsArr = []; resultsObj = resultsObj.value; const detailsObj = resultsObj.map((searchDetail, index) => { @@ -1098,7 +1098,7 @@ const CaseSummary = (props) => { ); - // console.log(item.incidentid, item.title); + //console.log(item.incidentid, item.title); })} diff --git a/components/cookiemanager/index.js b/components/cookiemanager/index.js index 007f773a..f025351b 100644 --- a/components/cookiemanager/index.js +++ b/components/cookiemanager/index.js @@ -65,7 +65,7 @@ const CookieManagementMain = (props) => { const [usageState, setUsageState] = useState( typeof cookieCheck.CookiePolicy == "undefined" ? null : cookieObj.usage ); - // const [communicationsState, setCommunicationsState] = useState( + //const [communicationsState, setCommunicationsState] = useState( // typeof cookieCheck.CookiePolicy == "undefined" // ? null // : cookieObj.communications @@ -431,12 +431,11 @@ const CookieManagementMain = (props) => { href={t( "cookies:cookie-settings-essential-link" )} - className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"> - + className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold" + > {t( "cookies:cookie-settings-essential-link-label" )} -

diff --git a/pages/account/register.js b/pages/account/register.js index 0a59dad1..0156a2fe 100644 --- a/pages/account/register.js +++ b/pages/account/register.js @@ -163,7 +163,7 @@ export const getServerSideProps = wrapper.getServerSideProps( let thisSession = await getSession(ctx); - // console.log( + //console.log( // "auth sess for register :", // thisSession, // thisSession.user.email diff --git a/pages/advancedsearch.js b/pages/advancedsearch.js index 4b390bd0..b23efddc 100644 --- a/pages/advancedsearch.js +++ b/pages/advancedsearch.js @@ -126,8 +126,8 @@ export const getServerSideProps = wrapper.getServerSideProps( await getLPA(), ]); - // const lpaData = require("../data/lpa.json"); - // const appealTypeData = require("../data/appealtypes.json"); + //const lpaData = require("../data/lpa.json"); + //const appealTypeData = require("../data/appealtypes.json"); store.dispatch(setAppealType(appealTypeData)); store.dispatch(setLPA(lpaData)); diff --git a/pages/api/endpoint/getbasicsearch_by_address_api copy.js b/pages/api/endpoint/getbasicsearch_by_address_api copy.js index 983b7d38..aaac35ff 100644 --- a/pages/api/endpoint/getbasicsearch_by_address_api copy.js +++ b/pages/api/endpoint/getbasicsearch_by_address_api copy.js @@ -431,7 +431,7 @@ export default async function ApiProxy(req, res) { item.NavigationProperty.toLowerCase() + "_value"; - // console.log( + //console.log( // "\n==========================================\n", // "basic search: " + queryUrl, // "\n\n", diff --git a/pages/api/endpoint/getbasicsearch_by_address_api.js b/pages/api/endpoint/getbasicsearch_by_address_api.js index 6ab7dd5d..9296bdc0 100644 --- a/pages/api/endpoint/getbasicsearch_by_address_api.js +++ b/pages/api/endpoint/getbasicsearch_by_address_api.js @@ -458,7 +458,7 @@ export default async function ApiProxy(req, res) { item.NavigationProperty.toLowerCase() + "_value"; - // console.log( + //console.log( // "\n==========================================\n", // "basic search: " + queryUrl, // "\n\n", diff --git a/pages/api/endpoint/getmylpacases_api.js b/pages/api/endpoint/getmylpacases_api.js index b7c84c65..0f252773 100644 --- a/pages/api/endpoint/getmylpacases_api.js +++ b/pages/api/endpoint/getmylpacases_api.js @@ -50,13 +50,13 @@ export default async function ApiProxy(req, res) { const lpaGUID = jsonpath('$..[?(@.name=="' + lpaid + '")]', lpaList); - console.log( - '$..[?(@.name="' + lpaid + '")]', - lpaList, - lpaid, - "LPAGUID=", - lpaGUID - ); + //console.log( + // '$..[?(@.name="' + lpaid + '")]', + // lpaList, + // lpaid, + // "LPAGUID=", + // lpaGUID + // ); var queryUrl = "incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_pinswg_associatedlpa_value eq " + diff --git a/pages/api/endpoint/getpersonalaccount_api.js b/pages/api/endpoint/getpersonalaccount_api.js index 8817b442..f709a65d 100644 --- a/pages/api/endpoint/getpersonalaccount_api.js +++ b/pages/api/endpoint/getpersonalaccount_api.js @@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) { contactid + ")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode,pinswg_typeofinvolvement,pinswg_contact_associatedlpa,pinswg_preferredlanguage&$count=true"; - // console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl)); + //console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl)); var apiResponse = contactid.length > 0 diff --git a/pages/api/file/createappealcompletemessage_api.js b/pages/api/file/createappealcompletemessage_api.js index f6579024..14661b18 100644 --- a/pages/api/file/createappealcompletemessage_api.js +++ b/pages/api/file/createappealcompletemessage_api.js @@ -19,8 +19,8 @@ ApiProxy.get(async (req, res) => { console.log("/////Create Case Message:\n", tempCaseRef, "\n//////////////"); - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); var checkquerypath = "/api/file/createappealcompletemessage_api?container=" + containerName + diff --git a/pages/api/file/createappealcompletemessageproxy_api.js b/pages/api/file/createappealcompletemessageproxy_api.js index df04081b..546756b5 100644 --- a/pages/api/file/createappealcompletemessageproxy_api.js +++ b/pages/api/file/createappealcompletemessageproxy_api.js @@ -22,8 +22,8 @@ ApiProxy.get(async (req, res) => { console.log("/////Create Case Message:\n", tempCaseRef, "\n//////////////"); - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); var token = await getToken(); diff --git a/pages/api/file/createrepcompletemessage_api.js b/pages/api/file/createrepcompletemessage_api.js index 7fb2d907..4febc9b6 100644 --- a/pages/api/file/createrepcompletemessage_api.js +++ b/pages/api/file/createrepcompletemessage_api.js @@ -15,8 +15,8 @@ ApiProxy.get(async (req, res) => { var tempCaseRef = req.query.tempcaseref; var filename = req.query.repid; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); //if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await createRepCompleteMessage(containerName, tempCaseRef, filename).then( diff --git a/pages/api/file/deleteawaitingsubmissionfromblob.js b/pages/api/file/deleteawaitingsubmissionfromblob.js index ab6b1b6d..64ca4d30 100644 --- a/pages/api/file/deleteawaitingsubmissionfromblob.js +++ b/pages/api/file/deleteawaitingsubmissionfromblob.js @@ -21,8 +21,8 @@ ApiProxy.get(async (req, res) => { "&blobname=" + blobName; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await deleteBlob( diff --git a/pages/api/file/deleteblob.js b/pages/api/file/deleteblob.js index ab6b1b6d..64ca4d30 100644 --- a/pages/api/file/deleteblob.js +++ b/pages/api/file/deleteblob.js @@ -21,8 +21,8 @@ ApiProxy.get(async (req, res) => { "&blobname=" + blobName; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await deleteBlob( diff --git a/pages/api/file/deleteblobcase.js b/pages/api/file/deleteblobcase.js index 8df70d36..2bfd453d 100644 --- a/pages/api/file/deleteblobcase.js +++ b/pages/api/file/deleteblobcase.js @@ -19,8 +19,8 @@ ApiProxy.get(async (req, res) => { "&casefolderID=" + casefolderID; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); //if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await deleteBlobCase(containerName, casefolderID).then((data) => { diff --git a/pages/api/file/deleteblobrep.js b/pages/api/file/deleteblobrep.js index 45d51be3..50f77135 100644 --- a/pages/api/file/deleteblobrep.js +++ b/pages/api/file/deleteblobrep.js @@ -24,8 +24,8 @@ ApiProxy.get(async (req, res) => { casefolderID = casefolderID + "/" + repfile; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); //if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await deleteBlobRep(containerName, casefolderID).then((data) => { diff --git a/pages/api/file/generateappealpdf.js b/pages/api/file/generateappealpdf.js index 14190d64..da80b4ea 100644 --- a/pages/api/file/generateappealpdf.js +++ b/pages/api/file/generateappealpdf.js @@ -105,7 +105,7 @@ import { statement_pdf } from "../../../components/pdftemplates/statement_pdf"; import { writtenStatement_pdf } from "../../../components/pdftemplates/writtenStatement_pdf"; import { other_pdf } from "../../../components/pdftemplates/other_pdf"; -// const ApiProxy = nextConnect(); +//const ApiProxy = nextConnect(); // ApiProxy.use(middleware); // ApiProxy.post(async (req, res) => { diff --git a/pages/api/file/generatepdf.js b/pages/api/file/generatepdf.js index 088f7dbe..da86a688 100644 --- a/pages/api/file/generatepdf.js +++ b/pages/api/file/generatepdf.js @@ -100,7 +100,7 @@ import { statement_pdf } from "../../../components/pdftemplates/statement_pdf"; import { writtenStatement_pdf } from "../../../components/pdftemplates/writtenStatement_pdf"; import { other_pdf } from "../../../components/pdftemplates/other_pdf"; import { consoleLogger } from "../../../actions"; -// const ApiProxy = nextConnect(); +//const ApiProxy = nextConnect(); // ApiProxy.use(middleware); // ApiProxy.post(async (req, res) => { @@ -131,7 +131,7 @@ export default async function handler(req, res) { var checkquerypath = "/api/file/generatepdf"; //console.log("-------", checkHash); - // console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash); //console.log(casefolderID, caseRef); // Create Document Component @@ -215,7 +215,7 @@ export default async function handler(req, res) { // code block } - // console.log( + //console.log( // "///////////////////////////////////\n file created: \n" + // process.cwd() + // `tmp/${reqBodyobj.repfile_name}.pdf` + diff --git a/pages/api/file/getawaitingsubmissionfromblob.js b/pages/api/file/getawaitingsubmissionfromblob.js index 085eb474..9b93f962 100644 --- a/pages/api/file/getawaitingsubmissionfromblob.js +++ b/pages/api/file/getawaitingsubmissionfromblob.js @@ -17,12 +17,12 @@ ApiProxy.get(async (req, res) => { var checkquerypath = "/api/file/getawaitingsubmissionfromblob?container=" + containerName; - console.log( - "///////////////////////\ngetawaitingsubmissionblob url :", - req.url, - "\n///////////////////////\n" - ); - // console.log(hashAPIPath(checkquerypath), checkHash); + // console.log( + // "///////////////////////\ngetawaitingsubmissionblob url :", + // req.url, + // "\n///////////////////////\n" + // ); + //console.log(hashAPIPath(checkquerypath), checkHash); //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { diff --git a/pages/api/file/getbloblist.js b/pages/api/file/getbloblist.js index 17f05b56..6154524b 100644 --- a/pages/api/file/getbloblist.js +++ b/pages/api/file/getbloblist.js @@ -49,8 +49,8 @@ ApiProxy.get(async (req, res) => { "&casefolderID=" + casefolderID; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await getBlobs(containerName, casefolderID).then((data) => { diff --git a/pages/api/file/getprogressobjblob.js b/pages/api/file/getprogressobjblob.js index 319ccba9..55e30a06 100644 --- a/pages/api/file/getprogressobjblob.js +++ b/pages/api/file/getprogressobjblob.js @@ -22,7 +22,7 @@ ApiProxy.get(async (req, res) => { casefolderID; //console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { const blobObj = await getProgressBlobs(containerName, casefolderID) diff --git a/pages/api/file/getrepsblob.js b/pages/api/file/getrepsblob.js index b64fd3ae..52ae0b3f 100644 --- a/pages/api/file/getrepsblob.js +++ b/pages/api/file/getrepsblob.js @@ -48,24 +48,24 @@ ApiProxy.get(async (req, res) => { var checkHash = req.query.hash; var checkquerypath = "/api/file/getrepsblob?container=" + containerName; - // console.log("-----", casefolderID); - // console.log("-----", req.query); - // console.log("-----", checkquerypath); - // console.log("-----", hashAPIPath(checkquerypath)); - // console.log("-----", checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log("-----", casefolderID); + //console.log("-----", req.query); + //console.log("-----", checkquerypath); + //console.log("-----", hashAPIPath(checkquerypath)); + //console.log("-----", checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { const blobObj = await getRepsBlobs(containerName, casefolderID) .then(async (data) => { - console.log( - "\n////////////////////////////\n getRepsBlobs:", - data - ); + //console.log( + // "\n////////////////////////////\n getRepsBlobs:", + // data + // ); return data; }) .then(async (data) => { - console.log("\n////////////////////////////\n now here:", data); + //console.log("\n////////////////////////////\n now here:", data); let result = await downloadAllRepsFiles(containerName, data); @@ -75,11 +75,11 @@ ApiProxy.get(async (req, res) => { .json(result); }) .catch((error) => { - console.log( - "///////////////////////\ngetRepsFromBlob api in api route response: " + - error + - "\n///////////////////////\n" - ); + //console.log( + // "///////////////////////\ngetRepsFromBlob api in api route response: " + + // error + + // "\n///////////////////////\n" + // ); //console.log("API call error", error); console.log(consoleLogger(error)); diff --git a/pages/api/file/setupcontainer.js b/pages/api/file/setupcontainer.js index cff853cb..eda50d6f 100644 --- a/pages/api/file/setupcontainer.js +++ b/pages/api/file/setupcontainer.js @@ -17,8 +17,8 @@ ApiProxy.get(async (req, res) => { var checkHash = req.query.hash; var checkquerypath = "/api/file/setupcontainer?ident=" + containerName; - // console.log(checkquerypath, hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + //console.log(checkquerypath, hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await createContainer(containerName) diff --git a/pages/api/file/upload.js b/pages/api/file/upload.js index f4a1f027..d5e20f05 100644 --- a/pages/api/file/upload.js +++ b/pages/api/file/upload.js @@ -12,9 +12,9 @@ ApiProxy.use(middleware); ApiProxy.post(async (req, res) => { var checkHash = req.query.hash; - // console.log(JSON.stringify(req.body)); - // console.log(JSON.stringify(req.body.appealData)); - // console.log(req.files); + //console.log(JSON.stringify(req.body)); + //console.log(JSON.stringify(req.body.appealData)); + //console.log(req.files); const appealData = req.body.appealData; const containerID = req.body.containerID[0]; @@ -25,8 +25,8 @@ ApiProxy.post(async (req, res) => { // var checkquerypath = "/api/file/upload"; - // console.log(hashAPIPath(checkquerypath), checkHash); - // console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash); + //console.log(hashAPIPath(checkquerypath), checkHash); + //console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash); // if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) { //createContainer(containerID).then((containerName) => { diff --git a/pages/case/[ticketnumber].js b/pages/case/[ticketnumber].js index 51905b8e..546be812 100644 --- a/pages/case/[ticketnumber].js +++ b/pages/case/[ticketnumber].js @@ -143,16 +143,16 @@ export const getServerSideProps = wrapper.getServerSideProps( const searchResultsObj = await getBasicSearch(developmentQuery); const searchDetailsObj = await getSearchDetails(searchResultsObj); - console.log( - "\n======================================\n", - searchResultsObj, - "\n======================================\n" - ); - console.log( - "\n======================================\n", - searchDetailsObj[0], - "\n======================================\n" - ); + //console.log( + // "\n======================================\n", + // searchResultsObj, + // "\n======================================\n" + // ); + //console.log( + // "\n======================================\n", + // searchDetailsObj[0], + // "\n======================================\n" + // ); store.dispatch(setSearch(developmentQuery)); @@ -203,7 +203,7 @@ export const getServerSideProps = wrapper.getServerSideProps( ); } } - // console.log(searchResultsObj); + //console.log(searchResultsObj); return { props: { // searchResultsObj: { diff --git a/pages/case/id/[incident].js b/pages/case/id/[incident].js index 1d385eba..cf8c1057 100644 --- a/pages/case/id/[incident].js +++ b/pages/case/id/[incident].js @@ -136,12 +136,12 @@ export const getServerSideProps = wrapper.getServerSideProps( const searchResultsObj = await getIncidentbyID(query.incident); const searchDetailsObj = await getSearchDetails(searchResultsObj); - // console.log( + //console.log( // "\n======================================\n", // searchResultsObj, // "\n======================================\n" // ); - // console.log( + //console.log( // "\n======================================\n", // searchDetailsObj[0], // "\n======================================\n" diff --git a/pages/dns/[developmentName].js b/pages/dns/[developmentName].js index 93419f2b..e46949ef 100644 --- a/pages/dns/[developmentName].js +++ b/pages/dns/[developmentName].js @@ -147,7 +147,7 @@ export const getServerSideProps = wrapper.getServerSideProps( store.dispatch(setSearch(developmentQuery)); - // console.log({ + //console.log({ // "currentReference": searchResultsObj.value[0].title, // "currentType": "searchResultsObj", // "incidentid": searchResultsObj.value[0].incidentid, @@ -187,7 +187,7 @@ export const getServerSideProps = wrapper.getServerSideProps( ); } } - // console.log(searchResultsObj); + //console.log(searchResultsObj); return { props: { searchResultsObj: { diff --git a/pages/dns/application-view.js b/pages/dns/application-view.js index 0c5685f4..2b51ffcc 100644 --- a/pages/dns/application-view.js +++ b/pages/dns/application-view.js @@ -56,7 +56,7 @@ export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ query, req, res }) => { console.log("query-", query); - // const searchResultsObj = (await getBasicSearch(query.q)) || null; + //const searchResultsObj = (await getBasicSearch(query.q)) || null; // store.dispatch(setSearchResults(searchResultsObj)); //store.dispatch(setSearch(query.q)); } diff --git a/pages/dns/applications.js b/pages/dns/applications.js index b4cd8c41..9697b40c 100644 --- a/pages/dns/applications.js +++ b/pages/dns/applications.js @@ -53,7 +53,7 @@ export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ query, req, res }) => { console.log("query-", query); - // const searchResultsObj = (await getBasicSearch(query.q)) || null; + //const searchResultsObj = (await getBasicSearch(query.q)) || null; // store.dispatch(setSearchResults(searchResultsObj)); //store.dispatch(setSearch(query.q)); } diff --git a/pages/myportal/[appealtypes].js b/pages/myportal/[appealtypes].js index 555ab2ae..c63250e2 100644 --- a/pages/myportal/[appealtypes].js +++ b/pages/myportal/[appealtypes].js @@ -87,7 +87,7 @@ let Home = (props) => { //let optionsTitleObj = []; - // const optionsTitleObj = selectedObj.reduce( + //const optionsTitleObj = selectedObj.reduce( // (obj, arrValue) => ( // (obj[arrValue] = arrValue // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "") diff --git a/pages/myportal/advancedsearch.js b/pages/myportal/advancedsearch.js index 90f83c85..39ceb508 100644 --- a/pages/myportal/advancedsearch.js +++ b/pages/myportal/advancedsearch.js @@ -99,8 +99,8 @@ export const getServerSideProps = wrapper.getServerSideProps( ] ); - // const lpaData = require("../../data/lpa.json"); - // const appealTypeData = require("../../data/appealtypes.json"); + //const lpaData = require("../../data/lpa.json"); + //const appealTypeData = require("../../data/appealtypes.json"); store.dispatch(setAccountDetails(accountDetails)); store.dispatch(setAppealType(appealTypeData)); diff --git a/pages/myportal/case/[ticketnumber].js b/pages/myportal/case/[ticketnumber].js index d651c653..43e1d684 100644 --- a/pages/myportal/case/[ticketnumber].js +++ b/pages/myportal/case/[ticketnumber].js @@ -160,16 +160,16 @@ export const getServerSideProps = wrapper.getServerSideProps( const searchResultsObj = await getBasicSearch(developmentQuery); const searchDetailsObj = await getSearchDetails(searchResultsObj); - console.log( - "\n======================================\n", - searchResultsObj, - "\n======================================\n" - ); - console.log( - "\n======================================\n", - searchDetailsObj[0], - "\n======================================\n" - ); + //console.log( + // "\n======================================\n", + // searchResultsObj, + // "\n======================================\n" + // ); + //console.log( + // "\n======================================\n", + // searchDetailsObj[0], + // "\n======================================\n" + // ); store.dispatch(setSearch(developmentQuery)); @@ -324,9 +324,9 @@ export const getServerSideProps = wrapper.getServerSideProps( ); } } - // console.log(searchResultsObj); + //console.log(searchResultsObj); - console.log(loggedInUser); + //console.log(loggedInUser); return { props: { // searchResultsObj: { @@ -341,7 +341,7 @@ export const getServerSideProps = wrapper.getServerSideProps( const getDetails = (resultsObj, detailsType) => { let detailsArr = []; - // console.log( + //console.log( // "//////////////////////////////////\n", // resultsObj, // //"\n", @@ -352,7 +352,7 @@ const getDetails = (resultsObj, detailsType) => { resultsObj = detailsType == "mySubmittedReps" ? resultsObj : resultsObj.value; - // console.log( + //console.log( // "////////////////////////////////// resultsobj\n", // detailsType, // "\n", diff --git a/pages/myportal/case/id/[incident].js b/pages/myportal/case/id/[incident].js index 6ef2878c..956ce841 100644 --- a/pages/myportal/case/id/[incident].js +++ b/pages/myportal/case/id/[incident].js @@ -133,12 +133,12 @@ export const getServerSideProps = wrapper.getServerSideProps( const searchResultsObj = await getIncidentbyID(query.incident); const searchDetailsObj = await getSearchDetails(searchResultsObj); - // console.log( + //console.log( // "\n======================================\n", // searchResultsObj, // "\n======================================\n" // ); - // console.log( + //console.log( // "\n======================================\n", // searchDetailsObj[0], // "\n======================================\n" @@ -175,7 +175,7 @@ export const getServerSideProps = wrapper.getServerSideProps( ); } } - // console.log(searchResultsObj); + //console.log(searchResultsObj); return { props: { searchResultsObj: { diff --git a/pages/myportal/index.js b/pages/myportal/index.js index 730caf5c..723b833a 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -223,7 +223,7 @@ export const getServerSideProps = wrapper.getServerSideProps( await getAwaitingSubmissionFromBlob(thisSession.user.id), ]); - // console.log( + //console.log( // "/////////////////////////\n ", // awaitingSubmissionFromBlob.value, // awaitingSubmissionFromBlob.case @@ -346,7 +346,7 @@ export const getServerSideProps = wrapper.getServerSideProps( const getDetails = (resultsObj, detailsType) => { let detailsArr = []; - // console.log( + //console.log( // "//////////////////////////////////\n", // resultsObj, // //"\n", @@ -357,7 +357,7 @@ const getDetails = (resultsObj, detailsType) => { resultsObj = detailsType == "mySubmittedReps" ? resultsObj : resultsObj.value; - // console.log( + //console.log( // "////////////////////////////////// resultsobj\n", // detailsType, // "\n", diff --git a/pages/newappeal/[appealtypes].js b/pages/newappeal/[appealtypes].js index 69144690..7f33296e 100644 --- a/pages/newappeal/[appealtypes].js +++ b/pages/newappeal/[appealtypes].js @@ -77,7 +77,7 @@ let Home = (props) => { //let optionsTitleObj = []; - // const optionsTitleObj = selectedObj.reduce( + //const optionsTitleObj = selectedObj.reduce( // (obj, arrValue) => ( // (obj[arrValue] = arrValue // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "") diff --git a/pages/newappeal/index.js b/pages/newappeal/index.js index 2c95649f..846d659d 100644 --- a/pages/newappeal/index.js +++ b/pages/newappeal/index.js @@ -183,8 +183,8 @@ export const getServerSideProps = wrapper.getServerSideProps( "\n////////////////////////////\n" ); - // const lpaData = require("../../data/lpa.json"); - // const appealTypeData = require("../../data/appealtypes.json"); + //const lpaData = require("../../data/lpa.json"); + //const appealTypeData = require("../../data/appealtypes.json"); store.dispatch(setAppealType(appealTypeData)); store.dispatch(setLPA(lpaData)); diff --git a/pages/storage.js b/pages/storage.js index 7d7eb94a..8aea7e59 100644 --- a/pages/storage.js +++ b/pages/storage.js @@ -13,7 +13,7 @@ import { getIP } from "../actions"; const ShowStorage = (props) => { const { container } = props; - // console.log("Containers:"); + //console.log("Containers:"); // // for await (const container of blobServiceClient.listContainers()) { // // console.log(`- ${container.name}`); // // } @@ -49,8 +49,8 @@ export const getServerSideProps = wrapper.getServerSideProps( creds ); - // const createContainerResponse = await containerClient.create(); - // console.log( + //const createContainerResponse = await containerClient.create(); + //console.log( // `Created container ${containerName} successfully`, // createContainerResponse.requestId // ); @@ -72,7 +72,7 @@ export const getServerSideProps = wrapper.getServerSideProps( // const blockBlobClient = // containerClient.getBlockBlobClient(blobName); - // // const uploadBlobResponse = await blockBlobClient.upload( + // //const uploadBlobResponse = await blockBlobClient.upload( // // content, // // Buffer.byteLength(content), // // uploadOptions @@ -90,7 +90,7 @@ export const getServerSideProps = wrapper.getServerSideProps( // //console.log(tags); // //await blockBlobClient.setTags(tags); - // // console.log( + // //console.log( // // `Uploaded block blob ${blobName} successfully`, // // uploadBlobResponse.requestId // // ); diff --git a/server/server.js b/server/server.js index 3b6f489e..ffab7135 100644 --- a/server/server.js +++ b/server/server.js @@ -1,37 +1,36 @@ // Node only has partial ES6 support, import/export is not // yet officially supported so we have to use require instead. -const express = require('express'); -const next = require('next'); -const compression = require('compression'); -// const cookieParser = require('cookie-parser'); +const express = require("express"); +const next = require("next"); +const compression = require("compression"); +//const cookieParser = require('cookie-parser'); const port = parseInt(process.env.PORT, 10) || 3000; -const app = next({ dev: process.env.NODE_ENV !== 'production' }); +const app = next({ dev: process.env.NODE_ENV !== "production" }); const handle = app.getRequestHandler(); - // Having trouble with X-origin client side, setup a proxy here -// const proxy = require('http-proxy-middleware'); -// const EXTERNAL_API = 'http://example.com/api'; +//const proxy = require('http-proxy-middleware'); +//const EXTERNAL_API = 'http://example.com/api'; app.prepare().then(() => { - const server = express(); + const server = express(); - // const api_proxy = proxy(EXTERNAL_API, { changeOrigin: true }); - // Enable compression locally, helps page load times because... why not. - server.use(compression()); + //const api_proxy = proxy(EXTERNAL_API, { changeOrigin: true }); + // Enable compression locally, helps page load times because... why not. + server.use(compression()); - // Parse cookies on the server, which we will pass through to React - // server.use(cookieParser()); + // Parse cookies on the server, which we will pass through to React + // server.use(cookieParser()); - // Enable your new proxy below - // server.use(api_proxy); + // Enable your new proxy below + // server.use(api_proxy); - server.get('*', (req, res) => { - return handle(req, res); - }); + server.get("*", (req, res) => { + return handle(req, res); + }); - server.listen(port, (err) => { - if (err) throw err; - console.log(`💻 Ready on http://localhost:${port}`); - }); + server.listen(port, (err) => { + if (err) throw err; + console.log(`💻 Ready on http://localhost:${port}`); + }); }); diff --git a/store/govgateway/action.js b/store/govgateway/action.js deleted file mode 100644 index e5116cb7..00000000 --- a/store/govgateway/action.js +++ /dev/null @@ -1,10 +0,0 @@ -export const govGatweayActionTypes = { - GETPROVIDERCONFIG: "GETPROVIDERCONFIG", -}; - -export const getGovGatewayConfig = (config) => (dispatch) => { - return dispatch({ - type: govGatweayActionTypes.GETPROVIDERCONFIG, - config: config, - }); -}; diff --git a/store/govgateway/reducer.js b/store/govgateway/reducer.js deleted file mode 100644 index e7742c7f..00000000 --- a/store/govgateway/reducer.js +++ /dev/null @@ -1,17 +0,0 @@ -import { govGatweayActionTypes } from "./action"; - -const govGatewayConfigInitialState = { - config: {}, -}; - -export default function reducer(state = govGatewayConfigInitialState, action) { - switch (action.type) { - case govGatweayActionTypes.GETPROVIDERCONFIG: - return { - ...state, - config: action.config, - }; - default: - return state; - } -} diff --git a/styles/sass/patterns/_step-by-step-nav.scss b/styles/sass/patterns/_step-by-step-nav.scss index e583f767..35343fec 100644 --- a/styles/sass/patterns/_step-by-step-nav.scss +++ b/styles/sass/patterns/_step-by-step-nav.scss @@ -340,7 +340,7 @@ $top-border: solid 2px govuk-colour("mid-grey"); } } -// contents of the steps, such as paragraphs and links +//contents of the steps, such as paragraphs and links .app-step-nav__paragraph { padding-bottom: govuk-spacing(3); From 300a45ee0fee17691399b1aab4a65ba458375f1d Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 5 Jun 2024 19:51:43 +0100 Subject: [PATCH 2/3] console log tidying --- components/breadcrumbs.js | 2 +- components/homepage/login.js | 2 +- components/mapping/osm.js | 2 +- components/myportal/advancedsearch.js | 2 +- components/myportal/topthree.js | 2 +- components/myportal/topthree_reps.js | 2 +- components/myportal/viewall.js | 18 +++++++++--------- components/newappeal/aboutyou.js | 4 ++-- components/newappeal/buildcheckrow.js | 2 +- components/newappeal/buildprogress.js | 2 +- components/newappeal/buildrow.js | 4 ++-- components/newappeal/complete.js | 2 +- components/newappeal/createCase.js | 6 +++--- components/newappeal/fileupload.js | 2 +- .../pdftemplates/lpaQuestionnaire_pdf.js | 2 +- components/search/addresssearchresults.js | 8 ++++---- components/search/advancedsearch.js | 2 +- components/search/searchresults.js | 4 ++-- components/utils/index.js | 2 +- 19 files changed, 35 insertions(+), 35 deletions(-) diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index b25b860e..eccd45da 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -45,7 +45,7 @@ const Breadcrumbs = (props) => { } } - // const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); // let spinnerState = () => { // showSpinnerState == true diff --git a/components/homepage/login.js b/components/homepage/login.js index 08f1d405..55cc0d07 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -28,7 +28,7 @@ let Login = (props) => { const router = useRouter(); const { locale } = router; - // const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); const [validLoginID, setValidLoginID] = useState(null); // let spinnerState = () => { diff --git a/components/mapping/osm.js b/components/mapping/osm.js index f06cda02..fad057e1 100644 --- a/components/mapping/osm.js +++ b/components/mapping/osm.js @@ -7,7 +7,7 @@ const OSMapComponent = (props) => { const markerRef = useRef(null); let data = [center]; - // const ModelsMap = (map, maps) => { + //const ModelsMap = (map, maps) => { // //instantiate array that will hold your Json Data // let dataArray = []; // //push your Json Data in the array diff --git a/components/myportal/advancedsearch.js b/components/myportal/advancedsearch.js index 3814dfc5..83c22701 100644 --- a/components/myportal/advancedsearch.js +++ b/components/myportal/advancedsearch.js @@ -273,7 +273,7 @@ let AdvancedSearch = (props) => { ); }; - // const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); // let spinnerState = () => { // showSpinnerState == true diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index a3f84785..f04d19d8 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -96,7 +96,7 @@ const TopThree = (props) => { setAwaitingSubmission(data), getDetails(data, "awaitingSubmission").then( (data) => { - // console.log( + //console.log( // "submission get details:", // data // ); diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js index 32b4b084..da3357bf 100644 --- a/components/myportal/topthree_reps.js +++ b/components/myportal/topthree_reps.js @@ -95,7 +95,7 @@ const TopThree = (props) => { setAwaitingSubmission(data), getDetails(data, "awaitingSubmission").then( (data) => { - // console.log( + //console.log( // "submission get details:", // data // ); diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index f61fb9ab..c3deef76 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -84,11 +84,11 @@ const ViewAllResults = (props) => { }; let currentView = props.currentView.currentView; - console.log("currentView.viewKey:", typeof currentView.viewKey); + //console.log("currentView.viewKey:", typeof currentView.viewKey); - typeof currentView.viewKey == "undefined" - ? console.log("no currentview") - : console.log("has currentview"); + // typeof currentView.viewKey == "undefined" + // ? console.log("no currentview") + // : console.log("has currentview"); var resultsArr = currentView.viewKey == "awaitingSubmissionDetails" @@ -144,7 +144,7 @@ const ViewAllResults = (props) => { // ? searchDetailsObj[key].value[0] // : searchDetailsObj[key]; - console.log(resultsArr[key]); + //console.log(resultsArr[key]); resultsRowArr.push(
@@ -724,9 +724,9 @@ const ViewAllResults = (props) => { const getSearchPageResults = useCallback( (pageNumber, orderBy, fieldSort) => { //console.log(advancedSearch, searchString, pageNumber); - console.log(pageNumber, orderBy, fieldSort); + //console.log(pageNumber, orderBy, fieldSort); resultsArr.sort(dynamicSort(orderBy, fieldSort)); - console.log(resultsArr); + //console.log(resultsArr); }, [selectedOption] ); @@ -752,7 +752,7 @@ const ViewAllResults = (props) => { const deleteCaseItem = (containerID, caseID) => { let cookies = parseCookies(); - console.log("sssss", containerID, caseID); + //console.log("sssss", containerID, caseID); deleteAwaitingSubmissionsFromBlob(containerID, caseID) .then((data) => { @@ -775,7 +775,7 @@ const ViewAllResults = (props) => { const deleteRepItem = (containerID, caseID, repfile) => { let cookies = parseCookies(); - console.log("sssss", containerID, caseID, repfile); + //console.log("sssss", containerID, caseID, repfile); deleteMyRepresentationsFromBlob(containerID, caseID, repfile) .then((data) => { diff --git a/components/newappeal/aboutyou.js b/components/newappeal/aboutyou.js index cbdfdfea..ab39d537 100644 --- a/components/newappeal/aboutyou.js +++ b/components/newappeal/aboutyou.js @@ -291,7 +291,7 @@ function Radiofield(props) { const router = useRouter(); const required = (value) => (value ? undefined : "Required"); - // console.log(props.options); + //console.log(props.options); const fieldOptions = props.options .slice(1, props.options.length - 1) @@ -310,7 +310,7 @@ function Radiofield(props) { (showIfHasParentShowValue == parentField) != false && showIfHasParentShowValue; - // console.log( + //console.log( // datafieldname, // showIfHasParentShowValue, // formProps[form].values[parentField] diff --git a/components/newappeal/buildcheckrow.js b/components/newappeal/buildcheckrow.js index d4701aed..cc560e5b 100644 --- a/components/newappeal/buildcheckrow.js +++ b/components/newappeal/buildcheckrow.js @@ -107,7 +107,7 @@ let BuildCheckRow = (props) => { // }); // } - // console.log( + //console.log( // datafieldname[0].value.indexOf("fileUpload") > 0, // isRequiredField, // props.props.form["appealForm"].values[ diff --git a/components/newappeal/buildprogress.js b/components/newappeal/buildprogress.js index 2335a89b..879e4860 100644 --- a/components/newappeal/buildprogress.js +++ b/components/newappeal/buildprogress.js @@ -24,7 +24,7 @@ const BuildProgress = (props) => { } = props; const parser = new DOMParser(); - // const progObj = getProgressObj( + //const progObj = getProgressObj( // formObjXML, // titleList, // mandatoryFieldsData, diff --git a/components/newappeal/buildrow.js b/components/newappeal/buildrow.js index 875356d8..06a6a013 100644 --- a/components/newappeal/buildrow.js +++ b/components/newappeal/buildrow.js @@ -104,7 +104,7 @@ export default function BuildRow(props) { dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value; - // const isRequiredField = jsonpath( + //const isRequiredField = jsonpath( // "$..value[?(@.LogicalName=='" + // datafieldname[0].value + // "')]", @@ -129,7 +129,7 @@ export default function BuildRow(props) { /> ); } else { - // console.log( + //console.log( // datafieldname[0].value, // isRequiredField[0].RequiredLevel.Value // ); diff --git a/components/newappeal/complete.js b/components/newappeal/complete.js index 29d9c1a8..16f6c8c8 100644 --- a/components/newappeal/complete.js +++ b/components/newappeal/complete.js @@ -102,7 +102,7 @@ let CompleteAppeal = (props) => { setCurrentSection(currentSection + 1); }; - // console.log(JSON.stringify(props.props.form.appealForm.values, null, 2)); + //console.log(JSON.stringify(props.props.form.appealForm.values, null, 2)); //alert(JSON.stringify(props.props.form.appealForm.values, null, 2)); return ( diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js index 8076d15f..bfd67148 100644 --- a/components/newappeal/createCase.js +++ b/components/newappeal/createCase.js @@ -292,7 +292,7 @@ function Radiofield(props) { let { t } = useTranslation(); const router = useRouter(); const required = (value) => (value ? undefined : "Required"); - // console.log(props.options); + //console.log(props.options); const fieldOptions = props.options .slice(1, props.options.length - 1) @@ -311,7 +311,7 @@ function Radiofield(props) { (showIfHasParentShowValue == parentField) != false && showIfHasParentShowValue; - // console.log( + //console.log( // datafieldname, // showIfHasParentShowValue, // formProps[form].values[parentField] @@ -417,7 +417,7 @@ let CreateCase = (props) => { appTypeCollection = getFormCollectionByID(whichAppealType); - // console.log( + //console.log( // "/newappeal" + // "/" + // appTypeCollection.UrlName + diff --git a/components/newappeal/fileupload.js b/components/newappeal/fileupload.js index 7bb09a62..6b4a6395 100644 --- a/components/newappeal/fileupload.js +++ b/components/newappeal/fileupload.js @@ -6,7 +6,7 @@ // import { JSONPath as jsonpath } from "jsonpath-plus"; // import _ from "lodash"; -// const FileUpload = () => { +//const FileUpload = () => { // const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); // const files = acceptedFiles.map((file) => ( //
  • diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js index a743defe..1b76a76a 100644 --- a/components/pdftemplates/lpaQuestionnaire_pdf.js +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -101,7 +101,7 @@ const styles = StyleSheet.create({ }); export const lpaQuestionnaire_pdf = ({ docProps }) => { - // console.log(docProps); + //console.log(docProps); function formatDates(dateObj) { var dateObj = new Date(dateObj); diff --git a/components/search/addresssearchresults.js b/components/search/addresssearchresults.js index 91edcc66..03ff4b21 100644 --- a/components/search/addresssearchresults.js +++ b/components/search/addresssearchresults.js @@ -127,7 +127,7 @@ const SearchResults = (props) => { }; const getDetails = (resultsObj, detailsType) => { - // console.log(resultsObj); + //console.log(resultsObj); let detailsArr = []; resultsObj = resultsObj.value; const detailsObj = resultsObj.map((searchDetail, index) => { @@ -297,10 +297,10 @@ const SearchResults = (props) => { ? "/fymhorth/achos/id" : "/achos/id" : myportal == true - ? "/myportal/case/id" - : "/case/id") + + ? "/myportal/case/" + : "/case/") + "/" + - item.incidentid + item.pinswg_name } className="govuk-link--no-underline" // onClick={() => { diff --git a/components/search/advancedsearch.js b/components/search/advancedsearch.js index ada09597..815a5f8c 100644 --- a/components/search/advancedsearch.js +++ b/components/search/advancedsearch.js @@ -366,7 +366,7 @@ let AdvancedSearch = (props) => { ); }; - // const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); // let spinnerState = () => { // showSpinnerState == true diff --git a/components/search/searchresults.js b/components/search/searchresults.js index 2401bfc4..2e539055 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -129,7 +129,7 @@ const SearchResults = (props) => { }; const getDetails = (resultsObj, detailsType) => { - // console.log(resultsObj); + //console.log(resultsObj); let detailsArr = []; resultsObj = resultsObj.value; const detailsObj = resultsObj.map((searchDetail, index) => { @@ -771,7 +771,7 @@ const SearchResults = (props) => { props.accountDetails.loggedinUserId, router.query, ]); - // console.log( + //console.log( // "page is here ", // currentPage, // orderByState + " " + fieldSortState diff --git a/components/utils/index.js b/components/utils/index.js index 91bc3619..b722f556 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -163,7 +163,7 @@ export const getSearchDetailsPaged = (searchResultsObj) => { ); } }); - // console.log(detailsArr); + //console.log(detailsArr); return Promise.all(detailsArr); }; From 87672a14b95acd81ae038025aa14b4bd0f3bff36 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 5 Jun 2024 19:52:31 +0100 Subject: [PATCH 3/3] uploading files to reps --- components/case/representation/index.js | 59 ++++++++++--------- .../representationCompleteSubmit.js | 49 +++++++++++++-- .../representation/representationElements.js | 20 +++---- .../representationLPAQuestionnaire_s78.js | 4 +- components/case/representationList.js | 2 +- 5 files changed, 86 insertions(+), 48 deletions(-) diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 552cb170..c6960ea0 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -601,6 +601,7 @@ let MakeRepresentation = (props) => { let incidentId = props.appealType.caseReference.incidentid; let updateBody = values || {}; const buildFileArray = []; + let newbuildArr = []; setSavingStatus(useSaveStatus); Object.assign(values, { @@ -724,8 +725,10 @@ let MakeRepresentation = (props) => { "size": Blob.size, }) ), + (newbuildArr = buildFileArray.concat(values.filesList)), + console.log(buildFileArray, newbuildArr), Object.assign(values, { - "filesList": buildFileArray, + "filesList": newbuildArr, })), generateRepPDF( values, @@ -738,22 +741,23 @@ let MakeRepresentation = (props) => { ? router.locale + "/myportal" : "/myportal" )) - : (values.hasOwnProperty("representationDocuments") && - (values.representationDocuments.map((Blob) => - buildFileArray.push({ - "name": Blob.name, - "size": Blob.size, - }) - ), - Object.assign(values, { - "filesList": buildFileArray, - })), - uploadRepresentationFiles(values), - generateRepPDF( - values, - props.props.accountDetails.containerID, - currentView.caseReference.currentReference - )); + : // (values.hasOwnProperty("representationDocuments") && + // (values.representationDocuments.map((Blob) => + // buildFileArray.push({ + // "name": Blob.name, + // "size": Blob.size, + // }) + // ), + // Object.assign(values, { + // "filesList": buildFileArray, + // }))), + console.log("zxcvbnm"), + uploadRepresentationFiles(values), + generateRepPDF( + values, + props.props.accountDetails.containerID, + currentView.caseReference.currentReference + ); }; const onHandleSubmit = (values) => { @@ -881,16 +885,17 @@ let MakeRepresentation = (props) => { Object.assign(values, { "locale": router.locale }), props.invalid == false && updateRepresentation(values, false, false), - values.hasOwnProperty("representationDocuments") && - (values.representationDocuments.map((Blob) => - buildFileArray.push({ - "name": Blob.name, - "size": Blob.size, - }) - ), - Object.assign(values, { - "filesList": buildFileArray, - })), + console.log("qwerty"), + // values.hasOwnProperty("representationDocuments") && + // (values.representationDocuments.map((Blob) => + // buildFileArray.push({ + // "name": Blob.name, + // "size": Blob.size, + // }) + // ), + // Object.assign(values, { + // "filesList": buildFileArray, + // })), console.log( "====================== rep lpa payload:\n", JSON.stringify(values) diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index 616b0990..f493477f 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -41,7 +41,7 @@ const RepCompleteSubmit = (props) => { const repFormData = formObj.representationForm.values; - // const repDate = new Date(); + //const repDate = new Date(); // let day = repDate.getDate(); // let month = repDate.getMonth() + 1; @@ -135,6 +135,48 @@ const RepCompleteSubmit = (props) => { } }; + let buildAppealFilesArray = []; + + let filesUploadObj = + formObj.representationForm.values.representationDocuments; + + for (let key in filesUploadObj) { + typeof filesUploadObj[key].name != "undefined" && + buildAppealFilesArray.push({ + "name": filesUploadObj[key].name, + "size": filesUploadObj[key].size, + }); + } + + console.log( + buildAppealFilesArray, + formObj.representationForm.values.filesList + ); + + buildAppealFilesArray = formObj.representationForm.values.hasOwnProperty( + "filesList" + ) + ? buildAppealFilesArray.concat( + formObj.representationForm.values.filesList + ) + : buildAppealFilesArray; + + console.log(buildAppealFilesArray); + + // const arrUniq = [ + // ...new Map(buildAppealFilesArray.map((v) => [v.name, v])).values(), + // ]; + + const arrUniq = buildAppealFilesArray.filter( + (obj1, i, arr) => arr.findIndex((obj2) => obj2.name === obj1.name) === i + ); + + console.log(arrUniq); + + Object.assign(formObj.representationForm.values, { + "filesList": arrUniq, + }); + return ( <> {currentView.representationSubmitConfirmation == true ? ( @@ -303,10 +345,7 @@ const RepCompleteSubmit = (props) => {
    - {formObj.representationForm.values.hasOwnProperty( - "filesList" - ) && - formObj.representationForm.values + {formObj.representationForm.values .filesList.length > 0 ? formObj.representationForm.values.filesList.map( (blob, i) => ( diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 63e2d498..cf53217c 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -962,10 +962,7 @@ export const RenderFileUpload = (field) => { const filelistObj = field.fileList || {}; - // const blobList = jsonpath( - // "$..[?(@.documentType=='" + field.documentTypeCode + "')]", - // filelistObj - // ); + console.log("----", filelistObj.length); let blobList = filelistObj; @@ -974,13 +971,11 @@ export const RenderFileUpload = (field) => { // let filesUploadObj = field.input.value; // for (let key in filesUploadObj) { - // for (let j in filesUploadObj[key]) { - // typeof filesUploadObj[key][j].name != "undefined" && - // buildAppealFilesArray.push({ - // "name": filesUploadObj[key][j].name, - // "size": filesUploadObj[key][j].size, - // }); - // } + // typeof filesUploadObj[key].name != "undefined" && + // buildAppealFilesArray.push({ + // "name": filesUploadObj[key].name, + // "size": filesUploadObj[key].size, + // }); // } // buildAppealFilesArray = buildAppealFilesArray.concat(blobList); @@ -1063,7 +1058,7 @@ export const RenderFileUpload = (field) => {
      {files.map( (file, i) => - file.hasOwnProperty("name") && ( + typeof file.name != "undefined" && (
      { −
      - {blob.name} { export default S78_Questionnaire; -// const selector = formValueSelector("representationForm"); //<-- same as form name +//const selector = formValueSelector("representationForm"); //<-- same as form name // S78_Questionnaire = connect((state) => { // const representationTypeValue = selector(state, "representationType"); @@ -1025,7 +1025,7 @@ export default S78_Questionnaire; // }; // })(S78_Questionnaire); -// const mapStateToProps = (state, props) => { +//const mapStateToProps = (state, props) => { // console.log(); // return { // search: state.search, diff --git a/components/case/representationList.js b/components/case/representationList.js index 16092d7f..e566687f 100644 --- a/components/case/representationList.js +++ b/components/case/representationList.js @@ -18,7 +18,7 @@ const RepresentationList = (props) => { const router = useRouter(); const { locale } = router; - // const [showSpinnerState, setShowSpinnerState] = useState(false); + //const [showSpinnerState, setShowSpinnerState] = useState(false); // let spinnerState = () => { // showSpinnerState == true