From 5ac82c38ed3ec4db1fe4ae96e7493a55154716ef Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Thu, 18 Jan 2024 16:24:54 +0700
Subject: Update product detail page

---
 .../modules/product-detail/components/PriceAction.tsx  | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 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 cade21b8..f25847a5 100644
--- a/src-migrate/modules/product-detail/components/PriceAction.tsx
+++ b/src-migrate/modules/product-detail/components/PriceAction.tsx
@@ -29,13 +29,25 @@ const PriceAction = ({ product }: Props) => {
     <div className='block md:sticky top-[150px] bg-white py-0 md:py-6 z-10' id='price-section'>
       {!!activePrice && activePrice.price > 0 && (
         <>
-          <div className={style['main-price']}>
-            Rp {formatCurrency(activePrice.price || 0)}
+          <div className='flex items-end gap-x-2'>
+            {activePrice.discount_percentage > 0 && (
+              <>
+                <div className={style['disc-badge']}>
+                  {Math.floor(activePrice.discount_percentage)}%
+                </div>
+                <div className={style['disc-price']}>
+                  Rp {formatCurrency(activePrice.price || 0)}
+                </div>
+              </>
+            )}
+            <div className={style['main-price']}>
+              Rp {formatCurrency(activePrice.price_discount || 0)}
+            </div>
           </div>
           <div className='h-1' />
           <div className={style['secondary-text']}>
             Termasuk PPN: {' '}
-            Rp {formatCurrency(Math.round(activePrice.price * 1.11))}
+            Rp {formatCurrency(Math.round(activePrice.price_discount * 1.11))}
           </div>
         </>
       )}
-- 
cgit v1.2.3

