From af311a10854f092efa57716ffd5329cce0c7d8db Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 13 Mar 2025 16:33:00 +0700
Subject: <iman> update mobile

---
 src/lib/transaction/components/Transaction.jsx | 39 ++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 6 deletions(-)

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

diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx
index 2e328a7e..299f7a07 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -41,6 +41,10 @@ import rejectProductApi from '../api/rejectProductApi';
 import { useRouter } from 'next/router';
 import { gtagPurchase } from '@/core/utils/googleTag';
 import { deleteItemCart } from '@/core/utils/cart';
+import {
+  downloadInvoice,
+  downloadTaxInvoice,
+} from '@/lib/invoice/utils/invoices';
 import axios from 'axios';
 const Transaction = ({ id }) => {
   const PPN = process.env.NEXT_PUBLIC_PPN;
@@ -50,6 +54,7 @@ const Transaction = ({ id }) => {
   const [reason, setReason] = useState('');
   const auth = useAuth();
   const { transaction } = useTransaction({ id });
+  console.log('transaction', transaction);
   const statusApprovalWeb = transaction.data?.approvalStep;
   const [isLoading, setIsLoading] = useState(false);
   const { queryAirwayBill } = useAirwayBill({ orderId: id });
@@ -463,7 +468,7 @@ const Transaction = ({ id }) => {
         <Manifest idAWB={idAWB} closePopup={closePopup}></Manifest>
 
         <MobileView>
-          <div className='p-4'>
+          <div className='px-4'>
             <div className='flex flex-row w-full justify-between items-center py-2 px-3 mb-4 text-sm border border-yellow-500 text-yellow-800 rounded-lg bg-yellow-50 gap-2'>
               <div class='flex items-center w-full ' role='alert'>
                 <svg
@@ -488,19 +493,19 @@ const Transaction = ({ id }) => {
               </span>
             </div>
           </div>
-          <div className='p-4'>
-            {auth?.feature?.soApproval && (
+          {auth?.feature?.soApproval && (
+            <div className='p-4'>
               <StepApproval
                 layer={statusApprovalWeb}
                 status={transaction?.data?.status}
                 className='ml-auto'
               />
-            )}
-          </div>
+            </div>
+          )}
 
           <div className='flex flex-row justify-between items-center gap-2 px-4'>
             <div className='flex flex-col justify-start items-start gap-2'>
-              <div className='font-medium'>Pengiriman</div>
+              <div className='font-medium'>Status Transaksi</div>
               <TransactionStatusBadge status={transaction.data?.status} />
             </div>
             <div>
@@ -510,6 +515,28 @@ const Transaction = ({ id }) => {
               />
             </div>
           </div>
+
+          {transaction.data?.invoices?.length === 0 ? (
+            <div className='px-4'>-</div>
+          ) : (
+            transaction.data?.invoices?.map((invoice, index) => (
+              <div
+                className='flex flex-row justify-between items-center gap-2 p-4'
+                key={index}
+              >
+                <div className=''>{invoice?.name}</div>
+                <span
+                  className='text-red-500'
+                  onClick={() => downloadInvoice(invoice)}
+                >
+                  Download
+                </span>
+              </div>
+            ))
+          )}
+
+          <Divider />
+
           <div className='flex flex-col gap-y-4 p-4'>
             <DescriptionRow label='Status Transaksi'>
               <div className='flex justify-end'></div>
-- 
cgit v1.2.3

