From fe5a14a764e05113a025d6f41ebd5677b3be4c40 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Wed, 4 Feb 2026 15:06:44 +0700 Subject: [PATCH] refactor(FE): Disable invoice download feature --- .../pages/purchase/PurchaseTable.tsx | 72 ++++++------------- 1 file changed, 23 insertions(+), 49 deletions(-) diff --git a/src/components/pages/purchase/PurchaseTable.tsx b/src/components/pages/purchase/PurchaseTable.tsx index 2c08f726..04d3ae93 100644 --- a/src/components/pages/purchase/PurchaseTable.tsx +++ b/src/components/pages/purchase/PurchaseTable.tsx @@ -17,7 +17,7 @@ import RowCollapseOptions from '@/components/table/RowCollapseOptions'; import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper'; import RequirePermission from '@/components/helper/RequirePermission'; import StatusBadge from '@/components/helper/StatusBadge'; -import PurchaseOrderInvoice from '@/components/pages/purchase/order/PurchaseOrderInvoice'; +// import PurchaseOrderInvoice from '@/components/pages/purchase/order/PurchaseOrderInvoice'; import { cn, formatDate } from '@/lib/helper'; import { isResponseSuccess } from '@/lib/api-helper'; @@ -159,26 +159,26 @@ const PurchaseTable = () => { PurchaseApi.getAllFetcher ); - const [isDownloadingInvoice, setIsDownloadingInvoice] = useState(false); - const [invoicePurchaseData, setInvoicePurchaseData] = - useState(null); + // const [isDownloadingInvoice, setIsDownloadingInvoice] = useState(false); + // const [invoicePurchaseData, setInvoicePurchaseData] = + // useState(null); - const handleDownloadInvoice = async (purchaseId: number) => { - setIsDownloadingInvoice(true); - try { - const response = await PurchaseApi.getSingle(purchaseId); - if (isResponseSuccess(response) && response.data) { - setInvoicePurchaseData(response.data); - setTimeout(() => { - setInvoicePurchaseData(null); - }, 1000); - } - } catch { - toast.error('Gagal mengambil data purchase order.'); - } finally { - setIsDownloadingInvoice(false); - } - }; + // const handleDownloadInvoice = async (purchaseId: number) => { + // setIsDownloadingInvoice(true); + // try { + // const response = await PurchaseApi.getSingle(purchaseId); + // if (isResponseSuccess(response) && response.data) { + // setInvoicePurchaseData(response.data); + // setTimeout(() => { + // setInvoicePurchaseData(null); + // }, 1000); + // } + // } catch { + // toast.error('Gagal mengambil data purchase order.'); + // } finally { + // setIsDownloadingInvoice(false); + // } + // }; // ===== TABLE COLUMNS DEFINITION ===== const purchaseColumns: ColumnDef[] = [ @@ -192,33 +192,7 @@ const PurchaseTable = () => { { accessorKey: 'po_expedition', header: 'PO Ekspedisi', - cell: (props) => { - const purchase = props.row.original; - - if (!purchase.po_number || purchase.po_number === 'Belum dibuat') { - return -; - } - - return ( - - ); - }, + cell: (props) => props.row.original.po_expedition || '-', }, { accessorKey: 'supplier.name', @@ -506,14 +480,14 @@ const PurchaseTable = () => { }} /> - {invoicePurchaseData && ( + {/*{invoicePurchaseData && (
- )} + )}*/} ); };