From 9622bff4d4902fcef81214236cc7ff035163e5e7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 13 Nov 2024 16:46:14 +0700 Subject: pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 277 +++++++++++++++++++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 src/lib/tempo/components/Tempo.jsx (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx new file mode 100644 index 00000000..9b68251c --- /dev/null +++ b/src/lib/tempo/components/Tempo.jsx @@ -0,0 +1,277 @@ +import { + CheckIcon, + ClockIcon, + EllipsisVerticalIcon, + MagnifyingGlassIcon, +} from '@heroicons/react/24/outline'; +import { toQuery } from 'lodash-contrib'; +import _ from 'lodash'; +import { useRouter } from 'next/router'; +import { useState } from 'react'; +import useInvoices from '../hooks/useInvoices'; +import Spinner from '@/core/components/elements/Spinner/Spinner'; +import Alert from '@/core/components/elements/Alert/Alert'; +import Pagination from '@/core/components/elements/Pagination/Pagination'; +import Link from '@/core/components/elements/Link/Link'; +import currencyFormat from '@/core/utils/currencyFormat'; +import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; +import { downloadInvoice, downloadTaxInvoice } from '../utils/invoices'; +import MobileView from '@/core/components/views/MobileView'; +import DesktopView from '@/core/components/views/DesktopView'; +import Menu from '@/lib/auth/components/Menu'; + +const Tempo = () => { + const router = useRouter(); + const { q = '', page = 1 } = router.query; + + const limit = 15; + + const query = { + name: q, + offset: (page - 1) * limit, + limit, + }; + const { invoices } = useInvoices({ query }); + + const [inputQuery, setInputQuery] = useState(q); + const [toOthers, setToOthers] = useState(null); + + const pageCount = Math.ceil(invoices?.data?.invoiceTotal / limit); + let pageQuery = _.omit(query, ['limit', 'offset']); + pageQuery = _.pickBy(pageQuery, _.identity); + pageQuery = toQuery(pageQuery); + + const handleSubmit = (e) => { + e.preventDefault(); + router.push(`/my/invoices?q=${inputQuery}`); + }; + + return ( + <> + +
+
+ setInputQuery(e.target.value)} + /> + +
+ + {invoices.isLoading && ( +
+ +
+ )} + + {!invoices.isLoading && invoices.data?.invoices?.length === 0 && ( + + Tidak ada invoice + + )} + + {invoices.data?.invoices?.map((invoice, index) => ( +
+
+ + + No. Invoice + +

{invoice.name}

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

{invoice.invoiceDate}

+

{invoice.paymentTerm}

+
+
+
+
+ + No. Purchase Order + +

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

+
+
+ + Total Invoice + +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ + {invoice.efaktur ? ( +
+ + Faktur Pajak +
+ ) : ( +
+ + Faktur Pajak +
+ )} +
+ ))} + + + + setToOthers(null)} + > +
+ + +
+
+
+
+ + +
+
+ +
+
+
+

+ Invoice & Faktur Pajak{' '} + {invoices?.data?.invoices + ? `(${invoices?.data?.invoices.length})` + : ''} +

+
+ setInputQuery(e.target.value)} + /> + +
+
+ + + + + + + + + + + + + + {invoices.isLoading && ( + + + + )} + {!invoices.isLoading && + (!invoices?.data?.invoices || + invoices?.data?.invoices?.length == 0) && ( + + + + )} + {invoices.data?.invoices?.map((invoice) => ( + + + + + + + + + ))} + +
No. InvoiceNo. POTanggalSalespersonStatusTotal
+
+ +
+
Tidak ada invoice
+ + {invoice.name} + + {invoice.purchaseOrderName || '-'}{invoice.invoiceDate}{invoice.sales} + {invoice.amountResidual > 0 ? ( +
+ Belum Lunas +
+ ) : ( +
+ Lunas +
+ )} +
+ {currencyFormat(invoice.amountTotal)} +
+ + +
+
+
+ + ); +}; + +export default Tempo; -- cgit v1.2.3 From f481bae4d28b770d85ca2340cff60acbec70d0ee Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 14 Nov 2024 09:45:15 +0700 Subject: --- src/lib/tempo/components/Tempo.jsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 9b68251c..c3cf621c 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -8,14 +8,17 @@ import { toQuery } from 'lodash-contrib'; import _ from 'lodash'; import { useRouter } from 'next/router'; import { useState } from 'react'; -import useInvoices from '../hooks/useInvoices'; +import useInvoices from '../../invoice/hooks/useInvoices'; import Spinner from '@/core/components/elements/Spinner/Spinner'; import Alert from '@/core/components/elements/Alert/Alert'; import Pagination from '@/core/components/elements/Pagination/Pagination'; import Link from '@/core/components/elements/Link/Link'; import currencyFormat from '@/core/utils/currencyFormat'; import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; -import { downloadInvoice, downloadTaxInvoice } from '../utils/invoices'; +import { + downloadInvoice, + downloadTaxInvoice, +} from '../../invoice/utils/invoices'; import MobileView from '@/core/components/views/MobileView'; import DesktopView from '@/core/components/views/DesktopView'; import Menu from '@/lib/auth/components/Menu'; @@ -183,13 +186,14 @@ const Tempo = () => {
+
+

Pembayaran Tempo

+

+ Jenis Tempo Pembayaran Anda adalah :{' '} + 7 Hari +

+
-

- Invoice & Faktur Pajak{' '} - {invoices?.data?.invoices - ? `(${invoices?.data?.invoices.length})` - : ''} -

Date: Thu, 14 Nov 2024 17:13:32 +0700 Subject: add penghajuan tempo --- src/lib/tempo/components/Tempo.jsx | 268 +++++++++++++++++++++++-------------- 1 file changed, 169 insertions(+), 99 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index c3cf621c..3f6e36d1 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -4,10 +4,10 @@ import { EllipsisVerticalIcon, MagnifyingGlassIcon, } from '@heroicons/react/24/outline'; -import { toQuery } from 'lodash-contrib'; +import { div, toQuery } from 'lodash-contrib'; import _ from 'lodash'; import { useRouter } from 'next/router'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import useInvoices from '../../invoice/hooks/useInvoices'; import Spinner from '@/core/components/elements/Spinner/Spinner'; import Alert from '@/core/components/elements/Alert/Alert'; @@ -22,8 +22,11 @@ import { import MobileView from '@/core/components/views/MobileView'; 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'; const Tempo = () => { + const auth = getAuth(); const router = useRouter(); const { q = '', page = 1 } = router.query; @@ -36,6 +39,8 @@ const Tempo = () => { }; const { invoices } = useInvoices({ query }); + const [isLoading, setIsLoading] = useState(true); + const [tempo, setTempo] = useState([]); const [inputQuery, setInputQuery] = useState(q); const [toOthers, setToOthers] = useState(null); @@ -48,9 +53,169 @@ const Tempo = () => { e.preventDefault(); router.push(`/my/invoices?q=${inputQuery}`); }; - + useEffect(() => { + const loadTempo = async () => { + setIsLoading(true); + const dataTempo = await odooApi( + 'GET', + `/api/v1/check/${auth.parentId}/tempo` + ); + setTempo(dataTempo); + setIsLoading(false); + }; + loadTempo(); + }, []); + const limitTempo = Math.round( + parseInt(tempo.amountDue + tempo.remainingLimit) + ); + const amountDue = Math.round(parseInt(tempo.amountDue)); + console.log('tempo', tempo); + const getLabel = () => { + if (Math.round((amountDue / limitTempo) * 100) >= 100) + return 'Limit Tempo mencapai batas'; + if (Math.round((amountDue / limitTempo) * 100) >= 50) return 'Hampir Habis'; + return ''; + }; return ( <> + +
+
+ +
+
+
+

Pembayaran Tempo

+

+ Jenis Tempo Pembayaran Anda adalah :{' '} + {!isLoading && ( + + {tempo.paymentTerm} + + )} +

+
+
+
+

Limit Tempo Terpakai

+

{!isLoading && currencyFormat(amountDue)}

+
+
+

Limit Tempo

+

{!isLoading && currencyFormat(limitTempo)}

+
+
+ +
+ + + {getLabel()} + +
+ +
+ + + setInputQuery(e.target.value)} + /> + +
+ + + + + + + + + + + + + + + {invoices.isLoading && ( + + + + )} + {!invoices.isLoading && + (!invoices?.data?.invoices || + invoices?.data?.invoices?.length == 0) && ( + + + + )} + {invoices.data?.invoices?.map((invoice) => ( + + + + + + + + + + ))} + +
No. InvoiceNo. TransaksiSalespersonTanggalJatuh TempoStatusTotal
+
+ +
+
Tidak ada invoice
+ + {invoice.name} + + {invoice.purchaseOrderName || '-'}{invoice.sales}{invoice.invoiceDate} + {invoice.amountResidual > 0 ? ( +
+ Belum Lunas +
+ ) : ( +
+ Lunas +
+ )} +
+ {invoice.amountResidual > 0 ? ( +
+ Belum Lunas +
+ ) : ( +
+ Lunas +
+ )} +
+ {currencyFormat(invoice.amountTotal)} +
+ + +
+
+
@@ -179,101 +344,6 @@ const Tempo = () => {
- - -
-
- -
-
-
-

Pembayaran Tempo

-

- Jenis Tempo Pembayaran Anda adalah :{' '} - 7 Hari -

-
-
- - setInputQuery(e.target.value)} - /> - - -
- - - - - - - - - - - - - - {invoices.isLoading && ( - - - - )} - {!invoices.isLoading && - (!invoices?.data?.invoices || - invoices?.data?.invoices?.length == 0) && ( - - - - )} - {invoices.data?.invoices?.map((invoice) => ( - - - - - - - - - ))} - -
No. InvoiceNo. POTanggalSalespersonStatusTotal
-
- -
-
Tidak ada invoice
- - {invoice.name} - - {invoice.purchaseOrderName || '-'}{invoice.invoiceDate}{invoice.sales} - {invoice.amountResidual > 0 ? ( -
- Belum Lunas -
- ) : ( -
- Lunas -
- )} -
- {currencyFormat(invoice.amountTotal)} -
- - -
-
-
); }; -- cgit v1.2.3 From cf92e065f057737071e6cd7c666a4f1c475bb613 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 15 Nov 2024 14:21:17 +0700 Subject: update pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 305 ++++++++++++++++++++++++------------- 1 file changed, 201 insertions(+), 104 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 3f6e36d1..ef516c64 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -4,6 +4,7 @@ import { EllipsisVerticalIcon, MagnifyingGlassIcon, } from '@heroicons/react/24/outline'; +import { Skeleton } from '@chakra-ui/react'; import { div, toQuery } from 'lodash-contrib'; import _ from 'lodash'; import { useRouter } from 'next/router'; @@ -25,33 +26,37 @@ 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'; const Tempo = () => { const auth = getAuth(); const router = useRouter(); - const { q = '', page = 1 } = router.query; + const { q = '', page = 1, limit = 15 } = router.query; - const limit = 15; + const [pageNew, setPageNew] = useState(page); + const [limitNew, setLimitNew] = useState(limit); const query = { name: q, - offset: (page - 1) * limit, - limit, + offset: (pageNew - 1) * limitNew, + limit: limitNew, }; const { invoices } = useInvoices({ query }); - + console.log('invoices', invoices); const [isLoading, setIsLoading] = useState(true); const [tempo, setTempo] = useState([]); const [inputQuery, setInputQuery] = useState(q); const [toOthers, setToOthers] = useState(null); - const pageCount = Math.ceil(invoices?.data?.invoiceTotal / limit); - let pageQuery = _.omit(query, ['limit', 'offset']); + const pageCount = Math.ceil(invoices?.data?.invoiceTotal / limitNew); + let pageQuery = _.omit(query, ['limitNew', 'offset']); + console.log('pageQuery1', pageQuery); pageQuery = _.pickBy(pageQuery, _.identity); + console.log('pageQuery2', pageQuery); pageQuery = toQuery(pageQuery); - + console.log('pageQuery3', pageQuery); const handleSubmit = (e) => { e.preventDefault(); - router.push(`/my/invoices?q=${inputQuery}`); + router.push(`/my/tempo?q=${inputQuery}`); }; useEffect(() => { const loadTempo = async () => { @@ -76,6 +81,8 @@ const Tempo = () => { if (Math.round((amountDue / limitTempo) * 100) >= 50) return 'Hampir Habis'; return ''; }; + const startItem = 1 + (pageNew - 1) * limitNew; + const endItem = Math.min(limitNew * pageNew, invoices?.data?.invoiceTotal); return ( <> @@ -83,26 +90,44 @@ const Tempo = () => {
-
+

