summaryrefslogtreecommitdiff
path: root/src/lib/product
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-04 10:09:43 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-04 10:09:43 +0700
commiteb7bea2f262ffa4faa39d4f163950892c5640c0f (patch)
treeab6f21b148ed23bb91b553211515fd70c7a68099 /src/lib/product
parentdde4c79768532247abae4a1d188c82f2d601fbe0 (diff)
pricelist di cart dan list variant
Diffstat (limited to 'src/lib/product')
-rw-r--r--src/lib/product/components/Product/ProductDesktop.jsx64
-rw-r--r--src/lib/product/components/Product/ProductMobile.jsx2
-rw-r--r--src/lib/product/components/Product/ProductMobileVariant.jsx1
3 files changed, 42 insertions, 25 deletions
diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 0df60673..30424943 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -452,7 +452,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
</div>
</div>
<div className='text-gray_r-9 text-base font-normal mt-1'>
- Termasuk PPN: {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+ Termasuk PPN:{' '}
+ {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (
@@ -461,7 +462,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
<>
{currencyFormat(lowestPrice?.price)}
<div className='text-gray_r-9 text-base font-normal mt-1'>
- Termasuk PPN: {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
+ Termasuk PPN:{' '}
+ {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (
@@ -575,32 +577,50 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
<ColumnsSLA variant={variant} product={product} />
</LazyLoadComponent>
<td>
- {variant.price.discountPercentage > 0 &&
+ {variant.isFlashsale ? (
+ <>
+ <div className='flex items-center gap-x-1 justify-center'>
+ <div className='badge-solid-red text-caption-1'>
+ {lowestPrice?.discountPercentage}%
+ </div>
+ <div className='line-through text-caption-1 text-gray_r-11'>
+ {currencyFormat(variant.price.price)}
+ </div>{' '}
+ <div className=' text-caption-1 text-red-600 font-semibold'>
+ {currencyFormat(variant.price.priceDiscount)}
+ </div>{' '}
+ </div>
+ {currencyFormat(variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+ </>
+ ) : (
+ <div>
+ {variant.price.price > 0 ? (
+ currencyFormat(variant.price.price * process.env.NEXT_PUBLIC_PPN)
+ ) : (
+ <a
+ href={whatsappUrl('product', {
+ name: variant.name,
+ manufacture: product.manufacture?.name,
+ url: createSlug('/shop/product/', product.name, product.id, true)
+ })}
+ className='text-red_r-11'
+ rel='noopener noreferrer'
+ target='_blank'
+ >
+ Call for price
+ </a>
+ )}
+ </div>
+ )}
+ {/* {variant.price.discountPercentage > 0 &&
variant.price.priceDiscount > 0 && (
<>
<div className='line-through text-caption-1 text-gray_r-11 mb-1'>
{currencyFormat(variant.price.price)}
</div>{' '}
</>
- )}
- <div>
- {variant.price.priceDiscount > 0 ? (
- currencyFormat(variant.price.priceDiscount)
- ) : (
- <a
- href={whatsappUrl('product', {
- name: variant.name,
- manufacture: product.manufacture?.name,
- url: createSlug('/shop/product/', product.name, product.id, true)
- })}
- className='text-red_r-11'
- rel='noopener noreferrer'
- target='_blank'
- >
- Call for price
- </a>
- )}
- </div>
+ )} */}
+
{/* <VariantPrice id={variant.id} /> */}
</td>
<td>
diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index a9d34683..94312d31 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -152,8 +152,6 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
router.push(`/shop/checkout?source=buy`)
}
- console.log('ini log', activeVariant)
-
const productSimilarQuery = [
product?.name,
`fq=-product_id_i:${product.id}`,
diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx
index a7b1a543..8cdb631f 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -82,7 +82,6 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
})
setAddCartAlert(true)
}
- console.log('ini log', activeVariant)
const handleClickBuy = () => {
if (!validAction()) return