From a9d1ba08ddc9018bb72e45b79c1754197b418947 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Tue, 14 Oct 2025 15:44:36 +0530 Subject: [PATCH] UI updation in Attendance Toady's and Regularization tab. --- src/components/Activities/Attendance.jsx | 270 ++++++++++--------- src/components/Activities/Regularization.jsx | 210 ++++++++------- 2 files changed, 242 insertions(+), 238 deletions(-) diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx index 0f726521..1e298df0 100644 --- a/src/components/Activities/Attendance.jsx +++ b/src/components/Activities/Attendance.jsx @@ -110,144 +110,146 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat }, [employeeHandler]); - + return ( <> -
-
- Date : {formatUTCToLocalTime(todayDate)} -
- setShowPending(e.target.checked)} - /> - -
-
- {attLoading ? ( -
Loading...
- ) : currentItems?.length > 0 ? ( - <> - - - - - - {/* */} - - - - - - - {currentItems && - currentItems - .sort((a, b) => { - const checkInA = a?.checkInTime - ? new Date(a.checkInTime) - : new Date(0); - const checkInB = b?.checkInTime - ? new Date(b.checkInTime) - : new Date(0); - return checkInB - checkInA; - }) - .map((item) => ( - - - - - {/* */} - - - - - - - ))} - {!attendance && ( - - - - )} - -
NameRoleOrganization - - Check-In - - Check-Out - Actions
- - {item.jobRoleName}{item.organizationName || "--"} - {item.checkInTime - ? convertShortTime(item.checkInTime) - : "--"} - - {item.checkOutTime - ? convertShortTime(item.checkOutTime) - : "--"} - - -
- No employees assigned to the project! -
- - - {!loading && finalFilteredData.length > ITEMS_PER_PAGE && ( - - +
+
+ Date : {formatUTCToLocalTime(todayDate)} +
+ setShowPending(e.target.checked)} /> - )} - - ) : ( -
- {searchTerm - ? "No results found for your search." - : attendanceList.length === 0 - ? "No employees assigned to the project." - : "No pending records available."} + +
+ {attLoading ? ( +
Loading...
+ ) : currentItems?.length > 0 ? ( + <> + + + + + + {/* */} + + + + + + + {currentItems && + currentItems + .sort((a, b) => { + const checkInA = a?.checkInTime + ? new Date(a.checkInTime) + : new Date(0); + const checkInB = b?.checkInTime + ? new Date(b.checkInTime) + : new Date(0); + return checkInB - checkInA; + }) + .map((item) => ( + + + + + {/* */} + + + + + + + ))} + {!attendance && ( + + + + )} + +
NameRoleOrganization + + Check-In + + Check-Out + Actions
+ + {item.jobRoleName}{item.organizationName || "--"} + {item.checkInTime + ? convertShortTime(item.checkInTime) + : "--"} + + {item.checkOutTime + ? convertShortTime(item.checkOutTime) + : "--"} + + +
+ No employees assigned to the project! +
+ + + + + ) : ( +
+ {searchTerm + ? "No results found for your search." + : attendanceList.length === 0 + ? "No employees assigned to the project." + : "No pending records available."} +
+ )} +
+ {!loading && finalFilteredData.length > ITEMS_PER_PAGE && ( + )}
diff --git a/src/components/Activities/Regularization.jsx b/src/components/Activities/Regularization.jsx index 0d6364a4..fbf1cddd 100644 --- a/src/components/Activities/Regularization.jsx +++ b/src/components/Activities/Regularization.jsx @@ -22,18 +22,18 @@ const Regularization = ({ handleRequest, searchTerm, projectId, organizationId, const { regularizes, loading, error, refetch } = useRegularizationRequests(selectedProject, organizationId, IncludeInActive); -useEffect(() => { - if (regularizes && regularizes.length) { - setregularizedList((prev) => { - const prevIds = prev.map((i) => i.id).join(","); - const newIds = regularizes.map((i) => i.id).join(","); - if (prevIds !== newIds) { - return regularizes; - } - return prev; - }); - } -}, [regularizes]); + useEffect(() => { + if (regularizes && regularizes.length) { + setregularizedList((prev) => { + const prevIds = prev.map((i) => i.id).join(","); + const newIds = regularizes.map((i) => i.id).join(","); + if (prevIds !== newIds) { + return regularizes; + } + return prev; + }); + } + }, [regularizes]); const sortByName = (a, b) => { @@ -132,108 +132,110 @@ useEffect(() => { return ( -
- {loading ? ( -
-

Loading...

-
- ) : currentItems?.length > 0 ? ( - - - - - - {/* */} - - +
+
+ {loading ? ( +
+

Loading...

+
+ ) : currentItems?.length > 0 ? ( +
NameDateOrganization - Check-In - - Check-Out -
+ + + + + {/* */} + + - - - - - - - {currentItems?.map((att, index) => ( - - + + + + + + {currentItems?.map((att, index) => ( + + + - + - {/* */} + {/* */} - - - - - - - ))} - -
NameDateOrganization + Check-In + + Check-Out + Request ByRequested AtAction
-
- -
- {/* +
Request ByRequested AtAction
+ - - {moment(att.checkOutTime).format("DD-MMM-YYYY")}{moment(att.checkOutTime).format("DD-MMM-YYYY")}{att.organizationName || "--"}{att.organizationName || "--"}{convertShortTime(att.checkInTime)} - {att.checkOutTime ? convertShortTime(att.checkOutTime) : "--"} - - {att.requestedBy - ? `${att.requestedBy?.firstName} ${att.requestedBy?.lastName}` - : "--"} - - {att.requestedAt - ? moment(att.requestedAt).format("DD-MMM-YYYY") - : "--"} - - -
+ {convertShortTime(att.checkInTime)} + + {att.checkOutTime ? convertShortTime(att.checkOutTime) : "--"} + + + {att.requestedBy + ? `${att.requestedBy?.firstName} ${att.requestedBy?.lastName}` + : "--"} + + + {att.requestedAt + ? moment(att.requestedAt).format("DD-MMM-YYYY") + : "--"} + + + + + + ))} + + - ) : ( -
- - {searchTerm - ? "No results found for your search." - : "No Requests Found !"} - -
- )} - {!loading && totalPages > 1 && ( - - )} + ) : ( +
+ + {searchTerm + ? "No results found for your search." + : "No Requests Found !"} + +
+ )} +
+ {!loading && totalPages > 1 && ( + + )}
); };