From 1dccd128c70696fa096128b0383d84b826595ee7 Mon Sep 17 00:00:00 2001
From: Miqdad <ahmadmiqdad27@gmail.com>
Date: Sat, 23 Aug 2025 12:04:15 +0700
Subject: <Miqdad> Fix Price

---
 .../product-detail/components/PriceAction.tsx      | 26 +++++++++++++++-------
 1 file changed, 18 insertions(+), 8 deletions(-)

(limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx')

diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx
index a90faee0..25a1aa47 100644
--- a/src-migrate/modules/product-detail/components/PriceAction.tsx
+++ b/src-migrate/modules/product-detail/components/PriceAction.tsx
@@ -112,22 +112,32 @@ const PriceAction = ({ product }: Props) => {
           </DesktopView>
           <MobileView>
             <div className='flex items-end gap-x-2'>
-              {activePrice.discount_percentage > 0 && (
+              {activePrice.discount_percentage > 0 ? (
                 <>
                   <div className={style['disc-badge']}>
                     {Math.floor(activePrice.discount_percentage)}%
-                  </div>{' '}
+                  </div>
+
+                  {/* harga setelah diskon (main-price) di kiri */}
                   <div className={style['main-price']}>
                     Rp {formatCurrency(activePrice.price_discount || 0)}
                   </div>
+
+                  {/* harga coret di kanan */}
+                  <div className={style['disc-price']}>
+                    Rp {formatCurrency(activePrice.price || 0)}
+                  </div>
                 </>
+              ) : (
+                // kalau tidak ada diskon, tampilkan harga normal saja
+                <div className={style['main-price']}>
+                  Rp {formatCurrency(activePrice.price || 0)}
+                </div>
               )}
-              <div className={style['disc-price']}>
-                Rp {formatCurrency(activePrice.price || 0)}
-              </div>
             </div>
-              <div className='text-md text-gray-500 shadow-0'>
-                Termasuk PPN: Rp{' '}
+
+            <div className='text-md text-gray-500 shadow-0'>
+              Termasuk PPN: Rp{' '}
               {formatCurrency(Math.round(activePrice.price_discount * PPN))}
             </div>
           </MobileView>
@@ -148,7 +158,7 @@ const PriceAction = ({ product }: Props) => {
       )}
 
       <DesktopView>
-      <div className='h-4' />
+        <div className='h-4' />
         <div className='flex gap-x-5 items-center'>
           {/* Qty */}
           <div className='inline-flex items-center border rounded-md overflow-hidden'>
-- 
cgit v1.2.3

