diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-08-28 17:08:20 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-08-28 17:08:20 +0700 |
| commit | b7833ad1d13772ea1dd7a6af6716a2c4b575132a (patch) | |
| tree | 55ea910659d58666569f45ab21c2c0184a6e9081 /src/lib/transaction/components | |
| parent | ff73ed876e8516ed1a3cfef1d5f8381a2d9ca70e (diff) | |
<Miqdad>Hide Beli lagi
Diffstat (limited to 'src/lib/transaction/components')
| -rw-r--r-- | src/lib/transaction/components/Transactions.jsx | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx index dd927dfa..bb24f717 100644 --- a/src/lib/transaction/components/Transactions.jsx +++ b/src/lib/transaction/components/Transactions.jsx @@ -69,6 +69,10 @@ const Transactions = ({ context = '' }) => { const [contextNew, setcontextNew] = useState(router.query.context || context); const [isOpenCalender, setIsOpenCalender] = useState(false); const calendarRef = useRef(null); + const isUnpaid = (s) => + ['belum_bayar'].includes( + String(s || '').toLowerCase() + ); // loading id utk tombol lanjutkan transaksi const [contLoadingId, setContLoadingId] = useState(null); @@ -617,18 +621,22 @@ const Transactions = ({ context = '' }) => { </div> <div className='flex flex-col gap-2 w-full'> - <button - type='button' - onClick={(e) => { - e.preventDefault(); - e.stopPropagation(); - handleBuyBack(saleOrder.products); - }} - className='w-full py-2 btn-solid-red text-center rounded-md' - > - Beli Lagi - </button> + {/* Beli Lagi hanya muncul jika status bukan unpaid */} + {!isUnpaid(saleOrder.status) && ( + <button + type='button' + onClick={(e) => { + e.preventDefault(); + e.stopPropagation(); + handleBuyBack(saleOrder.products); + }} + className='w-full py-2 btn-solid-red text-center rounded-md' + > + Beli Lagi + </button> + )} + {/* Bayar Sekarang hanya kalau eligible */} {saleOrder?.eligibleContinue && ( <button type='button' @@ -1111,18 +1119,21 @@ const Transactions = ({ context = '' }) => { </p> </div> - <button - type='button' - onClick={(e) => { - e.preventDefault(); - e.stopPropagation(); - handleBuyBack(saleOrder.products); - }} - className='w-full py-2 btn-solid-red text-nowrap rounded-md' - > - Beli Lagi - </button> + {!isUnpaid(saleOrder.status) && ( + <button + type='button' + onClick={(e) => { + e.preventDefault(); + e.stopPropagation(); + handleBuyBack(saleOrder.products); + }} + className='w-full py-2 btn-solid-red text-nowrap rounded-md' + > + Beli Lagi + </button> + )} + {/* Bayar Sekarang: hanya kalau eligible */} {saleOrder?.eligibleContinue && ( <button type='button' |
