From c21aa43ed120ec0bbda0884f6f55ba15eb868a09 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 23 Oct 2025 10:07:56 +0700 Subject: fixed product filter --- src/lib/product/components/ProductSearch.jsx | 60 ++++++++++++++++----------- src/pages/shop/search.jsx | 61 ++++++++++++++++------------ 2 files changed, 73 insertions(+), 48 deletions(-) diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 850d00cc..9503d400 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -6,7 +6,10 @@ import { HStack, Image, Tag, TagCloseButton, TagLabel } from '@chakra-ui/react'; import axios from 'axios'; import _ from 'lodash'; import { toQuery } from 'lodash-contrib'; -import { FunnelIcon, AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline'; +import { + FunnelIcon, + AdjustmentsHorizontalIcon, +} from '@heroicons/react/24/outline'; import odooApi from '@/core/api/odooApi'; import searchSpellApi from '@/core/api/searchSpellApi'; import Link from '@/core/components/elements/Link/Link'; @@ -57,7 +60,8 @@ const ProductSearch = ({ if (!router.isReady) return; const onBrandsPage = router.pathname.includes('brands'); - const hasOrder = typeof router.query?.orderBy === 'string' && router.query.orderBy !== ''; + const hasOrder = + typeof router.query?.orderBy === 'string' && router.query.orderBy !== ''; if (onBrandsPage && !hasOrder && !appliedDefaultBrandOrder.current) { let params = { @@ -175,7 +179,11 @@ const ProductSearch = ({ }, [dataCategoriesProduct, dataLob]); useEffect(() => { - if (prefixUrl.includes('category') || prefixUrl.includes('lob') || router.asPath.includes('penawaran')) { + if ( + prefixUrl.includes('category') || + prefixUrl.includes('lob') || + router.asPath.includes('penawaran') + ) { setQueryFinal({ ...finalQuery, q, limit, orderBy }); } else { setQueryFinal({ ...query, q, limit, orderBy }); @@ -430,7 +438,9 @@ const ProductSearch = ({
{isNotReadyStockPage && isBrand && isBrand.logo && (
-

Brand Pencarian {q}

+

+ Brand Pencarian {q} +

1 ? ( <> {productStart + 1}- - {parseInt(productStart) + parseInt(productRows) > productFound + {parseInt(productStart) + parseInt(productRows) > + productFound ? productFound : parseInt(productStart) + parseInt(productRows)}  dari  @@ -474,7 +485,8 @@ const ProductSearch = ({  produk{' '} {query.q && ( <> - untuk pencarian {query.q} + untuk pencarian{' '} + {query.q} )} @@ -512,7 +524,9 @@ const ProductSearch = ({
)} {!!dataLob?.length && } - {!!dataCategories?.length && } + {!!dataCategories?.length && ( + + )}
{products && products.map((product) => ( @@ -561,16 +575,16 @@ const ProductSearch = ({
)} - - -
- - +
+ +
+ +
@@ -621,7 +635,7 @@ const ProductSearch = ({ <> {productStart + 1}- {parseInt(productStart) + parseInt(productRows) > - productFound + productFound ? productFound : parseInt(productStart) + parseInt(productRows)}  dari  @@ -697,8 +711,8 @@ const ProductSearch = ({ href={ query?.q ? whatsappUrl('productSearch', { - name: query.q, - }) + name: query.q, + }) : whatsappUrl() } className='text-danger-500' @@ -783,9 +797,9 @@ const FilterChoicesComponent = ({ )} {brandValues?.length > 0 || - categoryValues?.length > 0 || - priceFrom || - priceTo ? ( + categoryValues?.length > 0 || + priceFrom || + priceTo ? (