diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-07-25 15:26:55 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-07-25 15:26:55 +0700 |
| commit | 915443e3f3a7dcf567fbf5a1dff7c6d6647d11b5 (patch) | |
| tree | 08ff05daa8f8f3335abd9c12c28bb1affffda58d /src/lib/product/components/Product/ProductMobile.jsx | |
| parent | 33ccd445bf3e72eafeadc920de0f788af91e57fd (diff) | |
| parent | d4f3cce1b07c5d4f75892ffc49c8dbbbbb58922f (diff) | |
Merge branch 'master' into Feature/SLA
# Conflicts:
# src/lib/product/components/Product/ProductDesktop.jsx
# src/lib/product/components/Product/ProductMobile.jsx
Diffstat (limited to 'src/lib/product/components/Product/ProductMobile.jsx')
| -rw-r--r-- | src/lib/product/components/Product/ProductMobile.jsx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index a5caee92..46a6af75 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -14,6 +14,7 @@ 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 PromotionType from '@/lib/promotinProgram/components/PromotionType' import { gtagAddToCart } from '@/core/utils/googleTag' import odooApi from '@/core/api/odooApi' import { Button, Spinner } from 'flowbite-react' @@ -27,6 +28,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { const [addCartAlert, setAddCartAlert] = useState(false) const [isLoadingSLA, setIsLoadingSLA] = useState(true) + const [promotionType, setPromotionType] = useState(false) + const [promotionActiveId, setPromotionActiveId] = useState(null) const getLowestPrice = () => { const prices = product.variants.map((variant) => variant.price) @@ -42,7 +45,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) => ({ @@ -71,7 +75,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { price: variant.price, stock: variant.stock, weight: variant.weight, - sla: variant.sla + sla: variant.sla, + hasProgram: variant.hasProgram }) } }, [selectedVariant, product]) @@ -95,6 +100,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { updateItemCart({ productId: activeVariant.id, quantity, + programLineId: promotionActiveId, selected: true }) setAddCartAlert(true) @@ -209,6 +215,17 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { isSearchable={product.variantTotal > 10} /> </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'> <div className='w-2/12'> |
