From 7350eb1edcfb7e9776fec70849ee0c64a795eda3 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 24 Oct 2024 11:35:14 +0700
Subject: <iman> add penawaran instan mobile

---
 .../components/Product/ProductMobileVariant.jsx    | 33 ++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/Product/ProductMobileVariant.jsx')

diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx
index af9e52bb..0f64b515 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -1,10 +1,10 @@
-import { Skeleton } from '@chakra-ui/react';
+import { Button, Skeleton } from '@chakra-ui/react';
 import { HeartIcon } from '@heroicons/react/24/outline';
 import { useRouter } from 'next/router';
 import { useEffect, useState } from 'react';
 import { toast } from 'react-hot-toast';
 import LazyLoad from 'react-lazy-load';
-
+import ImageNext from 'next/image';
 import odooApi from '@/core/api/odooApi';
 import Divider from '@/core/components/elements/Divider/Divider';
 import Image from '@/core/components/elements/Image/Image';
@@ -99,6 +99,20 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
     router.push(`/shop/checkout?source=buy`);
   };
 
+  const handleButton = (variant) => {
+    const quantity = quantityInput;
+    if (!validQuantity(quantity)) return;
+
+    updateItemCart({
+      productId: variant,
+      quantity,
+      programLineId: null,
+      selected: true,
+      source: 'buy',
+    });
+    router.push('/shop/quotation?source=buy');
+  };
+
   const productSimilarQuery = [
     product?.name,
     `fq=-product_id_i:${product.id}`,
@@ -236,6 +250,21 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
             Beli
           </button>
         </div>
+        <Button
+          onClick={() => handleButton(product.id)}
+          color={'red'}
+          colorScheme='white'
+          className='w-full border-2 p-2 gap-1 mt-2 hover:bg-slate-100 flex items-center'
+        >
+          <ImageNext
+            src='/images/writing.png'
+            alt='penawaran instan'
+            className=''
+            width={25}
+            height={25}
+          />
+          Penawaran Harga Instan
+        </Button>
       </div>
 
       <Divider />
-- 
cgit v1.2.3

