From b4a595eaa8600e7bd1bafcef38abe4c01a5b664c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 12 Mar 2025 16:59:18 +0700 Subject: fix transaction --- src/lib/transaction/components/Transaction.jsx | 58 +++++++++++++++---------- src/lib/transaction/components/Transactions.jsx | 28 +++--------- 2 files changed, 42 insertions(+), 44 deletions(-) (limited to 'src/lib/transaction') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 07f9573d..8369c425 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -49,7 +49,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 }); @@ -284,7 +283,6 @@ const Transaction = ({ id }) => { const handleCopyClick = (waybillNumber) => { const textToCopy = waybillNumber; - console.log('textToCopy', textToCopy); navigator.clipboard.writeText(textToCopy); setCopied(true); toast.success('No Resi Berhasil di Copy'); @@ -755,7 +753,7 @@ const Transaction = ({ id }) => { )} */} -
+
Nama Sales
: {transaction?.data?.sales}
@@ -853,11 +851,19 @@ const Transaction = ({ id }) => {
No. Telepon
:
-
{transaction?.data?.address?.customer?.phone}
+
+ {transaction?.data?.address?.customer?.phone + ? transaction?.data?.address?.customer?.phone + : '-'} +
Email
:
-
{transaction?.data?.address?.customer?.email}
+
+ {transaction?.data?.address?.customer?.email + ? transaction?.data?.address?.customer?.email + : '-'} +
Alamat Pengiriman
:
@@ -906,27 +912,33 @@ const Transaction = ({ id }) => {
Kurir
:
-
- {transaction?.data?.pickings[0]?.carrierName ? ( - <> -

{transaction?.data?.pickings[0]?.carrierName}

- - setIdAWB(transaction?.data?.pickings[0]?.id) - } - > - Lacak Pengiriman - - - ) : ( - '-' - )} -
+ {transaction?.data?.pickings[0]?.carrierName ? ( +
+

+ {transaction?.data?.pickings[0]?.carrierName} +

+ + setIdAWB(transaction?.data?.pickings[0]?.id) + } + > + Lacak Pengiriman + +
+ ) : ( + '-' + )}
Jenis Service
:
-
BELUM TAU AMBIL DARI MANA
+
+ {' '} + {transaction?.data?.pickings[0]?.serviceType && + transaction?.data?.pickings[0]?.carrierName + ? transaction?.data?.pickings[0]?.serviceType + : '-'} +
Tanggal Kirim
:
diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx index d93c9aef..ece97734 100644 --- a/src/lib/transaction/components/Transactions.jsx +++ b/src/lib/transaction/components/Transactions.jsx @@ -80,7 +80,6 @@ const Transactions = ({ context = '' }) => { const [isOpenCalender, setIsOpenCalender] = useState(false); const parseDate = (date) => { - console.log('masuk sini', date); if (null || 'null') return null; if (!date) return null; if (date instanceof Date) return date; // Jika sudah Date, langsung return @@ -95,19 +94,6 @@ const Transactions = ({ context = '' }) => { key: 'selection', }, ]); - console.log('startDate', startDate); - console.log('state', state); - // useEffect(() => { - // if (state[0].startDate != null) { - // setState([ - // { - // startDate: parseDate(startDate), - // endDate: parseDate(endDate), - // key: 'selection', - // }, - // ]); - // } - // }, [startDate, endDate]); const query = { name: q, @@ -369,7 +355,7 @@ const Transactions = ({ context = '' }) => { } if (status === 'all') { - router.push('/my/transactions'); + router.push(`${router.pathname}`); } else { setPageNew(1); } @@ -384,7 +370,7 @@ const Transactions = ({ context = '' }) => { }, ]); setIsOpenCalender(false); - router.push('/my/transactions'); + router.push(`${router.pathname}`); }; const formatDate = (dateString) => { @@ -649,7 +635,7 @@ const Transactions = ({ context = '' }) => { /> ))} {saleOrder.products?.length > 6 @@ -730,7 +716,7 @@ const Transactions = ({ context = '' }) => { pageCount={pageCount} currentPage={parseInt(pageNew)} // url={router.pathname + pageQuery} - url={`/my/transactions?${toQuery(_.omit(query, ['page']))}`} + url={`${router.pathname}?${toQuery(_.omit(query, ['page']))}`} className='mt-2 mb-2' /> @@ -997,7 +983,7 @@ const Transactions = ({ context = '' }) => { className='border py-2 px-4 hover:border-red-500 w-full rounded-lg' >
@@ -1068,7 +1054,7 @@ const Transactions = ({ context = '' }) => { /> ))} {saleOrder.products?.length > 6 @@ -1182,7 +1168,7 @@ const Transactions = ({ context = '' }) => { pageCount={pageCount} currentPage={parseInt(pageNew)} // url={router.pathname + (pageQuery ? `?${pageQuery}` : '')} - url={`/my/transactions?${toQuery(_.omit(query, ['page']))}`} + url={`${router.pathname}?${toQuery(_.omit(query, ['page']))}`} className='mt-2 mb-2' />
-- cgit v1.2.3