From bbc333053b2cb963f8a16cecb4d7f15a0111daf2 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 22 Jun 2023 11:02:53 +0700 Subject: page variant --- src/lib/product/api/variantApi.js | 9 + src/lib/product/components/Product/Product.jsx | 39 ++- .../components/Product/ProductDesktopVariant.jsx | 348 +++++++++++++++++++++ .../components/Product/ProductMobileVariant.jsx | 315 +++++++++++++++++++ src/pages/shop/product/variant/[slug].jsx | 75 +++++ 5 files changed, 777 insertions(+), 9 deletions(-) create mode 100644 src/lib/product/api/variantApi.js create mode 100644 src/lib/product/components/Product/ProductDesktopVariant.jsx create mode 100644 src/lib/product/components/Product/ProductMobileVariant.jsx create mode 100644 src/pages/shop/product/variant/[slug].jsx diff --git a/src/lib/product/api/variantApi.js b/src/lib/product/api/variantApi.js new file mode 100644 index 00000000..47273dd7 --- /dev/null +++ b/src/lib/product/api/variantApi.js @@ -0,0 +1,9 @@ +import odooApi from '@/core/api/odooApi' + +const variantApi = async ({ id, headers = {} }) => { + if (!id) return + const dataProduct = await odooApi('GET', `/api/v2/product_variant/${id}`, {}, headers) + return dataProduct +} + +export default variantApi diff --git a/src/lib/product/components/Product/Product.jsx b/src/lib/product/components/Product/Product.jsx index 351c07c1..0547c36e 100644 --- a/src/lib/product/components/Product/Product.jsx +++ b/src/lib/product/components/Product/Product.jsx @@ -7,8 +7,10 @@ import ProductMobile from './ProductMobile' import { useRouter } from 'next/router' import { useEffect } from 'react' import { gtagViewItem } from '@/core/utils/googleTag' +import ProductDesktopVariant from './ProductDesktopVariant' +import ProductMobileVariant from './ProductMobileVariant' -const Product = ({ product }) => { +const Product = ({ product, isVariant = false }) => { const auth = useAuth() const router = useRouter() const { wishlist } = useWishlist({ productId: product?.id }) @@ -29,15 +31,34 @@ const Product = ({ product }) => { } useEffect(() => { - gtagViewItem(product.variants) - }, [product]) + if (isVariant == false) { + gtagViewItem(product.variants) + } + }, [product, isVariant]) - return ( - <> - - - - ) + if (isVariant == true) { + return ( + <> + + + + ) + } else { + return ( + <> + + + + ) + } } export default Product diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx new file mode 100644 index 00000000..a98985c9 --- /dev/null +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -0,0 +1,348 @@ +import Image from '@/core/components/elements/Image/Image' +import Link from '@/core/components/elements/Link/Link' +import DesktopView from '@/core/components/views/DesktopView' +import currencyFormat from '@/core/utils/currencyFormat' +import { HeartIcon } from '@heroicons/react/24/outline' +import { useCallback, useEffect, useRef, useState } from 'react' +import LazyLoad from 'react-lazy-load' +import ProductSimilar from '../ProductSimilar' +import { toast } from 'react-hot-toast' +import { updateItemCart } from '@/core/utils/cart' +import { useRouter } from 'next/router' +import { createSlug } from '@/core/utils/slug' +import BottomPopup from '@/core/components/elements/Popup/BottomPopup' +import ProductCard from '../ProductCard' +import productSimilarApi from '../../api/productSimilarApi' +import whatsappUrl from '@/core/utils/whatsappUrl' + +const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) => { + const router = useRouter() + + const [lowestPrice, setLowestPrice] = useState(null) + + const [addCartAlert, setAddCartAlert] = useState(false) + + const getLowestPrice = useCallback(() => { + const lowest = product.price + /* const lowest = prices.reduce((lowest, price) => { + return price.priceDiscount < lowest.priceDiscount ? price : lowest + }, prices[0])*/ + return lowest + }, [product]) + + useEffect(() => { + const lowest = getLowestPrice() + setLowestPrice(lowest) + }, [getLowestPrice]) + + const [informationTab, setInformationTab] = useState(informationTabOptions[0].value) + + const variantQuantityRefs = useRef([]) + + const setVariantQuantityRef = (variantId) => (element) => { + variantQuantityRefs.current[variantId] = element + } + + const validQuantity = (quantity) => { + let isValid = true + if (!quantity || quantity < 1 || isNaN(parseInt(quantity))) { + toast.error('Jumlah barang minimal 1') + isValid = false + } + return isValid + } + + const handleAddToCart = (variant) => { + const quantity = variantQuantityRefs.current[variant].value + if (!validQuantity(quantity)) return + updateItemCart({ + productId: variant, + quantity, + selected: true + }) + setAddCartAlert(true) + } + + const handleBuy = (variant) => { + const quantity = variantQuantityRefs.current[variant].value + if (!validQuantity(quantity)) return + router.push(`/shop/checkout?productId=${variant}&quantity=${quantity}`) + } + + const variantSectionRef = useRef(null) + const goToVariantSection = () => { + if (variantSectionRef.current) { + const position = variantSectionRef.current.getBoundingClientRect() + window.scrollTo({ + top: position.top - 120 + window.pageYOffset, + behavior: 'smooth' + }) + } + } + + const productSimilarQuery = [ + product?.name, + `fq=-product_id_i:${product.id}`, + `fq=-manufacture_id_i:${product.manufacture?.id || 0}` + ].join('&') + + const [productSimilarInBrand, setProductSimilarInBrand] = useState(null) + + useEffect(() => { + const loadProductSimilarInBrand = async () => { + const productSimilarQuery = [product?.name, `fq=-product_id_i:${product.id}`].join('&') + const dataProductSimilar = await productSimilarApi({ query: productSimilarQuery }) + setProductSimilarInBrand(dataProductSimilar.products) + } + if (!productSimilarInBrand) loadProductSimilarInBrand() + }, [product, productSimilarInBrand]) + + return ( + +
+
+
+
+ {product.name} +
+ +
+

{product?.name}

+
+
+
Nomor SKU
+
SKU-{product.id}
+
+
+
Part Number
+
{product.code || '-'}
+
+
+
Manufacture
+
+ {product.manufacture?.name ? ( + + {product.manufacture?.name} + + ) : ( +
-
+ )} +
+
+
+
Berat Barang
+
+ {product?.weight > 0 && {product?.weight} KG} + {product?.weight == 0 && ( + + Tanya Berat + + )} +
+
+
+
+ + {/*
+
+
Informasi Produk
+
+ {informationTabOptions.map((option) => ( + setInformationTab(option.value)} + > + {option.label} + + ))} +
+
+
+ + + + + + Belum ada informasi. + +
+
+
+
*/} +
+ +
+ {lowestPrice?.discountPercentage > 0 && ( +
+
+ {lowestPrice?.discountPercentage}% +
+
+ {currencyFormat(lowestPrice?.price * 1.11)} +
+
+ )} +

+ {currencyFormat(lowestPrice?.priceDiscount)} +

+

+ {lowestPrice?.priceDiscount > 0 ? ( + currencyFormat(lowestPrice?.priceDiscount * 1.11) + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} + {lowestPrice?.priceDiscount > 0 && ( + *include PPN + )} +

+ +
+ + + +
+ +
+ +
+ +
+
+ Produk Serupa +
+
+ {productSimilarInBrand && + productSimilarInBrand?.map((product) => ( +
+ +
+ ))} +
+
+
+
+ +
+
Kamu Mungkin Juga Suka
+ + + +
+ + setAddCartAlert(false)} + > +
+
+ {product.name} +
+
{product.name}
+
+ + Lihat Keranjang + +
+
+ +
+
Kamu Mungkin Juga Suka
+ + + +
+
+
+
+ ) +} + +const informationTabOptions = [ + { value: 'description', label: 'Deskripsi' }, + { value: 'information', label: 'Info Penting' } +] + +const TabButton = ({ children, active, ...props }) => { + const activeClassName = active + ? 'text-danger-500 underline underline-offset-4' + : 'text-gray_r-12/80' + return ( + + ) +} + +const TabContent = ({ children, active, className = '', ...props }) => ( +
+ {children} +
+) + +export default ProductDesktopVariant diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx new file mode 100644 index 00000000..29d7700d --- /dev/null +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -0,0 +1,315 @@ +import Divider from '@/core/components/elements/Divider/Divider' +import Image from '@/core/components/elements/Image/Image' +import Link from '@/core/components/elements/Link/Link' +import currencyFormat from '@/core/utils/currencyFormat' +import { useEffect, useState } from 'react' +import Select from 'react-select' +import ProductSimilar from '../ProductSimilar' +import LazyLoad from 'react-lazy-load' +import { updateItemCart } from '@/core/utils/cart' +import { HeartIcon } from '@heroicons/react/24/outline' +import { useRouter } from 'next/router' +import MobileView from '@/core/components/views/MobileView' +import { toast } from 'react-hot-toast' +import { createSlug } from '@/core/utils/slug' +import BottomPopup from '@/core/components/elements/Popup/BottomPopup' +import whatsappUrl from '@/core/utils/whatsappUrl' +import { gtagAddToCart } from '@/core/utils/googleTag' + +const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { + const router = useRouter() + + const [quantity, setQuantity] = useState('1') + const [selectedVariant, setSelectedVariant] = useState(product.id) + const [informationTab, setInformationTab] = useState(informationTabOptions[0].value) + const [addCartAlert, setAddCartAlert] = useState(false) + + const getLowestPrice = () => { + const lowest = product.price + return lowest + } + + const [activeVariant, setActiveVariant] = useState({ + id: null, + code: product.code, + name: product.name, + price: getLowestPrice(), + stock: product.stockTotal, + weight: product.weight + }) + + useEffect(() => { + if (selectedVariant) { + setActiveVariant({ + id: product.id, + code: product.code, + name: product.name, + price: product.price, + stock: product.stock, + weight: product.weight + }) + } + }, [selectedVariant, product]) + + const validAction = () => { + let isValid = true + if (!selectedVariant) { + toast.error('Pilih varian terlebih dahulu') + isValid = false + } + if (!quantity || quantity < 1 || isNaN(parseInt(quantity))) { + toast.error('Jumlah barang minimal 1') + isValid = false + } + return isValid + } + + const handleClickCart = () => { + if (!validAction()) return + gtagAddToCart(activeVariant, quantity) + updateItemCart({ + productId: activeVariant.id, + quantity, + selected: true + }) + setAddCartAlert(true) + } + + const handleClickBuy = () => { + if (!validAction()) return + router.push(`/shop/checkout?productId=${activeVariant.id}&quantity=${quantity}`) + } + + const productSimilarQuery = [ + product?.name, + `fq=-product_id_i:${product.id}`, + `fq=-manufacture_id_i:${product.manufacture?.id || 0}` + ].join('&') + + return ( + + {product.name} + +
+
+ {product.manufacture?.name ? ( + + {product.manufacture?.name} + + ) : ( +
-
+ )} + +
+

{activeVariant?.name}

+ + {activeVariant?.price?.discountPercentage > 0 && ( +
+
+ {currencyFormat(activeVariant?.price?.price * 1.11)} +
+
{activeVariant?.price?.discountPercentage}%
+
+ )} +

+ {currencyFormat(activeVariant?.price?.priceDiscount)} +

+

+ {activeVariant?.price?.priceDiscount > 0 ? ( + currencyFormat(activeVariant?.price?.priceDiscount * 1.11) + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} + + {activeVariant?.price?.priceDiscount > 0 && ( + *include PPN + )} +

+
+ + + +
+
Jumlah
+
+
+ setQuantity(e.target.value)} + /> +
+ + +
+
+ + + +
+

Informasi Produk

+
+ {informationTabOptions.map((option) => ( + setInformationTab(option.value)} + > + {option.label} + + ))} +
+ + + + SKU-{product?.id} + + + {activeVariant?.code || '-'} + + + {activeVariant?.stock > 0 && ( + +
Ready Stock
+
{activeVariant?.stock > 5 ? '> 5' : '< 5'}
+
+ )} + {activeVariant?.stock == 0 && ( + + Tanya Stok + + )} +
+ + {activeVariant?.weight > 0 && {activeVariant?.weight} KG} + {activeVariant?.weight == 0 && ( + + Tanya Berat + + )} + +
+ + +
+ + + +
+

Kamu Mungkin Juga Suka

+ + + +
+ + setAddCartAlert(false)} + > +
+
+ {product.name} +
+
{product.name}
+
+ + Lihat Keranjang + +
+
+
+
Kamu Mungkin Juga Suka
+ + + +
+
+
+ ) +} + +const informationTabOptions = [ + { value: 'specification', label: 'Spesifikasi' } + // { value: 'description', label: 'Deskripsi' }, + // { value: 'information', label: 'Info Penting' } +] + +const TabButton = ({ children, active, ...props }) => { + const activeClassName = active ? 'text-danger-500 underline underline-offset-4' : 'text-gray_r-11' + return ( + + ) +} + +const TabContent = ({ children, active, className, ...props }) => ( +
+ {children} +
+) + +const SpecificationContent = ({ children, label }) => ( +
+ {label} + {children} +
+) + +export default ProductMobileVariant diff --git a/src/pages/shop/product/variant/[slug].jsx b/src/pages/shop/product/variant/[slug].jsx new file mode 100644 index 00000000..ba2a79d5 --- /dev/null +++ b/src/pages/shop/product/variant/[slug].jsx @@ -0,0 +1,75 @@ +import Seo from '@/core/components/Seo' +import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' +import { getIdFromSlug } from '@/core/utils/slug' +import PageNotFound from '@/pages/404' +import dynamic from 'next/dynamic' +import { useRouter } from 'next/router' +import cookie from 'cookie' +import variantApi from '@/lib/product/api/variantApi' + +const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout')) +const Product = dynamic(() => import('@/lib/product/components/Product/Product')) + +export async function getServerSideProps(context) { + const { slug } = context.query + const cookies = context.req.headers.cookie + const cookieObj = cookies ? cookie.parse(cookies) : {} + const auth = cookieObj.auth ? JSON.parse(cookieObj.auth) : {} + const authToken = auth?.token || '' + + let product = await variantApi({ id: getIdFromSlug(slug), headers: { Token: authToken } }) + if (product?.length == 1) { + product = product[0] + /* const regexHtmlTags = /(<([^>]+)>)/gi + const regexHtmlTagsExceptP = /<\/?(?!p\b)[^>]*>/g + product.description = product.description + .replace(regexHtmlTagsExceptP, ' ') + .replace(regexHtmlTags, ' ') + .trim()*/ + } else { + product = null + } + + return { + props: { product } + } +} + +export default function ProductDetail({ product }) { + const router = useRouter() + + if (!product) return + + return ( + + + {!product && ( +
+ +
+ )} + {product && } +
+ ) +} -- cgit v1.2.3 From 9bbb8d45420eca5a5987a43b55c2a4bec01f19fe Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 22 Jun 2023 13:39:23 +0700 Subject: xml google merchnt --- src/lib/product/api/variantSearchApi.js | 11 ++ src/pages/api/shop/variant.js | 157 +++++++++++++++++++++++++++ src/pages/google_merchant/products/[page].js | 3 +- src/pages/google_merchant/products/index.js | 3 +- 4 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 src/lib/product/api/variantSearchApi.js create mode 100644 src/pages/api/shop/variant.js diff --git a/src/lib/product/api/variantSearchApi.js b/src/lib/product/api/variantSearchApi.js new file mode 100644 index 00000000..d7b05423 --- /dev/null +++ b/src/lib/product/api/variantSearchApi.js @@ -0,0 +1,11 @@ +import _ from 'lodash-contrib' +import axios from 'axios' + +const variantSearchApi = async ({ query, operation = 'AND' }) => { + const dataProductSearch = await axios( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/variant?${query}&operation=${operation}` + ) + return dataProductSearch.data +} + +export default variantSearchApi diff --git a/src/pages/api/shop/variant.js b/src/pages/api/shop/variant.js new file mode 100644 index 00000000..30213cc3 --- /dev/null +++ b/src/pages/api/shop/variant.js @@ -0,0 +1,157 @@ +import axios from 'axios' +import camelcaseObjectDeep from 'camelcase-object-deep' + +export default async function handler(req, res) { + const { + q = '*', + page = 1, + brand = '', + category = '', + priceFrom = 0, + priceTo = 0, + orderBy = '', + operation = 'AND', + fq = '', + limit = 30 + } = req.query + + let paramOrderBy = '' + switch (orderBy) { + case 'price-asc': + paramOrderBy += 'price_discount_f ASC' + break + case 'price-desc': + paramOrderBy += 'price_discount_f DESC' + break + case 'popular': + paramOrderBy += 'search_rank_i DESC' + break + case 'popular-weekly': + paramOrderBy += 'search_rank_weekly_i DESC' + break + case 'stock': + paramOrderBy += 'stock_total_f DESC' + break + default: + paramOrderBy += 'product_rating_f DESC, price_discount_f DESC' + break + } + + let offset = (page - 1) * limit + let parameter = [ + 'facet.field=manufacture_name', + 'facet.field=category_name', + 'facet=true', + 'indent=true', + `facet.query=${escapeSolrQuery(q)}`, + `q.op=${operation}`, + `q=${escapeSolrQuery(q)}`, + 'qf=name_s', + `start=${offset}`, + `rows=${limit}`, + `sort=${paramOrderBy}` + ] + + if (priceFrom > 0 || priceTo > 0) { + parameter.push( + `fq=price_discount_f:[${priceFrom == '' ? '*' : priceFrom} TO ${ + priceTo == '' ? '*' : priceTo + }]` + ) + } + + if (brand) parameter.push(`fq=manufacture_name:${brand}`) + if (category) parameter.push(`fq=category_name:${category}`) + + // Single fq in url params + if (typeof fq === 'string') parameter.push(`fq=${fq}`) + // Multi fq in url params + if (Array.isArray(fq)) parameter = parameter.concat(fq.map((val) => `fq=${val}`)) + + let result = await axios(process.env.SOLR_HOST + '/solr/variants/select?' + parameter.join('&')) + try { + let { auth } = req.cookies + if (auth) auth = JSON.parse(auth) + result.data.response.products = productResponseMap( + result.data.response.docs, + auth?.pricelist || false + ) + result.data.responseHeader.params.start = parseInt(result.data.responseHeader.params.start) + result.data.responseHeader.params.rows = parseInt(result.data.responseHeader.params.rows) + delete result.data.response.docs + result.data = camelcaseObjectDeep(result.data) + res.status(200).json(result.data) + } catch (error) { + res.status(400).json({ error: error.message }) + } +} + +const escapeSolrQuery = (query) => { + if (query == '*') return query + + const specialChars = /([\+\-\!\(\)\{\}\[\]\^"~\*\?:\\\/])/g + const words = query.split(/\s+/) + const escapedWords = words.map((word) => { + if (specialChars.test(word)) { + return `"${word.replace(specialChars, '\\$1')}"` + } + return word + }) + + return escapedWords.join(' ') +} + +const productResponseMap = (products, pricelist) => { + return products.map((product) => { + let price = product.price_f || 0 + let priceDiscount = product.price_discount_f || 0 + let discountPercentage = product.discount_f || 0 + + if (pricelist) { + const pricelistDiscount = product?.[`price_${pricelist}_f`] || false + const pricelistDiscountPerc = product?.[`discount_${pricelist}_f`] || false + + if (pricelistDiscount && pricelistDiscount > 0) priceDiscount = pricelistDiscount + if (pricelistDiscountPerc && pricelistDiscountPerc > 0) + discountPercentage = pricelistDiscountPerc + } + + if (product?.flashsale_id_i > 0) { + price = product?.flashsale_base_price_f || 0 + priceDiscount = product?.flashsale_price_f || 0 + discountPercentage = product?.flashsale_discount_f || 0 + } + + let productMapped = { + id: product.product_id_i || '', + image: product.image_s || '', + code: product.default_code_s || '', + name: product.name_s || '', + lowestPrice: { price, priceDiscount, discountPercentage }, + variantTotal: product.variant_total_i || 0, + stockTotal: product.stock_total_f || 0, + weight: product.weight_f || 0, + manufacture: {}, + categories: [], + flashSale: { + id: product?.flashsale_id_i, + name: product?.product?.flashsale_name_s + } + } + + if (product.manufacture_id_i && product.manufacture_name_s) { + productMapped.manufacture = { + id: product.manufacture_id_i || '', + name: product.manufacture_name_s || '' + } + } + + productMapped.categories = [ + { + id: product.category_id_i || '', + name: product.category_name_s || '' + } + ] + return productMapped + }) +} diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 4a7d95c6..f9eac45d 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -1,6 +1,7 @@ import { createSlug } from '@/core/utils/slug' import toTitleCase from '@/core/utils/toTitleCase' import productSearchApi from '@/lib/product/api/productSearchApi' +import variantSearchApi from '@/lib/product/api/variantSearchApi' import _ from 'lodash-contrib' import { create } from 'xmlbuilder' @@ -18,7 +19,7 @@ export async function getServerSideProps({ res, query }) { orderBy: 'popular', fq: 'image_s:["" TO *]' } - const products = await productSearchApi({ query: _.toQuery(queries) }) + const products = await variantSearchApi({ query: _.toQuery(queries) }) const productItems = [] products.response.products.forEach((product) => { diff --git a/src/pages/google_merchant/products/index.js b/src/pages/google_merchant/products/index.js index a1f59d39..d3cdc514 100644 --- a/src/pages/google_merchant/products/index.js +++ b/src/pages/google_merchant/products/index.js @@ -1,4 +1,5 @@ import productSearchApi from '@/lib/product/api/productSearchApi' +import variantSearchApi from '@/lib/product/api/variantSearchApi' import _ from 'lodash-contrib' const limit = 5000 @@ -9,7 +10,7 @@ export async function getServerSideProps() { priceFrom: 1, fq: 'image_s:["" TO *]' } - const products = await productSearchApi({ query: _.toQuery(queries) }) + const products = await variantSearchApi({ query: _.toQuery(queries) }) const { numFound } = products.response const pageTotal = Math.ceil(numFound / limit) -- cgit v1.2.3 From 033b880d1a88e2fc0cd5bb8bce2ed24dae3e94ea Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 22 Jun 2023 16:57:41 +0700 Subject: change layout --- .../components/Product/ProductDesktopVariant.jsx | 56 ++++++++++++---------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index a98985c9..557bcc0e 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -195,42 +195,46 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) */} -
+
+
+ Harga Sebelum PPN : +
+
+ + {currencyFormat(lowestPrice?.priceDiscount)} + +
+
+ Termasuk PPN : {lowestPrice?.discountPercentage > 0 && ( -
+
{lowestPrice?.discountPercentage}%
{currencyFormat(lowestPrice?.price * 1.11)}
+

+ {lowestPrice?.priceDiscount > 0 ? ( + currencyFormat(lowestPrice?.priceDiscount * 1.11) + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} +

)} -

- {currencyFormat(lowestPrice?.priceDiscount)} -

-

- {lowestPrice?.priceDiscount > 0 ? ( - currencyFormat(lowestPrice?.priceDiscount * 1.11) - ) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - - )} - {lowestPrice?.priceDiscount > 0 && ( - *include PPN - )} -

Date: Fri, 23 Jun 2023 09:32:49 +0700 Subject: change request layout harga --- .../components/Product/ProductDesktopVariant.jsx | 75 +++++++++++----------- .../components/Product/ProductMobileVariant.jsx | 71 +++++++++++--------- 2 files changed, 76 insertions(+), 70 deletions(-) diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index 557bcc0e..e0573357 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -196,46 +196,45 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant })
*/}
-
-
- Harga Sebelum PPN : -
-
- - {currencyFormat(lowestPrice?.priceDiscount)} - -
-
- Termasuk PPN : - {lowestPrice?.discountPercentage > 0 && ( -
-
- {lowestPrice?.discountPercentage}% + {lowestPrice?.priceDiscount > 0 ? ( + <> +
+
+ Harga Sebelum PPN : +
+
+ + {currencyFormat(lowestPrice?.priceDiscount)} + +
-
- {currencyFormat(lowestPrice?.price * 1.11)} + Termasuk PPN : +
+
+ {lowestPrice?.discountPercentage}% +
+
+ {currencyFormat(lowestPrice?.price * 1.11)} +
+

+ {currencyFormat(lowestPrice?.priceDiscount * 1.11)} +

-

- {lowestPrice?.priceDiscount > 0 ? ( - currencyFormat(lowestPrice?.priceDiscount * 1.11) - ) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - - )} -

-
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + )} -
-
-
Produk Serupa diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index 29d7700d..26c3fea3 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -115,39 +115,48 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {

{activeVariant?.name}

- {activeVariant?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(activeVariant?.price?.price * 1.11)} + {activeVariant?.price?.priceDiscount > 0 ? ( + <> +
+
Harga Sebelum PPN :
+
+ {' '} + {currencyFormat(activeVariant?.price?.priceDiscount)} +
-
{activeVariant?.price?.discountPercentage}%
-
+
+ Termasuk PPN : +
+ {activeVariant?.price?.discountPercentage > 0 && ( + <> +
+ {activeVariant?.price?.discountPercentage}% +
+
+ {currencyFormat(activeVariant?.price?.price * 1.11)} +
+ + )} +

+ {currencyFormat(activeVariant?.price?.priceDiscount * 1.11)} +

+
+
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + )} -

- {currencyFormat(activeVariant?.price?.priceDiscount)} -

-

- {activeVariant?.price?.priceDiscount > 0 ? ( - currencyFormat(activeVariant?.price?.priceDiscount * 1.11) - ) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - - )} - - {activeVariant?.price?.priceDiscount > 0 && ( - *include PPN - )} -

-- cgit v1.2.3