From 62981e83e935efc6ea2aad845e28792b711a066f Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Sat, 22 Nov 2025 15:48:34 +0330 Subject: [PATCH] feat(companies): Add filtering functionality to company list table - Create CompanyListFilters component with form fields for name, email, phone, currency, and employee count - Integrate filter modal into CompaniesTable component with open/close state management - Update useCompanyListPresenter hook to handle filter form state and search parameters - Replace inline create button with ListHeader component for consistent UI patterns - Add support for URL-based query parameters to persist filter state - Implement form reset and filter clearing functionality - Add isMutating state tracking for loading indicators during filter searches - Update constants/enums to support currency filtering optionsfor --- .../Tables/companies/CompanyListFilters.tsx | 98 +++++++++++++++++++ src/components/Tables/companies/index.tsx | 35 ++++++- .../companies/useCompanyListPresenter.ts | 69 ++++++++----- src/constants/enums.ts | 12 +++ 4 files changed, 188 insertions(+), 26 deletions(-) create mode 100644 src/components/Tables/companies/CompanyListFilters.tsx diff --git a/src/components/Tables/companies/CompanyListFilters.tsx b/src/components/Tables/companies/CompanyListFilters.tsx new file mode 100644 index 0000000..0b270f8 --- /dev/null +++ b/src/components/Tables/companies/CompanyListFilters.tsx @@ -0,0 +1,98 @@ +import InputGroup from "@/components/FormElements/InputGroup"; +import { Select } from "@/components/FormElements/select"; +import { Currencies } from "@/constants/enums"; +import { + FieldValues, + UseFormHandleSubmit, + UseFormRegister, + UseFormSetValue, + UseFormWatch, +} from "react-hook-form"; + +interface CompanyListFiltersProps { + filterRegister: UseFormRegister; + setIsFilterModalOpen: (isOpen: boolean) => void; + isMutating: number; + handleFilterSubmit: UseFormHandleSubmit; + search: (data: any) => void; + watch: UseFormWatch; + setValue: UseFormSetValue; +} + +const CompanyListFilters = ({ + filterRegister, + setIsFilterModalOpen, + isMutating, + handleFilterSubmit, + search, + watch, + setValue, +}: CompanyListFiltersProps) => { + return ( +
+ + + +