refactor(FE-364): Refactor purchases export to use supplier reports

This commit is contained in:
rstubryan
2025-12-18 15:11:34 +07:00
parent d001b05c4e
commit 36389bae2a
2 changed files with 22 additions and 54 deletions
@@ -313,7 +313,7 @@ const PurchasesPerSupplierTab = () => {
end_date: tableFilterState.end_date || undefined,
sort_by: tableFilterState.sort_by || undefined,
filter_by: tableFilterState.filter_by || undefined,
limit: 10000,
limit: 100,
page: 1,
};
@@ -459,10 +459,6 @@ const PurchasesPerSupplierTab = () => {
return;
}
const allRows = allDataForExport.flatMap(
(supplierReport) => supplierReport.rows
);
const areaName =
tableFilterState.area_id.length > 0
? tableFilterState.area_id
@@ -518,7 +514,7 @@ const PurchasesPerSupplierTab = () => {
end_date: tableFilterState.end_date || '',
};
await generatePurchasesPerSupplierPDF(allRows, exportParams);
await generatePurchasesPerSupplierPDF(allDataForExport, exportParams);
toast.success('PDF berhasil dibuat dan diunduh.');
} catch {
toast.error('Gagal membuat PDF. Silakan coba lagi.');
@@ -821,7 +817,7 @@ const PurchasesPerSupplierTab = () => {
/>
<SelectInput
label='Urutkan Berdasarkan'
placeholder='Pilih Urutkan Berdasarkan'
placeholder='Urutkan Berdasarkan'
options={sortByOptions}
value={
sortByOptions?.find(