summaryrefslogtreecommitdiff
path: root/src-migrate/modules
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-08-31 12:28:43 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-08-31 12:28:43 +0700
commita2221f7b66f259cddc83ae95c159b30d7e5612ce (patch)
tree6529af5a7f6df27c9527d269c6cda3ae19af7bae /src-migrate/modules
parentd9152e6a45c7ea1c6a8ad5396cac4d9d3c3c66f1 (diff)
<iman> update new cart pop up image
Diffstat (limited to 'src-migrate/modules')
-rw-r--r--src-migrate/modules/product-promo/components/AddToCart.tsx23
1 files changed, 16 insertions, 7 deletions
diff --git a/src-migrate/modules/product-promo/components/AddToCart.tsx b/src-migrate/modules/product-promo/components/AddToCart.tsx
index a3938142..757253f7 100644
--- a/src-migrate/modules/product-promo/components/AddToCart.tsx
+++ b/src-migrate/modules/product-promo/components/AddToCart.tsx
@@ -34,6 +34,7 @@ const ProductPromoAddToCart = ({product, promotion }: Props) => {
const {askAdminUrl} = useProductDetail();
const [status, setStatus] = useState<Status>('idle')
+ const [idProduct, setidProduct] = useState<number>()
const { productCart, setRefreshCart, setProductCart, refreshCart, isLoading, setIsloading } =
useProductCartContext()
@@ -61,6 +62,7 @@ const ProductPromoAddToCart = ({product, promotion }: Props) => {
source: 'add_to_cart',
qtyAppend: true
})
+ setidProduct(promotion?.products[0]?.product_id)
setStatus('idle')
setRefreshCart(true);
setAddCartAlert(true);
@@ -123,13 +125,20 @@ const ProductPromoAddToCart = ({product, promotion }: Props) => {
>
<div className='flex mt-4'>
<div className='w-[10%]'>
- <ImageNext
- src={product.image}
- alt={product.name}
- className='h-32 object-contain object-center w-full border border-gray_r-4'
- width={80}
- height={80}
- />
+ <ImageNext
+ src={
+ product?.image
+ ? product.image
+ : idProduct
+ ? `https://erp.indoteknik.com/api/image/product.product/image_256/${idProduct}`
+ : `https://erp.indoteknik.com/api/image/product.template/image_256/${idProduct}`
+ }
+ alt={product.name}
+ className='h-32 object-contain object-center w-full border border-gray_r-4'
+ width={80}
+ height={80}
+ />
+
</div>
<div className='ml-3 flex flex-1 items-start font-medium justify-center flex-col gap-y-1'>
{!!product?.manufacture?.name ? (