summaryrefslogtreecommitdiff
path: root/src-migrate
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-07-12 16:52:14 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-07-12 16:52:14 +0700
commit7bec0ceaa7de91f1ba1c9ef18fca3c53d9a7155a (patch)
tree241e6641009bc43356eb1f7d5311f0b20712406b /src-migrate
parent1cae9058b3dc4bb3572babdbf0df29539f01d205 (diff)
<iman> update bug button quotation on cart
Diffstat (limited to 'src-migrate')
-rw-r--r--src-migrate/pages/shop/cart/index.tsx24
1 files changed, 18 insertions, 6 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index d89707d2..7de96425 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -2,8 +2,9 @@ import style from './cart.module.css';
import React, { useEffect, useMemo } from 'react';
import Link from 'next/link';
-import { Button, Tooltip } from '@chakra-ui/react';
-
+import { Button, Toast, Tooltip } from '@chakra-ui/react';
+import { toast } from 'react-hot-toast';
+import { useRouter } from 'next/router';
import { getAuth } from '~/libs/auth';
import { useCartStore } from '~/modules/cart/stores/useCartStore';
@@ -15,6 +16,7 @@ import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile';
import Image from '~/components/ui/image';
const CartPage = () => {
+ const router = useRouter();
const auth = getAuth();
const [isStepApproval, setIsStepApproval] = React.useState(false);
@@ -52,6 +54,18 @@ const CartPage = () => {
}
return false;
}, [cart]);
+
+ const handleCheckout = (()=>{
+ router.push('/shop/checkout');
+ })
+
+ const handleQuotation = (()=>{
+ if(hasSelectedPromo || !hasSelected){
+ toast.error('Maaf, Barang promo tidak dapat dibuat quotation');
+ }else{
+ router.push('/shop/quotation');
+ }
+ })
return (
<>
@@ -121,8 +135,7 @@ const CartPage = () => {
colorScheme='yellow'
w='full'
isDisabled={hasSelectedPromo || !hasSelected}
- as={Link}
- href='/shop/quotation'
+ onClick={handleQuotation}
>
Quotation
</Button>
@@ -138,8 +151,7 @@ const CartPage = () => {
colorScheme='red'
w='full'
isDisabled={!hasSelected || hasSelectNoPrice}
- as={Link}
- href='/shop/checkout'
+ onClick={handleCheckout}
>
Checkout
</Button>