summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2024-08-23 06:28:03 +0000
committerIT Fixcomart <it@fixcomart.co.id>2024-08-23 06:28:03 +0000
commita6be7fe1690ce5ad4479e9ff4bc4aa795316eacf (patch)
treefb0974e6f605069466633d7ccc51c640f6c31e35
parent8c64624326a18ecdd2de25731b2f579ea4d2b00d (diff)
parent6111e1115ffba4ef336dfb763b3fd23e52b6668b (diff)
Merged in Feature/pickup-service (pull request #262)
Feature/pickup service
-rw-r--r--public/images/PICKUP-NOW.pngbin0 -> 1926 bytes
-rw-r--r--src-migrate/modules/cart/components/Item.tsx9
-rw-r--r--src-migrate/types/cart.ts2
-rw-r--r--src-migrate/types/product.ts1
-rw-r--r--src/lib/checkout/components/Checkout.jsx4
-rw-r--r--src/lib/product/components/ProductCard.jsx32
-rw-r--r--src/utils/solrMapping.js1
7 files changed, 38 insertions, 11 deletions
diff --git a/public/images/PICKUP-NOW.png b/public/images/PICKUP-NOW.png
new file mode 100644
index 00000000..d7c01f44
--- /dev/null
+++ b/public/images/PICKUP-NOW.png
Binary files differ
diff --git a/src-migrate/modules/cart/components/Item.tsx b/src-migrate/modules/cart/components/Item.tsx
index 47893498..6ffbb524 100644
--- a/src-migrate/modules/cart/components/Item.tsx
+++ b/src-migrate/modules/cart/components/Item.tsx
@@ -17,11 +17,11 @@ import CartItemSelect from './ItemSelect'
type Props = {
item: CartItemProps
editable?: boolean
+ selfPicking?: boolean
pilihSemuaCart?: boolean
}
-const CartItem = ({ item, editable = true,}: Props) => {
-
+const CartItem = ({ item, editable = true, selfPicking}: Props) => {
return (
<div className={style.wrapper}>
{item.cart_type === 'promotion' && (
@@ -53,6 +53,11 @@ const CartItem = ({ item, editable = true,}: Props) => {
<CartItem.Image item={item} />
<div className={style.details}>
+ {(item.is_in_bu) && (item.on_hand_qty >= item.quantity) && (
+ <div className='text-[10px] text-red-500 italic'>
+ *Barang ini bisa di pickup maksimal pukul 16.00
+ </div>
+ )}
<CartItem.Name item={item} />
<div className='mt-2 flex justify-between w-full'>
diff --git a/src-migrate/types/cart.ts b/src-migrate/types/cart.ts
index 4e3c8b99..a3115103 100644
--- a/src-migrate/types/cart.ts
+++ b/src-migrate/types/cart.ts
@@ -32,6 +32,8 @@ export type CartItem = {
id: number;
name: string;
stock: number;
+ is_in_bu: boolean;
+ on_hand_qty: number;
weight: number;
attributes: string[];
parent: {
diff --git a/src-migrate/types/product.ts b/src-migrate/types/product.ts
index 681cdc8e..31ea0ce1 100644
--- a/src-migrate/types/product.ts
+++ b/src-migrate/types/product.ts
@@ -12,6 +12,7 @@ export interface IProduct {
variant_total: number;
description: string;
isSni: boolean;
+ is_in_bu: boolean;
isTkdn: boolean;
categories: {
id: string;
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 09a791ee..6deba693 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -1004,7 +1004,7 @@ const Checkout = () => {
<div className='p-4 flex flex-col gap-y-4'>
{!!products &&
snakecaseKeys(products).map((item, index) => (
- <CartItem key={index} item={item} editable={false} />
+ <CartItem key={index} item={item} editable={false} selfPicking={selectedExpedisi === '1,32' ? true : false}/>
))}
</div>
@@ -1295,7 +1295,7 @@ const Checkout = () => {
<div className='flex flex-col gap-y-8 border-t border-gray-300 pt-8'>
{!!products &&
snakecaseKeys(products).map((item, index) => (
- <CartItem key={index} item={item} editable={false} />
+ <CartItem key={index} item={item} editable={false} selfPicking={selectedExpedisi === '1,32' ? true : false} />
))}
</div>
</div>
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 35e2a665..22ce0533 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -146,13 +146,22 @@ 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'>
- {product?.manufacture?.name ? (
- <Link href={URL.manufacture} className='mb-1'>
- {product.manufacture.name}
+ <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>
- ) : (
- <div>-</div>
- )}
+
+
+ )}
+ </div>
<Link
href={URL.product}
className={`mb-2 !text-gray_r-12 leading-6 block line-clamp-3 h-[64px]`}
@@ -292,9 +301,18 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
</div>
)}
{product?.manufacture?.name ? (
- <Link href={URL.manufacture} className='mb-1'>
+ <div className='flex justify-between'>
+ <Link href={URL.manufacture} className='mb-1'>
{product.manufacture.name}
</Link>
+ {/* {product?.is_in_bu && (
+ <div className='bg-red-500 rounded'>
+ <span className='p-[6px] text-xs text-white'>
+ Click & Pickup
+ </span>
+ </div>
+ )} */}
+ </div>
) : (
<div>-</div>
)}
diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js
index d4694eb2..fee474be 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,
+ is_in_bu:product?.is_in_bu_b || false,
voucherPastiHemat:product?.voucher_pastihemat || []
};