From e24275fc16ba143d18a054c6b7f11338015d4165 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Thu, 27 Jul 2023 11:27:14 +0700
Subject: bugs fix button kerang

---
 src/lib/product/components/Product/ProductDesktop.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index dfff91d7..7e1d0d3b 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -96,6 +96,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
       router.push(`/login?next=/shop/product/${slug}`)
       return
     }
+    
     const quantity = variantQuantityRefs.current[variantId].value
 
     if (!validQuantity(quantity)) return
@@ -615,7 +616,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                         )} */}
                         <button
                           type='button'
-                          onClick={() => handleAddToCart(variant)}
+                          onClick={() => handleAddToCart(variant.id)}
                           className='flex-1 py-2 btn-yellow'
                         >
                           Keranjang
-- 
cgit v1.2.3


From 942b4c3548891f25198140b80192e9190a403ee5 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 1 Aug 2023 17:07:20 +0700
Subject: flash sale

---
 .../product/components/Product/ProductDesktop.jsx  | 34 ++++++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 7e1d0d3b..e13e2ab1 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -18,8 +18,10 @@ import odooApi from '@/core/api/odooApi'
 import { Button, Spinner } from 'flowbite-react'
 import PromotionType from '@/lib/promotinProgram/components/PromotionType'
 import useAuth from '@/core/hooks/useAuth'
+import ImageNext from 'next/image'
 
 const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
+  console.log('ini product', products)
   const router = useRouter()
   const auth = useAuth()
   const { slug } = router.query
@@ -96,7 +98,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
       router.push(`/login?next=/shop/product/${slug}`)
       return
     }
-    
+
     const quantity = variantQuantityRefs.current[variantId].value
 
     if (!validQuantity(quantity)) return
@@ -142,7 +144,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
   useEffect(() => {
     const loadProductSimilarInBrand = async () => {
       const productSimilarQuery = [product?.name, `fq=-product_id_i:${product.id}`].join('&')
-      const dataProductSimilar = await productSimilarApi({ query: productSimilarQuery })
+      const source = 'right'
+      const dataProductSimilar = await productSimilarApi({ query: productSimilarQuery, source })
       setProductSimilarInBrand(dataProductSimilar.products)
     }
     if (!productSimilarInBrand) loadProductSimilarInBrand()
@@ -170,7 +173,22 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
       <div className='container mx-auto pt-10'>
         <div className='flex'>
           <div className='w-full flex flex-wrap'>
-            <div className='w-5/12'>
+            <div className='w-5/12 relative'>
+              <div className='absolute bottom-0 bg-red-600 w-full'>
+                <div className='flex gap-x-2 items-center p-2'>
+                  <div className='bg-yellow-400 rounded-full p-1 h-10 w-14 flex items-center justify-center '>
+                    <span className='text-lg font-bold'>40%</span>
+                  </div>
+                  <div className='bg-red-600 border border-solid border-yellow-400 rounded-full h-10 p-2 flex w-[50%] items-center justify-center gap-x-4'>
+                    <ImageNext
+                      src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg'
+                      width={20}
+                      height={10}
+                    />
+                    <span className='text-white text-lg font-semibold'>FLASH SALE</span>
+                  </div>
+                </div>
+              </div>
               <Image
                 src={product.image}
                 alt={product.name}
@@ -375,6 +393,16 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                 <div className='text-gray_r-11 line-through text-caption-1'>
                   {currencyFormat(lowestPrice?.price)}
                 </div>
+                {product.flashSale.remainingTime > 0 && (
+                  <div className='bg-red-600 rounded-full mb-1 p-2 pl-3 pr-3 flex w-fit items-center gap-x-1'>
+                    <ImageNext
+                      src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg'
+                      width={15}
+                      height={10}
+                    />
+                    <span className='text-white text-xs font-semibold'>FLASH SALE</span>
+                  </div>
+                )}
               </div>
             )}
             <h3 className='text-danger-500 font-semibold mt-1 text-title-md'>
-- 
cgit v1.2.3


From 7f5b0518474f702b68ca459e5cb531212504472d Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Thu, 3 Aug 2023 14:22:27 +0700
Subject: flash sale

---
 .../product/components/Product/ProductDesktop.jsx  | 55 ++++++++++++++--------
 1 file changed, 36 insertions(+), 19 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index e13e2ab1..5cbe8a8a 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -19,6 +19,8 @@ import { Button, Spinner } from 'flowbite-react'
 import PromotionType from '@/lib/promotinProgram/components/PromotionType'
 import useAuth from '@/core/hooks/useAuth'
 import ImageNext from 'next/image'
+import CountDown2 from '@/core/components/elements/CountDown/CountDown2'
+import CountDown from '@/core/components/elements/CountDown/CountDown'
 
 const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
   console.log('ini product', products)
@@ -173,27 +175,42 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
       <div className='container mx-auto pt-10'>
         <div className='flex'>
           <div className='w-full flex flex-wrap'>
-            <div className='w-5/12 relative'>
-              <div className='absolute bottom-0 bg-red-600 w-full'>
-                <div className='flex gap-x-2 items-center p-2'>
-                  <div className='bg-yellow-400 rounded-full p-1 h-10 w-14 flex items-center justify-center '>
-                    <span className='text-lg font-bold'>40%</span>
-                  </div>
-                  <div className='bg-red-600 border border-solid border-yellow-400 rounded-full h-10 p-2 flex w-[50%] items-center justify-center gap-x-4'>
-                    <ImageNext
-                      src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg'
-                      width={20}
-                      height={10}
-                    />
-                    <span className='text-white text-lg font-semibold'>FLASH SALE</span>
+            <div className='w-5/12'>
+              <div className='relative mb-2'>
+                {product?.flashSale?.remainingTime > 0 && (
+                  <div className='absolute bottom-0 bg-red-600 w-full h-15 grid'>
+                    <div className='flex gap-x-2 items-center p-2'>
+                      <div className='bg-yellow-400 rounded-full p-1 h-9 w-20 flex items-center justify-center '>
+                        <span className='text-lg font-bold'>{product.lowestPrice.discountPercentage}%</span>
+                      </div>
+                      <div className='bg-red-600 border border-solid border-yellow-400 rounded-full h-9 p-2 flex w-[50%] items-center justify-center gap-x-4'>
+                        <ImageNext
+                          src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg'
+                          width={17}
+                          height={10}
+                        />
+                        <span className='text-white text-lg font-semibold'>{product.flashSale.tag || 'FLASH SALE'}</span>
+                      </div>
+                      <div>
+                        <CountDown2 initialTime={product.flashSale.remainingTime} />
+                      </div>
+                    </div>
                   </div>
-                </div>
+                )}
+                <Image
+                  src={product.image}
+                  alt={product.name}
+                  className='h-[430px] object-contain object-center w-full border border-gray_r-4'
+                />
+              </div>
+              <div>
+                <p className='text-justify text-xs leading-5'>
+                  <span className='font-semibold '>Keterangan : </span>Gambar atau foto berperan
+                  sebagai ilustrasi produk. Kadang tidak sesuai dengan kondisi terbaru dengan
+                  berbagai perubahan dan perbaikan. Hubungi tim sales kami untuk informasi yang
+                  lebih baik perihal gambar di 021-2933 8828.
+                </p>
               </div>
-              <Image
-                src={product.image}
-                alt={product.name}
-                className='h-[430px] object-contain object-center w-full border border-gray_r-4'
-              />
             </div>
 
             <div className='w-7/12 px-4'>
-- 
cgit v1.2.3

