diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js index 9a53d0c238..237b5063ec 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js @@ -74,9 +74,6 @@ const AssumptionsForm = ({ onSelect, ...props }) => { setSelectedRegistrationProcess(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedRegistrationProcess); },[props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm]) - const filteredOptions = resourceDistributionStrategyCode === "MIXED" - ? optionsForProcesses.filter(option => option.resourceDistributionStrategyName !== "Fixed post & House-to-House") - : optionsForProcesses; if (isLoadingPlanObject) { return @@ -102,7 +99,7 @@ const AssumptionsForm = ({ onSelect, ...props }) => { variant="select-dropdown" t={t} isMandatory={true} - option={filteredOptions.map(item => ({ + option={optionsForProcesses.map(item => ({ code: item.resourceDistributionStrategyCode, value: item.resourceDistributionStrategyName, }))} @@ -128,7 +125,7 @@ const AssumptionsForm = ({ onSelect, ...props }) => { variant="select-dropdown" t={t} isMandatory={true} - option={filteredOptions.map(item => ({ + option={optionsForProcesses.map(item => ({ code: item.resourceDistributionStrategyCode, value: item.resourceDistributionStrategyName, }))} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js index 254b333521..0131f18c15 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js @@ -18,6 +18,7 @@ const BoundarySelection = ({ onSelect, props: customProps, ...props }) => { const [statusMap, setStatusMap] = useState({}); const [executionCount, setExecutionCount] = useState(0); const [updateBoundary, setUpdateBoundary] = useState(true); + const [isStatusMapLoading, setIsStatusMapLoading] = useState(false); const handleBoundaryChange = (value) => { setBoundaryOptions(value?.boundaryOptions); setSelectedData(value?.selectedData); @@ -58,10 +59,19 @@ const BoundarySelection = ({ onSelect, props: customProps, ...props }) => { useEffect(() => { + // Show loader before updating statusMap + setIsStatusMapLoading(true); if (selectedData && selectedData.length >= 0) { - setStatusMap(() => Digit.Utils.microplanv1.createStatusMap(selectedData, boundaryHierarchy)) + const newStatusMap = Digit.Utils.microplanv1.createStatusMap(selectedData, boundaryHierarchy); + setStatusMap(newStatusMap); + // Hide loader after updating statusMap + setIsStatusMapLoading(false); } - }, [selectedData, boundaryHierarchy]) + return () => { + // Cleanup function to prevent state updates if component unmounts during loading + setIsStatusMapLoading(false); + }; + }, [selectedData, boundaryHierarchy]); useEffect(() => { @@ -94,7 +104,7 @@ const BoundarySelection = ({ onSelect, props: customProps, ...props }) => { return ( <> - + {isStatusMapLoading ? : }
{t(`MICROPLAN_SELECT_BOUNDARY`)}

{t(`MICROPLAN_SELECT_BOUNDARIES_DESCRIPTION`)}

diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js index 83890c1302..07e634794f 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js @@ -163,7 +163,7 @@ const formValidator = (formData, key, state, t) => { } const processesAreValid = formData?.selectedRegistrationProcess?.code && formData?.selectedDistributionProcess?.code; - if (processesAreValid && (formData?.selectedRegistrationProcess.code === formData?.selectedDistributionProcess.code)) { + if (processesAreValid && (formData?.selectedRegistrationProcess.code === formData?.selectedDistributionProcess.code) && (formData?.selectedRegistrationProcess.code !== "MIXED")) { return { key: "error", label: "ERROR_REGISTRATION_AND_DISTRIBUTION_ARE_SAME" }; // Customize as needed }