From 787d3aaa3187d3432c8e6b743b555ea3e4a4980c Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 3 Oct 2023 15:25:14 +0700
Subject: new pricelist di page product cart, product detail & product variant

---
 .../product/components/Product/ProductDesktop.jsx  | 74 +++++++++++++++-------
 1 file changed, 50 insertions(+), 24 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 5cc35df7..0df60673 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -413,13 +413,13 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
               <div className='text-gray_r-12/80'>Harga mulai dari: </div>
             )}
 
-            {lowestPrice?.discountPercentage > 0 && (
+            {/* {lowestPrice?.discountPercentage > 0 && (
               <div className='flex gap-x-1 items-center mt-2'>
                 <div className='badge-solid-red text-caption-1'>
                   {lowestPrice?.discountPercentage}%
                 </div>
-                <div className='text-gray_r-11 line-through text-caption-1'>
-                  {currencyFormat(lowestPrice?.price)}
+                <div className='text-gray_r-9 text-caption-1'>
+                  Include PPN {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
                 </div>
                 {product.flashSale.remainingTime > 0 && (
                   <div className='bg-red-600 rounded-full mb-1 p-2 pl-3 pr-3 flex w-fit items-center gap-x-1'>
@@ -436,28 +436,54 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                   </div>
                 )}
               </div>
+            )} */}
+
+            {product?.flashSale?.remainingTime > 0 ? (
+              <>
+                <div className='flex gap-x-1 items-center mt-2'>
+                  <div className='badge-solid-red text-caption-1'>
+                    {lowestPrice?.discountPercentage}%
+                  </div>
+                  <div className='text-gray_r-9 line-through text-caption-1'>
+                    {currencyFormat(lowestPrice?.price)}
+                  </div>
+                  <div className='text-danger-500 font-semibold text-xl'>
+                    {currencyFormat(lowestPrice?.priceDiscount)}
+                  </div>
+                </div>
+                <div className='text-gray_r-9 text-base font-normal mt-1'>
+                  Termasuk PPN: {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                </div>
+              </>
+            ) : (
+              <h3 className='text-danger-500 font-semibold mt-1 text-title-md'>
+                {lowestPrice?.price > 0 ? (
+                  <>
+                    {currencyFormat(lowestPrice?.price)}
+                    <div className='text-gray_r-9 text-base font-normal mt-1'>
+                      Termasuk PPN: {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
+                    </div>
+                  </>
+                ) : (
+                  <span className='text-gray_r-12/90 font-normal text-h-sm'>
+                    Hubungi kami untuk dapatkan harga terbaik,&nbsp;
+                    <a
+                      href={whatsappUrl('product', {
+                        name: product.name,
+                        manufacture: product.manufacture?.name,
+                        url: createSlug('/shop/product/', product.name, product.id, true)
+                      })}
+                      className='text-danger-500 underline'
+                      rel='noopener noreferrer'
+                      target='_blank'
+                    >
+                      klik disini
+                    </a>
+                  </span>
+                )}
+              </h3>
             )}
-            <h3 className='text-danger-500 font-semibold mt-1 text-title-md'>
-              {lowestPrice?.priceDiscount > 0 ? (
-                currencyFormat(lowestPrice?.priceDiscount)
-              ) : (
-                <span className='text-gray_r-12/90 font-normal text-h-sm'>
-                  Hubungi kami untuk dapatkan harga terbaik,&nbsp;
-                  <a
-                    href={whatsappUrl('product', {
-                      name: product.name,
-                      manufacture: product.manufacture?.name,
-                      url: createSlug('/shop/product/', product.name, product.id, true)
-                    })}
-                    className='text-danger-500 underline'
-                    rel='noopener noreferrer'
-                    target='_blank'
-                  >
-                    klik disini
-                  </a>
-                </span>
-              )}
-            </h3>
+
             {product.variants.length > 1 ? (
               <button
                 type='button'
-- 
cgit v1.2.3


From eb7bea2f262ffa4faa39d4f163950892c5640c0f Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 4 Oct 2023 10:09:43 +0700
Subject: pricelist di cart dan list variant

---
 .../product/components/Product/ProductDesktop.jsx  | 64 ++++++++++++++--------
 1 file changed, 42 insertions(+), 22 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 0df60673..30424943 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -452,7 +452,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                   </div>
                 </div>
                 <div className='text-gray_r-9 text-base font-normal mt-1'>
-                  Termasuk PPN: {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                  Termasuk PPN:{' '}
+                  {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
                 </div>
               </>
             ) : (
@@ -461,7 +462,8 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                   <>
                     {currencyFormat(lowestPrice?.price)}
                     <div className='text-gray_r-9 text-base font-normal mt-1'>
-                      Termasuk PPN: {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
+                      Termasuk PPN:{' '}
+                      {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
                     </div>
                   </>
                 ) : (
@@ -575,32 +577,50 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                         <ColumnsSLA variant={variant} product={product} />
                       </LazyLoadComponent>
                       <td>
-                        {variant.price.discountPercentage > 0 &&
+                        {variant.isFlashsale ? (
+                          <>
+                            <div className='flex items-center gap-x-1 justify-center'>
+                              <div className='badge-solid-red text-caption-1'>
+                                {lowestPrice?.discountPercentage}%
+                              </div>
+                              <div className='line-through text-caption-1 text-gray_r-11'>
+                                {currencyFormat(variant.price.price)}
+                              </div>{' '}
+                              <div className=' text-caption-1 text-red-600 font-semibold'>
+                                {currencyFormat(variant.price.priceDiscount)}
+                              </div>{' '}
+                            </div>
+                            {currencyFormat(variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                          </>
+                        ) : (
+                          <div>
+                            {variant.price.price > 0 ? (
+                              currencyFormat(variant.price.price * process.env.NEXT_PUBLIC_PPN)
+                            ) : (
+                              <a
+                                href={whatsappUrl('product', {
+                                  name: variant.name,
+                                  manufacture: product.manufacture?.name,
+                                  url: createSlug('/shop/product/', product.name, product.id, true)
+                                })}
+                                className='text-red_r-11'
+                                rel='noopener noreferrer'
+                                target='_blank'
+                              >
+                                Call for price
+                              </a>
+                            )}
+                          </div>
+                        )}
+                        {/* {variant.price.discountPercentage > 0 &&
                           variant.price.priceDiscount > 0 && (
                             <>
                               <div className='line-through text-caption-1 text-gray_r-11 mb-1'>
                                 {currencyFormat(variant.price.price)}
                               </div>{' '}
                             </>
-                          )}
-                        <div>
-                          {variant.price.priceDiscount > 0 ? (
-                            currencyFormat(variant.price.priceDiscount)
-                          ) : (
-                            <a
-                              href={whatsappUrl('product', {
-                                name: variant.name,
-                                manufacture: product.manufacture?.name,
-                                url: createSlug('/shop/product/', product.name, product.id, true)
-                              })}
-                              className='text-red_r-11'
-                              rel='noopener noreferrer'
-                              target='_blank'
-                            >
-                              Call for price
-                            </a>
-                          )}
-                        </div>
+                          )} */}
+
                         {/* <VariantPrice id={variant.id} /> */}
                       </td>
                       <td>
-- 
cgit v1.2.3


From 5624207e88c272a8edde9c334393bca5ac20d3fc Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 4 Oct 2023 11:35:03 +0700
Subject: ketingaalan

---
 .../product/components/Product/ProductDesktop.jsx  | 50 +++++++++++++++-------
 1 file changed, 35 insertions(+), 15 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 30424943..16ff31aa 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -44,8 +44,13 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
   const { setRefreshCart, refreshCart } = useProductCartContext()
 
   const getLowestPrice = useCallback(() => {
-    const prices = product.variants.map((variant) => variant.price)
+    const prices = product.variants.map((variant) => ({
+      price: variant.price,
+      isFlashsale: variant.isFlashsale
+    }))
     const lowest = prices.reduce((lowest, price) => {
+      console.log('ini reduce lowest', lowest)
+      console.log('ini reduce price', price)
       return price.priceDiscount < lowest.priceDiscount ? price : lowest
     }, prices[0])
     return lowest
@@ -438,32 +443,32 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
               </div>
             )} */}
 
-            {product?.flashSale?.remainingTime > 0 ? (
+            {lowestPrice?.isFlashsale ? (
               <>
                 <div className='flex gap-x-1 items-center mt-2'>
                   <div className='badge-solid-red text-caption-1'>
-                    {lowestPrice?.discountPercentage}%
+                    {lowestPrice?.price?.discountPercentage}%
                   </div>
                   <div className='text-gray_r-9 line-through text-caption-1'>
-                    {currencyFormat(lowestPrice?.price)}
+                    {currencyFormat(lowestPrice?.price?.price)}
                   </div>
                   <div className='text-danger-500 font-semibold text-xl'>
-                    {currencyFormat(lowestPrice?.priceDiscount)}
+                    {currencyFormat(lowestPrice?.price?.priceDiscount)}
                   </div>
                 </div>
                 <div className='text-gray_r-9 text-base font-normal mt-1'>
                   Termasuk PPN:{' '}
-                  {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                  {currencyFormat(lowestPrice?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
                 </div>
               </>
             ) : (
               <h3 className='text-danger-500 font-semibold mt-1 text-title-md'>
-                {lowestPrice?.price > 0 ? (
+                {lowestPrice?.price.price > 0 ? (
                   <>
-                    {currencyFormat(lowestPrice?.price)}
+                    {currencyFormat(lowestPrice?.price.price)}
                     <div className='text-gray_r-9 text-base font-normal mt-1'>
                       Termasuk PPN:{' '}
-                      {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
+                      {currencyFormat(lowestPrice?.price.price * process.env.NEXT_PUBLIC_PPN)}
                     </div>
                   </>
                 ) : (
@@ -581,21 +586,36 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                           <>
                             <div className='flex items-center gap-x-1 justify-center'>
                               <div className='badge-solid-red text-caption-1'>
-                                {lowestPrice?.discountPercentage}%
+                                {variant?.price?.discountPercentage}%
                               </div>
                               <div className='line-through text-caption-1 text-gray_r-11'>
-                                {currencyFormat(variant.price.price)}
+                                {currencyFormat(variant?.price?.price)}
                               </div>{' '}
                               <div className=' text-caption-1 text-red-600 font-semibold'>
-                                {currencyFormat(variant.price.priceDiscount)}
+                                {currencyFormat(variant?.price?.priceDiscount)}
                               </div>{' '}
                             </div>
-                            {currencyFormat(variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+                            <div className=' text-caption-1 text-gray_r-11 mb-1'>
+                              + PPN:{' '}
+                              {currencyFormat(
+                                variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN
+                              )}
+                            </div>
                           </>
                         ) : (
                           <div>
-                            {variant.price.price > 0 ? (
-                              currencyFormat(variant.price.price * process.env.NEXT_PUBLIC_PPN)
+                            {variant?.price?.price > 0 ? (
+                              <>
+                                <div className=' text-caption-1 text-red-600 font-semibold'>
+                                  {currencyFormat(variant?.price?.price)}
+                                </div>{' '}
+                                <div className=' text-caption-1 text-gray_r-11 mb-1'>
+                                  + PPN:{' '}
+                                  {currencyFormat(
+                                    variant?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN
+                                  )}
+                                </div>
+                              </>
                             ) : (
                               <a
                                 href={whatsappUrl('product', {
-- 
cgit v1.2.3


From 427feacedcdc511fcead8d2289264aa58bafd038 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 4 Oct 2023 15:34:39 +0700
Subject: set tier auth

---
 src/lib/product/components/Product/ProductDesktop.jsx | 2 --
 1 file changed, 2 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 16ff31aa..5e827089 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -49,8 +49,6 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
       isFlashsale: variant.isFlashsale
     }))
     const lowest = prices.reduce((lowest, price) => {
-      console.log('ini reduce lowest', lowest)
-      console.log('ini reduce price', price)
       return price.priceDiscount < lowest.priceDiscount ? price : lowest
     }, prices[0])
     return lowest
-- 
cgit v1.2.3


From e72c16eb549488e1ed847b022880f542d2a9c525 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Thu, 5 Oct 2023 09:32:12 +0700
Subject: add component list product for cart, quotation, and checkout

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

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index 5e827089..4c8c3ae9 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -594,7 +594,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                               </div>{' '}
                             </div>
                             <div className=' text-caption-1 text-gray_r-11 mb-1'>
-                              + PPN:{' '}
+                              Inc. PPN:{' '}
                               {currencyFormat(
                                 variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN
                               )}
@@ -608,7 +608,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
                                   {currencyFormat(variant?.price?.price)}
                                 </div>{' '}
                                 <div className=' text-caption-1 text-gray_r-11 mb-1'>
-                                  + PPN:{' '}
+                                  Inc. PPN:{' '}
                                   {currencyFormat(
                                     variant?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN
                                   )}
-- 
cgit v1.2.3

