diff --git a/src/components/pages/report/finance/tab/DebtSupplierTab.tsx b/src/components/pages/report/finance/tab/DebtSupplierTab.tsx index 174ff1e2..be2271f2 100644 --- a/src/components/pages/report/finance/tab/DebtSupplierTab.tsx +++ b/src/components/pages/report/finance/tab/DebtSupplierTab.tsx @@ -77,7 +77,10 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => { // ===== STATE MANAGEMENT ===== const [isPdfExportLoading, setIsPdfExportLoading] = useState(false); const [isExcelExportLoading, setIsExcelExportLoading] = useState(false); - const isAnyExportLoading = isPdfExportLoading || isExcelExportLoading; + const [isExcelGeneralExportLoading, setIsExcelGeneralExportLoading] = + useState(false); + const isAnyExportLoading = + isPdfExportLoading || isExcelExportLoading || isExcelGeneralExportLoading; // ===== PAGINATION STATE ===== const [currentPage, setCurrentPage] = useState(1); @@ -308,6 +311,23 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => { formik.values.endDate, ]); + const handleExportExcelGeneral = useCallback(async () => { + setIsExcelGeneralExportLoading(true); + try { + await DebtSupplierApi.exportToExcelGeneral( + filterParams.supplier_ids, + filterParams.filter_by, + filterParams.start_date, + filterParams.end_date + ); + toast.success('Excel General berhasil dibuat dan diunduh.'); + } catch { + toast.error('Gagal membuat Excel General. Silakan coba lagi.'); + } finally { + setIsExcelGeneralExportLoading(false); + } + }, [filterParams]); + // ===== TAB ACTIONS COMPONENT ===== const TabActions = useMemo(() => { return function TabActionsComponent() { @@ -370,7 +390,17 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => { className='w-full p-3 justify-start text-sm text-base-content/50 font-semibold text-nowrap' > - Export to Excel + Export to Excel - Supplier Per Sheet + +