mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat(FE-355): Remove pagination from HppPerKandangTab
This commit is contained in:
@@ -37,10 +37,6 @@ const HppPerKandangTab = () => {
|
||||
// ===== STATE MANAGEMENT =====
|
||||
const [isPdfExportLoading, setIsPdfExportLoading] = useState(false);
|
||||
|
||||
// ===== PAGINATION STATE =====
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
|
||||
// ===== SUBMISSION STATE =====
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
|
||||
@@ -162,7 +158,6 @@ const HppPerKandangTab = () => {
|
||||
return;
|
||||
}
|
||||
setIsSubmitted(true);
|
||||
setCurrentPage(1);
|
||||
}, [tableFilterState.period]);
|
||||
|
||||
// ===== DATA FETCHING =====
|
||||
@@ -188,8 +183,6 @@ const HppPerKandangTab = () => {
|
||||
period: tableFilterState.period || undefined,
|
||||
sort_by: tableFilterState.sort_by || undefined,
|
||||
show_unrecorded: tableFilterState.show_unrecorded,
|
||||
page: currentPage,
|
||||
limit: pageSize,
|
||||
};
|
||||
|
||||
return ['hpp-per-kandang-report', params];
|
||||
@@ -204,9 +197,7 @@ const HppPerKandangTab = () => {
|
||||
params.weight_max,
|
||||
params.period,
|
||||
params.sort_by,
|
||||
params.show_unrecorded,
|
||||
params.page,
|
||||
params.limit
|
||||
params.show_unrecorded
|
||||
)
|
||||
);
|
||||
|
||||
@@ -255,8 +246,6 @@ const HppPerKandangTab = () => {
|
||||
period: tableFilterState.period || undefined,
|
||||
sort_by: tableFilterState.sort_by || undefined,
|
||||
show_unrecorded: tableFilterState.show_unrecorded,
|
||||
limit: 10000,
|
||||
page: 1,
|
||||
};
|
||||
|
||||
return ['hpp-per-kandang-report-export', params];
|
||||
@@ -271,9 +260,7 @@ const HppPerKandangTab = () => {
|
||||
params.weight_max,
|
||||
params.period,
|
||||
params.sort_by,
|
||||
params.show_unrecorded,
|
||||
params.page,
|
||||
params.limit
|
||||
params.show_unrecorded
|
||||
)
|
||||
);
|
||||
|
||||
@@ -399,27 +386,6 @@ const HppPerKandangTab = () => {
|
||||
kandangOptions,
|
||||
]);
|
||||
|
||||
// ===== PAGINATION HANDLERS =====
|
||||
const handlePageChange = (page: number) => {
|
||||
setCurrentPage(page);
|
||||
};
|
||||
|
||||
const handleRowChange = (pageSize: number) => {
|
||||
setPageSize(pageSize);
|
||||
};
|
||||
|
||||
const handleNextPage = () => {
|
||||
if (meta && currentPage < meta.total_pages) {
|
||||
setCurrentPage(currentPage + 1);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePrevPage = () => {
|
||||
if (currentPage > 1) {
|
||||
setCurrentPage(currentPage - 1);
|
||||
}
|
||||
};
|
||||
|
||||
// ===== TABLE COLUMNS DEFINITION =====
|
||||
const totals: Totals = useMemo(() => {
|
||||
return {
|
||||
@@ -756,23 +722,9 @@ const HppPerKandangTab = () => {
|
||||
Tidak ada data yang dapat ditampilkan...
|
||||
</div>
|
||||
) : (
|
||||
<Card
|
||||
title={`Data HPP Per Kandang`}
|
||||
subtitle={
|
||||
summary
|
||||
? `Total Sisa Ayam: ${formatNumber(
|
||||
summary.total_remaining_chicken_birds
|
||||
)} ekor | Total Nilai Sisa: ${formatCurrency(
|
||||
summary.total_remaining_value_rp
|
||||
)}`
|
||||
: undefined
|
||||
}
|
||||
className={{ wrapper: 'w-full', body: 'py-6! p-0' }}
|
||||
>
|
||||
<Table
|
||||
data={data}
|
||||
columns={getTableColumns()}
|
||||
pageSize={pageSize}
|
||||
renderFooter={data.length > 0}
|
||||
className={{
|
||||
containerClassName: 'w-full',
|
||||
@@ -793,23 +745,8 @@ const HppPerKandangTab = () => {
|
||||
paginationClassName: 'hidden',
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
</Card>
|
||||
{meta && data.length > 0 && (
|
||||
<div className='mt-6'>
|
||||
<Pagination
|
||||
currentPage={meta.page}
|
||||
totalItems={meta.total_results}
|
||||
onPageChange={handlePageChange}
|
||||
onRowChange={handleRowChange}
|
||||
onNextPage={handleNextPage}
|
||||
onPrevPage={handlePrevPage}
|
||||
rowOptions={[10, 25, 50, 100]}
|
||||
itemsPerPage={meta.limit}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user