summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductCard.jsx
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-09-26 11:33:58 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-09-26 11:33:58 +0700
commit8fe167e2e03efcd3d7058c22f4efc6db961de71f (patch)
tree9734734660e6088cebd1738d8ac161834630937f /src/lib/product/components/ProductCard.jsx
parentd4cb977d050a54b9daa1658b6de6e82878ca4c9b (diff)
parent1c56a76f979a6e433d70634b92b1887fb1f19509 (diff)
Merge branch 'new-release' into CR/product_detail
# Conflicts: # package.json # src/utils/solrMapping.js
Diffstat (limited to 'src/lib/product/components/ProductCard.jsx')
-rw-r--r--src/lib/product/components/ProductCard.jsx59
1 files changed, 29 insertions, 30 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 22ce0533..d3b50302 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -17,12 +17,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
const [discount, setDiscount] = useState(0);
let voucherPastiHemat = 0;
-
- if (product?.voucherPastiHemat ? product?.voucherPastiHemat.length : voucherPastiHemat > 0) {
- const stringVoucher = product?.voucherPastiHemat[0];
- const validJsonString = stringVoucher.replace(/'/g, '"');
- voucherPastiHemat = JSON.parse(validJsonString);
- }
+ voucherPastiHemat = product?.newVoucherPastiHemat[0];
const callForPriceWhatsapp = whatsappUrl('product', {
name: product.name,
@@ -48,18 +43,18 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
const hitungDiscountVoucher = () => {
let countDiscount = 0;
- if (voucherPastiHemat.discount_type === 'percentage') {
+ if (voucherPastiHemat.discountType === 'percentage') {
countDiscount =
product?.lowestPrice.priceDiscount *
- (voucherPastiHemat.discount_amount / 100);
+ (voucherPastiHemat.discountAmount / 100);
if (
- voucherPastiHemat.max_discount > 0 &&
- countDiscount > voucherPastiHemat.max_discount
+ voucherPastiHemat.maxDiscount > 0 &&
+ countDiscount > voucherPastiHemat.maxDiscount
) {
- countDiscount = voucherPastiHemat.max_discount;
+ countDiscount = voucherPastiHemat.maxDiscount;
}
} else {
- countDiscount = voucherPastiHemat.discount_amount;
+ countDiscount = voucherPastiHemat.discountAmount;
}
setDiscount(countDiscount);
@@ -147,20 +142,24 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
</Link>
<div className='p-2 sm:p-3 pb-3 text-caption-2 sm:text-body-2 leading-5'>
<div className='flex justify-between '>
- {product?.manufacture?.name ? (
- <Link href={URL.manufacture} className='mb-1 mt-1'>
- {product.manufacture.name}
- </Link>
- ) : (
- <div>-</div>
- )}
- {product?.isInBu && (
- <Link href='/panduan-pick-up-service' className='group'>
- <Image src='/images/PICKUP-NOW.png' className='group-hover:scale-105 transition-transform duration-200' alt='pickup now' width={90} height={12} />
- </Link>
-
-
- )}
+ {product?.manufacture?.name ? (
+ <Link href={URL.manufacture} className='mb-1 mt-1'>
+ {product.manufacture.name}
+ </Link>
+ ) : (
+ <div>-</div>
+ )}
+ {product?.isInBu && (
+ <Link href='/panduan-pick-up-service' className='group'>
+ <Image
+ src='/images/PICKUP-NOW.png'
+ className='group-hover:scale-105 transition-transform duration-200'
+ alt='pickup now'
+ width={90}
+ height={12}
+ />
+ </Link>
+ )}
</div>
<Link
href={URL.product}
@@ -301,11 +300,11 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
</div>
)}
{product?.manufacture?.name ? (
- <div className='flex justify-between'>
+ <div className='flex justify-between'>
<Link href={URL.manufacture} className='mb-1'>
- {product.manufacture.name}
- </Link>
- {/* {product?.is_in_bu && (
+ {product.manufacture.name}
+ </Link>
+ {/* {product?.is_in_bu && (
<div className='bg-red-500 rounded'>
<span className='p-[6px] text-xs text-white'>
Click & Pickup