diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/transaction/components/Transaction.jsx | 58 | ||||
| -rw-r--r-- | src/lib/transaction/components/Transactions.jsx | 28 |
2 files changed, 42 insertions, 44 deletions
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 }) => { )} </div> */} - <div className='grid grid-cols-2 gap-x-6 mt-6'> + <div className='grid grid-cols-2 gap-x-6 mt-4'> <div className='grid grid-cols-[35%_65%] gap-y-4'> <div>Nama Sales</div> <div>: {transaction?.data?.sales}</div> @@ -853,11 +851,19 @@ const Transaction = ({ id }) => { <div>No. Telepon</div> <div>: </div> - <div>{transaction?.data?.address?.customer?.phone}</div> + <div> + {transaction?.data?.address?.customer?.phone + ? transaction?.data?.address?.customer?.phone + : '-'} + </div> <div>Email</div> <div>: </div> - <div>{transaction?.data?.address?.customer?.email}</div> + <div> + {transaction?.data?.address?.customer?.email + ? transaction?.data?.address?.customer?.email + : '-'} + </div> <div>Alamat Pengiriman</div> <div>: </div> @@ -906,27 +912,33 @@ const Transaction = ({ id }) => { <div>Kurir</div> <div>: </div> - <div className='flex flex-row gap-1 items-center justify-start'> - {transaction?.data?.pickings[0]?.carrierName ? ( - <> - <p>{transaction?.data?.pickings[0]?.carrierName}</p> - <span - className='text-red-500 text-xs font-semibold hover:cursor-pointer' - onClick={() => - setIdAWB(transaction?.data?.pickings[0]?.id) - } - > - Lacak Pengiriman - </span> - </> - ) : ( - '-' - )} - </div> + {transaction?.data?.pickings[0]?.carrierName ? ( + <div className='flex flex-row w-full gap-1 items-start justify-start '> + <p className=' text-nowrap'> + {transaction?.data?.pickings[0]?.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> + ) : ( + '-' + )} <div>Jenis Service</div> <div>: </div> - <div>BELUM TAU AMBIL DARI MANA</div> + <div> + {' '} + {transaction?.data?.pickings[0]?.serviceType && + transaction?.data?.pickings[0]?.carrierName + ? transaction?.data?.pickings[0]?.serviceType + : '-'} + </div> <div>Tanggal Kirim</div> <div>: </div> 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 = '' }) => { /> ))} <Link - href={`/my/quotations/${saleOrder?.id}`} + href={`${router.pathname}/${saleOrder?.id}`} className=' text-red-500 text-nowrap' > {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' > <Link - href={`/my/transactions/${saleOrder?.id}`} + href={`${router.pathname}/${saleOrder?.id}`} className='hover:border-red-500 block w-full' > <div className='flex flex-row justify-between items-center py-2'> @@ -1068,7 +1054,7 @@ const Transactions = ({ context = '' }) => { /> ))} <Link - href={`/my/quotations/${saleOrder?.id}`} + href={`${router.pathname}/${saleOrder?.id}`} className='text-sm text-red-500 text-nowrap' > {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' /> </div> |
