From 3f070a917666b5838fb433fa5d5e93d9753eb6fb Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Aug 2025 09:11:12 +0700
Subject: <hafid> export xls&csv

---
 src/lib/transaction/components/Transactions.jsx | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

(limited to 'src/lib/transaction/components/Transactions.jsx')

diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx
index acb925da..c1515bc5 100644
--- a/src/lib/transaction/components/Transactions.jsx
+++ b/src/lib/transaction/components/Transactions.jsx
@@ -127,6 +127,16 @@ const Transactions = ({ context = '' }) => {
     { id: 'cancel', label: 'Pesanan Dibatalkan' },
   ];
 
+  const contextLabelMap = {
+    draft: 'Pending Quotation',
+    waiting: 'Pesanan Diproses',
+    sale: 'Pesanan Dikemas',
+    partial_shipping: 'Dikirim Sebagian',
+    shipping: 'Pesanan Dikirim',
+    done: 'Pesanan Selesai',
+    cancel: 'Pesanan Dibatalkan',
+  };
+
   const sortes = [
     { id: 'none', label: 'Urutkan' },
     { id: 'asc', label: 'dari yang terkecil' },
@@ -199,7 +209,7 @@ const Transactions = ({ context = '' }) => {
         'Created By': saleOrder.address.customer?.name || '-',
         Salesperson: saleOrder.sales,
         Total: currencyFormat(saleOrder.amountTotal),
-        Status: saleOrder.status,
+        Status: contextLabelMap[saleOrder.status] || saleOrder.status,
       };
       if (siteFilter) {
         row['Site'] = siteFilter;
@@ -245,7 +255,7 @@ const Transactions = ({ context = '' }) => {
         saleOrder.address.customer?.name || '-',
         saleOrder.sales,
         currencyFormat(saleOrder.amountTotal),
-        saleOrder.status,
+        contextLabelMap[saleOrder.status] || saleOrder.status,
       ];
 
       if (siteFilter) {
@@ -273,7 +283,7 @@ const Transactions = ({ context = '' }) => {
       name: q,
       offset: (pageNew - 1) * limitNew,
       limit: limitNew,
-      context: contextMap[statusNew], // gunakan contextMap
+      context: contextNew[statusNew] || 'all',
       sort: sortNew,
       startDate: state[0]?.startDate
         ? state[0].startDate.toLocaleDateString('id-ID')
-- 
cgit v1.2.3

