From ea200698d878a54171857421cf20845998b3a228 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 25 Sep 2024 14:34:12 +0700 Subject: change code name --- src/lib/product/components/ProductCard.jsx | 61 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 31 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 10c06775..d3b50302 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -16,13 +16,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const utmSource = useUtmSource(); const [discount, setDiscount] = useState(0); - let voucherPastiHemat = product?.voucherPastiHemat ? 0 : product.newVoucherPastiHemat; - - if (product?.voucherPastiHemat ? product?.voucherPastiHemat.length : voucherPastiHemat > 0) { - const stringVoucher = product?.voucherPastiHemat[0]; - const validJsonString = stringVoucher.replace(/'/g, '"'); - voucherPastiHemat = JSON.parse(validJsonString); - } + let voucherPastiHemat = 0; + 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' }) => {
- {product?.manufacture?.name ? ( - - {product.manufacture.name} - - ) : ( -
-
- )} - {product?.isInBu && ( - - pickup now - - - - )} + {product?.manufacture?.name ? ( + + {product.manufacture.name} + + ) : ( +
-
+ )} + {product?.isInBu && ( + + pickup now + + )}
{
)} {product?.manufacture?.name ? ( -
+
- {product.manufacture.name} - - {/* {product?.is_in_bu && ( + {product.manufacture.name} + + {/* {product?.is_in_bu && (
Click & Pickup -- cgit v1.2.3