diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-01-22 10:41:53 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-01-22 10:41:53 +0700 |
| commit | fb80b92d502437160e45b237b380071ab102c838 (patch) | |
| tree | 7af89af778f0038dbd8f984d360d009c700c6c71 /src-migrate/pages | |
| parent | e49eba371229a643588d49d7ef408b6ef9469d53 (diff) | |
Update disable checkout when has product price 0 and fix filter brand
Diffstat (limited to 'src-migrate/pages')
| -rw-r--r-- | src-migrate/pages/shop/cart/index.tsx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index 397852f9..9ec58a48 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -9,6 +9,7 @@ import { useCartStore } from '~/modules/cart/stores/useCartStore' import CartItem from '~/modules/cart/components/Item' import CartSummary from '~/modules/cart/components/Summary' +import clsxm from '~/libs/clsxm' const CartPage = () => { const auth = getAuth() @@ -35,6 +36,14 @@ const CartPage = () => { return false }, [cart]) + const hasSelectNoPrice = useMemo(() => { + if (!cart) return false + for (const item of cart.products) { + if (item.selected && item.price.price_discount == 0) return true + } + return false + }, [cart]) + return ( <> <div className={style['title']}> @@ -71,11 +80,14 @@ const CartPage = () => { </Button> </Tooltip> - <Tooltip label={!hasSelected && 'Tidak ada item yang dipilih'}> + <Tooltip label={clsxm({ + 'Tidak ada item yang dipilih': !hasSelected, + 'Terdapat item yang tidak ada harga': hasSelectNoPrice + })}> <Button colorScheme='red' w='full' - isDisabled={!hasSelected} + isDisabled={!hasSelected || hasSelectNoPrice} as={Link} href='/shop/checkout' > |
