Adding pagination 20 in Profile Attendance page and adding condtion to show more then 20 records to show paging. #235

Merged
vikas.nale merged 1 commits from kartik_Bug#540 into Issues_July_2W 2025-07-09 07:08:58 +00:00
Showing only changes of commit 9b63b2000e - Show all commits

View File

@ -85,7 +85,7 @@ const AttendancesEmployeeRecords = ({ employee }) => {
const currentDate = new Date().toLocaleDateString("en-CA"); const currentDate = new Date().toLocaleDateString("en-CA");
const { currentPage, totalPages, currentItems, paginate } = usePagination( const { currentPage, totalPages, currentItems, paginate } = usePagination(
sortedFinalList, sortedFinalList,
10 20
); );
useEffect(() => { useEffect(() => {
@ -141,13 +141,12 @@ const AttendancesEmployeeRecords = ({ employee }) => {
id="DataTables_Table_0_length" id="DataTables_Table_0_length"
> >
<div className="col-md-3 my-0 "> <div className="col-md-3 my-0 ">
<DateRangePicker onRangeChange={setDateRange} endDateMode="yesterday"/> <DateRangePicker onRangeChange={setDateRange} endDateMode="yesterday" />
</div> </div>
<div className="col-md-2 m-0 text-end"> <div className="col-md-2 m-0 text-end">
<i <i
className={`bx bx-refresh cursor-pointer fs-4 ${ className={`bx bx-refresh cursor-pointer fs-4 ${loading ? "spin" : ""
loading ? "spin" : "" }`}
}`}
data-toggle="tooltip" data-toggle="tooltip"
title="Refresh" title="Refresh"
onClick={() => setIsRefreshing(!isRefreshing)} onClick={() => setIsRefreshing(!isRefreshing)}
@ -224,7 +223,7 @@ const AttendancesEmployeeRecords = ({ employee }) => {
</table> </table>
)} )}
</div> </div>
{!loading && data.length > 5 && ( {!loading && sortedFinalList.length > 20 && (
<nav aria-label="Page "> <nav aria-label="Page ">
<ul className="pagination pagination-sm justify-content-end py-1"> <ul className="pagination pagination-sm justify-content-end py-1">
<li <li
@ -240,9 +239,8 @@ const AttendancesEmployeeRecords = ({ employee }) => {
{[...Array(totalPages)].map((_, index) => ( {[...Array(totalPages)].map((_, index) => (
<li <li
key={index} key={index}
className={`page-item ${ className={`page-item ${currentPage === index + 1 ? "active" : ""
currentPage === index + 1 ? "active" : "" }`}
}`}
> >
<button <button
className="page-link " className="page-link "
@ -253,9 +251,8 @@ const AttendancesEmployeeRecords = ({ employee }) => {
</li> </li>
))} ))}
<li <li
className={`page-item ${ className={`page-item ${currentPage === totalPages ? "disabled" : ""
currentPage === totalPages ? "disabled" : "" }`}
}`}
> >
<button <button
className="page-link " className="page-link "