From f906429778e932e2cdbdee05492e697a090a469c Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 15 Nov 2024 15:21:21 +0700
Subject: <iman> update code

---
 src/lib/tempo/components/Tempo.jsx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'src/lib/tempo/components/Tempo.jsx')

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 (
     <>
       <DesktopView>
@@ -227,7 +232,9 @@ const Tempo = () => {
                       <td>
                         {invoice.amountResidual > 0 ? (
                           <div className='badge-solid-red h-fit mx-auto'>
-                            Belum Lunas
+                            {new Date() > getDueDate(invoice.invoiceDateDue)
+                              ? 'Jatuh Tempo'
+                              : 'Belum Lunas'}
                           </div>
                         ) : (
                           <div className='badge-solid-green h-fit mx-auto'>
-- 
cgit v1.2.3

