From e3d0de0ba20eee9d53e95c5525907b099d2b5b04 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 10 Jul 2024 14:20:29 +0700
Subject: <iman> update reaject button & component position

---
 src/lib/variant/components/VariantCard.jsx | 31 ++++++++++--------------------
 1 file changed, 10 insertions(+), 21 deletions(-)

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

diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx
index c629c987..5d95ee70 100644
--- a/src/lib/variant/components/VariantCard.jsx
+++ b/src/lib/variant/components/VariantCard.jsx
@@ -122,7 +122,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
         <Link href={createSlug('/shop/product/', product.parent.name, product.parent.id)}>
           <Card />
         </Link>
-        {buyMore && (
+        {buyMore  && (!transaction?.data?.productsRejectLine.some(pr => pr.id === product.id)) && (
           <div className='flex justify-end gap-x-2 mb-2'>
             <button
               type='button'
@@ -133,26 +133,15 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
             </button>
             {/* {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (transaction.data.isReaject == false) && ( */}
             {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (router.asPath.includes("/my/quotations/")) && (
-                      
-                          <button
-                            className="bg-red-500 text-white py-1 px-3 rounded"
-                            onClick={() => openModal(product)}
-                          >
-                            Reject
-                          </button>
-                      
-                      )}
-                      {/* {transaction.data.isReaject && (
-                  
-                          <button
-                            className="bg-gray-400 text-white py-1 px-3 rounded"
-                            onClick={() => openModal(product)}
-                            disabled
-                          >
-                            Direject
-                          </button>
-                     
-                      )} */}
+                      !transaction?.data?.productsRejectLine.some(pr => pr.id === product.id) && (
+                        <button
+                          className="bg-red-500 text-white py-1 px-3 rounded"
+                          onClick={() => openModal(product)}
+                        >
+                          Reject
+                        </button>
+                      )
+                    )}
                       {isModalOpen && (
                         <div className='fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center'>
                           <div className='bg-white p-4 rounded w-96
-- 
cgit v1.2.3

