summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/product/components/Product/ProductDesktop.jsx3
-rw-r--r--src/lib/product/components/Product/ProductMobile.jsx24
-rw-r--r--src/lib/promotinProgram/components/PromotionType.jsx6
3 files changed, 19 insertions, 14 deletions
diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 946529ce..e15ea252 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -84,7 +84,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
programLineId: product.variants[variantIndex].programActive,
selected: true
})
- }{
+ }else{
updateItemCart({
productId: variantId,
quantity,
@@ -202,6 +202,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
setPromotionActiveId={setPromotionActiveId}
promotionActiveId={promotionActiveId}
quantity={quantityActive}
+ product={product}
></PromotionType>
</div>
</div>
diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 2090d324..f3afa938 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -41,7 +41,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
name: product.name,
price: getLowestPrice(),
stock: product.stockTotal,
- weight: product.weight
+ weight: product.weight,
+ hasProgram: false
})
const variantOptions = product.variants?.map((variant) => ({
@@ -69,7 +70,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
name: variant.parent.name + variantAttributes,
price: variant.price,
stock: variant.stock,
- weight: variant.weight
+ weight: variant.weight,
+ hasProgram: variant.hasProgram
})
}
}, [selectedVariant, product])
@@ -190,14 +192,16 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
isSearchable={product.variantTotal > 10}
/>
</div>
- <div className='mt-5'>
- <PromotionType
- variantId={product.variants[0].id}
- setPromotionActiveId={setPromotionActiveId}
- promotionActiveId={promotionActiveId}
- quantity={quantity}
- ></PromotionType>
- </div>
+ {activeVariant.hasProgram && (
+ <div className='mt-5'>
+ <PromotionType
+ variantId={product.variants[0].id}
+ setPromotionActiveId={setPromotionActiveId}
+ promotionActiveId={promotionActiveId}
+ quantity={quantity}
+ ></PromotionType>
+ </div>
+ )}
<div className='mt-4 mb-2'>Jumlah</div>
<div className='flex gap-x-3'>
diff --git a/src/lib/promotinProgram/components/PromotionType.jsx b/src/lib/promotinProgram/components/PromotionType.jsx
index 44d1b524..ad7185e3 100644
--- a/src/lib/promotinProgram/components/PromotionType.jsx
+++ b/src/lib/promotinProgram/components/PromotionType.jsx
@@ -3,7 +3,6 @@ import Image from '@/core/components/elements/Image/Image'
import BottomPopup from '@/core/components/elements/Popup/BottomPopup'
import CountDown2 from '@/core/components/elements/CountDown/CountDown2'
import currencyFormat from '@/core/utils/currencyFormat'
-import odooApi from '@/core/api/odooApi'
import { getPromotionProgram } from '../api/homepageApi'
const PromotionType = ({
@@ -16,11 +15,10 @@ const PromotionType = ({
setProducts = null
}) => {
const [selectedPromo, setSelectedPromo] = useState(null)
-
const [promotionType, setPromotionType] = useState(false)
const [promos, setPromotionList] = useState(null)
const [activeTitle, setActiveTitle] = useState(null)
- const [quantitySet, setQuantity] = useState(quantity)
+ const [quantitySet, setQuantity] = useState(null)
useEffect(() => {
const id = variantId
@@ -36,6 +34,8 @@ const PromotionType = ({
if (product) {
const variant = product.variants.find((variant) => variant.id === variantId)
setQuantity(variant.quantity)
+ }else{
+ setQuantity(quantity)
}
}, [])