diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-27 13:10:59 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-27 13:10:59 +0700 |
| commit | f305582bc3336a19c07a2a0d9b9636413bb8c8a5 (patch) | |
| tree | 9bf736f5a21cc17e64baf85970e1a36bea0bfc77 | |
| parent | 70821880d1f8fcbd3c3f5bfb760f19aa9da8139f (diff) | |
<MIqdad> fix price detail product
| -rw-r--r-- | src-migrate/modules/product-detail/components/PriceAction.tsx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 683b679c..6cc2f0bf 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -95,28 +95,40 @@ const PriceAction = ({ product }: Props) => { <DesktopView> <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['main-price']} - style={fontSize ? { fontSize } : undefined} - > - Rp {formatCurrency(activePrice.price_discount || 0)} - </div> - </> + <div className={style['disc-badge']}> + {Math.floor(activePrice.discount_percentage)}% + </div> )} - <div className={style['disc-price']}> - Rp {formatCurrency(activePrice.price || 0)} + <div + className={style['main-price']} + style={fontSize ? { fontSize } : undefined} + > + Rp{' '} + {formatCurrency( + activePrice.discount_percentage > 0 + ? activePrice.price_discount || 0 + : activePrice.price || 0 + )} </div> + {activePrice.discount_percentage > 0 && ( + <div className={style['disc-price']}> + Rp {formatCurrency(activePrice.price || 0)} + </div> + )} </div> <div className='h-1' /> <div className={style['secondary-text']}> Termasuk PPN: Rp{' '} - {formatCurrency(Math.round(activePrice.price_discount * PPN))} + {formatCurrency( + Math.round( + (activePrice.discount_percentage > 0 + ? activePrice.price_discount + : activePrice.price) * PPN + ) + )} </div> </DesktopView> + <MobileView> <div className='flex items-end gap-x-2'> {activePrice.discount_percentage > 0 ? ( |
