diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js index b0dc35001fe..7ef117bb65a 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js @@ -306,6 +306,8 @@ const FormulaConfigWrapper = ({ onSelect, props: customProps }) => { useEffect(() => { window.addEventListener("isFormulaLastStep", isFormulaLastStep); return () => { + Digit.Utils.microplanv1.updateUrlParams({ isFormulaLastVerticalStep: null }); + Digit.Utils.microplanv1.updateUrlParams({ formulaInternalKey: null }); window.removeEventListener("isFormulaLastStep", isFormulaLastStep); }; }, []); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js index 06cbb3eff34..0ffa89d6928 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js @@ -120,6 +120,8 @@ const UserAccessWrapper = ({ onSelect, props: customProps, setupCompleted }) => return () => { window.removeEventListener("verticalStepper", moveToPreviousStep); window.removeEventListener("isLastStep", isLastStep); + Digit.Utils.microplanv1.updateUrlParams({ isLastVerticalStep: null }); + Digit.Utils.microplanv1.updateUrlParams({ internalKey: null }); }; }, [internalKey]); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js index f3e085b675d..2787d30d2a7 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js @@ -21,7 +21,7 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { const [active, setActive] = useState(0); const [showToast, setShowToast] = useState(false); const [showPopUp, setShowPopUp] = useState(false); - const { campaignId, microplanId, key, ...queryParams } = Digit.Hooks.useQueryParams(); + const { campaignId, microplanId, key, isFormulaLastVerticalStep, isLastVerticalStep, ...queryParams } = Digit.Hooks.useQueryParams(); const setupCompleted = queryParams?.["setup-completed"]; const [shouldUpdate, setShouldUpdate] = useState(false); const [currentKey, setCurrentKey] = useState(() => { @@ -271,8 +271,8 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { }; const onStepClick = (step) => { - if(setupCompleted){ - return + if (setupCompleted) { + return; } if (step > currentStep) return; const filteredSteps = microplanConfig?.[0].form.filter((item) => item.stepCount === String(step + 1)); @@ -328,10 +328,15 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { } const getNextActionLabel = () => { - if (filteredConfig?.[0]?.form?.[0]?.body?.[0]?.isLast) { + if (isLastVerticalStep && isLastVerticalStep === "false") { + return null; + } else if (isFormulaLastVerticalStep && isFormulaLastVerticalStep === "false") { + return null; + } else if (filteredConfig?.[0]?.form?.[0]?.body?.[0]?.isLast) { return t("MP_COMPLETE_SETUP"); + } else { + return t("MP_SAVE_PROCEED"); } - return t("MP_SAVE_PROCEED"); }; if (loader) { @@ -372,10 +377,10 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { label={getNextActionLabel()} /> {setupCompleted ? ( - history.goBack()} /> - ]} + history.goBack()} />]} /> ) : null} {showToast && (