diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js index 89ff13b33d9..d2867da7f74 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js @@ -326,6 +326,9 @@ const BoundaryRelationCreate = () => { } }; + const trimming = (val) => { + return val.trim().replace(/[\s_]+/g, ''); + }; const createNewHierarchy = async () => { @@ -340,14 +343,22 @@ const BoundaryRelationCreate = () => { isError: "info", transitionTime: 100000 }); - - const bh = [...boundaryData, ...newBoundaryData]; - const local = bh.map(item => ({ - code: `${hierarchyType}_${item.boundaryType}`.toUpperCase(), - message: item.boundaryType, - module: `hcm-boundary-${hierarchyType.toLowerCase()}`, - locale: locale - })); + + const local = [ + ...boundaryData.map(item => ({ + code: `${hierarchyType}_${trimming(item.boundaryType)}`.toUpperCase(), + message: `${t((defaultHierarchyType + "_" + item?.boundaryType).toUpperCase())}`, + module: `hcm-boundary-${hierarchyType.toLowerCase()}`, + locale: locale + })), + ...newBoundaryData.map(item => ({ + code: `${hierarchyType}_${trimming(item.boundaryType)}`.toUpperCase(), + message: item.boundaryType.trim(), + module: `hcm-boundary-${hierarchyType.toLowerCase()}`, + locale: locale + })) + ]; + const localisationResult = await localisationMutateAsync(local); if (!localisationResult.success) { @@ -409,17 +420,17 @@ const onConfirmClick=()=>{ setNewBoundaryData((prevItems) => { // Loop through the array starting from the second element return prevItems.map((item, idx) => { - item.boundaryType = item.boundaryType.trim(); + item.boundaryType = trimming(item.boundaryType).toUpperCase(); if (idx === 0) { if (newHierarchy) item.parentBoundaryType = null; else { if (boundaryData.length === 0) item.parentBoundaryType = null; - else item.parentBoundaryType = boundaryData[boundaryData.length - 1].boundaryType.trim(); + else item.parentBoundaryType = boundaryData[boundaryData.length - 1].boundaryType; } } if (idx > 0) { - item.parentBoundaryType = prevItems[idx - 1].boundaryType.trim(); + item.parentBoundaryType = trimming(prevItems[idx - 1].boundaryType); } return item; }); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js index dc1a7df23a2..c606e5f666e 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js @@ -109,7 +109,7 @@ const ViewHierarchy = () => { setShowPopUp(false); } else if ( resFile && resFile?.GeneratedResource?.[0]?.status === "inprogress"){ - setShowToast({label: "PLEASE_WAIT_AND_RETRY_AFTER_SOME_TIME", isError: "info" }); + setShowToast({label: t("PLEASE_WAIT_AND_RETRY_AFTER_SOME_TIME"), isError: "info" }); setShowPopUp(false); } @@ -307,11 +307,11 @@ const ViewHierarchy = () => { return new Promise((resolve, reject) => { const poll = async () => { try { - if (retries >= maxRetries) { - setDataCreationGoing(false); - reject(new Error("Max retries reached")); - return; - } + // if (retries >= maxRetries) { + // setDataCreationGoing(false); + // reject(new Error("Max retries reached")); + // return; + // } const searchResponse = await Digit.CustomService.getResponse({ url: "/project-factory/v1/data/_search", @@ -353,14 +353,14 @@ const ViewHierarchy = () => { poll().catch(reject); // Set a timeout for the entire polling operation - const timeoutDuration = (maxRetries + 1) * pollInterval; - setTimeout(() => { - if (retries < maxRetries) { - // Only reject if not already resolved - setDataCreationGoing(false); - reject(new Error("Polling timeout")); - } - }, timeoutDuration); + // const timeoutDuration = (maxRetries + 1) * pollInterval; + // setTimeout(() => { + // if (retries < maxRetries) { + // // Only reject if not already resolved + // setDataCreationGoing(false); + // reject(new Error("Polling timeout")); + // } + // }, timeoutDuration); }); }; @@ -370,6 +370,10 @@ const ViewHierarchy = () => { } + const trimming = (val)=>{ + return `${t(( hierarchyType + "_" + val.trim().replace(/[\s_]+/g, '')).toUpperCase())}`; + } + const [showPopUp, setShowPopUp] = useState(false); if(!viewState || isLoading) @@ -397,7 +401,7 @@ const ViewHierarchy = () => { return (