summaryrefslogtreecommitdiff
path: root/src/lib/treckingAwb
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2025-04-14 16:47:04 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2025-04-14 16:47:04 +0700
commit900372920d521ee940b141646381d363d487e4d0 (patch)
tree237776d120d8ce5f3320b4072b97e9957c00e33f /src/lib/treckingAwb
parente25b9c18c192277863727ce3707e51e4aabee3d3 (diff)
transaction
Diffstat (limited to 'src/lib/treckingAwb')
-rw-r--r--src/lib/treckingAwb/component/InformationSection.jsx73
-rw-r--r--src/lib/treckingAwb/component/Manifest.jsx71
2 files changed, 76 insertions, 68 deletions
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 (
+ <div className=''>
+ <div className='grid gap-y-4 p-4'>
+ <div className='grid grid-cols-[150px_auto] mb-4'>
+ <span className='font-semibold '>Nomor Resi</span>
+ <div className='flex gap-x-3'>
+ <span className='font-semibold'>: {manifests?.waybillNumber} </span>
+ <button
+ className={`${copied ? 'text-gray-400' : 'text-red-600 '}`}
+ onClick={() => handleCopyClick()}
+ >
+ <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>
+ <div className='grid grid-cols-[150px_auto]'>
+ <span>Kurir</span>
+ <span className='font-semibold'>
+ {' '}
+ : {manifests?.deliveryOrder.carrier}
+ </span>
+ </div>
+ <div className='grid grid-cols-[150px_auto]'>
+ <span>Jenis Service</span>
+ <span className='font-semibold'>
+ {' '}
+ : {manifests?.deliveryOrder.service}
+ </span>
+ </div>
+ <div className='grid grid-cols-[150px_auto]'>
+ <span>Tanggal Dikirim</span>
+ <span className='font-semibold'> : {manifests?.deliveredDate}</span>
+ </div>
+ <div className='grid grid-cols-[150px_auto]'>
+ <span>Estimasi Tiba</span>
+ <span className='font-semibold'>
+ :{' '}
+ <span className='text-red-600 font-semibold'>{manifests?.eta}</span>
+ </span>
+ </div>
+ </div>
+ </div>
+ );
+};
+
+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 }) => {
)}
</div>
- <div className=''>
- <div className='grid gap-y-2 text-sm'>
- <div className='grid grid-cols-[150px_auto]'>
- <span className='font-semibold'>Nomor Resi</span>
- <div className='flex gap-x-3'>
- <span className='font-semibold'>
- : {manifests?.waybillNumber}{' '}
- </span>
- <button
- className={`${copied ? 'text-gray-400' : 'text-red-600 '}`}
- onClick={() => handleCopyClick()}
- >
- <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>
- <div className='grid grid-cols-[150px_auto]'>
- <span>Kurir</span>
- <span className='font-semibold'>
- {' '}
- : {manifests?.deliveryOrder.carrier}
- </span>
- </div>
- <div className='grid grid-cols-[150px_auto]'>
- <span>Jenis Service</span>
- <span className='font-semibold'>
- {' '}
- : {manifests?.deliveryOrder.service}
- </span>
- </div>
- <div className='grid grid-cols-[150px_auto]'>
- <span>Tanggal Dikirim</span>
- <span className='font-semibold'> : {manifests?.deliveredDate}</span>
- </div>
- <div className='grid grid-cols-[150px_auto]'>
- <span>Estimasi Tiba</span>
- <span className='font-semibold'>
- :{' '}
- <span className='text-red-600 font-semibold'>
- {manifests?.eta}
- </span>
- </span>
- </div>
- </div>
- </div>
+ <InformationSection manifests={manifests} />
+
<hr className='mt-4' />
{manifests?.isDelay && (
<div