From 616e9292cd1db6bbc0cd28208e5403dd667152b9 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 27 Sep 2023 14:05:15 +0700
Subject: Update with chakra UI theme

---
 src/lib/product/components/Product/ProductMobile.jsx | 1 -
 1 file changed, 1 deletion(-)

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

diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 6b0b27a5..12c43727 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -17,7 +17,6 @@ import whatsappUrl from '@/core/utils/whatsappUrl'
 import PromotionType from '@/lib/promotinProgram/components/PromotionType'
 import { gtagAddToCart } from '@/core/utils/googleTag'
 import odooApi from '@/core/api/odooApi'
-import { Button, Spinner } from 'flowbite-react'
 import ImageNext from 'next/image'
 import CountDown2 from '@/core/components/elements/CountDown/CountDown2'
 
-- 
cgit v1.2.3


From 787d3aaa3187d3432c8e6b743b555ea3e4a4980c Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 3 Oct 2023 15:25:14 +0700
Subject: new pricelist di page product cart, product detail & product variant

---
 .../product/components/Product/ProductMobile.jsx   | 69 ++++++++++++++--------
 1 file changed, 44 insertions(+), 25 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 12c43727..a9d34683 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -100,7 +100,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
         price: variant.price,
         stock: variant.stock,
         weight: variant.weight,
-        hasProgram: variant.hasProgram
+        hasProgram: variant.hasProgram,
+        isFlashsale: variant.isFlashsale
       }
 
       setActiveVariant(newActiveVariant)
@@ -151,6 +152,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
     router.push(`/shop/checkout?source=buy`)
   }
 
+  console.log('ini log', activeVariant)
+
   const productSimilarQuery = [
     product?.name,
     `fq=-product_id_i:${product.id}`,
@@ -231,32 +234,48 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
             <div className='text-gray_r-12/80 text-caption-2 mt-2 mb-1'>Harga mulai dari: </div>
           )}
 
-        {activeVariant?.price?.discountPercentage > 0 && (
-          <div className='flex gap-x-1 items-center'>
-            <div className='text-gray_r-11 line-through text-caption-1'>
-              {currencyFormat(activeVariant?.price?.price)}
+        {activeVariant.isFlashsale ? (
+          <>
+            <div className='flex gap-x-1 items-center'>
+              <div className='badge-solid-red'>{activeVariant?.price?.discountPercentage}%</div>
+              <div className='text-gray_r-11 line-through text-caption-1'>
+                {currencyFormat(activeVariant?.price?.price)}
+              </div>
+              <div className='text-danger-500 font-semibold'>
+                {currencyFormat(activeVariant?.price?.priceDiscount)}
+              </div>
             </div>
-            <div className='badge-solid-red'>{activeVariant?.price?.discountPercentage}%</div>
-          </div>
+            <div className='text-gray_r-9 text-base font-normal mt-1'>
+              Termasuk PPN:{' '}
+              {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+            </div>
+          </>
+        ) : (
+          <h3 className='text-danger-500 font-semibold mt-1'>
+            {activeVariant?.price?.priceDiscount > 0 ? (
+              <>
+                {currencyFormat(activeVariant?.price?.priceDiscount)}
+                <div className='text-gray_r-9 text-base font-normal mt-1'>
+                  Termasuk PPN:{' '}
+                  {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                </div>
+              </>
+            ) : (
+              <span className='text-gray_r-11 leading-6 font-normal'>
+                Hubungi kami untuk dapatkan harga terbaik,&nbsp;
+                <a
+                  href={whatsappUrl('product', {
+                    name: product.name,
+                    url: createSlug('/shop/product/', product.name, product.id, true)
+                  })}
+                  className='text-danger-500 underline'
+                >
+                  klik disini
+                </a>
+              </span>
+            )}
+          </h3>
         )}
-        <h3 className='text-danger-500 font-semibold mt-1'>
-          {activeVariant?.price?.priceDiscount > 0 ? (
-            currencyFormat(activeVariant?.price?.priceDiscount)
-          ) : (
-            <span className='text-gray_r-11 leading-6 font-normal'>
-              Hubungi kami untuk dapatkan harga terbaik,&nbsp;
-              <a
-                href={whatsappUrl('product', {
-                  name: product.name,
-                  url: createSlug('/shop/product/', product.name, product.id, true)
-                })}
-                className='text-danger-500 underline'
-              >
-                klik disini
-              </a>
-            </span>
-          )}
-        </h3>
       </div>
 
       <Divider />
-- 
cgit v1.2.3

