From 25f1043e9017dbda6b61be01714b39572cf02ff4 Mon Sep 17 00:00:00 2001 From: deepvasoya Date: Tue, 3 Jun 2025 13:41:44 +0530 Subject: [PATCH] fix: clinic setup stepper --- src/views/ClinicSetup/index.jsx | 51 ++++++++++++++++------------- src/views/ClinicsList/index.jsx | 8 +++-- src/views/StaffManagement/index.jsx | 6 ++-- src/views/User/index.jsx | 2 +- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/views/ClinicSetup/index.jsx b/src/views/ClinicSetup/index.jsx index eeb5000..3b3c951 100644 --- a/src/views/ClinicSetup/index.jsx +++ b/src/views/ClinicSetup/index.jsx @@ -326,9 +326,7 @@ If No -Pt who do not have a Medicare card / Private patients with or without I } if (activeStep == 1) { - if ( - !audioListenDone - ) { + if (!audioListenDone) { pushNotification( "Please listen to the audio before proceeding", "error" @@ -337,13 +335,15 @@ If No -Pt who do not have a Medicare card / Private patients with or without I } } - const newActiveStep = - isLastStep() && !allStepsCompleted() - ? // It's the last step, but not all steps have been completed, - // find the first step that has not been completed - steps.findIndex((step, i) => !(i in completed)) - : activeStep + 1; - setActiveStep(newActiveStep); + // Only move to next step without marking as completed + if (!isLastStep()) { + setActiveStep(activeStep + 1); + } else if (!allStepsCompleted()) { + // If it's the last step and not all steps are completed, + // find the first uncompleted step + const firstUncompletedStep = steps.findIndex((step, i) => !(i in completed)); + setActiveStep(firstUncompletedStep); + } }; // Listen to voice using rime.ai API @@ -518,20 +518,25 @@ If No -Pt who do not have a Medicare card / Private patients with or without I // Handle complete step const handleComplete = () => { - - if( activeStep == 4 && !testConnDone){ + if (activeStep == 4 && !testConnDone) { pushNotification("Please test connection before proceeding", NOTIFICATION.ERROR); return; } - if (true) { - const newCompleted = { ...completed }; - newCompleted[activeStep] = true; - setCompleted(newCompleted); - handleNext(); + // Mark current step as completed + const newCompleted = { ...completed }; + newCompleted[activeStep] = true; + setCompleted(newCompleted); + + // Move to next step or first uncompleted step + if (!isLastStep()) { + setActiveStep(activeStep + 1); + } else if (!allStepsCompleted()) { + const firstUncompletedStep = steps.findIndex((step, i) => !(i in newCompleted)); + setActiveStep(firstUncompletedStep); } else { - // Scroll to the top to make error messages visible - window.scrollTo(0, 0); + // All steps completed + setActiveStep(steps.length); } }; @@ -1042,13 +1047,15 @@ If No -Pt who do not have a Medicare card / Private patients with or without I const stepProps = {}; const labelProps = {}; // Determine if this step is clickable - const isClickable = confirmPhoneNumber && completed[index]; + const isClickable = confirmPhoneNumber && (completed[index] || index < activeStep); + // Only show as completed if explicitly marked as completed + const isStepCompleted = completed[index] === true; return ( - + { options={{ enableRowSelection: false, showTopBar: false, - showFilters: true, + showFilters: false, }} searchText="Clinics" showSearchBox={true} @@ -544,7 +544,11 @@ const ClinicsList = () => { hideTopToolbar columns={columnsRegistered} getData={(filters) => getData(filters, false)} // false for registered - options={{ enableRowSelection: true, showTopBar: false }} + options={{ + enableRowSelection: false, + showTopBar: false, + showFilters: false, + }} showSearchBox={true} ref={ref} showAction={true} diff --git a/src/views/StaffManagement/index.jsx b/src/views/StaffManagement/index.jsx index 2745e9c..e4c8104 100644 --- a/src/views/StaffManagement/index.jsx +++ b/src/views/StaffManagement/index.jsx @@ -20,7 +20,7 @@ import CustomBreadcrumbs from "../../components/CustomBreadcrumbs"; import PageHeader from "../../components/PageHeader"; import { createAdmin, getAdmins, updateAdmin, deleteAdmin } from "../../services/auth.services"; import { pushNotification } from "../../utils/notification"; -import { NOTIFICATION } from "../../constants"; +import { NOT_AVAILABLE_TEXT, NOTIFICATION } from "../../constants"; import { useStyles } from "./staffStyles"; import Table from "../../components/Table"; @@ -215,7 +215,7 @@ const StaffManagement = () => { }, { size: 280, - accessorKey: "username", + accessorFn: ({ username }) => (username ? username.charAt(0).toUpperCase() + username.slice(1) : NOT_AVAILABLE_TEXT), header: "User Name", enableColumnFilter: false, }, @@ -304,7 +304,7 @@ const StaffManagement = () => { label="First Name" fullWidth margin="normal" - value={firstName} + value={firstName.charAt(0).toUpperCase() + firstName.slice(1)} onChange={(e) => setFirstName(e.target.value)} placeholder="First Name" required diff --git a/src/views/User/index.jsx b/src/views/User/index.jsx index e3f5e83..f600f8d 100644 --- a/src/views/User/index.jsx +++ b/src/views/User/index.jsx @@ -196,7 +196,7 @@ function Users() { }, { size: 100, - accessorFn: ({ name }) => name || NOT_AVAILABLE_TEXT, + accessorFn: ({ name }) => (name ? name.charAt(0).toUpperCase() + name.slice(1) : NOT_AVAILABLE_TEXT), accessorKey: "name", header: "Doctor/Nurse Name", isBold: true,