From 66fa65e4bb24e4a3b250c85f8ecd6eeac1abf5ef Mon Sep 17 00:00:00 2001 From: rstubryan Date: Wed, 14 Jan 2026 14:29:40 +0700 Subject: [PATCH] refactor(FE): Disable sales and filter_by until backend ready --- .../export/CustomerPaymentExportPDF.tsx | 18 +++-- .../report/finance/tab/CustomerPaymentTab.tsx | 71 ++++++++++--------- src/services/api/report/finance-report.ts | 10 ++- 3 files changed, 55 insertions(+), 44 deletions(-) diff --git a/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx b/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx index 5adcb694..5a656e7a 100644 --- a/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx +++ b/src/components/pages/report/finance/export/CustomerPaymentExportPDF.tsx @@ -177,10 +177,12 @@ interface CustomerPaymentExportPDFParams { data: CustomerPaymentReport[]; params?: { customer_name?: string; - sales?: string; + // TODO: Uncomment when BE is ready + // sales?: string; start_date?: string; end_date?: string; - filter_by?: string; + // TODO: Uncomment when BE is ready + // filter_by?: string; }; } @@ -195,9 +197,10 @@ const getParameterText = ( paramsText.push('Semua Customer'); } - if (params?.sales) { - paramsText.push(`Sales: ${params.sales}`); - } + // TODO: Uncomment when BE is ready + // if (params?.sales) { + // paramsText.push(`Sales: ${params.sales}`); + // } if (params?.start_date && params?.end_date) { const startDate = formatDate(params.start_date, 'DD MMM YYYY'); @@ -242,9 +245,10 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => { : '-'} - + {/* TODO: Uncomment when BE is ready */} + {/* Filter Tanggal: Tanggal DO - + */} Customer: {params.params?.customer_name || 'Semua Customer'} diff --git a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx index 9119e80d..f0b5850c 100644 --- a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx +++ b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx @@ -47,6 +47,8 @@ const CustomerPaymentTab = () => { const [filterCustomer, setFilterCustomer] = useState( [] ); + // TODO: Uncomment when BE is ready + // const [filterSales, setFilterSales] = useState([]); const [filterSales, setFilterSales] = useState([]); const [filterStartDate, setFilterStartDate] = useState(''); const [filterEndDate, setFilterEndDate] = useState(''); @@ -60,6 +62,7 @@ const CustomerPaymentTab = () => { hasMore: hasMoreCustomers, } = useSelect(CustomerApi.basePath, 'id', 'name', 'search'); + // TODO: Uncomment when BE is ready const { options: salesOptions, isLoadingOptions: isLoadingSales, @@ -133,23 +136,18 @@ const CustomerPaymentTab = () => { count += 1; } - // Sales filter - if (filterSales.length > 0) { - count += 1; - } - - // Filter by (always count if submitted) - if (isSubmitted) { - count += 1; - } + // TODO: Uncomment when BE is ready + // // Sales filter + // if (filterSales.length > 0) { + // count += 1; + // } return count; }, [ filterStartDate, filterEndDate, filterCustomer, - filterSales, - isSubmitted, + // filterSales, ]); const hasFilters = activeFiltersCount > 0; @@ -163,11 +161,12 @@ const CustomerPaymentTab = () => { filterCustomer.length > 0 ? filterCustomer.map((v) => String(v.value)).join(',') : undefined, - sales_id: - filterSales.length > 0 - ? filterSales.map((v) => String(v.value)).join(',') - : undefined, - filter_by: 'do_date' as const, + // TODO: Uncomment when BE is ready + // sales_id: + // filterSales.length > 0 + // ? filterSales.map((v) => String(v.value)).join(',') + // : undefined, + // filter_by: 'do_date' as const, start_date: filterStartDate || undefined, end_date: filterEndDate || undefined, page: currentPage, @@ -180,8 +179,8 @@ const CustomerPaymentTab = () => { ([, params]) => FinanceApi.getCustomerPaymentReport( params.customer_id, - params.sales_id, - params.filter_by, + undefined, // TODO: Change to params.sales_id when BE is ready + undefined, // TODO: Change to params.filter_by when BE is ready params.start_date, params.end_date, params.page, @@ -206,11 +205,11 @@ const CustomerPaymentTab = () => { filterCustomer.length > 0 ? filterCustomer.map((v) => String(v.value)).join(',') : undefined, - sales_id: - filterSales.length > 0 - ? filterSales.map((v) => String(v.value)).join(',') - : undefined, - filter_by: 'do_date' as const, + // TODO: Uncomment when BE is ready + // sales_id: + // filterSales.length > 0 + // ? filterSales.map((v) => String(v.value)).join(',') + // : undefined, start_date: filterStartDate || undefined, end_date: filterEndDate || undefined, limit: 100, @@ -219,8 +218,8 @@ const CustomerPaymentTab = () => { const response = await FinanceApi.getCustomerPaymentReport( params.customer_id, - params.sales_id, - params.filter_by, + undefined, // TODO: Change to params.sales_id when BE is ready + undefined, // TODO: Change to params.filter_by when BE is ready params.start_date, params.end_date, params.page, @@ -277,13 +276,15 @@ const CustomerPaymentTab = () => { filterCustomer.length > 0 ? filterCustomer.map((c) => c.label).join(', ') : undefined, - sales: - filterSales.length > 0 - ? filterSales.map((s) => s.label).join(', ') - : undefined, + // TODO: Uncomment when BE is ready + // sales: + // filterSales.length > 0 + // ? filterSales.map((s) => s.label).join(', ') + // : undefined, start_date: filterStartDate || undefined, end_date: filterEndDate || undefined, - filter_by: 'do_date', + // TODO: Uncomment when BE is ready + // filter_by: 'do_date' as const, }, }); toast.success('PDF berhasil dibuat dan diunduh.'); @@ -661,7 +662,8 @@ const CustomerPaymentTab = () => { /> -
+ {/* TODO: Uncomment when BE is ready */} + {/*
{ onMenuScrollToBottom={loadMoreSales} className={{ wrapper: 'w-full' }} /> -
+
*/} -
+ {/* TODO: Uncomment when BE is ready */} + {/*
{ isDisabled={true} className={{ wrapper: 'w-full' }} /> -
+
*/} {/* Action Buttons */} diff --git a/src/services/api/report/finance-report.ts b/src/services/api/report/finance-report.ts index 3a564e32..81f23481 100644 --- a/src/services/api/report/finance-report.ts +++ b/src/services/api/report/finance-report.ts @@ -13,8 +13,11 @@ export class FinanceApiService extends BaseApiService< async getCustomerPaymentReport( customer_id?: string, + // TODO: Uncomment when BE is ready + // sales_id?: string, + // filter_by?: 'do_date', sales_id?: string, - filter_by?: 'do_date', + filter_by?: 'do_date' | undefined, start_date?: string, end_date?: string, page?: number, @@ -26,8 +29,9 @@ export class FinanceApiService extends BaseApiService< method: 'GET', params: { customer_id: customer_id, - sales_id: sales_id, - filter_by: filter_by, + // TODO: Uncomment when BE is ready + // sales_id: sales_id, + // filter_by: filter_by, start_date: start_date, end_date: end_date, page: page,