Skip to content

Commit

Permalink
Vertical stepper enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov committed Oct 7, 2024
1 parent 8e22724 commit 6c05bf1
Showing 1 changed file with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,19 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {
};

const onSubmit = (formData) => {

// setIsSubmittting to true -> to run inline validations within the components

setIsSubmitting(true);


//config
const name = filteredConfig?.[0]?.form?.[0]?.name;
const currentConfBody = filteredConfig?.[0]?.form?.[0]?.body?.[0];

//Run sync validations on formData based on the screen(key)


const toastObject = Digit.Utils.microplanv1.formValidator(formData?.[currentConfBody?.key], currentConfBody?.key, state);
if (toastObject) {
setShowToast(toastObject);
Expand Down Expand Up @@ -211,38 +211,38 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => {
// setCurrentStep((prev) => prev - 1);
// }
// };
const moveToPreviousStep = ()=>{
const moveToPreviousStep = () => {
setCurrentStep((prev) => prev - 1);
setCurrentKey((prev) => prev - 1);
}
useEffect(() => {

window.addEventListener("moveToPrevious", moveToPreviousStep);

return () => {
window.removeEventListener("moveToPrevious", moveToPreviousStep );
window.removeEventListener("moveToPrevious", moveToPreviousStep);
};
}, []);
const onSecondayActionClick = () => {
if (currentStep === 0) {
history.push(`/${window.contextPath}/employee`);
} else {
setCurrentStep((prev) => prev - 1);
}
const { isLastVerticalStep } = Digit.Hooks.useQueryParams();
if (currentStep === 0) {
history.push(`/${window.contextPath}/employee`);
} else {
setCurrentStep((prev) => prev - 1);
}
const { isLastVerticalStep } = Digit.Hooks.useQueryParams();

if (isLastVerticalStep === 'true') {
window.dispatchEvent(new Event("verticalStepper"))
window.dispatchEvent(new Event("verticalStepper"))
return;

}

setCurrentStep((prev) => prev - 1);
setCurrentKey((prev) => prev - 1);


}

};
setCurrentStep((prev) => prev - 1);
setCurrentKey((prev) => prev - 1);



};

if (isLoadingCampaignObject || isLoadingPlanObject) {
return <Loader />;
Expand Down

0 comments on commit 6c05bf1

Please sign in to comment.