2115 lines
53 KiB
JavaScript
2115 lines
53 KiB
JavaScript
import axios from "axios";
|
|
import { BASE_URL } from "../core/env";
|
|
import { consoleLogger } from "../core/logger";
|
|
import { hashAPIPath } from "../core/hash";
|
|
|
|
export const getBasicSearch = (searchString) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicsearch_api?searchString=" +
|
|
searchString
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getCaseMessage = (searchString) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getcasemessage_api?id=" + searchString)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getIncidentbyID = (searchString) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getincidentbyid_api?searchString=" +
|
|
searchString
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getIsPublishedbyID = (searchString) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getispublishedbyid_api?searchString=" + searchString
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getPartSavedAppeal = (searchString) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getpartsavedappeal_api?searchString=" +
|
|
searchString
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getBasicDNSURLSearch = (searchString) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicdnsurlsearch_api?searchString=" +
|
|
searchString
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getSIPSEvents = async (caseid) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getsipsevents_api?caseid=" + caseid)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getSIPSMedia = async (caseid) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getsipsmedia_api?caseid=" + caseid)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getAddressSearchPaged = (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getbasicsearch_by_address_paged_api?searchString=" +
|
|
searchString +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getBasicSearchPaged = (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getbasicsearchpaged_api?searchString=" +
|
|
searchString +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getDNSCoords = () => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getdnscoords_api")
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getDNSList = (searchString) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getdnslist_api")
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getBasicDNSSearch = (searchString) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getBasicDNSSearchPaged = (
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getbasicdnssearchpaged_api?pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getAdvancedSearch = (searchString) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getadvancedsearch_api?searchstring=" +
|
|
JSON.stringify(searchString)
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getAdvancedSearchPaged = (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getadvancedsearchpaged_api?searchstring=" +
|
|
JSON.stringify(searchString) +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getBasicSearchDetails = async (
|
|
appealTypeName,
|
|
caseReference,
|
|
primaryIdAttribute,
|
|
incidentID
|
|
) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicsearchdetails_api?appealTypeName=" +
|
|
appealTypeName +
|
|
"&primaryIdAttribute=" +
|
|
primaryIdAttribute +
|
|
"&incidentID=" +
|
|
incidentID
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getBasicPartSavedDetails = (
|
|
appealTypeName,
|
|
caseReference,
|
|
primaryIdAttribute,
|
|
incidentID
|
|
) => {
|
|
//console.log(
|
|
// "///////api call: ",
|
|
// BASE_URL +
|
|
// "/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" +
|
|
// appealTypeName +
|
|
// "&primaryIdAttribute=" +
|
|
// primaryIdAttribute +
|
|
// "&incidentID=" +
|
|
// incidentID
|
|
// );
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" +
|
|
appealTypeName +
|
|
"&primaryIdAttribute=" +
|
|
primaryIdAttribute +
|
|
"&incidentID=" +
|
|
incidentID
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
console.log("this error", error);
|
|
});
|
|
};
|
|
|
|
export const getBasicSearchDetailsPaged = async (
|
|
appealTypeName,
|
|
caseReference,
|
|
primaryIdAttribute,
|
|
incidentIDs
|
|
) => {
|
|
if (!incidentIDs || incidentIDs.length === 0) return [];
|
|
|
|
console.log("=======", primaryIdAttribute);
|
|
// Build OData filter correctly
|
|
// const filter = incidentIDs
|
|
// .map((id) => `_${primaryIdAttribute}s_value eq ${id}`)
|
|
// .join(" or ");
|
|
|
|
const filter = incidentIDs
|
|
.map((id) => {
|
|
const suffix =
|
|
primaryIdAttribute === "pinswg_sipscase"
|
|
? `_${primaryIdAttribute}_value`
|
|
: `_${primaryIdAttribute}s_value`;
|
|
|
|
return `${suffix} eq ${id}`;
|
|
})
|
|
.join(" or ");
|
|
|
|
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
|
|
filter
|
|
)}`;
|
|
|
|
console.log(
|
|
`Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`
|
|
);
|
|
|
|
try {
|
|
const res = await axios.get(url);
|
|
return res.data.value || []; // ensure returning an array
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
return [];
|
|
}
|
|
};
|
|
|
|
export const getSearchDocumentDetails = (incidentID) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getsearchdocumentdetails_api?incidentid=" +
|
|
incidentID
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
throw error; // Important!
|
|
});
|
|
};
|
|
|
|
export const getSearchDocumentTypes = (incidentID) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getAppealPDFDocs = (incidentID) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
|
|
incidentID
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getSearchDocumentDetailsPaged = (
|
|
incidentID,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords,
|
|
documentType
|
|
) => {
|
|
//console.log("to api:", documentType);
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getsearchdocumentdetailspaged_api?incidentid=" +
|
|
incidentID +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords +
|
|
"&documentType=" +
|
|
documentType
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getLinkedCases = (parentIncidentid) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getlinkedcases_api?parentincidentid=" +
|
|
parentIncidentid
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getAppealsTypes = () => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getProjectTypes = () => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getprojecttypes_api")
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getAppealsTypesForNewAppeal = () => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api")
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getLPA = () => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
// iteration 2 methods
|
|
|
|
export const getFormData = (whichForm) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getformdata_api?whichForm=" + whichForm)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getMandatoryFields = (whichForm) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getmandatoryfields_api?whichForm=" +
|
|
whichForm
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getPickLists = (whichForm) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getpicklists_api?whichForm=" + whichForm)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getPersonalAccount = (contactid) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getpersonalaccount_api?contactid=" +
|
|
contactid
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
//console.log("returned:", error);
|
|
// let ErrResponse = {
|
|
// value: [],
|
|
// errorCode: error.response.status,
|
|
// errorMsg: error.response.statusText,
|
|
// };
|
|
// return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const getAppealID = (
|
|
caseReference,
|
|
updateFormCollection,
|
|
primaryAttribute
|
|
) => {
|
|
//console.log(
|
|
// "is this the collection?:",
|
|
// getFormCollection(updateFormCollection)
|
|
// )
|
|
|
|
//let formCollectionName = getFormCollection(updateFormCollection);
|
|
//console.log(formCollectionName);
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getappealid_api?updateFormCollection=" +
|
|
updateFormCollection +
|
|
"&primaryAttribute=" +
|
|
primaryAttribute +
|
|
"&caseReference=" +
|
|
caseReference
|
|
)
|
|
.then((res) => {
|
|
const result = Object.entries(res.data.value[0]).filter(
|
|
([key]) => !key.startsWith("_")
|
|
)[0][1];
|
|
// console.log("result:", res.data);
|
|
var appealID = result;
|
|
return appealID;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getLogin = (emailAddress, pwd) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getlogin_api?emailAddress=" +
|
|
emailAddress +
|
|
"&pwd=" +
|
|
pwd
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getMyCases = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getmycases_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getMyInvolvements = async (loggedInUserId) => {
|
|
try {
|
|
const res = await axios.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getmyinvolvements_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const getMyLPACases = (lpaid) => {
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getmylpacases_api?lpaid=" + lpaid)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getMyRepresentations = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getmyrepresentations_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getMyRepresentationsProxy = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getRepresentations = (incidentID) => {
|
|
return axios
|
|
.get("/api/endpoint/getrepresentations_api?incidentID=" + incidentID)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getRepresentationsProxy = (incidentID) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getrepresentationsproxy_api?incidentID=" + incidentID
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getWatchedCases = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getwatchedcases_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getWatchedCasesProxy = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getAwaitingSubmissionProxy = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getawaitingsubmissionproxy_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getAwaitingSubmission = (loggedInUserId) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getawaitingsubmission_api?loggedInUserId=" +
|
|
loggedInUserId
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getAwaitingSubmissionFromBlob = (containerName) => {
|
|
//console.log(
|
|
// "///////////////////////\ngetAwaitingSubmissionFromBlob: " +
|
|
// containerName,
|
|
// BASE_URL +
|
|
// "/api/file/getawaitingsubmissionfromblob?container=" +
|
|
// containerName +
|
|
// hashAPIPath(
|
|
// "/api/file/getawaitingsubmissionfromblob?container=" +
|
|
// containerName
|
|
// ),
|
|
// "\n///////////////////////\n"
|
|
// );
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/file/getawaitingsubmissionfromblob?container=" +
|
|
containerName +
|
|
hashAPIPath(
|
|
"/api/file/getawaitingsubmissionfromblob?container=" +
|
|
containerName
|
|
)
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getRepsFromBlob = (containerName) => {
|
|
//console.log(
|
|
// "///////////////////////\ngetRepsFromBlob function: " +
|
|
// containerName +
|
|
// "\n///////////////////////\n",
|
|
// BASE_URL +
|
|
// "/api/file/getrepsblob?container=" +
|
|
// containerName +
|
|
// hashAPIPath("/api/file/getrepsblob?container=" + containerName)
|
|
// );
|
|
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/file/getrepsblob?container=" +
|
|
containerName +
|
|
hashAPIPath("/api/file/getrepsblob?container=" + containerName)
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
//console.log(
|
|
// "///////////////////////\ngetRepsFromBlob error response: " +
|
|
// error +
|
|
// "\n///////////////////////\n"
|
|
// );
|
|
consoleLogger(error);
|
|
//console.log("API call error", error);
|
|
});
|
|
};
|
|
|
|
export const getRepsFromBlobProxy = async (containerName) => {
|
|
//console.log(
|
|
// "///////////////////////getRepsFromBlobProxy: " + containerName,
|
|
// "/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
|
// containerName,
|
|
// "\n///////////////////////\n"
|
|
// );
|
|
|
|
try {
|
|
const res = await axios.get(
|
|
// BASE_URL +
|
|
"/api/file/getrepsblobproxy?container=" + containerName
|
|
// +
|
|
// hashAPIPath(
|
|
// "/api/file/getawaitingsubmissionfromblob?container=" +
|
|
// containerName
|
|
// )
|
|
);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
|
|
console.log(
|
|
"///////////////////////getAwaitingSubmissionFromBlobProxy: " +
|
|
containerName,
|
|
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
|
containerName,
|
|
"\n///////////////////////\n"
|
|
);
|
|
|
|
try {
|
|
const res = await axios.get(
|
|
BASE_URL +
|
|
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
|
containerName
|
|
// +
|
|
// hashAPIPath(
|
|
// "/api/file/getawaitingsubmissionfromblob?container=" +
|
|
// containerName
|
|
// )
|
|
);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const getPortalModuleDetails = async (appealType, caseReference) => {
|
|
//console.log(
|
|
// BASE_URL +
|
|
// "/api/endpoint/getportalmoduledetails_api?appealType=" +
|
|
// appealType +
|
|
// "&caseReference=" +
|
|
// encodeURI(caseReference)
|
|
// );
|
|
|
|
// return axios
|
|
// .get(
|
|
// BASE_URL +
|
|
// "/api/endpoint/getportalmoduledetails_api?appealType=" +
|
|
// appealType +
|
|
// "&caseReference=" +
|
|
// encodeURI(caseReference)
|
|
// )
|
|
// .then((res) => res.data)
|
|
// .catch((error) => {
|
|
// console.log("error case ref:", caseReference);
|
|
// consoleLogger(error);
|
|
// });
|
|
|
|
var config = {
|
|
method: "get",
|
|
url:
|
|
BASE_URL +
|
|
"/api/endpoint/getportalmoduledetails_api?appealType=" +
|
|
appealType +
|
|
"&caseReference=" +
|
|
encodeURI(caseReference)
|
|
};
|
|
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
console.log("error case ref:", caseReference);
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getportalmoduledetailsproxy_api?appealType=" +
|
|
appealType +
|
|
"&caseReference=" +
|
|
caseReference.replace(/\'/g, "''")
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getEmailAccountCheck = (emailAddress) => {
|
|
return axios
|
|
.get(
|
|
"/api/endpoint/getemailaccountcheck_api?emailAddress=" +
|
|
emailAddress
|
|
)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
//uses more than get methods
|
|
|
|
export const updatePassword = (contactId, newpassword) => {
|
|
var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId;
|
|
var data = { "pinswg_custom_password": newpassword };
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const updateAccount = async (contactId, updateBody, ssr) => {
|
|
var queryUrl =
|
|
(ssr ? BASE_URL : "") +
|
|
"/api/endpoint/updateaccount_api?contactId=" +
|
|
contactId;
|
|
var data = updateBody;
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
//console.log("this error:", error);
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const createWatchedCases = async (formValues) => {
|
|
var data = formValues;
|
|
var queryUrl = "/api/endpoint/createwatchedcases_api";
|
|
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const createNewCase = (
|
|
appealTypeId,
|
|
lpaID,
|
|
contactid,
|
|
createBody,
|
|
containerName
|
|
) => {
|
|
appealTypeId = parseInt(appealTypeId);
|
|
|
|
var data = createBody;
|
|
|
|
var queryUrl =
|
|
"/api/endpoint/createcase_api?appealTypeId=" +
|
|
appealTypeId +
|
|
"&lpaID=" +
|
|
lpaID +
|
|
"&contactid=" +
|
|
contactid +
|
|
"&containername=" +
|
|
containerName;
|
|
|
|
var config = {
|
|
method: "post",
|
|
url: BASE_URL + queryUrl,
|
|
data: data
|
|
};
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const createNewCaseBlob = (
|
|
appealTypeId,
|
|
lpaID,
|
|
contactid,
|
|
createBody,
|
|
containerName,
|
|
lpaName
|
|
) => {
|
|
appealTypeId = parseInt(appealTypeId);
|
|
|
|
var data = createBody;
|
|
|
|
data.pinswg_lpaname = lpaName;
|
|
data.createdon = new Date();
|
|
|
|
var queryUrl =
|
|
"/api/file/createcase_api?appealTypeId=" +
|
|
appealTypeId +
|
|
"&lpaID=" +
|
|
lpaID +
|
|
"&contactid=" +
|
|
contactid +
|
|
"&containername=" +
|
|
containerName;
|
|
//+
|
|
// hashAPIPath(
|
|
// "/api/file/createcase_api?appealTypeId=" +
|
|
// appealTypeId +
|
|
// "&lpaID=" +
|
|
// lpaID +
|
|
// "&contactid=" +
|
|
// contactid +
|
|
// "&containername=" +
|
|
// containerName
|
|
// );
|
|
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
//console.log("the query url for crearte csase:", queryUrl);
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const updateCase = async (
|
|
incidentId,
|
|
updateBody,
|
|
updateFormCollection,
|
|
primaryAttribute,
|
|
caseReference
|
|
) => {
|
|
var data = updateBody;
|
|
|
|
var appealObj = await getAppealID(
|
|
caseReference,
|
|
updateFormCollection,
|
|
primaryAttribute
|
|
);
|
|
|
|
var queryUrl =
|
|
"/api/endpoint/updatecase_api?updateFormCollection=" +
|
|
updateFormCollection +
|
|
"&appealObj=" +
|
|
appealObj;
|
|
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: updateBody
|
|
};
|
|
|
|
//console.log(data);
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const updateCaseBlob = async (
|
|
incidentId,
|
|
updateBody,
|
|
updateFormCollection,
|
|
primaryAttribute,
|
|
caseReference
|
|
) => {
|
|
var data = updateBody;
|
|
|
|
var appealObj = await getAppealID(
|
|
caseReference,
|
|
updateFormCollection,
|
|
primaryAttribute
|
|
);
|
|
|
|
var queryUrl =
|
|
"/api/file/updatecase_api?updateFormCollection=" +
|
|
updateFormCollection +
|
|
"&appealObj=" +
|
|
appealObj;
|
|
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: updateBody
|
|
};
|
|
|
|
//console.log(data);
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const patchCase = async (incidentid) => {
|
|
var queryUrl = "/api/endpoint/patchcase_api?incidentid=" + incidentid;
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
//console.log("this error:", error);
|
|
});
|
|
};
|
|
|
|
export const getCase = (incidentID) => {
|
|
//console.log(
|
|
// "////////////// ------" +
|
|
// BASE_URL +
|
|
// "/api/endpoint/getcase_api?incidentID=" +
|
|
// incidentID
|
|
// );
|
|
return axios
|
|
.get(BASE_URL + "/api/endpoint/getcase_api?incidentID=" + incidentID)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getCaseByID = (incidentID) => {
|
|
//console.log(
|
|
// "////////////// ------" +
|
|
// BASE_URL +
|
|
// "/api/endpoint/getcase_api?incidentID=" +
|
|
// incidentID
|
|
// );
|
|
return axios
|
|
.get(
|
|
BASE_URL + "/api/endpoint/getcasebyid_api?incidentID=" + incidentID
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const deleteMyRepresentations = (myRepresentationsID) => {
|
|
var queryUrl =
|
|
"/api/endpoint/deletemyrepresentations_api?myRepresentationsID=" +
|
|
myRepresentationsID;
|
|
|
|
var config = {
|
|
method: "delete",
|
|
url: queryUrl + hashAPIPath(queryUrl),
|
|
headers: {
|
|
"OData-MaxVersion": "4.0",
|
|
"OData-Version": "4.0",
|
|
"Accept": "application/json;odata.metadata=none",
|
|
"Prefer": 'odata.include-annotations="*",return=representation',
|
|
"Content-Type": "application/json"
|
|
}
|
|
};
|
|
//console.log(config);
|
|
return axios(config)
|
|
.then((res) => {
|
|
//console.log("deleted ", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const deleteAwaitingSubmissions = (incidentID) => {
|
|
var queryUrl =
|
|
"/api/endpoint/deleteawaitingsubmissions_api?incidentID=" + incidentID;
|
|
|
|
var config = {
|
|
method: "delete",
|
|
url: queryUrl
|
|
};
|
|
//console.log(config);
|
|
return axios(config)
|
|
.then((res) => {
|
|
//console.log("deleted ", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const deleteAwaitingSubmissionsFromBlob = (
|
|
containerID,
|
|
casefolderID
|
|
) => {
|
|
var queryUrl =
|
|
"/api/file/deleteblobcase?container=" +
|
|
containerID +
|
|
"&casefolderID=" +
|
|
casefolderID;
|
|
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
//console.log(config);
|
|
return axios(config)
|
|
.then((res) => {
|
|
//console.log("deleted ", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const deleteMyRepresentationsFromBlob = (
|
|
containerID,
|
|
casefolderID,
|
|
repfile
|
|
) => {
|
|
var queryUrl =
|
|
"/api/file/deleteblobrep?container=" +
|
|
containerID +
|
|
"&casefolderID=" +
|
|
casefolderID +
|
|
"&repfile=" +
|
|
repfile;
|
|
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
//console.log(config);
|
|
return axios(config)
|
|
.then((res) => {
|
|
//console.log("deleted ", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const deleteWatchedCases = async (watchedCaseID) => {
|
|
var queryUrl =
|
|
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
|
|
var config = {
|
|
method: "delete",
|
|
url: queryUrl
|
|
};
|
|
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const createAccount = (formValues) => {
|
|
var data = formValues;
|
|
var queryUrl = "/api/endpoint/createaccount_api";
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
//console.log("posted ", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const uploadFiles = async (
|
|
formValues,
|
|
filesObj,
|
|
containerID,
|
|
casefolderID
|
|
) => {
|
|
let files = filesObj;
|
|
|
|
//console.log(formValues);
|
|
var formData = new FormData();
|
|
formData.append("appealData", JSON.stringify(formValues));
|
|
formData.append("containerID", containerID);
|
|
formData.append("casefolderID", casefolderID);
|
|
|
|
// files.forEach((file) => formData.append("files", file));
|
|
|
|
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);
|
|
formData.append(files[i][j].name, files[i][j]);
|
|
}
|
|
}
|
|
|
|
//console.log(formData);
|
|
|
|
var queryUrl = "/api/file/upload";
|
|
|
|
const config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: formData,
|
|
headers: { "content-type": "multipart/form-data" }
|
|
};
|
|
|
|
//console.log(config);
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const uploadSingleFile = async (filesObj, containerID, casefolderID) => {
|
|
let files = filesObj;
|
|
|
|
//console.log(formValues);
|
|
var formData = new FormData();
|
|
formData.append("containerID", containerID);
|
|
formData.append("casefolderID", casefolderID);
|
|
|
|
// files.forEach((file) => formData.append("files", file));
|
|
|
|
for (let i = 0; i < files.length; i++) {
|
|
console.log(files.length);
|
|
// for (let j = 0; j < files[i].length; j++) {
|
|
// console.log("upload files:", files[i][j].name);
|
|
formData.append(files[i].name, files[i]);
|
|
// }
|
|
}
|
|
|
|
//console.log(formData);
|
|
|
|
var queryUrl = "/api/file/uploadsinglefile";
|
|
|
|
const config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: formData,
|
|
headers: { "content-type": "multipart/form-data" }
|
|
};
|
|
|
|
//console.log(config);
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const uploadRepFiles = async (
|
|
formValues,
|
|
filesObj,
|
|
containerID,
|
|
casefolderID
|
|
) => {
|
|
let files = filesObj;
|
|
|
|
//console.log(formValues);
|
|
var formData = new FormData();
|
|
formData.append("appealData", JSON.stringify(formValues));
|
|
formData.append("containerID", containerID);
|
|
formData.append("casefolderID", casefolderID);
|
|
formData.append("repOrAppeal", true);
|
|
|
|
// files.forEach((file) => formData.append("files", file));
|
|
|
|
// 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);
|
|
// formData.append(files[i][j].name, files[i][j]);
|
|
// }
|
|
// }
|
|
|
|
//console.log(formData);
|
|
|
|
var queryUrl = "/api/file/upload";
|
|
|
|
const config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: formData,
|
|
headers: { "content-type": "multipart/form-data" }
|
|
};
|
|
|
|
//console.log(config);
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const generateRepPDF = async (
|
|
formValues,
|
|
containerID,
|
|
casefolderID,
|
|
options = {}
|
|
) => {
|
|
//let files = filesObj;
|
|
|
|
console.log("generateRepPDF function: " + formValues);
|
|
// var formData = new FormData();
|
|
// formValues.append("appealData", JSON.stringify(formValues));
|
|
// formValues.append("containerID", containerID);
|
|
// formValues.append("casefolderID", casefolderID);
|
|
|
|
// Object.assign(formValues, {
|
|
// "containerID": containerID,
|
|
// "casefolderID": casefolderID,
|
|
// });
|
|
|
|
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" },
|
|
};
|
|
|
|
//console.log(config);
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const generateAppealPDF = async (
|
|
formValues,
|
|
containerID,
|
|
casefolderID,
|
|
appealType,
|
|
fileList
|
|
) => {
|
|
//let files = filesObj;
|
|
|
|
//console.log("generateAppealPDF function: " + formValues);
|
|
// var formData = new FormData();
|
|
// formValues.append("appealData", JSON.stringify(formValues));
|
|
// formValues.append("containerID", containerID);
|
|
//formValues.append("filesList", fileList);
|
|
|
|
Object.assign(formValues, {
|
|
"filesList": fileList
|
|
});
|
|
|
|
var queryUrl = "/api/file/generateappealpdf?appealType=" + appealType;
|
|
|
|
const config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: formValues
|
|
//headers: { "content-type": "multipart/form-data" },
|
|
};
|
|
|
|
//console.log(config);
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (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
|
|
// )
|
|
// );
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/file/getbloblist?container=" +
|
|
containerName +
|
|
"&casefolderID=" +
|
|
casefolderID +
|
|
hashAPIPath(
|
|
"/api/file/getbloblist?container=" +
|
|
containerName +
|
|
"&casefolderID=" +
|
|
casefolderID
|
|
)
|
|
)
|
|
.then((res) => {
|
|
//console.log("//////////----", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
|
|
return axios
|
|
.get(
|
|
// BASE_URL +
|
|
"/api/file/getbloblistproxy?container=" +
|
|
containerName +
|
|
"&casefolderID=" +
|
|
casefolderID
|
|
)
|
|
.then((res) => {
|
|
//console.log("//////////----", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getFilesFromBlobHashed = (
|
|
containerName,
|
|
getblobshash,
|
|
casefolderID
|
|
) => {
|
|
return axios
|
|
.get(
|
|
"/api/file/getbloblist?container=" +
|
|
containerName +
|
|
"&casefolderID=" +
|
|
casefolderID +
|
|
getblobshash
|
|
)
|
|
.then((res) => {
|
|
//console.log("//////////----", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const deleteBlob = async (
|
|
containerName,
|
|
blobName,
|
|
deleteblobhash,
|
|
casefolderID
|
|
) => {
|
|
try {
|
|
const res = await axios.get(
|
|
"/api/file/deleteblob?container=" +
|
|
containerName +
|
|
"&casefolderID=" +
|
|
encodeURIComponent(casefolderID) +
|
|
"&blobname=" +
|
|
encodeURIComponent(blobName) +
|
|
deleteblobhash
|
|
);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const deleteRepBlob = async (
|
|
containerName,
|
|
blobName,
|
|
deleteblobhash,
|
|
casefolderID,
|
|
filenamePrefix
|
|
) => {
|
|
try {
|
|
const res = await axios.get(
|
|
"/api/file/deleteblob?container=" +
|
|
containerName +
|
|
"&casefolderID=" +
|
|
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
|
|
"&blobname=" +
|
|
encodeURIComponent(blobName) +
|
|
deleteblobhash
|
|
);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const downloadBlob = (containerName, blobName) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/file/downloadblob?container=" +
|
|
containerName.toLowerCase() +
|
|
"&blobname=" +
|
|
blobName,
|
|
{ responseType: "blob" }
|
|
)
|
|
.then((response) => {
|
|
//console.log("Downloaded blob content:");
|
|
|
|
res.setHeader(
|
|
"content-disposition",
|
|
"attachment; filename=" + blobName
|
|
);
|
|
//console.log("has downloaded");
|
|
|
|
return res.status(200).send(response.data);
|
|
})
|
|
.catch((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
|
|
// )
|
|
// );
|
|
try {
|
|
const res = await axios.get(
|
|
BASE_URL +
|
|
"/api/file/getprogressobjblob?container=" +
|
|
encodeURIComponent(containerName) +
|
|
"&casefolderID=" +
|
|
encodeURIComponent(casereference) +
|
|
hashAPIPath(
|
|
"/api/file/getprogressobjblob?container=" +
|
|
encodeURIComponent(containerName) +
|
|
"&casefolderID=" +
|
|
encodeURIComponent(casereference)
|
|
)
|
|
);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const sendEmail = async (
|
|
templateId,
|
|
emailAddress,
|
|
personalisation,
|
|
reference
|
|
) => {
|
|
var mailData = {
|
|
"templateId": templateId,
|
|
"emailAddress": emailAddress,
|
|
"reference": reference,
|
|
"personalisation": personalisation
|
|
};
|
|
|
|
try {
|
|
const response = await axios.post("/api/email/notify", mailData);
|
|
return response.data;
|
|
} catch (error) {
|
|
consoleLogger(error); // Optional custom logging
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export const getNotice = () => {
|
|
return axios
|
|
.get(BASE_URL + "/api/notices")
|
|
.then((res) => {
|
|
//console.log("//////////----", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getPortalLogin = async (emailAddress) => {
|
|
var queryUrl =
|
|
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
|
|
|
|
return axios
|
|
.get(BASE_URL + queryUrl + hashAPIPath(queryUrl))
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
|
|
return JSON.stringify(error);
|
|
});
|
|
};
|
|
|
|
export const getPortalLoginProxy = async (emailAddress) => {
|
|
var queryUrl =
|
|
"/api/endpoint/getportalloginproxy_api?emailAddress=" + emailAddress;
|
|
|
|
return axios
|
|
.get(queryUrl)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
|
|
return JSON.stringify(error);
|
|
});
|
|
};
|
|
|
|
export const createContainerProxy = (containerName) => {
|
|
var queryUrl =
|
|
"/api/file/setupcontainer?ident=" +
|
|
containerName +
|
|
hashAPIPath("/api/file/setupcontainer?ident=" + containerName);
|
|
|
|
return axios
|
|
.get(BASE_URL + queryUrl)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
|
|
return JSON.stringify(error);
|
|
});
|
|
};
|
|
|
|
export const sendCaseCompleteMessage = async (
|
|
containerID,
|
|
caseReference,
|
|
inv
|
|
) => {
|
|
var queryUrl =
|
|
"/api/file/createappealcompletemessage_api?container=" +
|
|
containerID +
|
|
"&tempcaseref=" +
|
|
caseReference +
|
|
"&inv=" +
|
|
inv;
|
|
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
|
|
//console.log(data);
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
console.log("sendCaseCompleteMessage: ", res.data);
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const sendCaseCompleteMessageProxy = async (
|
|
containerID,
|
|
caseReference
|
|
) => {
|
|
var queryUrl =
|
|
"/api/file/createappealcompletemessageproxy_api?container=" +
|
|
containerID +
|
|
"&tempcaseref=" +
|
|
caseReference;
|
|
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
|
|
//console.log(data);
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const sendRepCompleteMessage = async (
|
|
containerID,
|
|
caseReference,
|
|
fileName
|
|
) => {
|
|
var queryUrl =
|
|
"/api/file/createrepcompletemessage_api?container=" +
|
|
containerID +
|
|
"&tempcaseref=" +
|
|
caseReference +
|
|
"&repid=" +
|
|
fileName;
|
|
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
|
|
//console.log(data);
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const setRepInvolvment = async (caseid, contactid) => {
|
|
var queryUrl = "/api/file/createrepinvolvement_api";
|
|
|
|
var data = { "incidentid": caseid, "contactid": contactid };
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const setCaseInvolvment = async (caseid, contactid) => {
|
|
var queryUrl = "/api/file/createrepinvolvement_api";
|
|
|
|
var data = { "incidentid": caseid, "contactid": contactid };
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const getAddressSearch = async (searchString) => {
|
|
const params = new URLSearchParams(searchString);
|
|
const str = params.toString();
|
|
|
|
var queryUrl =
|
|
BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str;
|
|
|
|
var config = {
|
|
method: "get",
|
|
url: queryUrl
|
|
};
|
|
|
|
return axios(config)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
let ErrResponse = {
|
|
value: [],
|
|
errorCode: error.response.status,
|
|
errorMsg: error.response.statusText
|
|
};
|
|
return ErrResponse;
|
|
});
|
|
};
|
|
|
|
export const createCRMTask = async (formValues) => {
|
|
var queryUrl = "/api/endpoint/createcrmtask_api";
|
|
|
|
var data = formValues;
|
|
var config = {
|
|
method: "post",
|
|
url: queryUrl,
|
|
data: data
|
|
};
|
|
|
|
try {
|
|
const res = await axios(config);
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
}
|
|
};
|
|
|
|
export const getPreferredLanguage = async (email) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getpreferredlanguage_api?emailAddress=" +
|
|
email
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getAppealPDFDocument = async (incidentid) => {
|
|
return axios
|
|
.get(
|
|
BASE_URL +
|
|
"/api/endpoint/getappealpdfdocuments_api?incidentid=" +
|
|
incidentid
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
export const getNewAppeals = async (searchString) => {
|
|
try {
|
|
const res = await axios.get(BASE_URL + "/api/admin/getnewappeals_api");
|
|
return res.data;
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
}
|
|
};
|
|
|
|
export const getNewAppealsPage = async (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return axios
|
|
.get(
|
|
"/api/admin/getnewappeals_api?searchString=" +
|
|
searchString +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|
|
|
|
export const getNewDocumentsPaged = async (
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords,
|
|
documentType,
|
|
documentOrigin,
|
|
selectedWeeks
|
|
) => {
|
|
console.log(
|
|
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords +
|
|
"&documentType=" +
|
|
documentType +
|
|
"&numberWeeks=" +
|
|
selectedWeeks +
|
|
"&documentOrigin=" +
|
|
documentOrigin
|
|
);
|
|
return axios
|
|
.get(
|
|
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords +
|
|
"&documentType=" +
|
|
documentType +
|
|
"&numberWeeks=" +
|
|
selectedWeeks +
|
|
"&documentOrigin=" +
|
|
documentOrigin
|
|
)
|
|
.then((res) => {
|
|
return res.data;
|
|
})
|
|
.catch((error) => {
|
|
consoleLogger(error);
|
|
return error.response;
|
|
});
|
|
};
|