From 8a4d7247dd4163050f95055f13391b709bb29e66 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 10 Aug 2024 13:22:42 +0700
Subject: <iman> add feature tracking order

---
 src/lib/tracking-order/component/TrackingOrder.jsx | 94 ++++++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 src/lib/tracking-order/component/TrackingOrder.jsx

(limited to 'src/lib/tracking-order/component/TrackingOrder.jsx')

diff --git a/src/lib/tracking-order/component/TrackingOrder.jsx b/src/lib/tracking-order/component/TrackingOrder.jsx
new file mode 100644
index 00000000..476e6507
--- /dev/null
+++ b/src/lib/tracking-order/component/TrackingOrder.jsx
@@ -0,0 +1,94 @@
+import odooApi from '@/core/api/odooApi'
+import HookFormSelect from '@/core/components/elements/Select/HookFormSelect'
+import cityApi from '@/lib/address/api/cityApi'
+import { yupResolver } from '@hookform/resolvers/yup'
+import React, { useEffect, useRef, useState } from 'react'
+import ReCAPTCHA from 'react-google-recaptcha'
+import { Controller, useForm } from 'react-hook-form'
+import { toast } from 'react-hot-toast'
+import * as Yup from 'yup'
+import { useRouter } from 'next/router'
+import Manifest from '@/lib/treckingAwb/component/Manifest'
+const TrackingOrder = () => {
+    const [idAWB, setIdAWB] = useState(null)
+    const closePopup = () => {
+        setIdAWB(null)
+      }
+    const {
+        register,
+        handleSubmit,
+        formState: { errors },
+        control,
+        reset
+      } = useForm({
+        resolver: yupResolver(validationSchema),
+        defaultValues
+      })
+
+    const onSubmitHandler = async (values) => {
+        console.log('values',values)
+        // setIdAWB(shipment.id)
+        // setIdAWB(20623)
+        setIdAWB(25085)
+      }
+  return (
+    <div className='container mx-auto flex py-10 flex-col'>
+        <h1 className='text-h-sm md:text-title-sm font-semibold mb-6'>Tracking Order</h1>
+        <div className='flex justify-start items-start'>
+            <span className='text-base w-full'>Untuk melacak pesanan Anda, masukkan ID Pesanan Anda di kotak di bawah ini dan tekan tombol "Lacak". ID ini diberikan kepada Anda pada tanda terima dan dalam email konfirmasi yang seharusnya Anda terima.</span>
+        </div>
+        <div>
+            <form onSubmit={handleSubmit(onSubmitHandler)} className='flex mt-4 flex-row w-full '>
+                <div className=' w-[90%] grid grid-cols-2 gap-4'>
+                    <div className='flex flex-col '>
+                        <label className='form-label mb-2'>ID Pesanan*</label>
+                        <input
+                            {...register('id')}
+                            placeholder='dapat dilihat pada email konfirmasi anda'
+                            type='text'
+                            className='form-input mb-2'
+                            aria-invalid={errors.id?.message}
+                            />
+                            {console.log("errors",errors)}
+                        <div className='text-caption-2 text-danger-500 mt-1'>{errors.id?.message}</div>
+                    </div>
+                    <div className='flex flex-col '>
+                        <label className='form-label mb-2'>Email Penagihan*</label>
+                        <input
+                            {...register('email')}
+                            placeholder='Email yang anda gunakan saat pembayaran'
+                            type='text'
+                            className='form-input'
+                            aria-invalid={errors.email?.message}
+                        />
+                        <div className='text-caption-2 text-danger-500 mt-1'>{errors.email?.message}</div>
+                    </div>
+                </div>
+                <div className={` ${errors.id?.message ? 'mt-2' : 'mt-5'} flex items-center ml-4`}>
+                    <button
+                        type='submit'
+                        className='bg-red-600 border border-red-600 rounded-md text-sm text-white w-24 h-11 mb-1 content-center'
+                    >
+                        Lacak
+                    </button>
+
+                </div>
+            </form>
+            <Manifest idAWB={idAWB} closePopup={closePopup} />
+        </div>
+    </div>
+  )
+}
+
+const validationSchema = Yup.object().shape({
+    email: Yup.string().email('Format harus seperti contoh@email.com'),
+    id: Yup.string().required('Harus di-isi'),
+  })
+  
+  const defaultValues = {
+    email: '',
+    id: ''
+  }
+
+
+export default TrackingOrder
-- 
cgit v1.2.3

