From 7fe286e1436fc66b31912e08a3e79bcc430a89b9 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 27 Dec 2024 14:58:04 +0700
Subject: <iman> update merchant

---
 src/lib/form/components/Merchant.jsx | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

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

diff --git a/src/lib/form/components/Merchant.jsx b/src/lib/form/components/Merchant.jsx
index db5f5ddd..4dd50983 100644
--- a/src/lib/form/components/Merchant.jsx
+++ b/src/lib/form/components/Merchant.jsx
@@ -9,7 +9,7 @@ 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 createLeadApi from '../api/createLeadApi';
+import createMerchantApi from '../api/createMerchantApi';
 import addressApi from '@/lib/address/api/addressApi';
 import PageContent from '@/lib/content/components/PageContent';
 import { useRouter } from 'next/router';
@@ -21,6 +21,7 @@ import Image from 'next/image';
 import { ChevronRightIcon } from '@heroicons/react/24/outline';
 import MobileView from '@/core/components/views/MobileView';
 import DesktopView from '@/core/components/views/DesktopView';
+import getFileBase64 from '@/core/utils/getFileBase64';
 const CreateMerchant = () => {
   const {
     register,
@@ -247,7 +248,7 @@ const CreateMerchant = () => {
       state: values.state,
       city: values.city,
       district: values.district,
-      SubDistrict: values.SubDistrict,
+      subDistrict: values.subDistrict,
       zip: values.zip,
       bank_name: values.bank,
       rekening_name: values.rekening,
@@ -289,7 +290,7 @@ const CreateMerchant = () => {
     };
     // const formData = new FormData();
     // formData.append('npwp', values.npwp[0]);
-    // const create_leads = await createLeadApi({ formData });
+    const create_leads = await createMerchantApi({ data });
     // if (create_leads) {
     //   toast.success('Berhasil menambahkan data');
     //   reset();
@@ -920,21 +921,21 @@ const CreateMerchant = () => {
                 </div>
               </div>
               <div className='flex justify-end'>
-                <Button
+                {/* <Button
                   colorScheme='red'
                   className='w-full md:w-fit'
                   type='submit'
                 >
                   Daftar Merchant{' '}
                   {<ChevronRightIcon className='w-5' color='white' />}
-                </Button>
+                </Button> */}
                 <div>
-                  {/* <button
-                  type='submit'
-                  className='btn-yellow w-full md:w-fit mt-6 ml-0 md:ml-auto'
-                >
-                  Simpan
-                </button> */}
+                  <button
+                    type='submit'
+                    className='btn-yellow w-full md:w-fit mt-6 ml-0 md:ml-auto'
+                  >
+                    Simpan
+                  </button>
                 </div>
               </div>
             </form>
@@ -1485,7 +1486,6 @@ const validationSchema = Yup.object().shape({
     .email('Format harus seperti contoh@email.com')
     .required('Harus di-isi'),
   phone: Yup.string().required('Harus di-isi'),
-  cp: Yup.string().required('Harus di-isi'),
   state: Yup.string().required('Harus dipilih'),
   city: Yup.string().required('Harus dipilih'),
   district: Yup.string().required('Harus dipilih'),
@@ -1494,9 +1494,7 @@ const validationSchema = Yup.object().shape({
   bank: Yup.string().required('Harus di-isi'),
   rekening: Yup.string().required('Harus di-isi'),
   accountNumber: Yup.string().required('Harus di-isi'),
-  company_unit: Yup.string().required('Harus di-isi'),
   address: Yup.string().required('Harus di-isi'),
-  website: Yup.string().required('Harus di-isi'),
   mobile: Yup.string().required('Harus di-isi'),
   npwp: Yup.mixed().required('File is required'),
   suratPernyataan: Yup.mixed().required('File is required'),
@@ -1515,10 +1513,7 @@ const defaultValues = {
   bank: '',
   rekening: '',
   accountNumber: '',
-  company_unit: '',
-  cp: '',
   address: '',
-  website: '',
   mobile: '',
 };
 
-- 
cgit v1.2.3

