From 48db7565a82c8785a29cb3eee14306d65d61255c Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 6 Aug 2025 14:17:51 +0700
Subject: <hafid> button cancel & download in quotation

---
 src/lib/transaction/components/Transaction.jsx | 146 +++++--------------------
 1 file changed, 29 insertions(+), 117 deletions(-)

(limited to 'src/lib/transaction/components/Transaction.jsx')

diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx
index 2c1a6208..842567f8 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -819,64 +819,23 @@ const Transaction = ({ id }) => {
 
           {/* <Divider /> */}
 
-          {/* <div className='p-4 pt-0'>
-            {transaction.data?.status == 'draft' &&
-              auth?.feature.soApproval && (
-                <div className='flex gap-x-2'>
-                  <button
-                    className='btn-yellow w-full'
-                    onClick={checkout}
-                    disabled={
-                      transaction.data?.status === 'cancel'
-                        ? true
-                        : false || auth?.webRole === statusApprovalWeb
-                        ? true
-                        : false
-                    }
-                  >
-                    Approve
-                  </button>
-                  <button
-                    className='btn-solid-red px-7 w-full'
-                    onClick={checkout}
-                    disabled={
-                      transaction.data?.status === 'cancel'
-                        ? true
-                        : false || auth?.webRole === statusApprovalWeb
-                        ? true
-                        : false
-                    }
-                  >
-                    Reject
-                  </button>
-                </div>
-              )}
-            {transaction.data?.status == 'draft' &&
-              !auth?.feature?.soApproval && (
-                <button
-                  className='btn-yellow w-full mt-4'
-                  onClick={openContinueTransaction}
-                >
-                  Lanjutkan Transaksi
-                </button>
-              )}
-            <button
-              className='btn-light w-full mt-4'
-              disabled={transaction.data?.status != 'draft'}
-              onClick={() => downloadQuotation(transaction.data)}
-            >
-              Download Quotation
-            </button>
-            {transaction.data?.status != 'draft' && (
+          {transaction.data?.status === 'draft' && (
+            <div className='p-4 pt-0'>
               <button
-                className='btn-light w-full mt-4'
-                disabled={transaction.data?.status != 'waiting'}
+                className='btn-yellow w-full mt-4'
+                disabled={transaction.data?.status != 'draft'}
+                onClick={() => downloadQuotation(transaction.data)}
+              >
+                Download Quotation
+              </button>
+              <button
+                className='btn-solid-red w-full mt-4'
                 onClick={openCancelTransaction}
               >
                 Batalkan Transaksi
               </button>
-            )}
-          </div> */}
+            </div>
+          )}
         </MobileView>
 
         <DesktopView>
@@ -918,70 +877,23 @@ const Transaction = ({ id }) => {
                 </span>
                 <TransactionStatusBadge status={transaction?.data?.status} />
               </div>
-              {/* <div className='flex gap-x-4'>
-                <button
-                  type='button'
-                  className='btn-solid-red px-3 py-2 mr-auto'
-                  onClick={() => downloadQuotation(transaction.data)}
-                >
-                  Download
-                </button>
-                {transaction.data?.status == 'draft' &&
-                  auth?.feature?.soApproval &&
-                  auth?.webRole && (
-                    <div className='flex gap-x-2'>
-                      <button
-                        className='btn-yellow'
-                        onClick={handleApproval}
-                        disabled={
-                          transaction.data?.status === 'cancel'
-                            ? true
-                            : false || auth?.webRole === statusApprovalWeb
-                            ? true
-                            : false || statusApprovalWeb < 1
-                            ? true
-                            : false
-                        }
-                      >
-                        Approve
-                      </button>
-                      <button
-                        className='btn-solid-red px-7'
-                        onClick={openRejectTransaction}
-                        disabled={
-                          transaction.data?.status === 'cancel'
-                            ? true
-                            : false || auth?.webRole === statusApprovalWeb
-                            ? true
-                            : false || statusApprovalWeb < 1
-                            ? true
-                            : false
-                        }
-                      >
-                        Reject
-                      </button>
-                    </div>
-                  )}
-                {transaction.data?.status == 'draft' &&
-                  !auth?.feature.soApproval && (
-                    <button
-                      className='btn-yellow'
-                      onClick={openContinueTransaction}
-                    >
-                      Lanjutkan Transaksi
-                    </button>
-                  )}
-                {transaction.data?.status != 'draft' &&
-                  !auth?.feature.soApproval && (
-                    <button
-                      className='btn-light'
-                      disabled={transaction.data?.status != 'waiting'}
-                      onClick={openCancelTransaction}
-                    >
-                      Batalkan Transaksi
-                    </button>
-                  )}
-              </div> */}
+              {transaction.data?.status === 'draft' && (
+                <div className='flex gap-x-4'>
+                  <button
+                    type='button'
+                    className='btn-yellow px-3 py-2 mr-auto'
+                    onClick={() => downloadQuotation(transaction.data)}
+                  >
+                    Download
+                  </button>
+                  <button
+                    className='btn-solid-red'
+                    onClick={openCancelTransaction}
+                  >
+                    Batalkan Transaksi
+                  </button>
+                </div>
+              )}
 
               <div className='grid grid-cols-2 gap-x-6 mt-4'>
                 <div className='grid grid-cols-[35%_65%] gap-y-4'>
-- 
cgit v1.2.3

