From a08c6f9a773732c959e440dbcc653a6e80045e81 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 30 Aug 2023 15:29:52 +0700
Subject: change popup tracking history di page daftart transaksi dan quotation

---
 src/lib/transaction/components/Transaction.jsx | 53 ++++++++++++++++----------
 1 file changed, 32 insertions(+), 21 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 74f3dbd5..82eb1775 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -21,6 +21,7 @@ import Image from '@/core/components/elements/Image/Image'
 import { createSlug } from '@/core/utils/slug'
 import toTitleCase from '@/core/utils/toTitleCase'
 import useAirwayBill from '../hooks/useAirwayBill'
+import Manifest from '@/lib/treckingAwb/component/Manifest'
 
 const Transaction = ({ id }) => {
   const { transaction } = useTransaction({ id })
@@ -31,6 +32,7 @@ const Transaction = ({ id }) => {
   const poNumber = useRef(null)
   const poFile = useRef(null)
   const [uploadPo, setUploadPo] = useState(false)
+  const [idAWB, setIdAWB] = useState(null)
   const openUploadPo = () => setUploadPo(true)
   const closeUploadPo = () => setUploadPo(false)
   const submitUploadPo = async () => {
@@ -110,6 +112,10 @@ const Transaction = ({ id }) => {
     )
   }
 
+  const closePopup = () => {
+    setIdAWB(null)
+  }
+
   return (
     transaction.data?.name && (
       <>
@@ -158,6 +164,7 @@ const Transaction = ({ id }) => {
             </button>
           </div>
         </BottomPopup>
+        <Manifest idAWB={idAWB} closePopup={closePopup}></Manifest>
 
         <MobileView>
           <div className='flex flex-col gap-y-4 p-4'>
@@ -179,26 +186,28 @@ const Transaction = ({ id }) => {
           <div className='p-4'>
             <div className='font-medium'>Pengiriman</div>
             <div className='flex flex-col gap-y-3 mt-4'>
-              {queryAirwayBill.data?.airways?.map((airway) => (
+              {transaction?.data?.pickings?.map((airway) => (
                 <button
-                  className='shadow rounded-md p-4 text-gray_r-12 font-normal flex justify-between items-center text-left'
-                  key={airway?.waybillNumber}
-                  onClick={() => setAirwayBillPopup(airway?.waybillNumber)}
+                  className='shadow rounded-md p-3 text-gray_r-12 font-normal flex justify-between items-center text-left'
+                  key={airway?.id}
+                  onClick={() => setIdAWB(airway?.id)}
                 >
                   <div>
-                    <span className='text-sm text-gray_r-11'>No Resi</span>
-                    <p className='mt-1 font-medium'>{airway?.waybillNumber}</p>
+                    <span className='text-sm text-gray_r-11'>
+                      No Resi : {airway?.trackingNumber || '-'}{' '}
+                    </span>
+                    <p className='mt-1 font-medium'>{airway?.name}</p>
                   </div>
                   <div className='flex gap-x-2'>
-                    <div className='text-sm text-gray_r-11 badge-green'>
-                      {airway?.deliveryStatus?.status}
+                    <div className='text-sm text-gray-600 badge-green leading-[1.5] mt-1'>
+                      {airway?.delivered ? 'Pesanan Tiba' : 'Sedang Dikirim'}
                     </div>
                     <ChevronRightIcon className='w-5 stroke-2' />
                   </div>
                 </button>
               ))}
             </div>
-            {!queryAirwayBill?.data?.airways && (
+            {transaction?.data?.pickings == 0 && (
               <div className='badge-red text-sm px-2'>Belum ada pengiriman</div>
             )}
           </div>
@@ -368,27 +377,29 @@ const Transaction = ({ id }) => {
               </div>
 
               <div className='text-h-sm font-semibold mt-10 mb-4'>Pengiriman</div>
-              <div className='grid grid-cols-3 gap-4'>
-                {queryAirwayBill.data?.airways?.map((airway) => (
+              <div className='grid grid-cols-3 gap-1'>
+                {transaction?.data?.pickings?.map((airway) => (
                   <button
-                    className='shadow rounded-md p-4 text-gray_r-12 font-normal flex justify-between items-center text-left'
-                    key={airway?.waybillNumber}
-                    onClick={() => setAirwayBillPopup(airway?.waybillNumber)}
+                    className='shadow rounded-md p-3 text-gray_r-12 font-normal flex justify-between items-center text-left'
+                    key={airway?.id}
+                    onClick={() => setIdAWB(airway?.id)}
                   >
                     <div>
-                      <span className='text-sm text-gray_r-11'>No Resi</span>
-                      <p className='mt-1 font-medium'>{airway?.waybillNumber}</p>
+                      <span className='text-sm text-gray_r-11'>
+                        No Resi : {airway?.trackingNumber || '-'}{' '}
+                      </span>
+                      <p className='mt-1 font-medium'>{airway?.name}</p>
                     </div>
                     <div className='flex gap-x-2'>
-                      <div className='text-sm text-gray_r-11 badge-green'>
-                        {airway?.deliveryStatus?.status}
+                      <div className='text-sm text-gray-600 badge-green leading-[1.5] mt-1'>
+                        {airway?.delivered ? 'Pesanan Tiba' : 'Sedang Dikirim'}
                       </div>
                       <ChevronRightIcon className='w-5 stroke-2' />
                     </div>
                   </button>
                 ))}
               </div>
-              {!queryAirwayBill.data?.airways && (
+              {transaction?.data?.pickings.length == 0 && (
                 <div className='badge-red text-sm'>Belum ada pengiriman</div>
               )}
 
@@ -514,7 +525,7 @@ const Transaction = ({ id }) => {
           </div>
         </DesktopView>
 
-        {queryAirwayBill.data?.airways?.map((airway) => (
+        {/* {queryAirwayBill.data?.airways?.map((airway) => (
           <BottomPopup
             key={airway.waybillNumber}
             title='Detail Pengiriman'
@@ -564,7 +575,7 @@ const Transaction = ({ id }) => {
               </ol>
             </div>
           </BottomPopup>
-        ))}
+        ))} */}
       </>
     )
   )
-- 
cgit v1.2.3

