diff --git a/src/components/pages/marketing/MarketingFilter.tsx b/src/components/pages/marketing/MarketingFilter.tsx index 624c573c..0142cf07 100644 --- a/src/components/pages/marketing/MarketingFilter.tsx +++ b/src/components/pages/marketing/MarketingFilter.tsx @@ -41,9 +41,12 @@ const MarketingFilterModal = ({ isLoadingOptions: isLoadingProductsOptions, setInputValue: setProductsInputValue, loadMore: loadMoreProducts, - } = useSelect(MarketingApi.basePath, 'id', 'so_number', '', { - limit: 'limit', - }); + } = useSelect( + MarketingApi.basePath, + 'id', + 'so_number', + 'search' + ); const productsOptions = useMemo(() => { if (!productsRawData || !isResponseSuccess(productsRawData)) return []; @@ -70,18 +73,15 @@ const MarketingFilterModal = ({ isLoadingOptions: isLoadingCustomersOptions, setInputValue: setCustomersInputValue, loadMore: loadMoreCustomers, - } = useSelect(MarketingApi.basePath, 'customer.id', 'customer.name', '', { - limit: 'limit', - }); - - const salesCustomerOptions = useMemo(() => { - const seen = new Set(); - return customersOptions.filter((customer) => { - if (seen.has(customer.value)) return false; - seen.add(customer.value); - return true; - }); - }, [customersOptions]); + } = useSelect( + MarketingApi.basePath, + 'customer.id', + 'customer.name', + 'search', + { + has_marketing: 'true', + } + ); const statusOptions = [ ...MARKETING_APPROVAL_LINE.map((item) => ({ @@ -190,7 +190,7 @@ const MarketingFilterModal = ({ label='Customer' isClearable placeholder='Pilih customer' - options={salesCustomerOptions} + options={customersOptions} isLoading={isLoadingCustomersOptions} value={formik.values.customer} onChange={customerChangeHandler}