Merge branch 'Development' into SIPS-Development

This commit is contained in:
2025-12-02 14:03:48 +00:00
14 changed files with 287 additions and 322 deletions
+86 -18
View File
@@ -179,6 +179,92 @@ export const getPartSavedDetails = (searchResultsObj) => {
* Get the details of a case from the appeal type
* @param object searchResultsObj
*/
// export const getSearchDetailsPaged = (searchResultsObj) => {
// let detailsArr = [];
// searchResultsObj = searchResultsObj.value;
// const detailsObj = searchResultsObj.map((searchDetail, index) => {
// if (searchDetail.pinswg_appealcasetype == null) {
// console.log(searchDetail.title);
// } else {
// let formMeta = getFormCollectionByID(
// searchDetail.pinswg_appealcasetype
// );
// formMeta?.LogicalCollectionName &&
// formMeta?.LogicalCollectionName != "pinswg_sipses" &&
// detailsArr.push(
// getBasicSearchDetailsPaged(
// formMeta.LogicalCollectionName,
// searchDetail.title,
// formMeta.PrimaryIdAttribute,
// searchDetail.incidentid
// )
// );
// }
// });
// return Promise.all(detailsArr);
// };
// export const getSearchDetailsPaged = async (searchResultsObj) => {
// const searchResults = searchResultsObj.value;
// //Group incidents by appeal type
// const groupedByAppealType = {};
// searchResults.forEach((incident) => {
// const appealType = incident.pinswg_appealcasetype;
// if (!appealType) return;
// const formMeta = getFormCollectionByID(appealType);
// if (
// !formMeta?.LogicalCollectionName ||
// formMeta.LogicalCollectionName === "pinswg_sipses"
// )
// return;
// const key = formMeta.LogicalCollectionName;
// if (!groupedByAppealType[key]) groupedByAppealType[key] = [];
// groupedByAppealType[key].push({
// incidentID: incident.incidentid,
// caseReference: incident.title,
// primaryIdAttribute: formMeta.PrimaryIdAttribute,
// });
// });
// // Make all API calls in parallel per appeal type
// const allDetails = await Promise.all(
// Object.entries(groupedByAppealType).map(
// async ([appealTypeName, incidents]) => {
// console.log(
// `Fetching details for appeal type: ${appealTypeName}, incidents: ${incidents.length}`
// );
// // Fully parallel for each incident
// const results = await Promise.all(
// incidents.map((i) =>
// getBasicSearchDetailsPaged(
// appealTypeName,
// i.caseReference,
// i.primaryIdAttribute,
// i.incidentID
// ).catch((err) => {
// console.error(
// `Error fetching incident ${i.caseReference}:`,
// err
// );
// return null; // continue other calls even if one fails
// })
// )
// );
// return results.filter((r) => r); // remove nulls from failed calls
// }
// )
// );
// //Flatten all results into a single array
// return allDetails.flat();
// };
export const getSearchDetailsPaged = async (searchResultsObj) => {
searchResultsObj = searchResultsObj.value;
@@ -233,24 +319,6 @@ export const getSearchDetailsPaged = async (searchResultsObj) => {
return allDetails;
};
// export const absoluteUrl = (req, setLocalhost) => {
// var protocol = "https:";
// var host = req
// ? req.headers["x-forwarded-host"] || req.headers["host"]
// : window.location.host;
// if (host.indexOf("localhost") > -1) {
// if (setLocalhost) host = setLocalhost;
// protocol = "http:";
// }
// return {
// protocol: protocol,
// host: host,
// origin: protocol + "//" + host,
// };
// };
export const getProgressObj = (
formObjXML,
titleList,