diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-12-16 17:42:31 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-12-16 17:42:31 +0700 |
| commit | 0178a1f88d7d34824562e1413be073c0795a47cf (patch) | |
| tree | 20a26bd36d2c8e0c3e09681836eea9f403519f70 /src/lib/tempo | |
| parent | 4711fff3bf3b07c50f353a7c5956055a37a5e4d2 (diff) | |
<iman> update code
Diffstat (limited to 'src/lib/tempo')
| -rw-r--r-- | src/lib/tempo/components/Tempo.jsx | 134 |
1 files changed, 70 insertions, 64 deletions
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'} </Skeleton> @@ -175,7 +177,7 @@ const Tempo = () => { {getLabel()} </span> </div> - {auth?.tempoProgres == 'review' && !tempo.paymentTerm ? ( + {auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? ( <div className='flex justify-center'> <Image src='/images/ICON-DOKUMEN-VERIFIKASI.png' @@ -313,7 +315,9 @@ const Tempo = () => { 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'} </Skeleton> @@ -377,7 +381,7 @@ const Tempo = () => { </div> </div> <div className='p-4 flex flex-col gap-y-4'> - {!invoices.isLoading && invoices.data?.invoices?.length != 0 && ( + {auth && !auth?.tempoProgres == 'review' && tempo.paymentTerm && ( <form className='flex gap-x-3' onSubmit={handleSubmit}> <input type='text' @@ -398,7 +402,7 @@ const Tempo = () => { </div> )} - {!invoices.isLoading && invoices.data?.invoices?.length === 0 && ( + {auth && auth?.tempoProgres == 'review' && !tempo.paymentTerm ? ( // <Alert type='info' className='text-center'> // Tidak ada invoice // </Alert> @@ -408,72 +412,73 @@ const Tempo = () => { width={isMobile ? 300 : 600} height={isMobile ? 300 : 550} /> - )} - - {invoices.data?.invoices?.map((invoice, index) => ( - <div - className='p-4 shadow border border-gray_r-3 rounded-md' - key={index} - > - <div className='grid grid-cols-2'> - <Link href={`/my/quotations/${invoice.salesOrderId}`}> - <span className='text-caption-2 text-gray_r-11'> - No. Transaksi - </span> - <h2 className='font-semibold text-black mt-1'> - {invoice.salesOrder} - </h2> - </Link> - <div className='flex gap-x-1 justify-end items-end '> - {invoice.amountResidual > 0 ? ( - new Date() > getDueDate(invoice.invoiceDateDue) ? ( - <div className='inline-flex items-end rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/20'> - Jatuh Tempo - </div> + ) : ( + invoices.data?.invoices?.map((invoice, index) => ( + <div + className='p-4 shadow border border-gray_r-3 rounded-md' + key={index} + > + <div className='grid grid-cols-2'> + <Link href={`/my/quotations/${invoice.salesOrderId}`}> + <span className='text-caption-2 text-gray_r-11'> + No. Transaksi + </span> + <h2 className='font-semibold text-black mt-1'> + {invoice.salesOrder} + </h2> + </Link> + <div className='flex gap-x-1 justify-end items-end '> + {invoice.amountResidual > 0 ? ( + new Date() > getDueDate(invoice.invoiceDateDue) ? ( + <div className='inline-flex items-end rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/20'> + Jatuh Tempo + </div> + ) : ( + <div className='badge-solid-red h-fit ml-auto'> + Belum Lunas + </div> + ) ) : ( - <div className='badge-solid-red h-fit ml-auto'> - Belum Lunas + <div className='badge-solid-green h-fit ml-auto'> + Lunas </div> - ) - ) : ( - <div className='badge-solid-green h-fit ml-auto'>Lunas</div> - )} - {/* <EllipsisVerticalIcon + )} + {/* <EllipsisVerticalIcon className='w-5 h-5' onClick={() => setToOthers(invoice)} /> */} + </div> </div> - </div> - <Link href={`/my/invoices/${invoice.id}`}> - <div className='grid grid-cols-2 text-caption-2 text-gray_r-11 mt-2 font-normal'> - <p className='opacity-70'> - {formatTanggal(invoice.invoiceDate)} - </p> - <p className='text-right text-xs text-red-500'> - Jatuh Tempo: {formatTanggal(invoice.invoiceDateDue)} - </p> - </div> - <hr className='my-3' /> - <div className='grid grid-cols-2'> - <div> - <span className='text-caption-2 text-gray_r-11'> - No. Invoice - </span> - <p className='mt-1 font-semibold text-gray_r-12'> - {invoice.name || '-'} + <Link href={`/my/invoices/${invoice.id}`}> + <div className='grid grid-cols-2 text-caption-2 text-gray_r-11 mt-2 font-normal'> + <p className='opacity-70'> + {formatTanggal(invoice.invoiceDate)} </p> - </div> - <div className='text-right'> - <span className='opacity-65 text-caption-2 text-gray_r-11'> - Total Belanja - </span> - <p className='mt-1 font-semibold text-red-500 '> - {currencyFormat(invoice.amountTotal)} + <p className='text-right text-xs text-red-500'> + Jatuh Tempo: {formatTanggal(invoice.invoiceDateDue)} </p> </div> - </div> - </Link> - {/* {invoice.efaktur ? ( + <hr className='my-3' /> + <div className='grid grid-cols-2'> + <div> + <span className='text-caption-2 text-gray_r-11'> + No. Invoice + </span> + <p className='mt-1 font-semibold text-gray_r-12'> + {invoice.name || '-'} + </p> + </div> + <div className='text-right'> + <span className='opacity-65 text-caption-2 text-gray_r-11'> + Total Belanja + </span> + <p className='mt-1 font-semibold text-red-500 '> + {currencyFormat(invoice.amountTotal)} + </p> + </div> + </div> + </Link> + {/* {invoice.efaktur ? ( <div className='badge-green h-fit mt-3 ml-auto flex items-center gap-x-0.5'> <CheckIcon className='w-4 stroke-2' /> Faktur Pajak @@ -484,8 +489,9 @@ const Tempo = () => { Faktur Pajak </div> )} */} - </div> - ))} + </div> + )) + )} <Pagination pageCount={pageCount} |
