From b4abdb00ef83aa824e8a05d5b75df48adb7b9629 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 3 May 2023 10:38:52 +0700
Subject: semi dynamic page

---
 src/lib/form/components/KunjunganService.jsx | 66 +++++++++++++++++-----------
 1 file changed, 40 insertions(+), 26 deletions(-)

(limited to 'src/lib/form/components/KunjunganService.jsx')

diff --git a/src/lib/form/components/KunjunganService.jsx b/src/lib/form/components/KunjunganService.jsx
index 7797444d..076f6814 100644
--- a/src/lib/form/components/KunjunganService.jsx
+++ b/src/lib/form/components/KunjunganService.jsx
@@ -41,18 +41,32 @@ const CreateKunjunganService = () => {
     }
     const data = {
       ...values,
-      name : 'Pengajuan Kunjungan Service - ' + values.company,
-      contact_name : values.cp,
-      email_from : values.email,
-      phone : values.mobile,
-      description :  "\r\n Nama Perusahaan : " + values.company + " \r\n  Alamat  : " + values.address + " \r\n  Propinsi  : " + values.city + " \r\n  Telepon: " + values.phone + " \r\n  Handphone : " + values.mobile +" \r\n  Email  : " + values.email + " \r\n Keterangan  : " + values.description ,
+      name: 'Pengajuan Kunjungan Service - ' + values.company,
+      contact_name: values.cp,
+      email_from: values.email,
+      phone: values.mobile,
+      description:
+        '\r\n Nama Perusahaan : ' +
+        values.company +
+        ' \r\n  Alamat  : ' +
+        values.address +
+        ' \r\n  Propinsi  : ' +
+        values.city +
+        ' \r\n  Telepon: ' +
+        values.phone +
+        ' \r\n  Handphone : ' +
+        values.mobile +
+        ' \r\n  Email  : ' +
+        values.email +
+        ' \r\n Keterangan  : ' +
+        values.description
     }
 
     const create_leads = await createLeadApi({ data })
     if (create_leads) {
       toast.success('Berhasil menambahkan alamat')
       reset()
-     recaptchaRef.current.reset()
+      recaptchaRef.current.reset()
     }
   }
   return (
@@ -125,9 +139,7 @@ const CreateKunjunganService = () => {
                 type='text'
                 className='form-input'
               />
-              <div className='text-caption-2 text-danger-500 mt-1'>
-                {errors.cp?.message}
-              </div>
+              <div className='text-caption-2 text-danger-500 mt-1'>{errors.cp?.message}</div>
             </div>
           </div>
           <div className='grid grid-cols-1 md:grid-cols-2 gap-4 mt-4'>
@@ -156,7 +168,9 @@ const CreateKunjunganService = () => {
           </div>
           <div className='grid grid-cols-1 md:grid-cols-2 gap-4 mt-4'>
             <div>
-              <label className='form-label mb-2'>Sebutkan: Merek, Tipe, Permasalahan, Service, Perawatan</label>
+              <label className='form-label mb-2'>
+                Sebutkan: Merek, Tipe, Permasalahan, Service, Perawatan
+              </label>
               <textarea {...register('description')} type='text' className='form-input' />
               <div className='text-caption-2 text-danger-500 mt-1'>
                 {errors.description?.message}
@@ -181,24 +195,24 @@ const CreateKunjunganService = () => {
   )
 }
 const validationSchema = Yup.object().shape({
-    company: Yup.string().required('Harus di-isi'),
-    email: Yup.string().email('Format harus seperti contoh@email.com').required('Harus di-isi'),
-    phone: Yup.string().required('Harus di-isi'),
-    city: Yup.string().required('Harus di-isi'),
-    cp: Yup.string().required('Harus di-isi'),
-    mobile: Yup.string().required('Harus di-isi'),
-    email: Yup.string().required('Harus di-isi'),
-    address: Yup.string().required('Harus di-isi')
+  company: Yup.string().required('Harus di-isi'),
+  email: Yup.string().email('Format harus seperti contoh@email.com').required('Harus di-isi'),
+  phone: Yup.string().required('Harus di-isi'),
+  city: Yup.string().required('Harus di-isi'),
+  cp: Yup.string().required('Harus di-isi'),
+  mobile: Yup.string().required('Harus di-isi'),
+  email: Yup.string().required('Harus di-isi'),
+  address: Yup.string().required('Harus di-isi')
 })
 const defaultValues = {
-    company:'',
-    email: '',
-    phone: '',
-    city: '',
-    cp: '',
-    mobile: '',
-    email: '',
-    address: ''
+  company: '',
+  email: '',
+  phone: '',
+  city: '',
+  cp: '',
+  mobile: '',
+  email: '',
+  address: ''
 }
 
 export default CreateKunjunganService
-- 
cgit v1.2.3

