mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
feat(FE-355): Remove pagination from HppPerKandangTab
This commit is contained in:
@@ -37,10 +37,6 @@ const HppPerKandangTab = () => {
|
|||||||
// ===== STATE MANAGEMENT =====
|
// ===== STATE MANAGEMENT =====
|
||||||
const [isPdfExportLoading, setIsPdfExportLoading] = useState(false);
|
const [isPdfExportLoading, setIsPdfExportLoading] = useState(false);
|
||||||
|
|
||||||
// ===== PAGINATION STATE =====
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
const [pageSize, setPageSize] = useState(10);
|
|
||||||
|
|
||||||
// ===== SUBMISSION STATE =====
|
// ===== SUBMISSION STATE =====
|
||||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||||
|
|
||||||
@@ -162,7 +158,6 @@ const HppPerKandangTab = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIsSubmitted(true);
|
setIsSubmitted(true);
|
||||||
setCurrentPage(1);
|
|
||||||
}, [tableFilterState.period]);
|
}, [tableFilterState.period]);
|
||||||
|
|
||||||
// ===== DATA FETCHING =====
|
// ===== DATA FETCHING =====
|
||||||
@@ -188,8 +183,6 @@ const HppPerKandangTab = () => {
|
|||||||
period: tableFilterState.period || undefined,
|
period: tableFilterState.period || undefined,
|
||||||
sort_by: tableFilterState.sort_by || undefined,
|
sort_by: tableFilterState.sort_by || undefined,
|
||||||
show_unrecorded: tableFilterState.show_unrecorded,
|
show_unrecorded: tableFilterState.show_unrecorded,
|
||||||
page: currentPage,
|
|
||||||
limit: pageSize,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return ['hpp-per-kandang-report', params];
|
return ['hpp-per-kandang-report', params];
|
||||||
@@ -204,9 +197,7 @@ const HppPerKandangTab = () => {
|
|||||||
params.weight_max,
|
params.weight_max,
|
||||||
params.period,
|
params.period,
|
||||||
params.sort_by,
|
params.sort_by,
|
||||||
params.show_unrecorded,
|
params.show_unrecorded
|
||||||
params.page,
|
|
||||||
params.limit
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -255,8 +246,6 @@ const HppPerKandangTab = () => {
|
|||||||
period: tableFilterState.period || undefined,
|
period: tableFilterState.period || undefined,
|
||||||
sort_by: tableFilterState.sort_by || undefined,
|
sort_by: tableFilterState.sort_by || undefined,
|
||||||
show_unrecorded: tableFilterState.show_unrecorded,
|
show_unrecorded: tableFilterState.show_unrecorded,
|
||||||
limit: 10000,
|
|
||||||
page: 1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return ['hpp-per-kandang-report-export', params];
|
return ['hpp-per-kandang-report-export', params];
|
||||||
@@ -271,9 +260,7 @@ const HppPerKandangTab = () => {
|
|||||||
params.weight_max,
|
params.weight_max,
|
||||||
params.period,
|
params.period,
|
||||||
params.sort_by,
|
params.sort_by,
|
||||||
params.show_unrecorded,
|
params.show_unrecorded
|
||||||
params.page,
|
|
||||||
params.limit
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -399,27 +386,6 @@ const HppPerKandangTab = () => {
|
|||||||
kandangOptions,
|
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 =====
|
// ===== TABLE COLUMNS DEFINITION =====
|
||||||
const totals: Totals = useMemo(() => {
|
const totals: Totals = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
@@ -756,23 +722,9 @@ const HppPerKandangTab = () => {
|
|||||||
Tidak ada data yang dapat ditampilkan...
|
Tidak ada data yang dapat ditampilkan...
|
||||||
</div>
|
</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
|
<Table
|
||||||
data={data}
|
data={data}
|
||||||
columns={getTableColumns()}
|
columns={getTableColumns()}
|
||||||
pageSize={pageSize}
|
|
||||||
renderFooter={data.length > 0}
|
renderFooter={data.length > 0}
|
||||||
className={{
|
className={{
|
||||||
containerClassName: 'w-full',
|
containerClassName: 'w-full',
|
||||||
@@ -793,23 +745,8 @@ const HppPerKandangTab = () => {
|
|||||||
paginationClassName: 'hidden',
|
paginationClassName: 'hidden',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Card>
|
|
||||||
)}
|
)}
|
||||||
</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>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user