From 90eef08f9b66ff71bf21c19395f1f36ba698e7dd Mon Sep 17 00:00:00 2001 From: rstubryan Date: Mon, 12 Jan 2026 14:30:34 +0700 Subject: [PATCH] refactor(FE): Enable sales tab and fetch sales data --- src/app/closing/detail/page.tsx | 10 ++-- .../pages/closing/ClosingDetail.tsx | 10 ++-- .../pages/closing/sale/SalesReportTable.tsx | 48 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/app/closing/detail/page.tsx b/src/app/closing/detail/page.tsx index f3a78d9d..e630a279 100644 --- a/src/app/closing/detail/page.tsx +++ b/src/app/closing/detail/page.tsx @@ -19,10 +19,10 @@ const ClosingDetailPage = () => { (id: number) => ClosingApi.getGeneralInfo(id) ); - // const { data: salesData, isLoading: isLoadingSales } = useSWR( - // closingId ? `sales-${closingId}` : null, - // () => ClosingApi.getPenjualan(Number(closingId)) - // ); + const { data: salesData, isLoading: isLoadingSales } = useSWR( + closingId ? `sales-${closingId}` : null, + () => ClosingApi.getPenjualan(Number(closingId)) + ); const { data: hppEkspedisiData, isLoading: isLoadingHppEkspedisi } = useSWR( closingId ? `hpp-ekspedisi-${closingId}` : null, @@ -55,7 +55,7 @@ const ClosingDetailPage = () => { = ({ /> ), }, - // { - // id: 'penjualan', - // label: 'Penjualan', - // content: , - // }, + { + id: 'penjualan', + label: 'Penjualan', + content: , + }, { id: 'overhead', label: 'Overhead', diff --git a/src/components/pages/closing/sale/SalesReportTable.tsx b/src/components/pages/closing/sale/SalesReportTable.tsx index 89cb6615..fe8d46a5 100644 --- a/src/components/pages/closing/sale/SalesReportTable.tsx +++ b/src/components/pages/closing/sale/SalesReportTable.tsx @@ -215,31 +215,31 @@ const SalesReportTable = ({ return kandang?.name || '-'; }, }, - { - id: 'payment_status', - accessorKey: 'payment_status', - header: 'Status Pembayaran', - cell: (props) => { - const status = props.getValue() as string; - const getStatusColor = (status: string) => { - if (!status) return 'neutral'; - switch (status.toLowerCase()) { - case 'paid': - return 'success'; - case 'tempo': - return 'warning'; - default: - return 'neutral'; - } - }; + // { + // id: 'payment_status', + // accessorKey: 'payment_status', + // header: 'Status Pembayaran', + // cell: (props) => { + // const status = props.getValue() as string; + // const getStatusColor = (status: string) => { + // if (!status) return 'neutral'; + // switch (status.toLowerCase()) { + // case 'paid': + // return 'success'; + // case 'tempo': + // return 'warning'; + // default: + // return 'neutral'; + // } + // }; - return ( - - {status || '-'} - - ); - }, - }, + // return ( + // + // {status || '-'} + // + // ); + // }, + // }, ], [] );