From 591dc095a0e5f655e419ec4d1ae11d8f54bed196 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Mon, 9 Oct 2023 10:51:46 +0700
Subject: update fitur variant page

---
 .../components/Product/ProductMobileVariant.jsx        | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 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 8cdb631f..9888e482 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -29,7 +29,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
   const [isLoadingSLA, setIsLoadingSLA] = useState(true)
 
   const getLowestPrice = () => {
-    const lowest = product.price
+    const lowest = product.lowestPrice
     return lowest
   }
 
@@ -40,7 +40,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
     price: getLowestPrice(),
     stock: product.stockTotal,
     weight: product.weight,
-    isFlashSale: product.isFlashsale
+    isFlashSale: product.isFlashSale
   })
 
   useEffect(() => {
@@ -50,9 +50,9 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
         code: product.code,
         name: product.name,
         price: product.price,
-        stock: product.stock,
+        stock: product.stockTotal,
         weight: product.weight,
-        isFlashSale: product.isFlashsale
+        isFlashSale: product.isFlashSale
       })
     }
   }, [selectedVariant, product])
@@ -115,7 +115,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
   return (
     <MobileView>
       <Image
-        src={product.parent.image}
+        src={product.image}
         alt={product.name}
         className='h-72 object-contain object-center w-full border-b border-gray_r-4'
       />
@@ -141,7 +141,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
         </div>
         <h1 className='leading-6 font-medium mb-3'>{activeVariant?.name}</h1>
 
-        {activeVariant.isFlashsale ? (
+        {activeVariant.isFlashSale && activeVariant?.price?.discountPercentage > 0 ? (
           <>
             <div className='flex gap-x-1 items-center'>
               <div className='badge-solid-red'>{activeVariant?.price?.discountPercentage}%</div>
@@ -159,12 +159,12 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
           </>
         ) : (
           <h3 className='text-danger-500 font-semibold mt-1'>
-            {activeVariant?.price?.priceDiscount > 0 ? (
+            {activeVariant?.price?.price > 0 ? (
               <>
-                {currencyFormat(activeVariant?.price?.priceDiscount)}
+                {currencyFormat(activeVariant?.price?.price)}
                 <div className='text-gray_r-9 text-base font-normal mt-1'>
                   Termasuk PPN:{' '}
-                  {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                  {currencyFormat(activeVariant?.price.price * process.env.NEXT_PUBLIC_PPN)}
                 </div>
               </>
             ) : (
-- 
cgit v1.2.3

