diff --git a/actions/azurestorage.js b/actions/azurestorage.js
index f52bb013..e4cedfe4 100644
--- a/actions/azurestorage.js
+++ b/actions/azurestorage.js
@@ -411,7 +411,9 @@ export const createRepPDFBlob = async (
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
- const uploadBlobResponse = await blockBlobClient.uploadStream(content);
+ const uploadBlobResponse = Buffer.isBuffer(content)
+ ? await blockBlobClient.uploadData(content)
+ : await blockBlobClient.uploadStream(content);
let whichLocation =
repName.indexOf("_IP_") > 0
diff --git a/actions/index.js b/actions/index.js
index c099b55e..a988fc54 100644
--- a/actions/index.js
+++ b/actions/index.js
@@ -34,7 +34,7 @@ export const getIP = (req) => {
console.info(
"\n====================\n Client IP address: " + ip,
- "\n=====================\n",
+ "\n=====================\n"
);
};
@@ -42,7 +42,7 @@ export const consoleLogger = (err) => {
console.log(
"\n\n/////////////////////////////////////////////////\nRaw Error " +
err +
- "\n\n/////////////////////////////////////////////////\n",
+ "\n\n/////////////////////////////////////////////////\n"
);
var errStr =
"\n\n/////////////////////////////////////////////////\nServer Error " +
@@ -102,7 +102,7 @@ export const getToken = () => {
.post(
`${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
tokenBody,
- tokenConfig,
+ tokenConfig
)
.then((res) => res.data)
.then((data) => {
@@ -130,8 +130,8 @@ const tokenBody =
const tokenConfig = {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache",
- },
+ "Cache-Control": "no-cache"
+ }
};
export const azureHeaders = (access_token) => {
@@ -142,8 +142,8 @@ export const azureHeaders = (access_token) => {
"Accept": "application/json;odata.metadata=none",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
- "Authorization": "Bearer " + access_token,
- },
+ "Authorization": "Bearer " + access_token
+ }
};
};
@@ -155,8 +155,8 @@ export const azureHeadersNoOdata = (access_token) => {
//"Accept": "application/json;odata.metadata=none",
//"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
- "Authorization": "Bearer " + access_token,
- },
+ "Authorization": "Bearer " + access_token
+ }
};
};
@@ -169,8 +169,8 @@ export const azureHeadersPaged = (access_token) => {
"Prefer":
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
"Content-Type": "application/json",
- "Authorization": "Bearer " + access_token,
- },
+ "Authorization": "Bearer " + access_token
+ }
};
};
export const azureHeadersPagedCustom = (access_token, showNumberOfRecords) => {
@@ -183,15 +183,15 @@ export const azureHeadersPagedCustom = (access_token, showNumberOfRecords) => {
'odata.include-annotations="*",return=representation, odata.maxpagesize=' +
showNumberOfRecords,
"Content-Type": "application/json",
- "Authorization": "Bearer " + access_token,
- },
+ "Authorization": "Bearer " + access_token
+ }
};
};
export const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
- CryptoJS.enc.Hex.parse(WORDKEY),
+ CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
@@ -216,7 +216,7 @@ export const getBasicSearch = (searchString) => {
.get(
BASE_URL +
"/api/endpoint/getbasicsearch_api?searchString=" +
- searchString,
+ searchString
)
.then((res) => {
return res.data;
@@ -244,7 +244,7 @@ export const getIncidentbyID = (searchString) => {
.get(
BASE_URL +
"/api/endpoint/getincidentbyid_api?searchString=" +
- searchString,
+ searchString
)
.then((res) => {
return res.data;
@@ -258,7 +258,7 @@ export const getIncidentbyID = (searchString) => {
export const getIsPublishedbyID = (searchString) => {
return axios
.get(
- "/api/endpoint/getispublishedbyid_api?searchString=" + searchString,
+ "/api/endpoint/getispublishedbyid_api?searchString=" + searchString
)
.then((res) => {
return res.data;
@@ -274,7 +274,7 @@ export const getPartSavedAppeal = (searchString) => {
.get(
BASE_URL +
"/api/endpoint/getpartsavedappeal_api?searchString=" +
- searchString,
+ searchString
)
.then((res) => {
return res.data;
@@ -290,7 +290,7 @@ export const getBasicDNSURLSearch = (searchString) => {
.get(
BASE_URL +
"/api/endpoint/getbasicdnsurlsearch_api?searchString=" +
- searchString,
+ searchString
)
.then((res) => {
return res.data;
@@ -330,7 +330,7 @@ export const getAddressSearchPaged = (
pageNumber,
orderBy,
fieldSort,
- showNumberOfRecords,
+ showNumberOfRecords
) => {
return axios
.get(
@@ -343,7 +343,7 @@ export const getAddressSearchPaged = (
"&fieldSort=" +
fieldSort +
"&showNumberOfRecords=" +
- showNumberOfRecords,
+ showNumberOfRecords
)
.then((res) => {
return res.data;
@@ -359,7 +359,7 @@ export const getBasicSearchPaged = (
pageNumber,
orderBy,
fieldSort,
- showNumberOfRecords,
+ showNumberOfRecords
) => {
return axios
.get(
@@ -372,7 +372,7 @@ export const getBasicSearchPaged = (
"&fieldSort=" +
fieldSort +
"&showNumberOfRecords=" +
- showNumberOfRecords,
+ showNumberOfRecords
)
.then((res) => {
return res.data;
@@ -394,7 +394,7 @@ export const getDNSCoords = () => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -425,7 +425,7 @@ export const getBasicDNSSearchPaged = (
pageNumber,
orderBy,
fieldSort,
- showNumberOfRecords,
+ showNumberOfRecords
) => {
return axios
.get(
@@ -436,7 +436,7 @@ export const getBasicDNSSearchPaged = (
"&fieldSort=" +
fieldSort +
"&showNumberOfRecords=" +
- showNumberOfRecords,
+ showNumberOfRecords
)
.then((res) => res.data)
.catch((error) => {
@@ -450,7 +450,7 @@ export const getAdvancedSearch = (searchString) => {
.get(
BASE_URL +
"/api/endpoint/getadvancedsearch_api?searchstring=" +
- JSON.stringify(searchString),
+ JSON.stringify(searchString)
)
.then((res) => res.data)
.catch((error) => {
@@ -458,7 +458,7 @@ export const getAdvancedSearch = (searchString) => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -470,7 +470,7 @@ export const getAdvancedSearchPaged = (
pageNumber,
orderBy,
fieldSort,
- showNumberOfRecords,
+ showNumberOfRecords
) => {
return axios
.get(
@@ -483,7 +483,7 @@ export const getAdvancedSearchPaged = (
"&fieldSort=" +
fieldSort +
"&showNumberOfRecords=" +
- showNumberOfRecords,
+ showNumberOfRecords
)
.then((res) => res.data)
.catch((error) => {
@@ -491,7 +491,7 @@ export const getAdvancedSearchPaged = (
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -502,7 +502,7 @@ export const getBasicSearchDetails = async (
appealTypeName,
caseReference,
primaryIdAttribute,
- incidentID,
+ incidentID
) => {
return axios
.get(
@@ -512,7 +512,7 @@ export const getBasicSearchDetails = async (
"&primaryIdAttribute=" +
primaryIdAttribute +
"&incidentID=" +
- incidentID,
+ incidentID
)
.then((res) => res.data)
.catch((error) => {
@@ -524,7 +524,7 @@ export const getBasicPartSavedDetails = (
appealTypeName,
caseReference,
primaryIdAttribute,
- incidentID,
+ incidentID
) => {
//console.log(
// "///////api call: ",
@@ -544,7 +544,7 @@ export const getBasicPartSavedDetails = (
"&primaryIdAttribute=" +
primaryIdAttribute +
"&incidentID=" +
- incidentID,
+ incidentID
)
.then((res) => res.data)
.catch((error) => {
@@ -556,7 +556,7 @@ export const getBasicSearchDetailsPaged = async (
appealTypeName,
caseReference,
primaryIdAttribute,
- incidentIDs,
+ incidentIDs
) => {
if (!incidentIDs || incidentIDs.length === 0) return [];
@@ -578,11 +578,11 @@ export const getBasicSearchDetailsPaged = async (
.join(" or ");
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
- filter,
+ filter
)}`;
console.log(
- `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`,
+ `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`
);
try {
@@ -598,7 +598,7 @@ export const getSearchDocumentDetails = (incidentID) => {
return axios
.get(
"/api/endpoint/getsearchdocumentdetails_api?incidentid=" +
- incidentID,
+ incidentID
)
.then((res) => res.data)
.catch((error) => {
@@ -610,7 +610,7 @@ export const getSearchDocumentDetails = (incidentID) => {
export const getSearchDocumentTypes = (incidentID) => {
return axios
.get(
- "/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID,
+ "/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID
)
.then((res) => res.data)
.catch((error) => {
@@ -623,7 +623,7 @@ export const getAppealPDFDocs = (incidentID) => {
.get(
BASE_URL +
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
- incidentID,
+ incidentID
)
.then((res) => res.data)
.catch((error) => {
@@ -637,7 +637,7 @@ export const getSearchDocumentDetailsPaged = (
orderBy,
fieldSort,
showNumberOfRecords,
- documentType,
+ documentType
) => {
//console.log("to api:", documentType);
return axios
@@ -653,7 +653,7 @@ export const getSearchDocumentDetailsPaged = (
"&showNumberOfRecords=" +
showNumberOfRecords +
"&documentType=" +
- documentType,
+ documentType
)
.then((res) => res.data)
.catch((error) => {
@@ -665,7 +665,7 @@ export const getLinkedCases = (parentIncidentid) => {
return axios
.get(
"/api/endpoint/getlinkedcases_api?parentincidentid=" +
- parentIncidentid,
+ parentIncidentid
)
.then((res) => {
return res.data;
@@ -684,7 +684,7 @@ export const getAppealsTypes = () => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -700,7 +700,7 @@ export const getProjectTypes = () => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -716,7 +716,7 @@ export const getAppealsTypesForNewAppeal = () => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -734,7 +734,7 @@ export const getLPA = () => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
@@ -757,7 +757,7 @@ export const getMandatoryFields = (whichForm) => {
.get(
BASE_URL +
"/api/endpoint/getmandatoryfields_api?whichForm=" +
- whichForm,
+ whichForm
)
.then((res) => res.data)
.catch((error) => {
@@ -779,7 +779,7 @@ export const getPersonalAccount = (contactid) => {
.get(
BASE_URL +
"/api/endpoint/getpersonalaccount_api?contactid=" +
- contactid,
+ contactid
)
.then((res) => {
return res.data;
@@ -799,7 +799,7 @@ export const getPersonalAccount = (contactid) => {
export const getAppealID = (
caseReference,
updateFormCollection,
- primaryAttribute,
+ primaryAttribute
) => {
//console.log(
// "is this the collection?:",
@@ -815,11 +815,11 @@ export const getAppealID = (
"&primaryAttribute=" +
primaryAttribute +
"&caseReference=" +
- caseReference,
+ caseReference
)
.then((res) => {
const result = Object.entries(res.data.value[0]).filter(
- ([key]) => !key.startsWith("_"),
+ ([key]) => !key.startsWith("_")
)[0][1];
// console.log("result:", res.data);
var appealID = result;
@@ -836,7 +836,7 @@ export const getLogin = (emailAddress, pwd) => {
"/api/endpoint/getlogin_api?emailAddress=" +
emailAddress +
"&pwd=" +
- pwd,
+ pwd
)
.then((res) => res.data)
.catch((error) => {
@@ -849,7 +849,7 @@ export const getMyCases = (loggedInUserId) => {
.get(
BASE_URL +
"/api/endpoint/getmycases_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => {
return res.data;
@@ -864,7 +864,7 @@ export const getMyInvolvements = async (loggedInUserId) => {
const res = await axios.get(
BASE_URL +
"/api/endpoint/getmyinvolvements_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
);
return res.data;
} catch (error) {
@@ -888,7 +888,7 @@ export const getMyRepresentations = (loggedInUserId) => {
.get(
BASE_URL +
"/api/endpoint/getmyrepresentations_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => res.data)
.catch((error) => {
@@ -900,7 +900,7 @@ export const getMyRepresentationsProxy = (loggedInUserId) => {
return axios
.get(
"/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => res.data)
.catch((error) => {
@@ -920,8 +920,7 @@ export const getRepresentations = (incidentID) => {
export const getRepresentationsProxy = (incidentID) => {
return axios
.get(
- "/api/endpoint/getrepresentationsproxy_api?incidentID=" +
- incidentID,
+ "/api/endpoint/getrepresentationsproxy_api?incidentID=" + incidentID
)
.then((res) => res.data)
.catch((error) => {
@@ -934,7 +933,7 @@ export const getWatchedCases = (loggedInUserId) => {
.get(
BASE_URL +
"/api/endpoint/getwatchedcases_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => res.data)
.catch((error) => {
@@ -946,7 +945,7 @@ export const getWatchedCasesProxy = (loggedInUserId) => {
return axios
.get(
"/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => res.data)
.catch((error) => {
@@ -958,7 +957,7 @@ export const getAwaitingSubmissionProxy = (loggedInUserId) => {
return axios
.get(
"/api/endpoint/getawaitingsubmissionproxy_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => res.data)
.catch((error) => {
@@ -971,7 +970,7 @@ export const getAwaitingSubmission = (loggedInUserId) => {
.get(
BASE_URL +
"/api/endpoint/getawaitingsubmission_api?loggedInUserId=" +
- loggedInUserId,
+ loggedInUserId
)
.then((res) => {
return res.data;
@@ -1001,8 +1000,8 @@ export const getAwaitingSubmissionFromBlob = (containerName) => {
containerName +
hashAPIPath(
"/api/file/getawaitingsubmissionfromblob?container=" +
- containerName,
- ),
+ containerName
+ )
)
.then((res) => {
return res.data;
@@ -1028,7 +1027,7 @@ export const getRepsFromBlob = (containerName) => {
BASE_URL +
"/api/file/getrepsblob?container=" +
containerName +
- hashAPIPath("/api/file/getrepsblob?container=" + containerName),
+ hashAPIPath("/api/file/getrepsblob?container=" + containerName)
)
.then((res) => {
return res.data;
@@ -1055,7 +1054,7 @@ export const getRepsFromBlobProxy = async (containerName) => {
try {
const res = await axios.get(
// BASE_URL +
- "/api/file/getrepsblobproxy?container=" + containerName,
+ "/api/file/getrepsblobproxy?container=" + containerName
// +
// hashAPIPath(
// "/api/file/getawaitingsubmissionfromblob?container=" +
@@ -1074,14 +1073,14 @@ export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
containerName,
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName,
- "\n///////////////////////\n",
+ "\n///////////////////////\n"
);
try {
const res = await axios.get(
BASE_URL +
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
- containerName,
+ containerName
// +
// hashAPIPath(
// "/api/file/getawaitingsubmissionfromblob?container=" +
@@ -1124,7 +1123,7 @@ export const getPortalModuleDetails = async (appealType, caseReference) => {
"/api/endpoint/getportalmoduledetails_api?appealType=" +
appealType +
"&caseReference=" +
- encodeURI(caseReference),
+ encodeURI(caseReference)
};
try {
@@ -1142,7 +1141,7 @@ export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
appealType +
"&caseReference=" +
- caseReference.replace(/\'/g, "''"),
+ caseReference.replace(/\'/g, "''")
)
.then((res) => res.data)
.catch((error) => {
@@ -1154,7 +1153,7 @@ export const getEmailAccountCheck = (emailAddress) => {
return axios
.get(
"/api/endpoint/getemailaccountcheck_api?emailAddress=" +
- emailAddress,
+ emailAddress
)
.then((res) => res.data)
.catch((error) => {
@@ -1170,7 +1169,7 @@ export const updatePassword = (contactId, newpassword) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
return axios(config)
@@ -1191,7 +1190,7 @@ export const updateAccount = async (contactId, updateBody, ssr) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
return axios(config)
.then((res) => {
@@ -1210,7 +1209,7 @@ export const createWatchedCases = async (formValues) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
try {
@@ -1226,7 +1225,7 @@ export const createNewCase = (
lpaID,
contactid,
createBody,
- containerName,
+ containerName
) => {
appealTypeId = parseInt(appealTypeId);
@@ -1245,7 +1244,7 @@ export const createNewCase = (
var config = {
method: "post",
url: BASE_URL + queryUrl,
- data: data,
+ data: data
};
return axios(config)
@@ -1263,7 +1262,7 @@ export const createNewCaseBlob = (
contactid,
createBody,
containerName,
- lpaName,
+ lpaName
) => {
appealTypeId = parseInt(appealTypeId);
@@ -1296,7 +1295,7 @@ export const createNewCaseBlob = (
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
//console.log("the query url for crearte csase:", queryUrl);
@@ -1315,14 +1314,14 @@ export const updateCase = async (
updateBody,
updateFormCollection,
primaryAttribute,
- caseReference,
+ caseReference
) => {
var data = updateBody;
var appealObj = await getAppealID(
caseReference,
updateFormCollection,
- primaryAttribute,
+ primaryAttribute
);
var queryUrl =
@@ -1334,7 +1333,7 @@ export const updateCase = async (
var config = {
method: "post",
url: queryUrl,
- data: updateBody,
+ data: updateBody
};
//console.log(data);
@@ -1353,14 +1352,14 @@ export const updateCaseBlob = async (
updateBody,
updateFormCollection,
primaryAttribute,
- caseReference,
+ caseReference
) => {
var data = updateBody;
var appealObj = await getAppealID(
caseReference,
updateFormCollection,
- primaryAttribute,
+ primaryAttribute
);
var queryUrl =
@@ -1372,7 +1371,7 @@ export const updateCaseBlob = async (
var config = {
method: "post",
url: queryUrl,
- data: updateBody,
+ data: updateBody
};
//console.log(data);
@@ -1390,7 +1389,7 @@ export const patchCase = async (incidentid) => {
var queryUrl = "/api/endpoint/patchcase_api?incidentid=" + incidentid;
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
return axios(config)
@@ -1428,7 +1427,7 @@ export const getCaseByID = (incidentID) => {
// );
return axios
.get(
- BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID,
+ BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID
)
.then((res) => {
return res.data;
@@ -1451,8 +1450,8 @@ export const deleteMyRepresentations = (myRepresentationsID) => {
"OData-Version": "4.0",
"Accept": "application/json;odata.metadata=none",
"Prefer": 'odata.include-annotations="*",return=representation',
- "Content-Type": "application/json",
- },
+ "Content-Type": "application/json"
+ }
};
//console.log(config);
return axios(config)
@@ -1471,7 +1470,7 @@ export const deleteAwaitingSubmissions = (incidentID) => {
var config = {
method: "delete",
- url: queryUrl,
+ url: queryUrl
};
//console.log(config);
return axios(config)
@@ -1486,7 +1485,7 @@ export const deleteAwaitingSubmissions = (incidentID) => {
export const deleteAwaitingSubmissionsFromBlob = (
containerID,
- casefolderID,
+ casefolderID
) => {
var queryUrl =
"/api/file/deleteblobcase?container=" +
@@ -1496,7 +1495,7 @@ export const deleteAwaitingSubmissionsFromBlob = (
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
//console.log(config);
return axios(config)
@@ -1512,7 +1511,7 @@ export const deleteAwaitingSubmissionsFromBlob = (
export const deleteMyRepresentationsFromBlob = (
containerID,
casefolderID,
- repfile,
+ repfile
) => {
var queryUrl =
"/api/file/deleteblobrep?container=" +
@@ -1524,7 +1523,7 @@ export const deleteMyRepresentationsFromBlob = (
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
//console.log(config);
return axios(config)
@@ -1542,7 +1541,7 @@ export const deleteWatchedCases = async (watchedCaseID) => {
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
var config = {
method: "delete",
- url: queryUrl,
+ url: queryUrl
};
try {
@@ -1559,7 +1558,7 @@ export const createAccount = (formValues) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
return axios(config)
@@ -1576,7 +1575,7 @@ export const uploadFiles = async (
formValues,
filesObj,
containerID,
- casefolderID,
+ casefolderID
) => {
let files = filesObj;
@@ -1603,7 +1602,7 @@ export const uploadFiles = async (
method: "post",
url: queryUrl,
data: formData,
- headers: { "content-type": "multipart/form-data" },
+ headers: { "content-type": "multipart/form-data" }
};
//console.log(config);
@@ -1641,7 +1640,7 @@ export const uploadSingleFile = async (filesObj, containerID, casefolderID) => {
method: "post",
url: queryUrl,
data: formData,
- headers: { "content-type": "multipart/form-data" },
+ headers: { "content-type": "multipart/form-data" }
};
//console.log(config);
@@ -1657,7 +1656,7 @@ export const uploadRepFiles = async (
formValues,
filesObj,
containerID,
- casefolderID,
+ casefolderID
) => {
let files = filesObj;
@@ -1685,7 +1684,7 @@ export const uploadRepFiles = async (
method: "post",
url: queryUrl,
data: formData,
- headers: { "content-type": "multipart/form-data" },
+ headers: { "content-type": "multipart/form-data" }
};
//console.log(config);
@@ -1697,7 +1696,12 @@ export const uploadRepFiles = async (
}
};
-export const generateRepPDF = async (formValues, containerID, casefolderID) => {
+export const generateRepPDF = async (
+ formValues,
+ containerID,
+ casefolderID,
+ options = {}
+) => {
//let files = filesObj;
console.log("generateRepPDF function: " + formValues);
@@ -1711,12 +1715,14 @@ export const generateRepPDF = async (formValues, containerID, casefolderID) => {
// "casefolderID": casefolderID,
// });
- var queryUrl = "/api/file/generatepdf";
+ var queryUrl =
+ "/api/file/generatepdf" + (options.download ? "?download=true" : "");
const config = {
method: "post",
url: queryUrl,
data: formValues,
+ ...(options.download ? { responseType: "blob" } : {})
//headers: { "content-type": "multipart/form-data" },
};
@@ -1734,7 +1740,7 @@ export const generateAppealPDF = async (
containerID,
casefolderID,
appealType,
- fileList,
+ fileList
) => {
//let files = filesObj;
@@ -1745,7 +1751,7 @@ export const generateAppealPDF = async (
//formValues.append("filesList", fileList);
Object.assign(formValues, {
- "filesList": fileList,
+ "filesList": fileList
});
var queryUrl = "/api/file/generateappealpdf?appealType=" + appealType;
@@ -1753,7 +1759,7 @@ export const generateAppealPDF = async (
const config = {
method: "post",
url: queryUrl,
- data: formValues,
+ data: formValues
//headers: { "content-type": "multipart/form-data" },
};
@@ -1792,8 +1798,8 @@ export const getFilesFromBlob = (containerName, casefolderID) => {
"/api/file/getbloblist?container=" +
containerName +
"&casefolderID=" +
- casefolderID,
- ),
+ casefolderID
+ )
)
.then((res) => {
//console.log("//////////----", res.data);
@@ -1811,7 +1817,7 @@ export const getFilesFromBlobproxy = (containerName, casefolderID) => {
"/api/file/getbloblistproxy?container=" +
containerName +
"&casefolderID=" +
- casefolderID,
+ casefolderID
)
.then((res) => {
//console.log("//////////----", res.data);
@@ -1825,7 +1831,7 @@ export const getFilesFromBlobproxy = (containerName, casefolderID) => {
export const getFilesFromBlobHashed = (
containerName,
getblobshash,
- casefolderID,
+ casefolderID
) => {
return axios
.get(
@@ -1833,7 +1839,7 @@ export const getFilesFromBlobHashed = (
containerName +
"&casefolderID=" +
casefolderID +
- getblobshash,
+ getblobshash
)
.then((res) => {
//console.log("//////////----", res.data);
@@ -1848,7 +1854,7 @@ export const deleteBlob = async (
containerName,
blobName,
deleteblobhash,
- casefolderID,
+ casefolderID
) => {
try {
const res = await axios.get(
@@ -1858,7 +1864,7 @@ export const deleteBlob = async (
encodeURIComponent(casefolderID) +
"&blobname=" +
encodeURIComponent(blobName) +
- deleteblobhash,
+ deleteblobhash
);
return res.data;
} catch (error) {
@@ -1871,7 +1877,7 @@ export const deleteRepBlob = async (
blobName,
deleteblobhash,
casefolderID,
- filenamePrefix,
+ filenamePrefix
) => {
try {
const res = await axios.get(
@@ -1881,7 +1887,7 @@ export const deleteRepBlob = async (
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
"&blobname=" +
encodeURIComponent(blobName) +
- deleteblobhash,
+ deleteblobhash
);
return res.data;
} catch (error) {
@@ -1897,14 +1903,14 @@ export const downloadBlob = (containerName, blobName) => {
containerName.toLowerCase() +
"&blobname=" +
blobName,
- { responseType: "blob" },
+ { responseType: "blob" }
)
.then((response) => {
//console.log("Downloaded blob content:");
res.setHeader(
"content-disposition",
- "attachment; filename=" + blobName,
+ "attachment; filename=" + blobName
);
//console.log("has downloaded");
@@ -1941,8 +1947,8 @@ export const getProgressFromBlob = async (containerName, casereference) => {
"/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) +
"&casefolderID=" +
- encodeURIComponent(casereference),
- ),
+ encodeURIComponent(casereference)
+ )
);
return res.data;
} catch (error) {
@@ -1954,13 +1960,13 @@ export const sendEmail = async (
templateId,
emailAddress,
personalisation,
- reference,
+ reference
) => {
var mailData = {
"templateId": templateId,
"emailAddress": emailAddress,
"reference": reference,
- "personalisation": personalisation,
+ "personalisation": personalisation
};
//console.log(
@@ -2055,7 +2061,7 @@ export const createContainerProxy = (containerName) => {
export const sendCaseCompleteMessage = async (
containerID,
caseReference,
- inv,
+ inv
) => {
var queryUrl =
"/api/file/createappealcompletemessage_api?container=" +
@@ -2067,7 +2073,7 @@ export const sendCaseCompleteMessage = async (
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
//console.log(data);
@@ -2084,7 +2090,7 @@ export const sendCaseCompleteMessage = async (
export const sendCaseCompleteMessageProxy = async (
containerID,
- caseReference,
+ caseReference
) => {
var queryUrl =
"/api/file/createappealcompletemessageproxy_api?container=" +
@@ -2094,7 +2100,7 @@ export const sendCaseCompleteMessageProxy = async (
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
//console.log(data);
@@ -2111,7 +2117,7 @@ export const sendCaseCompleteMessageProxy = async (
export const sendRepCompleteMessage = async (
containerID,
caseReference,
- fileName,
+ fileName
) => {
var queryUrl =
"/api/file/createrepcompletemessage_api?container=" +
@@ -2123,7 +2129,7 @@ export const sendRepCompleteMessage = async (
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
//console.log(data);
@@ -2144,7 +2150,7 @@ export const setRepInvolvment = async (caseid, contactid) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
try {
@@ -2162,7 +2168,7 @@ export const setCaseInvolvment = async (caseid, contactid) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
try {
@@ -2182,7 +2188,7 @@ export const getAddressSearch = async (searchString) => {
var config = {
method: "get",
- url: queryUrl,
+ url: queryUrl
};
return axios(config)
@@ -2194,7 +2200,7 @@ export const getAddressSearch = async (searchString) => {
let ErrResponse = {
value: [],
errorCode: error.response.status,
- errorMsg: error.response.statusText,
+ errorMsg: error.response.statusText
};
return ErrResponse;
});
@@ -2207,7 +2213,7 @@ export const createCRMTask = async (formValues) => {
var config = {
method: "post",
url: queryUrl,
- data: data,
+ data: data
};
try {
@@ -2223,7 +2229,7 @@ export const getPreferredLanguage = async (email) => {
.get(
BASE_URL +
"/api/endpoint/getpreferredlanguage_api?emailAddress=" +
- email,
+ email
)
.then((res) => {
return res.data;
@@ -2239,7 +2245,7 @@ export const getAppealPDFDocument = async (incidentid) => {
.get(
BASE_URL +
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
- incidentid,
+ incidentid
)
.then((res) => {
return res.data;
@@ -2264,7 +2270,7 @@ export const getNewAppealsPage = async (
pageNumber,
orderBy,
fieldSort,
- showNumberOfRecords,
+ showNumberOfRecords
) => {
return axios
.get(
@@ -2277,7 +2283,7 @@ export const getNewAppealsPage = async (
"&fieldSort=" +
fieldSort +
"&showNumberOfRecords=" +
- showNumberOfRecords,
+ showNumberOfRecords
)
.then((res) => {
return res.data;
@@ -2295,7 +2301,7 @@ export const getNewDocumentsPaged = async (
showNumberOfRecords,
documentType,
documentOrigin,
- selectedWeeks,
+ selectedWeeks
) => {
console.log(
"/api/admin/getlatestdocuments_api?pageNumber=" +
@@ -2311,7 +2317,7 @@ export const getNewDocumentsPaged = async (
"&numberWeeks=" +
selectedWeeks +
"&documentOrigin=" +
- documentOrigin,
+ documentOrigin
);
return axios
.get(
@@ -2328,7 +2334,7 @@ export const getNewDocumentsPaged = async (
"&numberWeeks=" +
selectedWeeks +
"&documentOrigin=" +
- documentOrigin,
+ documentOrigin
)
.then((res) => {
return res.data;
diff --git a/components/case/representation/index.js b/components/case/representation/index.js
index e5dc32f7..d35c7d81 100644
--- a/components/case/representation/index.js
+++ b/components/case/representation/index.js
@@ -1,10 +1,9 @@
import { JSONPath as jsonpath } from "jsonpath-plus";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
-import { useState } from "react";
-import { useDropzone } from "react-dropzone";
+import { useEffect, useState } from "react";
import { connect } from "react-redux";
-import { formValueSelector, reduxForm } from "redux-form";
+import { reduxForm } from "redux-form";
import { useSession } from "next-auth/react";
import { generateRepPDF, sendEmail, uploadRepFiles } from "../../../actions";
@@ -33,9 +32,7 @@ import RepresentationProgress_s78 from "./representationProgress/representationP
let MakeRepresentation = (props) => {
let { t } = useTranslation();
- const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
- const [clearRepForm, setClearRepForm] = useState(false);
const [savingStatus, setSavingStatus] = useState(false);
const [finaliseAppealProcess, setFinaliseAppealProcess] = useState(false);
@@ -97,7 +94,7 @@ let MakeRepresentation = (props) => {
let questionnaireCount = updateQuestionnaireCount();
const isLPA =
- accountDetails[
+ accountDetails?.[
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
] == "LPA"
? true
@@ -164,7 +161,39 @@ let MakeRepresentation = (props) => {
return values;
};
- isLPA && setRepresentationCapacity("LPA");
+ useEffect(() => {
+ if (isLPA && !currentView?.representationCapacity) {
+ setRepresentationCapacity("LPA");
+ }
+ }, [isLPA, currentView?.representationCapacity, setRepresentationCapacity]);
+
+ const normalizeCapacity = (rawCapacity) => {
+ const normalized = (rawCapacity || "")
+ .toString()
+ .toLowerCase()
+ .replace(/(\band|[\s\-\+\(\)\,\&])/g, "");
+
+ const capacityMap = {
+ appellant: "appellant",
+ apelydd: "appellant",
+ agent: "agent",
+ asiant: "agent",
+ interestedparty: "interestedparty",
+ lpa: "lpa",
+ landowner: "landowner",
+ [t("myrepresentations:capacity-options-arr-appellant")
+ .toLowerCase()
+ .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")]: "appellant",
+ [t("myrepresentations:capacity-options-arr-agent")
+ .toLowerCase()
+ .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")]: "agent",
+ [t("myrepresentations:capacity-options-arr-interested")
+ .toLowerCase()
+ .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")]: "interestedparty"
+ };
+
+ return capacityMap[normalized] || normalized || "false";
+ };
const getCasePath = () => {
switch (currentType) {
@@ -257,6 +286,9 @@ let MakeRepresentation = (props) => {
})[0];
}
+ const safeDetailsObj = detailsObj || {};
+ const safeResultsObj = resultsObj || {};
+
const buildRepsArr = (detailsObj) => {
const buildArr = [];
const todaysDate = new Date();
@@ -440,15 +472,10 @@ let MakeRepresentation = (props) => {
);
}
- const capacity = getNormalizedCapacity();
+ const capacity = normalizeCapacity(getNormalizedCapacity());
switch (capacity) {
- case "appellant":
- case "apelydd":
- case "apelydd":
- case t(
- "myrepresentations:capacity-options-arr-appellant"
- ).toLowerCase(): {
+ case "appellant": {
const Component =
appealType === 846040002
? ConsultationAppellant
@@ -463,7 +490,6 @@ let MakeRepresentation = (props) => {
);
}
- case "lpa":
case "lpa": {
return (