diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx index c3cbfe41..f7dd4ba7 100644 --- a/src/components/Activities/Attendance.jsx +++ b/src/components/Activities/Attendance.jsx @@ -24,6 +24,7 @@ const Attendance = ({ getRole, handleModalData }) => { attendance, loading: attLoading, recall: attrecall, + isFetching } = useAttendance(selectedProject); const filteredAttendance = ShowPending ? attendance?.filter( @@ -100,6 +101,7 @@ const Attendance = ({ getRole, handleModalData }) => { className="form-check-input" role="switch" id="inactiveEmployeesCheckbox" + disabled={isFetching} checked={ShowPending} onChange={(e) => setShowPending(e.target.checked)} /> diff --git a/src/components/Activities/AttendcesLogs.jsx b/src/components/Activities/AttendcesLogs.jsx index 5c78bc62..982ef879 100644 --- a/src/components/Activities/AttendcesLogs.jsx +++ b/src/components/Activities/AttendcesLogs.jsx @@ -214,6 +214,7 @@ const AttendanceLog = ({ type="checkbox" className="form-check-input" role="switch" + disabled={isFetching} id="inactiveEmployeesCheckbox" checked={showOnlyCheckout} onChange={(e) => setshowOnlyCheckout(e.target.checked)} @@ -233,7 +234,7 @@ const AttendanceLog = ({
{isLoading ? ( -
Loading...
+

Loading...

) : data?.length > 0 ? ( diff --git a/src/components/Activities/Regularization.jsx b/src/components/Activities/Regularization.jsx index db58ed58..e4853402 100644 --- a/src/components/Activities/Regularization.jsx +++ b/src/components/Activities/Regularization.jsx @@ -28,12 +28,13 @@ const Regularization = ({ handleRequest }) => { const handler = useCallback( (msg) => { if (selectedProject == msg.projectId) { - const updatedAttendance = regularizes?.filter( item => item.id !== msg.response.id ); + const updatedAttendance = regularizes?.filter( + (item) => item.id !== msg.response.id + ); cacheData("regularizedList", { data: updatedAttendance, projectId: selectedProject, }); - // clearCacheKey("regularizedList") refetch(); } }, @@ -51,7 +52,7 @@ const Regularization = ({ handleRequest }) => { return () => eventBus.off("regularization", handler); }, [handler]); - const employeeHandler = useCallback( + const employeeHandler = useCallback( (msg) => { if (regularizes.some((item) => item.employeeId == msg.employeeId)) { refetch(); @@ -60,91 +61,70 @@ const Regularization = ({ handleRequest }) => { [regularizes] ); - useEffect(() => { + useEffect(() => { eventBus.on("employee", employeeHandler); return () => eventBus.off("employee", employeeHandler); }, [employeeHandler]); return ( -
-
- - - - - - - - - - - {/* {loading && ( - - )} */} - - {!loading && - (currentItems?.length > 0 ? ( - currentItems?.map((att, index) => ( - - +
NameDate - Check-In - - Check-Out - Action
- Loading... -
-
- - +
+ {loading ? ( +
+

Loading...

+
+ ) : currentItems?.length > 0 ? ( + + + + + + + + + + + + {currentItems?.map((att, index) => ( + + - - - - - - )) - ) : ( - - + + + + ))} - -
NameDate + Check-In + + Check-Out + Action
+ {moment(att.checkOutTime).format("DD-MMM-YYYY")}{convertShortTime(att.checkInTime)} - {att.checkOutTime - ? convertShortTime(att.checkOutTime) - : "--"} - - {/*
*/} - - {/*
*/} -
- No Record Found + + {moment(att.checkOutTime).format("DD-MMM-YYYY")}{convertShortTime(att.checkInTime)} + {att.checkOutTime ? convertShortTime(att.checkOutTime) : "--"} + + + {/* */}
+
+ ) : ( +
No Requests Found
+ )} {!loading && totalPages > 1 && (