From 8b173abd19630b7cab5f0f562925c46e3f71d096 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 4 Jul 2023 13:38:33 +0700
Subject: promotion program

---
 src/lib/variant/components/VariantGroupCard.jsx | 67 ++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

(limited to 'src/lib/variant/components/VariantGroupCard.jsx')

diff --git a/src/lib/variant/components/VariantGroupCard.jsx b/src/lib/variant/components/VariantGroupCard.jsx
index 8cb1eec4..aba6971f 100644
--- a/src/lib/variant/components/VariantGroupCard.jsx
+++ b/src/lib/variant/components/VariantGroupCard.jsx
@@ -1,14 +1,79 @@
 import { useState } from 'react'
 import VariantCard from './VariantCard'
+import Image from '@/core/components/elements/Image/Image'
+import currencyFormat from '@/core/utils/currencyFormat'
 
 const VariantGroupCard = ({ variants, ...props }) => {
+  console.log('variant', variants)
   const [showAll, setShowAll] = useState(false)
   const variantsToShow = showAll ? variants : variants.slice(0, 2)
 
   return (
     <>
       {variantsToShow?.map((variant, index) => (
-        <VariantCard key={index} product={variant} {...props} />
+        <>
+          <VariantCard key={index} product={variant} {...props} />
+          {variant.program &&
+            variant.program.items &&
+            variant.program.items.map((item) => (
+              <div key={item.id}>
+                <div className='flex gap-x-3'>
+                  <div className='w-4/12 flex items-center gap-x-2'>
+                    <Image
+                      src={item.parent.image}
+                      alt={item.name}
+                      className='object-contain object-center border border-gray_r-6 h-32 w-full rounded-md'
+                    />
+                  </div>
+                  <div className='w-8/12 flex flex-col'>
+                    <p className='product-card__title wrap-line-ellipsis-2'>
+                      {item.name}
+                    </p>
+                    <p className='text-caption-2 text-gray_r-11 mt-1'>
+                      {/* {product.code || '-'}
+                      {product.attributes.length > 0 ? ` ・ ${product.attributes.join(', ')}` : ''} */}
+                    </p>
+                    <p className='text-caption-2 text-gray_r-11 mt-1'>
+                      Berat Item : {item.weight} Kg
+                    </p>
+                    <div className='flex flex-wrap gap-x-1 items-center mt-auto'>
+                      {item.price.discountPercentage > 0 && (
+                        <>
+                          <p className='text-caption-2 text-gray_r-11 line-through'>
+                            {currencyFormat(item.price.price)}
+                          </p>
+                          <span className='badge-red'>{item.price.discountPercentage}%</span>
+                        </>
+                      )}
+                    </div>
+                    <p className='text-caption-2 text-gray_r-11 mt-1'>
+                      {item.price.priceDiscount > 0
+                        ? currencyFormat(item.price.priceDiscount) +
+                          ' × ' +
+                          item.quantity +
+                          ' Barang'
+                        : ''}
+                    </p>
+                    <p className='text-caption-2 text-gray_r-12 font-bold mt-2'>
+                      {item.price.priceDiscount > 0 ? (
+                        currencyFormat(item.quantity * item.price.priceDiscount)
+                      ) : (
+                        <a
+                          href={whatsappUrl('product', {
+                            name: item.name,
+                            url: createSlug('/shop/product/', item.name, item.id, true)
+                          })}
+                          className='underline text-danger-500'
+                        >
+                          Call For Price{' '}
+                        </a>
+                      )}
+                    </p>
+                  </div>
+                </div>
+              </div>
+            ))}
+        </>
       ))}
       {variants.length > 2 && (
         <button
-- 
cgit v1.2.3


From 9272a07644a75d201753501cfff173b1260963ea Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 5 Jul 2023 09:29:46 +0700
Subject: cart, checkout dan nav bar mobile

---
 src/lib/variant/components/VariantGroupCard.jsx | 40 +++++--------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

(limited to 'src/lib/variant/components/VariantGroupCard.jsx')

diff --git a/src/lib/variant/components/VariantGroupCard.jsx b/src/lib/variant/components/VariantGroupCard.jsx
index aba6971f..dd5983a9 100644
--- a/src/lib/variant/components/VariantGroupCard.jsx
+++ b/src/lib/variant/components/VariantGroupCard.jsx
@@ -26,49 +26,25 @@ const VariantGroupCard = ({ variants, ...props }) => {
                     />
                   </div>
                   <div className='w-8/12 flex flex-col'>
-                    <p className='product-card__title wrap-line-ellipsis-2'>
-                      {item.name}
-                    </p>
-                    <p className='text-caption-2 text-gray_r-11 mt-1'>
-                      {/* {product.code || '-'}
-                      {product.attributes.length > 0 ? ` ・ ${product.attributes.join(', ')}` : ''} */}
-                    </p>
+                    <div className='mb-2'>
+                      <span className='border border-solid border-red-600 rounded-md p-1 text-red-600'>
+                        {variant.program.type.label}
+                      </span>
+                    </div>
+                    <p className='product-card__title wrap-line-ellipsis-2'>{item.name}</p>
                     <p className='text-caption-2 text-gray_r-11 mt-1'>
                       Berat Item : {item.weight} Kg
                     </p>
-                    <div className='flex flex-wrap gap-x-1 items-center mt-auto'>
+                    <div className='flex flex-wrap gap-x-1 items-center mt-1'>
                       {item.price.discountPercentage > 0 && (
                         <>
                           <p className='text-caption-2 text-gray_r-11 line-through'>
                             {currencyFormat(item.price.price)}
                           </p>
-                          <span className='badge-red'>{item.price.discountPercentage}%</span>
                         </>
                       )}
                     </div>
-                    <p className='text-caption-2 text-gray_r-11 mt-1'>
-                      {item.price.priceDiscount > 0
-                        ? currencyFormat(item.price.priceDiscount) +
-                          ' × ' +
-                          item.quantity +
-                          ' Barang'
-                        : ''}
-                    </p>
-                    <p className='text-caption-2 text-gray_r-12 font-bold mt-2'>
-                      {item.price.priceDiscount > 0 ? (
-                        currencyFormat(item.quantity * item.price.priceDiscount)
-                      ) : (
-                        <a
-                          href={whatsappUrl('product', {
-                            name: item.name,
-                            url: createSlug('/shop/product/', item.name, item.id, true)
-                          })}
-                          className='underline text-danger-500'
-                        >
-                          Call For Price{' '}
-                        </a>
-                      )}
-                    </p>
+                    <p className='text-caption-2 text-gray_r-12 font-bold mt-2'>Gratis</p>
                   </div>
                 </div>
               </div>
-- 
cgit v1.2.3

