From e13527fe816cdc65b9d1c34d887b96f581ff933d Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Sat, 22 Nov 2025 15:54:31 +0330 Subject: [PATCH] feat(company-categories): Add filtering functionality to category list table - Create CompanyCategoryListFilters component with search and published status filters - Integrate ListHeader component to replace inline create button - Add filter modal with form handling and submission logic - Implement useForm hook for filter form state management - Add search parameter synchronization with URL query params - Support clearing individual filter fields and resetting filters - Add loading state indicator during filter search operations - Maintain consistency with existing filtering patterns used in companies and tenders tables --- .../CompanyCategoryListFilters.tsx | 79 +++++++++++++++++++ .../companies/company-categories/index.tsx | 35 +++++++- .../useCompanyCategoriesPresenter.ts | 54 +++++++++++-- 3 files changed, 158 insertions(+), 10 deletions(-) create mode 100644 src/components/Tables/companies/company-categories/CompanyCategoryListFilters.tsx diff --git a/src/components/Tables/companies/company-categories/CompanyCategoryListFilters.tsx b/src/components/Tables/companies/company-categories/CompanyCategoryListFilters.tsx new file mode 100644 index 0000000..2292d9c --- /dev/null +++ b/src/components/Tables/companies/company-categories/CompanyCategoryListFilters.tsx @@ -0,0 +1,79 @@ +import InputGroup from "@/components/FormElements/InputGroup"; +import { Select } from "@/components/FormElements/select"; +import { + FieldValues, + UseFormHandleSubmit, + UseFormRegister, + UseFormSetValue, + UseFormWatch, +} from "react-hook-form"; + +interface CompanyCategoryListFiltersProps { + filterRegister: UseFormRegister; + setIsFilterModalOpen: (isOpen: boolean) => void; + isMutating: number; + handleFilterSubmit: UseFormHandleSubmit; + search: (data: any) => void; + watch: UseFormWatch; + setValue: UseFormSetValue; +} + +const CompanyCategoryListFilters = ({ + filterRegister, + setIsFilterModalOpen, + isMutating, + handleFilterSubmit, + search, + watch, + setValue, +}: CompanyCategoryListFiltersProps) => { + return ( +
+ +