diff --git a/src/components/input/SelectInputCheckbox.tsx b/src/components/input/SelectInputCheckbox.tsx index 0827a70a..b0ef61a3 100644 --- a/src/components/input/SelectInputCheckbox.tsx +++ b/src/components/input/SelectInputCheckbox.tsx @@ -47,7 +47,7 @@ const CheckboxOption = < ); }; -const SelectInputCheckbox = ( +const SelectInputCheckbox = ( props: SelectInputCheckboxProps ) => { const { diff --git a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx index dfadd1ec..822d5938 100644 --- a/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx +++ b/src/components/pages/report/finance/tab/CustomerPaymentTab.tsx @@ -116,6 +116,41 @@ const CustomerPaymentTab = () => { filterModal.closeModal(); }, [filterModal]); + // ===== ACTIVE FILTERS COUNT ===== + const activeFiltersCount = useMemo(() => { + let count = 0; + + // Date filter (start_date + end_date = 1 filter) + if (filterStartDate || filterEndDate) { + count += 1; + } + + // Customer filter + if (filterCustomer.length > 0) { + count += 1; + } + + // Sales filter + if (filterSales.length > 0) { + count += 1; + } + + // Filter by (always count if submitted) + if (isSubmitted) { + count += 1; + } + + return count; + }, [ + filterStartDate, + filterEndDate, + filterCustomer, + filterSales, + isSubmitted, + ]); + + const hasFilters = activeFiltersCount > 0; + // ===== DATA FETCHING ===== const { data: customerPayment, isLoading } = useSWR( isSubmitted @@ -533,14 +568,37 @@ const CustomerPaymentTab = () => { className={{ wrapper: 'w-full', body: 'p-1!' }} >
- +