From 702f43a7190d65c2370e7019311cc26c2cc0eafd Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 6 Jun 2023 17:01:23 +0700
Subject: program promotion

---
 src/lib/product/components/Product/ProductMobile.jsx | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'src/lib/product/components/Product/ProductMobile.jsx')

diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 426fe1b8..5ed796ae 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'
 
 const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
   const router = useRouter()
@@ -170,6 +171,13 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
       <Divider />
 
       <div className='p-4'>
+        <div className='mb-5'>
+          {/* <PromotionType></PromotionType> */}
+          <button type='button' className='text-gray-900  flex p-3 rounded-lg bg-white border border-gray-300  hover:bg-gray-100 py-2.5 w-[100%]'>
+           <span className='text-left'>%</span>
+           <span className='text-left ml-5'>Makin Hemat Pakai Promo</span>
+          </button>
+        </div>
         <div>
           <label className='flex justify-between'>
             Pilih Varian:
-- 
cgit v1.2.3


From eb4ae7be05ed97bd02b7f3e9cc56393f435188e2 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 14 Jun 2023 13:22:20 +0700
Subject: layout promotion program di detail product dan layout modal popup

---
 src/lib/product/components/Product/ProductMobile.jsx | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

(limited to 'src/lib/product/components/Product/ProductMobile.jsx')

diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 5ed796ae..1c2974b0 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -172,11 +172,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
 
       <div className='p-4'>
         <div className='mb-5'>
-          {/* <PromotionType></PromotionType> */}
-          <button type='button' className='text-gray-900  flex p-3 rounded-lg bg-white border border-gray-300  hover:bg-gray-100 py-2.5 w-[100%]'>
-           <span className='text-left'>%</span>
-           <span className='text-left ml-5'>Makin Hemat Pakai Promo</span>
-          </button>
+          <PromotionType></PromotionType>
         </div>
         <div>
           <label className='flex justify-between'>
-- 
cgit v1.2.3


From 637c22f1886cecf7307ced88dc951134d466a3fa Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Mon, 19 Jun 2023 15:46:03 +0700
Subject: checkout

---
 src/lib/product/components/Product/ProductMobile.jsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src/lib/product/components/Product/ProductMobile.jsx')

diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 1c2974b0..4da237ed 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -171,9 +171,6 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
       <Divider />
 
       <div className='p-4'>
-        <div className='mb-5'>
-          <PromotionType></PromotionType>
-        </div>
         <div>
           <label className='flex justify-between'>
             Pilih Varian:
@@ -189,6 +186,10 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
             isSearchable={product.variantTotal > 10}
           />
         </div>
+        <div className='mt-5'>
+          <PromotionType></PromotionType>
+        </div>
+
         <div className='mt-4 mb-2'>Jumlah</div>
         <div className='flex gap-x-3'>
           <div className='w-2/12'>
-- 
cgit v1.2.3


From 927022b91855dba6d64365b68b4d20551256e7db Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 27 Jun 2023 16:47:16 +0700
Subject: product detail mobile & cart

---
 src/lib/product/components/Product/ProductMobile.jsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'src/lib/product/components/Product/ProductMobile.jsx')

diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx
index 4da237ed..2090d324 100644
--- a/src/lib/product/components/Product/ProductMobile.jsx
+++ b/src/lib/product/components/Product/ProductMobile.jsx
@@ -24,6 +24,9 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
   const [informationTab, setInformationTab] = useState(informationTabOptions[0].value)
   const [addCartAlert, setAddCartAlert] = useState(false)
 
+  const [promotionType, setPromotionType] = useState(false)
+  const [promotionActiveId, setPromotionActiveId] = useState(null)
+
   const getLowestPrice = () => {
     const prices = product.variants.map((variant) => variant.price)
     const lowest = prices.reduce((lowest, price) => {
@@ -89,6 +92,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
     updateItemCart({
       productId: activeVariant.id,
       quantity,
+      programLineId: promotionActiveId,
       selected: true
     })
     setAddCartAlert(true)
@@ -187,7 +191,12 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
           />
         </div>
         <div className='mt-5'>
-          <PromotionType></PromotionType>
+          <PromotionType
+            variantId={product.variants[0].id}
+            setPromotionActiveId={setPromotionActiveId}
+            promotionActiveId={promotionActiveId}
+            quantity={quantity}
+          ></PromotionType>
         </div>
 
         <div className='mt-4 mb-2'>Jumlah</div>
-- 
cgit v1.2.3


From ead27f576ea73bb4625fea839ee78c4a8db0d4e9 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Thu, 6 Jul 2023 10:21:50 +0700
Subject: variant page

---
 .../product/components/Product/ProductMobile.jsx   | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

(limited to 'src/lib/product/components/Product/ProductMobile.jsx')

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'>
-- 
cgit v1.2.3

