From e3d0de0ba20eee9d53e95c5525907b099d2b5b04 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 10 Jul 2024 14:20:29 +0700 Subject: update reaject button & component position --- src/lib/transaction/components/Transaction.jsx | 316 ++++++++++++++++--------- 1 file changed, 207 insertions(+), 109 deletions(-) (limited to 'src/lib/transaction/components') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 03c94ded..8e7cede0 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -143,6 +143,15 @@ const Transaction = ({ id }) => { [transaction.data] ); + const memoizeVariantGroupCardReject = useMemo( + () => ( +
+ +
+ ), + [transaction.data] + ); + if (transaction.isLoading) { return (
@@ -176,7 +185,7 @@ const Transaction = ({ id }) => { let idProduct = selectedProduct?.id await rejectProductApi({ idSo, idProduct, reason}); closeModal(); - toast.success("Produk berhasil di reaject") + toast.success("Produk berhasil di reject") setTimeout(() => { window.location.reload(); }, 1500); @@ -329,6 +338,37 @@ const Transaction = ({ id }) => { +
+

Invoice

+
+ {transaction.data?.invoices?.map((invoice, index) => ( + +
+
+

{invoice?.name}

+
+ {invoice.amountResidual > 0 ? ( +
Belum Lunas
+ ) : ( +
Lunas
+ )} +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ +
+ + ))} + {transaction.data?.invoices?.length === 0 && ( +
Belum ada invoice
+ )} +
+
+ + + {!auth?.feature.soApproval && (
@@ -354,8 +394,20 @@ const Transaction = ({ id }) => {
Detail Produk
+ {transaction?.data?.products.length > 0? ( +
+ {memoizeVariantGroupCard} +
+ ) : ( +
Semua produk telah di reject
+ )} - {memoizeVariantGroupCard} + {transaction?.data?.productsRejectLine.length > 0 && ( +
+
Detail Produk Reject
+ {memoizeVariantGroupCardReject} +
+ )} @@ -363,37 +415,6 @@ const Transaction = ({ id }) => { -
-

Invoice

-
- {transaction.data?.invoices?.map((invoice, index) => ( - -
-
-

{invoice?.name}

-
- {invoice.amountResidual > 0 ? ( -
Belum Lunas
- ) : ( -
Lunas
- )} -

- {currencyFormat(invoice.amountTotal)} -

-
-
- -
- - ))} - {transaction.data?.invoices?.length === 0 && ( -
Belum ada invoice
- )} -
-
- - -
{transaction.data?.status == 'draft' && auth?.feature.soApproval && (
@@ -561,51 +582,83 @@ const Transaction = ({ id }) => { />
- -
- Pengiriman -
-
- {transaction?.data?.pickings?.map((airway) => ( - + ))} +
+
+
+
Invoice
+ {transaction.data?.invoices?.length === 0 && ( +
Belum ada invoice
+ )} +
+ {transaction.data?.invoices?.map((invoice, index) => ( + +
+
+

{invoice?.name}

+
+ {invoice.amountResidual > 0 ? ( +
Belum Lunas
+ ) : ( +
Lunas
+ )} +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ +
+ + ))}
- - ))} +
- {transaction?.data?.pickings.length == 0 && ( -
Belum ada pengiriman
- )} -
+
Rincian Pembelian
- - - - - {/* */} - - - - - - - + {transaction?.data?.products?.length > 0? ( +
Nama ProdukDiskonJumlahHargaSubtotal
+ + + + {/* */} + + + + + + + {transaction?.data?.products?.map((product) => ( )} - {/* {transaction.data.isReaject && ( - - )} */} ))}
Nama ProdukDiskonJumlahHargaSubtotal
@@ -668,21 +721,14 @@ const Transaction = ({ id }) => { - -
+ ) : ( +
Semua produk telah di reject
+ )} + {isModalOpen && (
Subtotal
@@ -738,33 +785,84 @@ const Transaction = ({ id }) => {
+ ))} -
Invoice
-
- {transaction.data?.invoices?.map((invoice, index) => ( - -
-
-

{invoice?.name}

-
- {invoice.amountResidual > 0 ? ( -
Belum Lunas
- ) : ( -
Lunas
- )} -

- {currencyFormat(invoice.amountTotal)} -

-
-
- -
- - ))} -
- {transaction.data?.invoices?.length === 0 && ( -
Belum ada invoice
+ + + {transaction?.data?.productsRejectLine.length > 0 && ( +
+ Rincian Produk Reject +
+ )} + {transaction?.data?.productsRejectLine.length > 0 && ( + + + + + {/* */} + + + + + + + {transaction?.data?.productsRejectLine?.map((product) => ( + + + {/* */} + + + + + ))} + +
Nama ProdukDiskonJumlahHargaSubtotal
+ + {product?.name} + +
+ + {product?.parent?.name} + +
+ {product?.code}{' '} + {product?.attributes.length > 0 + ? `| ${product?.attributes.join(', ')}` + : ''} +
+
+
+ {product.price.discountPercentage > 0 + ? `${product.price.discountPercentage}%` + : ''} + {product.quantity} + {/* {product.price.discountPercentage > 0 && ( +
+ {currencyFormat(product.price.price)} +
+ )} */} +
{currencyFormat(product.price.priceDiscount)}
+
{currencyFormat(product.quantity * product.price.priceDiscount)}
)} +
-- cgit v1.2.3