From f0df1a21f6a53baa12a7e44300ac2035adeb7f53 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 4 Oct 2023 12:05:14 +0700
Subject: mobile version

---
 src/lib/cart/components/Cart.jsx | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

(limited to 'src/lib/cart/components/Cart.jsx')

diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx
index acd23af6..5716d01b 100644
--- a/src/lib/cart/components/Cart.jsx
+++ b/src/lib/cart/components/Cart.jsx
@@ -32,7 +32,7 @@ const Cart = () => {
 
   const [cart, setCart] = useState(null)
 
-  const {setRefreshCart} = useProductCartContext()
+  const { setRefreshCart } = useProductCartContext()
 
   useEffect(() => {
     if (!auth) return
@@ -115,7 +115,7 @@ const Cart = () => {
         selected: true
       }).then(() => {
         getCart().then(() => {
-          if(promotionActiveId){
+          if (promotionActiveId) {
             setPromotionType(false)
           }
         })
@@ -438,7 +438,7 @@ const Cart = () => {
                     product.program.items &&
                     product.program.items.map((item) => (
                       <div key={item.id} className='flex mx-4 relative'>
-                         <ComponentCanBuy canBuy={product.canBuy} />
+                        <ComponentCanBuy canBuy={product.canBuy} />
                         <input className='mr-2 accent-danger-500 w-4' />
                         <Link
                           href={createSlug(
@@ -685,19 +685,25 @@ const Cart = () => {
                         </td>
                         <td className='relative'>
                           <ComponentCanBuy canBuy={product.canBuy} />
-                          {product?.hasFlashsale && (
-                            <div className='flex gap-x-1 items-center justify-center mt-3'>
-                              <div className='text-gray_r-11 line-through text-caption-1'>
-                                {currencyFormat(product?.price?.price)}
+                          {product?.hasFlashsale ? (
+                            <>
+                              <div className='flex gap-x-1 items-center justify-center mt-3'>
+                                <div className='text-gray_r-11 line-through text-caption-1'>
+                                  {currencyFormat(product?.price?.price)}
+                                </div>
+                                <div className='badge-solid-red'>
+                                  {product?.price?.discountPercentage}%
+                                </div>
                               </div>
-                              <div className='badge-solid-red'>
-                                {product?.price?.discountPercentage}%
+                              <div className='font-normal mt-1'>
+                                {currencyFormat(product?.price?.priceDiscount)}
                               </div>
+                            </>
+                          ) : (
+                            <div className='font-normal mt-1'>
+                              {currencyFormat(product?.price?.price)}
                             </div>
                           )}
-                          <div className='font-normal mt-1'>
-                            {currencyFormat(product?.price?.priceDiscount)}
-                          </div>
                         </td>
                         <td className='relative'>
                           <ComponentCanBuy canBuy={product.canBuy} />
-- 
cgit v1.2.3

