mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
refactor(FE-364): Timestamp purchases-per-supplier export filenames
This commit is contained in:
@@ -421,7 +421,7 @@ export const generatePurchasesPerSupplierPDF = async (
|
|||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = `laporan-pembelian-per-supplier-${formatDate(new Date(), 'YYYY-MM-DD-HHmm')}.pdf`;
|
link.download = `laporan-pembelian-per-supplier-dicetak-pada${formatDate(new Date(), 'YYYY-MM-DD-HHmm')}.pdf`;
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
|
|||||||
@@ -361,31 +361,6 @@ const PurchasesPerSupplierTab = () => {
|
|||||||
|
|
||||||
const workbook = XLSX.utils.book_new();
|
const workbook = XLSX.utils.book_new();
|
||||||
|
|
||||||
const areaName =
|
|
||||||
tableFilterState.area_id.length > 0
|
|
||||||
? tableFilterState.area_id
|
|
||||||
.map(
|
|
||||||
(id) =>
|
|
||||||
areaOptions.find((opt) => opt.value === Number(id))?.label
|
|
||||||
)
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(', ') || 'Semua Area'
|
|
||||||
: 'Semua Area';
|
|
||||||
|
|
||||||
const supplierName =
|
|
||||||
tableFilterState.supplier_id.length > 0
|
|
||||||
? tableFilterState.supplier_id
|
|
||||||
.map(
|
|
||||||
(id) =>
|
|
||||||
supplierOptions.find((opt) => opt.value === Number(id))?.label
|
|
||||||
)
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(', ') || 'Semua Supplier'
|
|
||||||
: 'Semua Supplier';
|
|
||||||
|
|
||||||
const startDate = tableFilterState.start_date || 'all';
|
|
||||||
const endDate = tableFilterState.end_date || 'all';
|
|
||||||
|
|
||||||
Object.entries(groupedBySupplier).forEach(
|
Object.entries(groupedBySupplier).forEach(
|
||||||
([supplierName, supplierData]) => {
|
([supplierName, supplierData]) => {
|
||||||
const totals = supplierData.reduce(
|
const totals = supplierData.reduce(
|
||||||
@@ -477,7 +452,7 @@ const PurchasesPerSupplierTab = () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const filename = `Laporan_Pembelian_Per_Supplier_${areaName}_${supplierName}_${startDate}_to_${endDate}.xlsx`;
|
const filename = `laporan-pembelian-per-supplier-dicetak-pada${formatDate(new Date(), 'YYYY-MM-DD-HHmm')}.xlsx`;
|
||||||
|
|
||||||
XLSX.writeFile(workbook, filename);
|
XLSX.writeFile(workbook, filename);
|
||||||
toast.success('Excel berhasil dibuat dan diunduh.');
|
toast.success('Excel berhasil dibuat dan diunduh.');
|
||||||
|
|||||||
Reference in New Issue
Block a user