From f4eba44dbacf13be894744e48d4248714daee223 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 17 Jul 2024 15:22:34 +0700 Subject: update nomor wa di keranjang --- src/lib/checkout/components/Checkout.jsx | 4 +++- src/lib/checkout/components/CheckoutOld.jsx | 4 +++- src/lib/checkout/components/CheckoutSection.jsx | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 77c3590b..3d7d47b1 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -1589,7 +1589,9 @@ const PickupAddress = ({ label }) => ( Kodepos : 14440

Telp : 021-2933 8828/29

-

Mobile : 0813 9000 7430

+

+ Mobile : 0817-1718-1922 +

); diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx index e2c45ce6..3c4229aa 100644 --- a/src/lib/checkout/components/CheckoutOld.jsx +++ b/src/lib/checkout/components/CheckoutOld.jsx @@ -802,7 +802,9 @@ const PickupAddress = ({ label }) => ( Daerah Khusus Ibukota Jakarta, Indonesia Kodepos : 14440

Telp : 021-2933 8828/29

-

Mobile : 0813 9000 7430

+

+ Mobile : 0817-1718-1922 +

) diff --git a/src/lib/checkout/components/CheckoutSection.jsx b/src/lib/checkout/components/CheckoutSection.jsx index affe6138..3ed4b115 100644 --- a/src/lib/checkout/components/CheckoutSection.jsx +++ b/src/lib/checkout/components/CheckoutSection.jsx @@ -2,6 +2,7 @@ import Link from 'next/link'; import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; import { AnimatePresence, motion } from 'framer-motion'; import { Divider, Spinner } from '@chakra-ui/react'; +import whatsappUrl from '@/core/utils/whatsappUrl'; export const SectionAddress = ({ address, label, url }) => { return ( @@ -185,7 +186,9 @@ export const PickupAddress = ({ label }) => ( Kodepos : 14440

Telp : 021-2933 8828/29

-

Mobile : 0813 9000 7430

+

+ Mobile : 0817-1718-1922 +

); -- cgit v1.2.3 From d0f97021c611d07944f3cbc7e2610b1d495d897f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 17 Jul 2024 15:41:02 +0700 Subject: update hover wa link --- src/lib/checkout/components/Checkout.jsx | 2 +- src/lib/checkout/components/CheckoutOld.jsx | 2 +- src/lib/checkout/components/CheckoutSection.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 3d7d47b1..92e14db6 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -1589,7 +1589,7 @@ const PickupAddress = ({ label }) => ( Kodepos : 14440

Telp : 021-2933 8828/29

-

+

Mobile : 0817-1718-1922

diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx index 3c4229aa..5b479a73 100644 --- a/src/lib/checkout/components/CheckoutOld.jsx +++ b/src/lib/checkout/components/CheckoutOld.jsx @@ -802,7 +802,7 @@ const PickupAddress = ({ label }) => ( Daerah Khusus Ibukota Jakarta, Indonesia Kodepos : 14440

Telp : 021-2933 8828/29

-

+

Mobile : 0817-1718-1922

diff --git a/src/lib/checkout/components/CheckoutSection.jsx b/src/lib/checkout/components/CheckoutSection.jsx index 3ed4b115..623152c6 100644 --- a/src/lib/checkout/components/CheckoutSection.jsx +++ b/src/lib/checkout/components/CheckoutSection.jsx @@ -186,7 +186,7 @@ export const PickupAddress = ({ label }) => ( Kodepos : 14440

Telp : 021-2933 8828/29

-

+

Mobile : 0817-1718-1922

-- cgit v1.2.3 From ecaa66653e57e369b97674ff239177244f8f83ff Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 22 Jul 2024 11:13:59 +0700 Subject: voucher in product card --- src/lib/product/components/ProductCard.jsx | 152 +++++++++++++++++------------ src/utils/solrMapping.js | 1 + 2 files changed, 93 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 98732407..818dbbcf 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -14,7 +14,15 @@ import useUtmSource from '~/hooks/useUtmSource'; const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const router = useRouter(); const utmSource = useUtmSource(); + const [discount, setDiscount] = useState(0); + let voucherPastiHemat = 0; + + if (product?.voucherPastiHemat.length > 0) { + const stringVoucher = product?.voucherPastiHemat[0]; + const validJsonString = stringVoucher.replace(/'/g, '"'); + voucherPastiHemat = JSON.parse(validJsonString); + } const callForPriceWhatsapp = whatsappUrl('product', { name: product.name, @@ -38,42 +46,59 @@ 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 = voucherPastiHemat.max_discount; + } + } else { + countDiscount = voucherPastiHemat.discount_amount; + } + + setDiscount(countDiscount); + }; + + useEffect(() => { + hitungDiscountVoucher(); + }, []); + if (variant == 'vertical') { return ( -
+
-
- {product?.name} -
-
- {product?.isSni && ( - - )} -
-
- {product?.isTkdn && ( - - )} +
+ {product?.name} +
+
+ {product?.isSni && ( + + )} +
+
+ {product?.isTkdn && ( + + )} +
-
- {router.pathname != '/' && product?.flashSale?.id > 0 && (
@@ -178,6 +203,13 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )}
)} + {discount > 0 && ( +
+
+ Hemat : {currencyFormat(discount)} +
+
+ )}
{product?.stockTotal > 0 && ( @@ -200,37 +232,37 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
-
- {product?.name} -
-
- {product?.isSni && ( - - )} -
-
- {product?.isTkdn && ( - - )} +
+ {product?.name} +
+
+ {product?.isSni && ( + + )} +
+
+ {product?.isTkdn && ( + + )} +
-
{product.variantTotal > 1 && (
{product.variantTotal} Varian diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js index dd90ac7d..d4694eb2 100644 --- a/src/utils/solrMapping.js +++ b/src/utils/solrMapping.js @@ -38,6 +38,7 @@ export const productMappingSolr = (products, pricelist) => { qtySold: product?.qty_sold_f || 0, isTkdn:product?.tkdn_b || false, isSni:product?.sni_b || false, + voucherPastiHemat:product?.voucher_pastihemat || [] }; if (product.manufacture_id_i && product.manufacture_name_s) { -- cgit v1.2.3