From 3607bdc77dab01d2d6b80b1fe113f6a796dc3d17 Mon Sep 17 00:00:00 2001 From: Vikas Nale Date: Wed, 7 May 2025 16:43:21 +0530 Subject: [PATCH] increase page size --- src/components/Activities/Attendance.jsx | 6 +- src/components/Activities/AttendcesLogs.jsx | 20 +++-- src/components/Activities/Regularization.jsx | 90 +++++++++---------- .../employee/AttendancesEmployeeRecords.jsx | 34 ++++--- 4 files changed, 74 insertions(+), 76 deletions(-) diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx index 69f3de10..9d4de50a 100644 --- a/src/components/Activities/Attendance.jsx +++ b/src/components/Activities/Attendance.jsx @@ -1,4 +1,4 @@ -import React, { useState,useEffect } from "react"; +import React, { useState, useEffect } from "react"; import moment from "moment"; import Avatar from "../common/Avatar"; import { convertShortTime } from "../../utils/dateUtils"; @@ -32,7 +32,7 @@ const Attendance = ({ attendance, getRole, handleModalData }) => { const { currentPage, totalPages, currentItems, paginate } = usePagination( filteredData, - 5 + 10 ); return ( <> @@ -116,7 +116,7 @@ const Attendance = ({ attendance, getRole, handleModalData }) => { ))} - {!attendance && ( + {!attendance && ( No employees assigned to the project )} diff --git a/src/components/Activities/AttendcesLogs.jsx b/src/components/Activities/AttendcesLogs.jsx index d9124dec..498d5413 100644 --- a/src/components/Activities/AttendcesLogs.jsx +++ b/src/components/Activities/AttendcesLogs.jsx @@ -66,7 +66,7 @@ const AttendanceLog = ({ handleModalData, projectId }) => { const currentDate = new Date().toLocaleDateString("en-CA"); const { currentPage, totalPages, currentItems, paginate } = usePagination( sortedFinalList, - 5 + 10 ); useEffect(() => { @@ -86,8 +86,8 @@ const AttendanceLog = ({ handleModalData, projectId }) => { const attendanceDate = [ ...new Set(sortedFinalList.map((item) => item.checkInTime.split("T")[0])), ].sort((a, b) => new Date(b) - new Date(a)); - if(attendanceDate != dates){ - setDates(attendanceDate); + if (attendanceDate != dates) { + setDates(attendanceDate); } }, [data]); @@ -134,11 +134,15 @@ const AttendanceLog = ({ handleModalData, projectId }) => { {dates.map((date, i) => { return ( - {currentItems.some(item => item.checkInTime.split("T")[0] === date) && - - {date} - - } + {currentItems.some( + (item) => item.checkInTime.split("T")[0] === date + ) && ( + + + {date} + + + )} {currentItems ?.filter((item) => item.checkInTime.includes(date)) .map((attendance, index) => ( diff --git a/src/components/Activities/Regularization.jsx b/src/components/Activities/Regularization.jsx index 8b9f9cf1..32025941 100644 --- a/src/components/Activities/Regularization.jsx +++ b/src/components/Activities/Regularization.jsx @@ -23,11 +23,11 @@ const Regularization = ({ handleRequest }) => { return nameA.localeCompare(nameB); }; - const filteredData = regularizesList.sort(sortByName) - + const filteredData = regularizesList.sort(sortByName); + const { currentPage, totalPages, currentItems, paginate } = usePagination( filteredData, - 5 + 10 ); return ( @@ -94,50 +94,46 @@ const Regularization = ({ handleRequest }) => { {!loading && ( - - )} + + )} ); }; diff --git a/src/pages/employee/AttendancesEmployeeRecords.jsx b/src/pages/employee/AttendancesEmployeeRecords.jsx index 4890ad03..fd98b044 100644 --- a/src/pages/employee/AttendancesEmployeeRecords.jsx +++ b/src/pages/employee/AttendancesEmployeeRecords.jsx @@ -70,7 +70,7 @@ const AttendancesEmployeeRecords = ({ employee }) => { const currentDate = new Date().toLocaleDateString("en-CA"); const { currentPage, totalPages, currentItems, paginate } = usePagination( sortedFinalList, - 5 + 10 ); useEffect(() => { @@ -84,7 +84,7 @@ const AttendancesEmployeeRecords = ({ employee }) => { }) ); } - }, [dateRange, employee,isRefreshing]); + }, [dateRange, employee, isRefreshing]); const openModal = (id) => { setAttendanecId(id); @@ -132,20 +132,18 @@ const AttendancesEmployeeRecords = ({ employee }) => { setIsRefreshing(!isRefreshing)} />
- {(!loading && data.length === 0) && - No employee logs - } - {error &&
{error }
} - {(loading && !data ) &&
Loading...
} - {(data && data.length > 0 ) && ( + {!loading && data.length === 0 && No employee logs} + {error &&
{error}
} + {loading && !data &&
Loading...
} + {data && data.length > 0 && ( @@ -165,7 +163,7 @@ const AttendancesEmployeeRecords = ({ employee }) => { - {currentItems?.map( ( attendance, index ) => ( + {currentItems?.map((attendance, index) => ( - + @@ -200,18 +198,18 @@ const AttendancesEmployeeRecords = ({ employee }) => { tabIndex="0" aria-controls="DataTables_Table_0" data-bs-toggle="modal" - onClick={() => openModal( attendance.id )} + onClick={() => openModal(attendance.id)} > View - ) )} + ))}
@@ -184,12 +182,12 @@ const AttendancesEmployeeRecords = ({ employee }) => {
{" "} - {moment( attendance.checkInTime ).format( "DD-MMM-YYYY" )} + {moment(attendance.checkInTime).format("DD-MMM-YYYY")} {convertShortTime( attendance.checkInTime )}{convertShortTime(attendance.checkInTime)} {attendance.checkOutTime - ? convertShortTime( attendance.checkOutTime ) + ? convertShortTime(attendance.checkOutTime) : "--"}
- ) } + )}
- {(!loading && data.length > 5) && ( + {!loading && data.length > 5 && (