fix: pagination positioning

This commit is contained in:
Adnan Zahir
2026-04-25 13:06:44 +07:00
parent c875ebd951
commit a11d05e720
2 changed files with 44 additions and 47 deletions
@@ -731,29 +731,6 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
/> />
)} )}
{!isLoading && data.length > 0 && meta && (
<div className='max-w-sm ml-auto'>
<Pagination
totalItems={meta.total_results || 0}
itemsPerPage={meta.limit || 0}
currentPage={meta.page || 0}
onPrevPage={() =>
setCurrentPage((curr) => (curr > 1 ? curr - 1 : curr))
}
onNextPage={() =>
setCurrentPage((curr) =>
meta.total_pages && curr < meta.total_pages
? curr + 1
: curr
)
}
onPageChange={(pageNumber) => setCurrentPage(pageNumber)}
rowOptions={[10, 20, 50, 100]}
onRowChange={setPageSize}
/>
</div>
)}
{!isLoading && {!isLoading &&
data.length > 0 && data.length > 0 &&
data.map((customerReport) => { data.map((customerReport) => {
@@ -848,6 +825,27 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
</Card> </Card>
); );
})} })}
{!isLoading && data.length > 0 && meta && (
<div className='mt-5 px-3'>
<Pagination
totalItems={meta.total_results || 0}
itemsPerPage={meta.limit || 0}
currentPage={meta.page || 0}
onPrevPage={() =>
setCurrentPage((curr) => (curr > 1 ? curr - 1 : curr))
}
onNextPage={() =>
setCurrentPage((curr) =>
meta.total_pages && curr < meta.total_pages ? curr + 1 : curr
)
}
onPageChange={(pageNumber) => setCurrentPage(pageNumber)}
rowOptions={[10, 20, 50, 100]}
onRowChange={setPageSize}
/>
</div>
)}
</div> </div>
{/* Filter Modal */} {/* Filter Modal */}
@@ -149,7 +149,8 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
handleFilterModalOpenRef.current = () => { handleFilterModalOpenRef.current = () => {
const restoredFilterBy = const restoredFilterBy =
dataTypeOptions.find((opt) => opt.value === filterParams.filter_by) || null; dataTypeOptions.find((opt) => opt.value === filterParams.filter_by) ||
null;
const supplierIdList = filterParams.supplier_ids const supplierIdList = filterParams.supplier_ids
? filterParams.supplier_ids.split(',') ? filterParams.supplier_ids.split(',')
@@ -662,29 +663,6 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
/> />
)} )}
{!isLoading && data.length > 0 && meta && (
<div className='max-w-sm ml-auto'>
<Pagination
totalItems={meta.total_results || 0}
itemsPerPage={meta.limit || 0}
currentPage={meta.page || 0}
onPrevPage={() =>
setCurrentPage((curr) => (curr > 1 ? curr - 1 : curr))
}
onNextPage={() =>
setCurrentPage((curr) =>
meta.total_pages && curr < meta.total_pages
? curr + 1
: curr
)
}
onPageChange={(pageNumber) => setCurrentPage(pageNumber)}
rowOptions={[10, 20, 50, 100]}
onRowChange={setPageSize}
/>
</div>
)}
{!isLoading && {!isLoading &&
data.length > 0 && data.length > 0 &&
data.map((supplierReport) => { data.map((supplierReport) => {
@@ -772,6 +750,27 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
</Card> </Card>
); );
})} })}
{!isLoading && data.length > 0 && meta && (
<div className='mt-5 px-3'>
<Pagination
totalItems={meta.total_results || 0}
itemsPerPage={meta.limit || 0}
currentPage={meta.page || 0}
onPrevPage={() =>
setCurrentPage((curr) => (curr > 1 ? curr - 1 : curr))
}
onNextPage={() =>
setCurrentPage((curr) =>
meta.total_pages && curr < meta.total_pages ? curr + 1 : curr
)
}
onPageChange={(pageNumber) => setCurrentPage(pageNumber)}
rowOptions={[10, 20, 50, 100]}
onRowChange={setPageSize}
/>
</div>
)}
</div> </div>
{/* Filter Modal */} {/* Filter Modal */}