Pembayaran Tempo

-

- Jenis Tempo Pembayaran Anda adalah :{' '} - {!isLoading && ( - - {tempo.paymentTerm} - - )} +

+ Jenis Tempo Pembayaran Anda adalah{' '} + + {' '} + {tempo.paymentTerm} +

Limit Tempo Terpakai

-

{!isLoading && currencyFormat(amountDue)}

+ + {currencyFormat(amountDue)} +

Limit Tempo

-

{!isLoading && currencyFormat(limitTempo)}

+ + {currencyFormat(limitTempo)} +
@@ -122,102 +147,174 @@ const Tempo = () => { {getLabel()}
+
+
+
+ + setInputQuery(e.target.value)} + /> +
+ {!invoices.isLoading && ( +
+

+ Menampilkan {startItem}-{endItem} dari{' '} + {invoices?.data?.invoiceTotal} +

+ +
+ )} +
-
-
- - setInputQuery(e.target.value)} - /> -
-
- - - - - - - - - - - - - - - {invoices.isLoading && ( +
No. InvoiceNo. TransaksiSalespersonTanggalJatuh TempoStatusTotal
+ - + + + + + + + - )} - {!invoices.isLoading && - (!invoices?.data?.invoices || - invoices?.data?.invoices?.length == 0) && ( + + + {invoices.isLoading && ( - + )} - {invoices.data?.invoices?.map((invoice) => ( - - - - - - - - - - ))} - -
-
- -
-
No. InvoiceNo. TransaksiSalespersonTanggalJatuh TempoStatusTotal
Tidak ada invoice +
+ +
+
- - {invoice.name} - - {invoice.purchaseOrderName || '-'}{invoice.sales}{invoice.invoiceDate} - {invoice.amountResidual > 0 ? ( -
- Belum Lunas -
- ) : ( -
- Lunas -
- )} -
- {invoice.amountResidual > 0 ? ( -
- Belum Lunas -
- ) : ( -
- Lunas -
- )} -
- {currencyFormat(invoice.amountTotal)} -
+ {!invoices.isLoading && + (!invoices?.data?.invoices || + invoices?.data?.invoices?.length == 0) && ( + + Tidak ada invoice + + )} + {invoices.data?.invoices?.map((invoice) => ( + + + + {invoice.name} + + + {invoice.salesOrder || '-'} + {invoice.sales} + {invoice.invoiceDate} + {invoice.invoiceDateDue} + + {invoice.amountResidual > 0 ? ( +
+ Belum Lunas +
+ ) : ( +
+ Lunas +
+ )} + + + {currencyFormat(invoice.amountTotal)} + + + ))} + + - + +
+
+ +
+
+
+

+ Jenis Tempo Pembayaran Anda adalah{' '} + + {' '} + {tempo.paymentTerm} + +

+
+
+
+

Limit Tempo Terpakai

+ + {currencyFormat(amountDue)} + +
+
+

Limit Tempo

+ + {currencyFormat(limitTempo)} + +
+
+
+
+ + + {getLabel()} + +
{ -- cgit v1.2.3 From f906429778e932e2cdbdee05492e697a090a469c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 15 Nov 2024 15:21:21 +0700 Subject: update code --- src/lib/tempo/components/Tempo.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index ef516c64..7d9ede7d 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -83,6 +83,11 @@ const Tempo = () => { }; const startItem = 1 + (pageNew - 1) * limitNew; const endItem = Math.min(limitNew * pageNew, invoices?.data?.invoiceTotal); + const getDueDate = (invoice) => { + const [day, month, year] = invoice.split('/'); + const dueDate = new Date(year, month - 1, day); // Konversi ke objek Date + return dueDate; + }; return ( <> @@ -227,7 +232,9 @@ const Tempo = () => { {invoice.amountResidual > 0 ? (
- Belum Lunas + {new Date() > getDueDate(invoice.invoiceDateDue) + ? 'Jatuh Tempo' + : 'Belum Lunas'}
) : (
-- cgit v1.2.3 From 0a84e659a4ac55207ca9624977be6bf771c3abe9 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 15 Nov 2024 17:10:46 +0700 Subject: update --- src/lib/tempo/components/Tempo.jsx | 106 ++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 43 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 7d9ede7d..bfeddfbb 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -88,6 +88,18 @@ const Tempo = () => { const dueDate = new Date(year, month - 1, day); // Konversi ke objek Date return dueDate; }; + + const formatTanggal = (tanggalInput) => { + const [day, month, year] = tanggalInput.split('/'); + const date = new Date(year, month - 1, day); + const formattedDate = new Intl.DateTimeFormat('id-ID', { + day: '2-digit', + month: 'short', + year: 'numeric', + }).format(date); + + return formattedDate; + }; return ( <> @@ -265,45 +277,43 @@ const Tempo = () => {
-
-
-
-

- Jenis Tempo Pembayaran Anda adalah{' '} - - {' '} - {tempo.paymentTerm} - -

+
+
+

+ Jenis Tempo Pembayaran Anda adalah{' '} + + {' '} + {tempo.paymentTerm} + +

+
+
+
+

Limit Tempo Terpakai

+ + {currencyFormat(amountDue)} +
-
-
-

Limit Tempo Terpakai

- - {currencyFormat(amountDue)} - -
-
-

Limit Tempo

- - {currencyFormat(limitTempo)} - -
+
+

Limit Tempo

+ + {currencyFormat(limitTempo)} +
@@ -322,6 +332,8 @@ const Tempo = () => { {getLabel()}
+
+
{
- No. Invoice + No. Transaksi -

{invoice.name}

+

+ {invoice.salesOrder} +

{invoice.amountResidual > 0 ? (
- Belum Lunas + {new Date() > getDueDate(invoice.invoiceDateDue) + ? 'Jatuh Tempo' + : 'Belum Lunas'}
) : (
Lunas
@@ -375,8 +391,12 @@ const Tempo = () => {
-

{invoice.invoiceDate}

-

{invoice.paymentTerm}

+

+ {formatTanggal(invoice.invoiceDate)} +

+

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


-- cgit v1.2.3 From 13b9b5dd101e6dba13ddcf04aff42cfb4156c4d8 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 16 Nov 2024 09:50:43 +0700 Subject: update --- src/lib/tempo/components/Tempo.jsx | 42 ++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index bfeddfbb..8fb55147 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -116,7 +116,7 @@ const Tempo = () => { isLoaded={!isLoading} h='fit' w={32} - className='badge-solid-green px-2 text-sm flex items-center justify-center font-thin' + className='badge-solid-green px-1 text-sm flex items-center justify-center font-thin' > {' '} {tempo.paymentTerm} @@ -125,7 +125,7 @@ const Tempo = () => {
-

Limit Tempo Terpakai

+

Kredit Limit Terpakai

{
-

Limit Tempo

+

Sisa Kredit Limit

+ + {currencyFormat(Math.round(parseInt(limitTempo - amountDue)))} + +
+
+

Kredit Limit

{ {invoice.invoiceDateDue} {invoice.amountResidual > 0 ? ( -
- {new Date() > getDueDate(invoice.invoiceDateDue) - ? 'Jatuh Tempo' - : 'Belum Lunas'} -
+ new Date() > getDueDate(invoice.invoiceDateDue) ? ( +
+ Jatuh Tempo +
+ ) : ( +
+ Belum Lunas +
+ ) ) : (
Lunas @@ -304,6 +319,17 @@ const Tempo = () => { {currencyFormat(amountDue)}
+
+

Sisa Kredit Limit

+ + {currencyFormat(Math.round(parseInt(limitTempo - amountDue)))} + +

Limit Tempo

Date: Mon, 18 Nov 2024 13:43:26 +0700 Subject: add pengajuan tempo detail --- src/lib/tempo/components/Tempo.jsx | 157 ++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 80 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 8fb55147..71dd0f64 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -41,7 +41,6 @@ const Tempo = () => { limit: limitNew, }; const { invoices } = useInvoices({ query }); - console.log('invoices', invoices); const [isLoading, setIsLoading] = useState(true); const [tempo, setTempo] = useState([]); const [inputQuery, setInputQuery] = useState(q); @@ -49,11 +48,8 @@ const Tempo = () => { const pageCount = Math.ceil(invoices?.data?.invoiceTotal / limitNew); let pageQuery = _.omit(query, ['limitNew', 'offset']); - console.log('pageQuery1', pageQuery); pageQuery = _.pickBy(pageQuery, _.identity); - console.log('pageQuery2', pageQuery); pageQuery = toQuery(pageQuery); - console.log('pageQuery3', pageQuery); const handleSubmit = (e) => { e.preventDefault(); router.push(`/my/tempo?q=${inputQuery}`); @@ -74,7 +70,6 @@ const Tempo = () => { parseInt(tempo.amountDue + tempo.remainingLimit) ); const amountDue = Math.round(parseInt(tempo.amountDue)); - console.log('tempo', tempo); const getLabel = () => { if (Math.round((amountDue / limitTempo) * 100) >= 100) return 'Limit Tempo mencapai batas'; @@ -292,72 +287,74 @@ const Tempo = () => {
-
-
-

- Jenis Tempo Pembayaran Anda adalah{' '} - - {' '} - {tempo.paymentTerm} - -

-
-
-
-

Limit Tempo Terpakai

- - {currencyFormat(amountDue)} - +
+
+
+

+ Jenis Tempo Pembayaran Anda adalah{' '} + + {' '} + {tempo.paymentTerm} + +

-
-

Sisa Kredit Limit

- - {currencyFormat(Math.round(parseInt(limitTempo - amountDue)))} - +
+
+

Limit Tempo Terpakai

+ + {currencyFormat(amountDue)} + +
+
+

Sisa Kredit Limit

+ + {currencyFormat(Math.round(parseInt(limitTempo - amountDue)))} + +
+
+

Limit Tempo

+ + {currencyFormat(limitTempo)} + +
-
-

Limit Tempo

- - {currencyFormat(limitTempo)} - +
+ + + {getLabel()} +
-
- - - {getLabel()} - -
@@ -391,7 +388,7 @@ const Tempo = () => { key={index} >
- + No. Transaksi @@ -399,7 +396,7 @@ const Tempo = () => { {invoice.salesOrder} -
+
{invoice.amountResidual > 0 ? (
{new Date() > getDueDate(invoice.invoiceDateDue) @@ -409,13 +406,13 @@ const Tempo = () => { ) : (
Lunas
)} - setToOthers(invoice)} - /> + /> */}
- +

{formatTanggal(invoice.invoiceDate)} @@ -428,23 +425,23 @@ const Tempo = () => {

- No. Purchase Order + No. Invoice -

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

+ {invoice.name || '-'}

- - Total Invoice + + Total Belanja -

+

{currencyFormat(invoice.amountTotal)}

- {invoice.efaktur ? ( + {/* {invoice.efaktur ? (
Faktur Pajak @@ -454,7 +451,7 @@ const Tempo = () => { Faktur Pajak
- )} + )} */}
))} -- cgit v1.2.3 From 00cbfa62bf4c5784b1c49c766cc2a53749a6cc43 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 21 Nov 2024 16:38:57 +0700 Subject: edit pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 71dd0f64..d8af450d 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -305,7 +305,7 @@ const Tempo = () => {
-

Limit Tempo Terpakai

+

Kredit Limit Terpakai

{
-

Limit Tempo

+

Kredit Limit

{ {invoice.salesOrder} -
+
{invoice.amountResidual > 0 ? ( -
- {new Date() > getDueDate(invoice.invoiceDateDue) - ? 'Jatuh Tempo' - : 'Belum Lunas'} -
+ new Date() > getDueDate(invoice.invoiceDateDue) ? ( +
+ Jatuh Tempo +
+ ) : ( +
+ Belum Lunas +
+ ) ) : (
Lunas
)} -- cgit v1.2.3 From 35793c84f780e0de60a5e833343949e980d3a63f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 23 Nov 2024 13:35:14 +0700 Subject: update --- src/lib/tempo/components/Tempo.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index d8af450d..80d593e6 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -113,8 +113,7 @@ const Tempo = () => { w={32} className='badge-solid-green px-1 text-sm flex items-center justify-center font-thin' > - {' '} - {tempo.paymentTerm} + {tempo.paymentTerm ? tempo.paymentTerm : 'Review'}

@@ -127,7 +126,7 @@ const Tempo = () => { // w={16} className='text-3xl font-semibold' > - {currencyFormat(amountDue)} + {amountDue ? currencyFormat(amountDue) : '-'}
@@ -138,7 +137,11 @@ const Tempo = () => { // w={16} className='text-3xl font-semibold' > - {currencyFormat(Math.round(parseInt(limitTempo - amountDue)))} + {limitTempo && amountDue + ? currencyFormat( + Math.round(parseInt(limitTempo - amountDue)) + ) + : '-'}
@@ -149,7 +152,7 @@ const Tempo = () => { // w={16} className='text-3xl font-semibold' > - {currencyFormat(limitTempo)} + {limitTempo ? currencyFormat(limitTempo) : '-'}
-- cgit v1.2.3 From 9a49b8d84761781531cb417731cb9ef802f63541 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 4 Dec 2024 10:59:21 +0700 Subject: update pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 80d593e6..e6c3959d 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -301,8 +301,7 @@ const Tempo = () => { w={24} className='badge-solid-green px-1 text-xs flex items-center justify-center font-thin' > - {' '} - {tempo.paymentTerm} + {tempo.paymentTerm ? tempo.paymentTerm : 'Review'}

-- cgit v1.2.3 From e9cd13307f0095dc4edc5048752675d80c551564 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 6 Dec 2024 17:06:26 +0700 Subject: pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 217 ++++++++++++++++++++----------------- 1 file changed, 116 insertions(+), 101 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index e6c3959d..95eb461f 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -27,11 +27,13 @@ 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'; const Tempo = () => { const auth = getAuth(); const router = useRouter(); const { q = '', page = 1, limit = 15 } = router.query; - + const { isDesktop, isMobile } = useDevice(); const [pageNew, setPageNew] = useState(page); const [limitNew, setLimitNew] = useState(limit); @@ -173,116 +175,129 @@ const Tempo = () => { {getLabel()}
-
-
- - - setInputQuery(e.target.value)} - /> - - {!invoices.isLoading && ( -
-

- Menampilkan {startItem}-{endItem} dari{' '} - {invoices?.data?.invoiceTotal} -

- -
- )} + {!invoices?.data?.invoices || + invoices?.data?.invoices?.length == 0 ? ( +
+ Registrasi Tempo
+ ) : ( +
+
+
+ + setInputQuery(e.target.value)} + /> +
+ {!invoices.isLoading && ( +
+

+ Menampilkan {startItem}-{endItem} dari{' '} + {invoices?.data?.invoiceTotal} +

+ +
+ )} +
- - - - - - - - - - - - - - {invoices.isLoading && ( +
No. InvoiceNo. TransaksiSalespersonTanggalJatuh TempoStatusTotal
+ - + + + + + + + - )} - {!invoices.isLoading && - (!invoices?.data?.invoices || - invoices?.data?.invoices?.length == 0) && ( + + + {invoices.isLoading && ( - + )} - {invoices.data?.invoices?.map((invoice) => ( - - - - - - - + + + )} + {invoices.data?.invoices?.map((invoice) => ( + + + + + + + - - - ))} - -
-
- -
-
No. InvoiceNo. TransaksiSalespersonTanggalJatuh TempoStatusTotal
Tidak ada invoice +
+ +
+
- - {invoice.name} - - {invoice.salesOrder || '-'}{invoice.sales}{invoice.invoiceDate}{invoice.invoiceDateDue} - {invoice.amountResidual > 0 ? ( - new Date() > getDueDate(invoice.invoiceDateDue) ? ( -
- Jatuh Tempo -
+ {!invoices.isLoading && + (!invoices?.data?.invoices || + invoices?.data?.invoices?.length == 0) && ( +
Tidak ada Invoice
+ + {invoice.name} + + {invoice.salesOrder || '-'}{invoice.sales}{invoice.invoiceDate}{invoice.invoiceDateDue} + {invoice.amountResidual > 0 ? ( + new Date() > getDueDate(invoice.invoiceDateDue) ? ( +
+ Jatuh Tempo +
+ ) : ( +
+ Belum Lunas +
+ ) ) : ( -
- Belum Lunas +
+ Lunas
- ) - ) : ( -
- Lunas -
- )} -
- {currencyFormat(invoice.amountTotal)} -
+ )} + + + {currencyFormat(invoice.amountTotal)} + + + ))} + + + + +
+ )} - -
-- cgit v1.2.3 From f2451beed670dc697aa2026b2df6ad1ad1e90da2 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 9 Dec 2024 15:00:45 +0700 Subject: update pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 95eb461f..33c5bae6 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -61,7 +61,7 @@ const Tempo = () => { setIsLoading(true); const dataTempo = await odooApi( 'GET', - `/api/v1/check/${auth.parentId}/tempo` + `/api/v1/check/${auth.partnerId}/tempo` ); setTempo(dataTempo); setIsLoading(false); @@ -329,7 +329,7 @@ const Tempo = () => { // w={16} className='font-semibold text-base' > - {currencyFormat(amountDue)} + {amountDue ? currencyFormat(amountDue) : '-'}
@@ -340,7 +340,11 @@ const Tempo = () => { // w={16} className='font-semibold text-base' > - {currencyFormat(Math.round(parseInt(limitTempo - amountDue)))} + {limitTempo && amountDue + ? currencyFormat( + Math.round(parseInt(limitTempo - amountDue)) + ) + : '-'}
@@ -351,7 +355,7 @@ const Tempo = () => { // w={16} className=' font-semibold text-base' > - {currencyFormat(limitTempo)} + {limitTempo ? currencyFormat(limitTempo) : '-'}
-- cgit v1.2.3 From 0f84963214ee6dc5b5a44d945540826a66bec9e0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 11 Dec 2024 11:51:45 +0700 Subject: update pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 33c5bae6..dc8307c8 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -175,8 +175,7 @@ const Tempo = () => { {getLabel()}
- {!invoices?.data?.invoices || - invoices?.data?.invoices?.length == 0 ? ( + {tempo.length > 0 && !tempo.paymentTerm ? (
Date: Fri, 13 Dec 2024 14:18:03 +0700 Subject: update pengajuan tempo request --- src/lib/tempo/components/Tempo.jsx | 50 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index dc8307c8..8a7f4f71 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -108,7 +108,7 @@ const Tempo = () => {

Pembayaran Tempo

- Jenis Tempo Pembayaran Anda adalah{' '} + Status Detail Tempo Pembayaran Anda adalah{' '} { {getLabel()}

- {tempo.length > 0 && !tempo.paymentTerm ? ( + {auth?.tempoProgres == 'review' && !tempo.paymentTerm ? (
{ {invoice.amountResidual > 0 ? ( new Date() > getDueDate(invoice.invoiceDateDue) ? ( -
+
Jatuh Tempo
) : ( -
- Belum Lunas +
+ Belum Jatuh Tempo
) ) : ( @@ -308,7 +308,7 @@ const Tempo = () => {

- Jenis Tempo Pembayaran Anda adalah{' '} + Status Detail Tempo Pembayaran Anda adalah{' '} {

-
- setInputQuery(e.target.value)} - /> - -
+ {!invoices.isLoading && invoices.data?.invoices?.length != 0 && ( +
+ setInputQuery(e.target.value)} + /> + +
+ )} {invoices.isLoading && (
@@ -397,9 +399,15 @@ const Tempo = () => { )} {!invoices.isLoading && invoices.data?.invoices?.length === 0 && ( - - Tidak ada invoice - + // + // Tidak ada invoice + // + Registrasi Tempo )} {invoices.data?.invoices?.map((invoice, index) => ( -- cgit v1.2.3 From 0178a1f88d7d34824562e1413be073c0795a47cf Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 16 Dec 2024 17:42:31 +0700 Subject: update code --- src/lib/tempo/components/Tempo.jsx | 134 +++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 64 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 8a7f4f71..97b21454 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -113,7 +113,9 @@ const Tempo = () => { isLoaded={!isLoading} h='fit' w={32} - className='badge-solid-green px-1 text-sm flex items-center justify-center font-thin' + className={`${ + tempo.paymentTerm ? 'badge-solid-green' : 'badge-yellow' + } px-1 text-sm flex items-center justify-center font-thin`} > {tempo.paymentTerm ? tempo.paymentTerm : 'Review'} @@ -175,7 +177,7 @@ const Tempo = () => { {getLabel()}
- {auth?.tempoProgres == 'review' && !tempo.paymentTerm ? ( + {auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? (
{ isLoaded={!isLoading} h='fit' w={24} - className='badge-solid-green px-1 text-xs flex items-center justify-center font-thin' + className={`${ + tempo.paymentTerm ? 'badge-solid-green' : 'badge-yellow' + } px-1 text-xs flex items-center justify-center font-thin`} > {tempo.paymentTerm ? tempo.paymentTerm : 'Review'} @@ -377,7 +381,7 @@ const Tempo = () => {
- {!invoices.isLoading && invoices.data?.invoices?.length != 0 && ( + {auth && !auth?.tempoProgres == 'review' && tempo.paymentTerm && (
{
)} - {!invoices.isLoading && invoices.data?.invoices?.length === 0 && ( + {auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? ( // // Tidak ada invoice // @@ -408,72 +412,73 @@ const Tempo = () => { width={isMobile ? 300 : 600} height={isMobile ? 300 : 550} /> - )} - - {invoices.data?.invoices?.map((invoice, index) => ( -
-
- - - No. Transaksi - -

- {invoice.salesOrder} -

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

+ {invoice.salesOrder} +

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

- {formatTanggal(invoice.invoiceDate)} -

-

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

-
-
-
-
- - No. Invoice - -

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

+

+ {formatTanggal(invoice.invoiceDate)}

-
-
- - Total Belanja - -

- {currencyFormat(invoice.amountTotal)} +

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

-
- - {/* {invoice.efaktur ? ( +
+
+
+ + No. Invoice + +

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

+
+
+ + Total Belanja + +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ + {/* {invoice.efaktur ? (
Faktur Pajak @@ -484,8 +489,9 @@ const Tempo = () => { Faktur Pajak
)} */} -
- ))} +
+ )) + )} Date: Mon, 23 Dec 2024 13:39:47 +0700 Subject: update pengajuan tempo --- src/lib/tempo/components/Tempo.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 97b21454..6f0a2a8c 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -323,7 +323,7 @@ const Tempo = () => {

-
+

Kredit Limit Terpakai

{ // // Tidak ada invoice // - Registrasi Tempo +
+ Registrasi Tempo +
) : ( invoices.data?.invoices?.map((invoice, index) => (
Date: Thu, 9 Jan 2025 08:53:25 +0700 Subject: update tempo --- src/lib/tempo/components/Tempo.jsx | 194 ++++++++++++++++++++++++++++++------- 1 file changed, 160 insertions(+), 34 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 6f0a2a8c..f2a9e650 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -29,18 +29,22 @@ 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'; +import { Tooltip } from '@chakra-ui/react'; +import { InfoIcon } from 'lucide-react'; const Tempo = () => { const auth = getAuth(); const router = useRouter(); - const { q = '', page = 1, limit = 15 } = router.query; + const { q = '', page = 1, limit = 15, status = 0 } = router.query; const { isDesktop, isMobile } = useDevice(); const [pageNew, setPageNew] = useState(page); const [limitNew, setLimitNew] = useState(limit); + const [statusNew, setStatusNew] = useState(status); const query = { name: q, offset: (pageNew - 1) * limitNew, limit: limitNew, + status: statusNew, }; const { invoices } = useInvoices({ query }); const [isLoading, setIsLoading] = useState(true); @@ -71,7 +75,7 @@ const Tempo = () => { const limitTempo = Math.round( parseInt(tempo.amountDue + tempo.remainingLimit) ); - const amountDue = Math.round(parseInt(tempo.amountDue)); + const amountDue = Math.round(parseInt(tempo.amountDue + tempo.amountDueSale)); const getLabel = () => { if (Math.round((amountDue / limitTempo) * 100) >= 100) return 'Limit Tempo mencapai batas'; @@ -79,7 +83,13 @@ const Tempo = () => { return ''; }; const startItem = 1 + (pageNew - 1) * limitNew; - const endItem = Math.min(limitNew * pageNew, invoices?.data?.invoiceTotal); + const endItem = Math.min( + limitNew * pageNew, + invoices?.data?.invoiceTotal + + (statusNew === 0 || statusNew === 2 || statusNew === 4 + ? invoices?.data?.saleOrderTotal + : 0) + ); const getDueDate = (invoice) => { const [day, month, year] = invoice.split('/'); const dueDate = new Date(year, month - 1, day); // Konversi ke objek Date @@ -97,6 +107,13 @@ const Tempo = () => { return formattedDate; }; + + const handleClick = () => { + setStatusNew((prevStatus) => (prevStatus === 4 ? 0 : 4)); // Toggle antara 4 dan 0 + }; + const handleClickInvoice = () => { + setStatusNew((prevStatus) => (prevStatus === 1 ? 0 : 1)); // Toggle antara 4 dan 0 + }; return ( <> @@ -107,6 +124,27 @@ const Tempo = () => {

Pembayaran Tempo

+
+

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

+ +
+ +
+
+

Status Detail Tempo Pembayaran Anda adalah{' '} {

-
-
-

Kredit Limit Terpakai

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

Sisa Kredit Limit

{limitTempo && amountDue ? currencyFormat( @@ -148,31 +175,72 @@ const Tempo = () => { : '-'}
-
-

Kredit Limit

+
+
+

Kredit Limit Terpakai

+ + {amountDue ? currencyFormat(amountDue) : '-'} + +
+
+ {tempo.amountDueTotal + ? tempo.amountDueTotal + + tempo.amountDueSaleTotal + + ` Transaksi` + : ''} +
+
+
+
+

Jatuh Tempo

+ + {tempo.amountJatuhTempo + ? currencyFormat(tempo.amountJatuhTempo) + : '-'} + +
+
+ {tempo.amountJatuhTempoTotal + ? tempo.amountJatuhTempoTotal + ` Invoice` + : ''} +
+
+ {/*
+

Jatuh Tempo

- {limitTempo ? currencyFormat(limitTempo) : '-'} + {tempo.amountJatuhTempo + ? currencyFormat(tempo.amountJatuhTempo) + : '-'} -
+
*/}
- {getLabel()} @@ -187,7 +255,7 @@ const Tempo = () => { />
) : ( -
+
@@ -236,6 +320,48 @@ const Tempo = () => { Total + + {/* {invoices.isLoading && ( + + +
+ +
+ + + )} */} + {/* {!invoices.isLoading && + (!invoices?.data?.saleOrders || + invoices?.data?.saleOrders?.length == 0) && ( + + Tidak ada orders + + )} */} + {(statusNew == 0 || statusNew == 2 || statusNew == 4) && + invoices.data?.saleOrders?.map((orders) => ( + + {orders.salesOrder || '-'} + + + {orders.name} + + + {orders.sales} + {orders.dateOrder.split(' ')[0]} + - + + { +
+ Belum Jatuh Tempo +
+ } + + + {currencyFormat(orders.amountTotal)} + + + ))} + {invoices.isLoading && ( -- cgit v1.2.3 From ad3418b4181a79485b0feb6882d6ae4ec744c776 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 9 Jan 2025 09:51:23 +0700 Subject: update tempo --- src/lib/tempo/components/Tempo.jsx | 40 +++++++------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index f2a9e650..b79824fa 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -76,12 +76,7 @@ const Tempo = () => { parseInt(tempo.amountDue + tempo.remainingLimit) ); const amountDue = Math.round(parseInt(tempo.amountDue + tempo.amountDueSale)); - const getLabel = () => { - if (Math.round((amountDue / limitTempo) * 100) >= 100) - return 'Limit Tempo mencapai batas'; - if (Math.round((amountDue / limitTempo) * 100) >= 50) return 'Hampir Habis'; - return ''; - }; + const startItem = 1 + (pageNew - 1) * limitNew; const endItem = Math.min( limitNew * pageNew, @@ -159,13 +154,13 @@ const Tempo = () => {

-
+

Sisa Kredit Limit

{limitTempo && amountDue @@ -176,7 +171,7 @@ const Tempo = () => {
{ {amountDue ? currencyFormat(amountDue) : '-'} @@ -201,7 +196,7 @@ const Tempo = () => {
{ {tempo.amountJatuhTempo @@ -240,11 +235,6 @@ const Tempo = () => {
*/}
-
- - {getLabel()} - -
{auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? (
{
-
- - - {getLabel()} - -
-- cgit v1.2.3 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/tempo/components/Tempo.jsx | 305 +++++++++++++++++++++++++------------ 1 file changed, 209 insertions(+), 96 deletions(-) (limited to 'src/lib/tempo/components') 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 +
+ )} */}
- )} */} -
- )) + ))} +
)} -- cgit v1.2.3 From 40f762589601de0fe1d5b06164b2553ebdbf5ecd Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 11 Jan 2025 09:27:46 +0700 Subject: update code --- src/lib/tempo/components/Tempo.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/tempo/components') diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx index 3af5b56c..c246f3d8 100644 --- a/src/lib/tempo/components/Tempo.jsx +++ b/src/lib/tempo/components/Tempo.jsx @@ -33,7 +33,7 @@ import { InfoIcon } from 'lucide-react'; const Tempo = () => { const auth = getAuth(); const router = useRouter(); - const { q = '', page = 1, limit = 15, status = 0 } = router.query; + const { q = '', page = 1, limit = 15, status = '' } = router.query; const { isDesktop, isMobile } = useDevice(); const [pageNew, setPageNew] = useState(page); const [limitNew, setLimitNew] = useState(limit); @@ -282,7 +282,7 @@ const Tempo = () => {