summaryrefslogtreecommitdiff
path: root/src-migrate/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/pages')
-rw-r--r--src-migrate/pages/shop/cart/index.tsx16
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'
>