From fedaceac3e41741c198c94fd20917c9572fa7ec1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 10 Jan 2025 15:26:44 +0700 Subject: update tempo page mobile view --- src/lib/auth/components/Menu.jsx | 2 +- src/lib/tempo/components/Tempo.jsx | 305 +++++++++++++++++-------- src/lib/transaction/components/Transaction.jsx | 2 +- 3 files changed, 211 insertions(+), 98 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/Menu.jsx b/src/lib/auth/components/Menu.jsx index b562878d..d99917d0 100644 --- a/src/lib/auth/components/Menu.jsx +++ b/src/lib/auth/components/Menu.jsx @@ -64,7 +64,7 @@ const Menu = () => { {auth && auth.partnerTempo && - (auth.partnerTempo?.toLowerCase().includes('tempo') || + (auth.partnerTempo || auth.tempoProgres === 'review') && (
diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index b79824fa..3af5b56c 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -25,7 +25,6 @@ import DesktopView from '@/core/components/views/DesktopView'; import Menu from '@/lib/auth/components/Menu'; import odooApi from '@/core/api/odooApi'; import { getAuth } from '@/core/utils/auth'; -import ProgressBar from '@ramonak/react-progress-bar'; import FooterBanner from '~/modules/footer-banner'; import Image from '~/components/ui/image'; import useDevice from '@/core/hooks/useDevice'; @@ -286,6 +285,11 @@ const Tempo = () => { value={statusNew} onChange={(e) => { setStatusNew(Number(e.target.value)); + if (e.target.value == 0) { + if (inputQuery) { + router.push('/my/tempo/'); + } + } }} className='border p-2' > @@ -424,40 +428,44 @@ const Tempo = () => {
+

+ + Kredit Limit Anda :{' '} + + + {limitTempo ? currencyFormat(limitTempo) : '-'} + +

- Status Detail Tempo Pembayaran Anda adalah{' '} + + Status Detail Tempo Pembayaran Anda adalah : + {tempo.paymentTerm ? tempo.paymentTerm : 'Review'}

-
-
-

Kredit Limit Terpakai

- - {amountDue ? currencyFormat(amountDue) : '-'} - -
+
-

Sisa Kredit Limit

+

Sisa Kredit Limit

{limitTempo && amountDue ? currencyFormat( @@ -465,34 +473,72 @@ const Tempo = () => { ) : '-'} +
{' '} +
+

Kredit Limit Terpakai

+ + {amountDue ? currencyFormat(amountDue) : '-'} +
-

Kredit Limit

+

Jatuh Tempo

- {limitTempo ? currencyFormat(limitTempo) : '-'} + {tempo.amountJatuhTempo + ? currencyFormat(tempo.amountJatuhTempo) + : '-'}
-
- {auth && !auth?.tempoProgres == 'review' && tempo.paymentTerm && ( -
- setInputQuery(e.target.value)} - /> +
+ {auth && (!auth?.tempoProgres == 'review' || tempo.paymentTerm) && ( + +
+ setInputQuery(e.target.value)} + /> +
+
+
+ +
+
)} @@ -515,90 +561,157 @@ const Tempo = () => { />
) : ( - invoices.data?.invoices?.map((invoice, index) => ( -
-
- - - No. Transaksi - -

- {invoice.salesOrder} -

- -
- {invoice.amountResidual > 0 ? ( - new Date() > getDueDate(invoice.invoiceDateDue) ? ( -
- Jatuh Tempo -
- ) : ( +
+ {(statusNew == 0 || statusNew == 2 || statusNew == 4) && + invoices.data?.saleOrders?.map((invoice, index) => ( +
+
+ + + No. Transaksi + +

+ {invoice.name} +

+ +
- Belum Lunas + Belum Jatuh Tempo
- ) - ) : ( -
- Lunas + {/* setToOthers(invoice)} + /> */}
- )} - {/* setToOthers(invoice)} - /> */} +
+ +
+

+ {invoice.dateOrder.split(' ')[0]} +

+

+ Jatuh Tempo: - +

+
+
+
+
+ + No. Invoice + +

-

+
+
+ + Total Belanja + +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ + {/* {invoice.efaktur ? ( +
+ + Faktur Pajak
-
- -
-

- {formatTanggal(invoice.invoiceDate)} -

-

- Jatuh Tempo: {formatTanggal(invoice.invoiceDateDue)} -

+ ) : ( +
+ + Faktur Pajak
-
+ )} */} +
+ ))} + {invoices.data?.invoices?.map((invoice, index) => ( +
-
+ - No. Invoice + No. Transaksi -

- {invoice.name || '-'} -

+

+ {invoice.salesOrder} +

+ +
+ {invoice.amountResidual > 0 ? ( + new Date() > getDueDate(invoice.invoiceDateDue) ? ( +
+ Jatuh Tempo +
+ ) : ( +
+ Belum Jatuh Tempo +
+ ) + ) : ( +
+ Lunas +
+ )} + {/* setToOthers(invoice)} + /> */}
-
- - Total Belanja - -

- {currencyFormat(invoice.amountTotal)} +

+ +
+

+ {formatTanggal(invoice.invoiceDate)}

+

+ Jatuh Tempo: {formatTanggal(invoice.invoiceDateDue)} +

+
+
+
+
+ + No. Invoice + +

+ {invoice.name || '-'} +

+
+
+ + Total Belanja + +

+ {currencyFormat(invoice.amountTotal)} +

+
+ + {/* {invoice.efaktur ? ( +
+ + Faktur Pajak
- - {/* {invoice.efaktur ? ( -
- - Faktur Pajak -
- ) : ( -
- - Faktur Pajak + ) : ( +
+ + Faktur Pajak +
+ )} */}
- )} */} -
- )) + ))} +
)} diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 751d4e39..f5dc507a 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -89,7 +89,7 @@ const Transaction = ({ id }) => { const [continueTransaction, setContinueTransaction] = useState(false); const openCancelTransaction = () => setCancelTransaction(true); const openContinueTransaction = () => { - if (auth.partnerTempo.toLowerCase().includes('tempo')) { + if (auth.partnerTempo) { checkout(); } else { if (!transaction.data?.purchaseOrderFile) { -- cgit v1.2.3