diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-07-25 13:52:12 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-07-25 13:52:12 +0700 |
| commit | b951ed0de4285076a71f57a0e440b5e68d4a44bd (patch) | |
| tree | 4bf1f65ab9798e118e654bf9d8eae1c19c6b87ba /src | |
| parent | 84725a658e8baa021fd1d724566c3e5a451a29bb (diff) | |
| parent | 6be3ec5948932671013aba249fbc5c44ecf9e95b (diff) | |
Merge branch 'feature/voucher_on_products_card' into development
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/product/components/ProductCard.jsx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 3b5fab28..a9d23b8c 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -49,8 +49,13 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const hitungDiscountVoucher = () => { let countDiscount = 0; if (voucherPastiHemat.discount_type === 'percentage') { - countDiscount = product?.lowestPrice.priceDiscount * (voucherPastiHemat.discount_amount / 100); - if (voucherPastiHemat.max_discount > 0 && countDiscount > voucherPastiHemat.max_discount) { + countDiscount = + product?.lowestPrice.priceDiscount * + (voucherPastiHemat.discount_amount / 100); + if ( + voucherPastiHemat.max_discount > 0 && + countDiscount > voucherPastiHemat.max_discount + ) { countDiscount = voucherPastiHemat.max_discount; } } else { @@ -203,10 +208,10 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} </div> )} - {discount > 0 && ( + {discount > 0 && product?.flashSale?.id < 1 && ( <div className='flex gap-x-1 mb-1 text-sm'> <div className='inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20'> - Hemat : {currencyFormat(discount)} + Voucher : {currencyFormat(discount)} </div> </div> )} @@ -351,6 +356,14 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { </div> )} + {discount > 0 && product?.flashSale?.id < 1 && ( + <div className='flex gap-x-1 mb-1 text-sm'> + <div className='inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20'> + Voucher : {currencyFormat(discount)} + </div> + </div> + )} + <div className='flex w-full items-center gap-x-1 '> {product?.stockTotal > 0 && ( <div className='badge-solid-red'>Ready Stock</div> |
