diff --git a/src/components/Activities/AttendcesLogs.jsx b/src/components/Activities/AttendcesLogs.jsx index 465dc341..31c1522f 100644 --- a/src/components/Activities/AttendcesLogs.jsx +++ b/src/components/Activities/AttendcesLogs.jsx @@ -132,9 +132,12 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => { }, [showPending]); - useEffect(() => { + useEffect(() => { + if (data?.length) { filtering(data); - }, [data, showPending]); + } +}, [data, showPending]); + // New useEffect to handle search filtering const filteredSearchData = useMemo(() => { @@ -148,31 +151,6 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => { }); }, [processedData, searchTerm]); - // const filteredSearchData = useMemo(() => { - // let tempData = processedData; - - // if (searchTerm) { - // const lowercasedSearchTerm = searchTerm.toLowerCase(); - // tempData = tempData.filter((item) => { - // const fullName = `${item.firstName} ${item.lastName}`.toLowerCase(); - // return fullName.includes(lowercasedSearchTerm); - // }); - // } - - // if (filters?.selectedOrganization) { - // tempData = tempData.filter( - // (item) => item.organization?.name === filters.selectedOrganization - // ); - // } - - // if (filters?.selectedServices?.length > 0) { - // tempData = tempData.filter((item) => - // filters.selectedServices.includes(item.service?.name) - // ); - // } - - // return tempData; - // }, [processedData, searchTerm, filters]); const { @@ -250,12 +228,12 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => { className="dataTables_length text-start py-2 d-flex justify-content-between" id="DataTables_Table_0_length" > -
+
-
+
{
-
+
{isLoading ? ( -
+

Loading...

) : filteredSearchData?.length > 0 ? ( @@ -370,7 +348,7 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => { ) : ( -
No data available for the selected date range. Please Select another date.
+
No data for this date range. Please choose another.
)}
{paginatedAttendances?.length == 0 && filteredSearchData?.length > 0 && ( diff --git a/src/components/Activities/CheckCheckOutForm.jsx b/src/components/Activities/CheckCheckOutForm.jsx index 3d7c5e0e..830c8db0 100644 --- a/src/components/Activities/CheckCheckOutForm.jsx +++ b/src/components/Activities/CheckCheckOutForm.jsx @@ -110,8 +110,8 @@ const CheckInCheckOut = ({ modeldata, closeModal, handleSubmitForm }) => { }, [projectNames, projectId, loading]); return ( -
-
+ +