From 900372920d521ee940b141646381d363d487e4d0 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 14 Apr 2025 16:47:04 +0700 Subject: transaction --- src/lib/transaction/components/Transaction.jsx | 89 +++++++++++++--------- .../treckingAwb/component/InformationSection.jsx | 73 ++++++++++++++++++ src/lib/treckingAwb/component/Manifest.jsx | 71 +---------------- 3 files changed, 127 insertions(+), 106 deletions(-) create mode 100644 src/lib/treckingAwb/component/InformationSection.jsx (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 2ca7d386..62743df3 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -41,6 +41,7 @@ import { useRouter } from 'next/router'; import { gtagPurchase } from '@/core/utils/googleTag'; import { deleteItemCart } from '@/core/utils/cart'; import axios from 'axios'; +import InformationSection from '../../treckingAwb/component/InformationSection'; const Transaction = ({ id }) => { const PPN = process.env.NEXT_PUBLIC_PPN; const router = useRouter(); @@ -208,7 +209,9 @@ const Transaction = ({ id }) => {

{currencyFormat(transaction.data?.amountUntaxed)}

-

PPN {((PPN - 1) * 100).toFixed(0)}%

+

+ PPN {((PPN - 1) * 100).toFixed(0)}% +

{currencyFormat(transaction.data?.amountTax)}

@@ -279,6 +282,8 @@ const Transaction = ({ id }) => { } }; + console.log('ini transaction', transaction.data); + return ( transaction.data?.name && ( <> @@ -731,52 +736,58 @@ const Transaction = ({ id }) => {
-
- Informasi Pelanggan -
-
-
-
Detail Pelanggan
- +
+
+
+ Informasi Pelanggan +
+
+
Detail Pelanggan
+ +
-
-
- Pengiriman + Informasi Pengiriman
{transaction?.data?.pickings.length == 0 && (
Belum ada pengiriman
)} -
- {transaction?.data?.pickings?.map((airway) => ( - - ))} -
+ {/*
*/} + {transaction?.data?.pickings?.map((airway) => ( +
+ +
+ // + ))} + {/*
*/}
+
+ +
Invoice @@ -976,7 +987,9 @@ const Transaction = ({ id }) => { {currencyFormat(transaction.data?.amountUntaxed)}
-
PPN {((PPN - 1) * 100).toFixed(0)}%
+
+ PPN {((PPN - 1) * 100).toFixed(0)}% +
{currencyFormat(transaction.data?.amountTax)}
diff --git a/src/lib/treckingAwb/component/InformationSection.jsx b/src/lib/treckingAwb/component/InformationSection.jsx new file mode 100644 index 00000000..41386683 --- /dev/null +++ b/src/lib/treckingAwb/component/InformationSection.jsx @@ -0,0 +1,73 @@ +import { useState } from "react"; +import toast from "react-hot-toast"; + +const InformationSection = ({ manifests }) => { + const [copied, setCopied] = useState(false); + + const handleCopyClick = () => { + const textToCopy = manifests?.waybillNumber; + navigator.clipboard.writeText(textToCopy); + setCopied(true); + toast.success('No Resi Berhasil di Copy'); + setTimeout(() => setCopied(false), 2000); // Reset copied state after 2 seconds + }; + + return ( +
+
+
+ Nomor Resi +
+ : {manifests?.waybillNumber} + +
+
+
+ Kurir + + {' '} + : {manifests?.deliveryOrder.carrier} + +
+
+ Jenis Service + + {' '} + : {manifests?.deliveryOrder.service} + +
+
+ Tanggal Dikirim + : {manifests?.deliveredDate} +
+
+ Estimasi Tiba + + :{' '} + {manifests?.eta} + +
+
+
+ ); +}; + +export default InformationSection; diff --git a/src/lib/treckingAwb/component/Manifest.jsx b/src/lib/treckingAwb/component/Manifest.jsx index fa998bd3..e2251e3e 100644 --- a/src/lib/treckingAwb/component/Manifest.jsx +++ b/src/lib/treckingAwb/component/Manifest.jsx @@ -6,6 +6,7 @@ import { useEffect, useState } from 'react'; import { toast } from 'react-hot-toast'; import ImageNext from 'next/image'; import { list } from 'postcss'; +import InformationSection from './InformationSection'; function capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1); @@ -71,16 +72,6 @@ const Manifest = ({ idAWB, closePopup }) => { } }, [idAWB]); - const [copied, setCopied] = useState(false); - - const handleCopyClick = () => { - const textToCopy = manifests?.waybillNumber; - navigator.clipboard.writeText(textToCopy); - setCopied(true); - toast.success('No Resi Berhasil di Copy'); - setTimeout(() => setCopied(false), 2000); // Reset copied state after 2 seconds - }; - return ( <> {isLoading && ( @@ -129,64 +120,8 @@ const Manifest = ({ idAWB, closePopup }) => { )}
-
-
-
- Nomor Resi -
- - : {manifests?.waybillNumber}{' '} - - -
-
-
- Kurir - - {' '} - : {manifests?.deliveryOrder.carrier} - -
-
- Jenis Service - - {' '} - : {manifests?.deliveryOrder.service} - -
-
- Tanggal Dikirim - : {manifests?.deliveredDate} -
-
- Estimasi Tiba - - :{' '} - - {manifests?.eta} - - -
-
-
+ +
{manifests?.isDelay && (