From a7574b1276d751824b0c16c0696133ea1517223a Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Thu, 3 Aug 2023 17:06:09 +0700
Subject: voucher

---
 src/lib/checkout/components/Checkout.jsx | 161 +++++++++++++++++++------------
 1 file changed, 97 insertions(+), 64 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 53ac63e1..9ffac61a 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -301,7 +301,7 @@ const Checkout = () => {
       voucher: activeVoucher,
       type: 'sale_order'
     }
-    if(query){
+    if (query) {
       data.source = 'buy'
     }
     if (poNumber.current.value) data.po_number = poNumber.current.value
@@ -491,6 +491,81 @@ const Checkout = () => {
                   )}
 
                   <div className={`border border-solid mb-5 w-full hover:cursor-pointer  p-4 `}>
+                    {item.canApply && (
+                      <div
+                        class='p-2 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:text-green-400'
+                        role='alert'
+                      >
+                        <p>
+                          Potensi potongan sebesar{' '}
+                          <span className='text-red-500'>
+                            {currencyFormat(item.discountVoucher)}
+                          </span>
+                        </p>
+                      </div>
+                    )}
+                    {!item.canApply && item.applyStatus === 'UM' && (
+                      <div
+                        class='p-2 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400'
+                        role='alert'
+                      >
+                        <p>
+                          Tambah produk{' '}
+                          <span className='text-red-500'>{item.manufactureNames}</span> senilai{' '}
+                          <span className='text-red-500'>
+                            {currencyFormat(item.minPurchaseAmount)}
+                          </span>{' '}
+                          untuk pakai promo ini
+                        </p>
+                      </div>
+                    )}
+
+                    {!item.canApply &&
+                      item.applyStatus === 'MPA' &&
+                      item.manufactureNames != '' && (
+                        <div
+                          class='p-2 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400'
+                          role='alert'
+                        >
+                          <p>
+                            Tambah produk{' '}
+                            <span className='text-red-500'>{item.manufactureNames}</span> senilai{' '}
+                            <span className='text-red-500'>
+                              {currencyFormat(item.differenceToApply)}
+                            </span>{' '}
+                            untuk pakai promo ini
+                          </p>
+                        </div>
+                      )}
+
+                    {!item.canApply &&
+                      item.applyStatus === 'MPA' &&
+                      item.manufactureNames === '' && (
+                        <div
+                          class='p-2 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400'
+                          role='alert'
+                        >
+                          <p>
+                            Tambah{' '}
+                            <span className='text-red-500'>
+                              {currencyFormat(item.differenceToApply)}
+                            </span>{' '}
+                            untuk pakai promo ini{' '}
+                          </p>
+                        </div>
+                      )}
+
+                    {!item.canApply &&
+                      item.has_flashsale_products &&
+                      item.apply_status === 'UM' && (
+                        <div
+                          class='p-2 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400'
+                          role='alert'
+                        >
+                          <p>Voucher tidak dapat di gabung dengan</p>
+                        </div>
+                      )}
+
                     <div className={`flex gap-x-3`}>
                       <div className='hidden md:w-[250px] md:block'>
                         <Image src={item.image} alt={item.name} className={`object-cover`} />
@@ -516,7 +591,7 @@ const Checkout = () => {
                             </label>
                           </div>
                         </div>
-                        <hr className='mt-3 my-4 border-gray_r-8' />
+                        <hr className='mt-2 my-2 border-gray_r-8' />
                         <div className='flex justify-between items-center'>
                           <p className='text-justify text-sm md:text-xs'>
                             Kode Voucher :{' '}
@@ -528,51 +603,30 @@ const Checkout = () => {
                             )}
                           </p>
                         </div>
+                        <div className='flex items-center mt-3'>
+                          <svg
+                            aria-hidden='true'
+                            fill='none'
+                            stroke='currentColor'
+                            stroke-width='1.5'
+                            viewBox='0 0 24 24'
+                            className='w-5 text-black'
+                          >
+                            <path
+                              d='M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z'
+                              stroke-linecap='round'
+                              stroke-linejoin='round'
+                            ></path>
+                          </svg>
+                          <span className='text-left ml-3 text-sm '>
+                            Berakhir dalam{' '}
+                            <span className='text-red-600'>{item.remainingTime}</span> lagi{' '}
+                          </span>
+                        </div>
                       </div>
                     </div>
                     <div className='mt-3'>
                       <p className='text-justify text-sm '>
-                        {!item.canApply &&
-                          item.applyStatus === 'MPA' &&
-                          item.manufactureNames != '' && (
-                            <p>
-                              Tambah produk{' '}
-                              <span className='text-red-500'>{item.manufactureNames}</span> senilai{' '}
-                              <span className='text-red-500'>
-                                {currencyFormat(item.differenceToApply)}
-                              </span>{' '}
-                              untuk pakai promo ini
-                            </p>
-                          )}
-                        {!item.canApply &&
-                          item.applyStatus === 'MPA' &&
-                          item.manufactureNames === '' && (
-                            <p>
-                              Tambah{' '}
-                              <span className='text-red-500'>
-                                {currencyFormat(item.differenceToApply)}
-                              </span>{' '}
-                              untuk pakai promo ini{' '}
-                            </p>
-                          )}
-                        {!item.canApply && item.applyStatus === 'UM' && (
-                          <p>
-                            Tambah produk{' '}
-                            <span className='text-red-500'>{item.manufactureNames}</span> senilai{' '}
-                            <span className='text-red-500'>
-                              {currencyFormat(item.minPurchaseAmount)}
-                            </span>{' '}
-                            untuk pakai promo ini
-                          </p>
-                        )}
-                        {item.canApply && (
-                          <p>
-                            Potensi potongan sebesar{' '}
-                            <span className='text-red-500'>
-                              {currencyFormat(item.discountVoucher)}
-                            </span>
-                          </p>
-                        )}
                         {/* {item.canApply === false
                           ? 'Tambah ' +
                             currencyFormat(item.differenceToApply) +
@@ -580,27 +634,6 @@ const Checkout = () => {
                           : 'Potensi potongan sebesar ' +
                             currencyFormat(hitungDiscountVoucher(item.code))} */}
                       </p>
-                      <hr className='mt-2 my-4 border-gray_r-8' />
-                      <div className='flex items-center'>
-                        <svg
-                          aria-hidden='true'
-                          fill='none'
-                          stroke='currentColor'
-                          stroke-width='1.5'
-                          viewBox='0 0 24 24'
-                          className='w-5 text-black'
-                        >
-                          <path
-                            d='M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z'
-                            stroke-linecap='round'
-                            stroke-linejoin='round'
-                          ></path>
-                        </svg>
-                        <span className='text-left ml-3 text-sm '>
-                          Berakhir dalam <span className='text-red-600'>{item.remainingTime}</span>{' '}
-                          lagi{' '}
-                        </span>
-                      </div>
                     </div>
                   </div>
                 </div>
-- 
cgit v1.2.3

