From cb1bf0046249492094e59107ee5c904a36338eeb Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 12 Aug 2025 15:57:14 +0700
Subject: <hafid> Transaction detail

---
 src/lib/transaction/components/Transaction.jsx | 149 ++++++++++---------------
 1 file changed, 57 insertions(+), 92 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 6fabca05..77e60dc1 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -58,7 +58,6 @@ 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 });
@@ -89,8 +88,6 @@ const Transaction = ({ id }) => {
       setTotalDiscountAmount(calculateTotalDiscountAmount);
     }
   }, [transaction.data, transaction.isLoading]);
-  console.log('totalAmount', totalAmount);
-  console.log('totalDiscountAmount', totalDiscountAmount);
   const submitUploadPo = async () => {
     const file = poFile.current.files[0];
     const name = poNumber.current.value;
@@ -339,7 +336,7 @@ const Transaction = ({ id }) => {
     const [day, month, year] = dateString.split('/');
     return `${day} ${months[parseInt(month, 10) - 1]} ${year}`;
   };
-
+  // console.log(transaction);
   return (
     transaction.data?.name && (
       <>
@@ -562,6 +559,7 @@ const Transaction = ({ id }) => {
           <Divider />
 
           <div className='flex flex-col gap-y-4 p-4'>
+            <h4 className="font-semibold">Detail Order</h4>
             <DescriptionRow label='No Transaksi'>
               <p className='font-semibold'>{transaction.data?.name}</p>
             </DescriptionRow>
@@ -580,6 +578,27 @@ const Transaction = ({ id }) => {
 
           <Divider />
 
+          <div className='flex flex-col gap-y-4 p-4'>
+            <h4 className="font-semibold">Alamat Pengiriman</h4>
+            <DescriptionRow label='Nama Penerima'>
+              <p className='font-semibold'>{transaction?.data?.address?.customer?.name}</p>
+            </DescriptionRow>
+            <DescriptionRow label='No. Telp'>
+              {transaction?.data?.address?.customer?.phone
+                ? transaction?.data?.address?.customer?.phone
+                : '-'}
+            </DescriptionRow>
+            <DescriptionRow label='Email'>
+              {transaction?.data?.address?.customer?.email
+                ? transaction?.data?.address?.customer?.email
+                : '-'}
+            </DescriptionRow>
+            <DescriptionRow label='Alamat Pengiriman'>
+              {transaction?.data?.address?.customer?.alamatBisnis}
+            </DescriptionRow>
+          </div>
+
+          <Divider />
           <div className='p-4'>
             <div className='font-medium mb-4'>Info Pengiriman</div>
             {transaction?.data?.pickings.length == 0 && (
@@ -1006,88 +1025,54 @@ const Transaction = ({ id }) => {
                 </div>
                 <div className='flex flex-col w-1/2 justify-start items-start'>
                   <span className='text-h-sm font-medium mb-2'>
-                    Info Pengiriman
+                    Info Ekspedisi
                   </span>
                   <div className='grid grid-cols-[34%_2%_64%] gap-y-4  w-full'>
-                    <div>Nomor Resi</div>
-                    <div>: </div>
-                    <div className='flex flex-row gap-1 '>
-                      {transaction?.data?.pickings[0]?.trackingNumber || '-'}
-                      {transaction?.data?.pickings[0]?.trackingNumber && (
-                        <button
-                          className={`${
-                            copied ? 'text-gray-400' : 'text-red-600 '
-                          }`}
-                          onClick={() =>
-                            handleCopyClick(
-                              transaction?.data?.pickings[0]?.trackingNumber
-                            )
-                          }
-                        >
-                          <svg
-                            aria-hidden='true'
-                            fill='none'
-                            stroke='currentColor'
-                            stroke-width='1.5'
-                            viewBox='0 0 24 24'
-                            className='w-5 h-6'
-                          >
-                            <path
-                              d='M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75'
-                              stroke-linecap='round'
-                              stroke-linejoin='round'
-                            ></path>
-                          </svg>
-                        </button>
-                      )}
-                    </div>
-
                     <div>Kurir</div>
                     <div>: </div>
-                    {transaction?.data?.pickings[0]?.carrierName ? (
+                    {transaction?.data?.carrierName ? (
                       <div className='flex flex-row  w-full gap-1 items-center justify-start '>
                         <p className=' text-nowrap'>
-                          {transaction?.data?.pickings[0]?.carrierName}
+                          {transaction?.data?.carrierName}
                         </p>
-                        <span
-                          className='text-red-500 text-sm  font-semibold hover:cursor-pointer'
-                          onClick={() =>
-                            setIdAWB(transaction?.data?.pickings[0]?.id)
-                          }
-                        >
-                          Lacak Pengiriman
-                        </span>
                       </div>
                     ) : (
                       '-'
                     )}
+                    {transaction?.data?.carrierId !== 32 &&(
+                    <>
+                      <div>Jenis Service</div>
+                      <div>: </div>
+                      <div>
+                        {' '}
+                        {transaction?.data?.serviceType
+                          ? transaction?.data?.serviceType
+                          : '-'}
+                      </div>
+                    </>
+                    )}
 
-                    <div>Jenis Service</div>
-                    <div>: </div>
-                    <div>
-                      {' '}
-                      {transaction?.data?.pickings[0]?.serviceType &&
-                      transaction?.data?.pickings[0]?.carrierName
-                        ? transaction?.data?.pickings[0]?.serviceType
-                        : '-'}
-                    </div>
-
-                    <div>Tanggal Kirim</div>
+                    <div>Estimasi Tanggal Kirim</div>
                     <div>: </div>
                     <div>
-                      {transaction?.data?.pickings[0]?.date
-                        ? formatDate(transaction?.data?.pickings[0]?.date)
-                        : '-'}
-                    </div>
-
-                    <div>Estimasi Tiba</div>
-                    <div>: </div>
-                    <div className='text-red-500'>
-                      {transaction?.data?.pickings[0]?.eta
-                        ? transaction?.data?.pickings[0]?.eta
+                      {transaction?.data?.expectedReadyToShip
+                        ? transaction?.data?.expectedReadyToShip
                         : '-'}
                     </div>
-                    {transaction?.data?.pickings[0] && (
+                    {transaction?.data?.carrierId !== 32 &&(
+                    <>
+                      <div>Estimasi Tiba</div>
+                      <div>: </div>
+                      <div className=''>
+                          {transaction?.data?.etaDateStart && transaction?.data?.etaDateEnd ? (
+                            `${transaction.data.etaDateStart} - ${transaction.data.etaDateEnd}`
+                          ) : (
+                            '-'
+                          )}
+                      </div>
+                    </>
+                    )}
+                    {transaction?.data?.pickings[0] && transaction?.data?.carrierId !== 32 && (
                       <div className='w-full bagian-informasi col-span-3'>
                         <div
                           class='flex items-center w-fit py-2 px-3 mb-4 text-sm border border-yellow-500 text-yellow-800 rounded-lg bg-yellow-50'
@@ -1113,10 +1098,10 @@ const Transaction = ({ id }) => {
                 </div>
               </div>
 
-              <div className='text-h-sm font-semibold mt-2 mb-4'>
+              <div className='text-h-sm font-semibold mt-4 mb-4'>
                 Informasi Pengiriman
               </div>
-              <div className='flex gap-3'>
+              <div className='grid grid-cols-1 md:grid-cols-2 gap-3'>
                 {transaction?.data?.pickings.length == 0 && (
                   <div className='badge-red text-sm'>
                     Belum ada pengiriman
@@ -1143,26 +1128,6 @@ const Transaction = ({ id }) => {
                       </button>
                     </div>
                   </div>
-                  // <button
-                  //   className='shadow rounded-md p-3 text-gray_r-12 font-normal flex justify-between items-center text-left h-20'
-                  //   key={airway?.id}
-                  //   onClick={() => setIdAWB(airway?.id)}
-                  // >
-                  //   <div>
-                  //     <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-600 badge-green leading-[1.5] mt-1'>
-                  //       {airway?.delivered
-                  //         ? 'Pesanan Tiba'
-                  //         : 'Sedang Dikirim'}
-                  //     </div>
-                  //     <ChevronRightIcon className='w-5 stroke-2' />
-                  //   </div>
-                  // </button>
                 ))}
                 {/* </div> */}
               
-- 
cgit v1.2.3

