From 8f36292c816773e5bcd0bf70f795f869aee69215 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 23 May 2025 10:41:53 +0700
Subject: Revert "form-merchant & quotation tampilan"

This reverts commit 60cbad2ae4b551d8f1e6959a3c90134c16b10e26.
---
 .../merchant/components/InformasiPerusahaan.jsx    | 46 +++++++++-------------
 1 file changed, 18 insertions(+), 28 deletions(-)

(limited to 'src/lib/merchant/components/InformasiPerusahaan.jsx')

diff --git a/src/lib/merchant/components/InformasiPerusahaan.jsx b/src/lib/merchant/components/InformasiPerusahaan.jsx
index 8e4f9c56..1e8704ac 100644
--- a/src/lib/merchant/components/InformasiPerusahaan.jsx
+++ b/src/lib/merchant/components/InformasiPerusahaan.jsx
@@ -56,7 +56,6 @@ const CreateMerchant = forwardRef(
       resolver: yupResolver(validationSchema),
       defaultValues,
     });
-    const [bisnisType, setBisnisType] = useState([]);
     const [state, setState] = useState([]);
     const [cities, setCities] = useState([]);
     const [districts, setDistricts] = useState([]);
@@ -72,7 +71,6 @@ const CreateMerchant = forwardRef(
     const kartuNamaRef = useRef(null);
     const suratPernyataanRef = useRef(null);
     const fotoKantorRef = useRef(null);
-    const bisnisTypeRef = useRef(null);
 
      const handleConfirmSubmit = (format, base64) => {
         if (format == 'pdf') {
@@ -230,7 +228,7 @@ const CreateMerchant = forwardRef(
               accountNumber: data.accountNumber || '',
               phone: data.phone || '',
               mobile: data.mobile || '',
-              bisnisType: data.bisnisType || '',
+              bisnisType: data.bisnisType ? parseInt(data.bisnisType) : null,
               categoryPerusahaan: data.categoryPerusahaan
                 ? parseInt(data.categoryPerusahaan)
                 : null,
@@ -264,12 +262,6 @@ const CreateMerchant = forwardRef(
       loadData();
     }, [reset, handleIsError]);
 
-    useEffect(() => {
-      if (errors.bisnisType && bisnisTypeRef.current) {
-        bisnisTypeRef.current.scrollIntoView({ behavior: "smooth", block: "center" });
-      }
-    }, [errors.bisnisType]);
-
     useEffect(() => {
       const loadProfile = async () => {
         try {
@@ -538,6 +530,7 @@ const CreateMerchant = forwardRef(
         }
         return;
       }
+        
       const create_leads = await createMerchantApi({ data });
       if (create_leads) {
         toast.dismiss(toastId);
@@ -600,11 +593,9 @@ const CreateMerchant = forwardRef(
                   name="bisnisType"
                   control={control}
                   render={({ field }) => (
-                    <div ref={bisnisTypeRef} className="space-y-2 w-full flex flex-row">
-                      <div className="w-2/5">
+                    <div className="space-y-2">
                       <label className="font-semibold text-gray-800">Tipe Bisnis</label>
-                      </div>
-                      <div className="flex items-center space-x-6 .w-3/5">
+                      <div className="flex items-center space-x-6">
                         {dataBisnisType.map((option) => (
                           <label key={option.value} className="flex items-center space-x-2 cursor-pointer">
                             <input
@@ -614,20 +605,20 @@ const CreateMerchant = forwardRef(
                               onChange={() => field.onChange(option.value)}
                               className="sr-only peer"
                             />
-                             <div className="w-4 h-4 rounded-full border-2 border-red-100 flex items-center justify-center 
+                            <div className="w-4 h-4 rounded-full border-2 border-red-100 flex items-center justify-center 
                peer-checked:border-[5px] peer-checked:border-red-500 
                peer-focus:outline peer-focus:outline-red-100">
                               <div className="absolute top-1/2 left-1/2 w-2.5 h-2.5 bg-red-500 rounded-full -translate-x-1/2 -translate-y-1/2 opacity-0 peer-checked:opacity-200" />
                             </div>
-                            <span className=" text-gray-800">{option.label}</span>
+                            <span className="text-sm text-gray-800">{option.label}</span>
                           </label>
-                          
                         ))}
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errors.bisnisType?.message}
-                </div>
                       </div>
+                      <div className='text-caption-2 text-danger-500 mt-1'>
+                      { errors.bisnisType?.message}
+                       </div>
                     </div>
+                    
                   )}
                 />
                 <div className='w-full flex flex-row'>
@@ -649,7 +640,7 @@ const CreateMerchant = forwardRef(
                       className='form-input'
                     />
                     <span className='opacity-65 text-xs'>
-                      Format: PT. INDOTEKNIK DOTCOM GEMILANG{''}
+                      Format: PT. INDOTEKNIK DOTCOM GEMILANG
                     </span>
                     <div className='text-caption-2 text-danger-500 mt-1'>
                       {errors.name?.message}
@@ -731,7 +722,7 @@ const CreateMerchant = forwardRef(
                     </label>
                     {!isKonfirmasi && (
                       <span className='opacity-65 text-xs'>
-                        Alamat sesuai dengan alamat perusahaan{''}
+                        Alamat sesuai dengan alamat perusahaan
                       </span>
                     )}
                   </div>
@@ -1560,7 +1551,7 @@ const CreateMerchant = forwardRef(
                   name="bisnisType"
                   control={control}
                   render={({ field }) => (
-                    <div ref={bisnisTypeRef} className="space-y-2">
+                    <div className="space-y-2">
                       <label className="font-semibold text-gray-800">Tipe Bisnis</label>
                       <div className="flex items-center space-x-6">
                         {dataBisnisType.map((option) => (
@@ -1579,15 +1570,15 @@ const CreateMerchant = forwardRef(
                             </div>
                             <span className="text-sm text-gray-800">{option.label}</span>
                           </label>
-                          
                         ))}
                       </div>
+                        <div className='text-caption-2 text-danger-500 mt-1'>
+                          {errors.bisnisType?.message}
+                        </div>
                     </div>
                   )}
                 />
-                <div className='text-caption-2 text-danger-500 mt-1'>
-                  {errors.bisnisType?.message}
-                </div>
+
             <div className='w-full mt-4'>
               <form
                 onSubmit={handleSubmit(onSubmitHandler)}
@@ -2240,7 +2231,6 @@ const CreateMerchant = forwardRef(
 );
 
 const validationSchema = Yup.object().shape({
-  bisnisType: Yup.string().required('Harus dipilih'),
   name: Yup.string().required('Harus di-isi'),
   address: Yup.string().required('Harus di-isi'),
   state: Yup.string().required('Harus dipilih'),
@@ -2262,6 +2252,7 @@ const validationSchema = Yup.object().shape({
     .required('Harus di-isi'),
   phone: Yup.string().required('Harus di-isi'),
   mobile: Yup.string().required('Harus di-isi'),
+  bisnisType: Yup.string().required('Harus dipilih'),
 });
 const defaultValues = {
   name: '',
@@ -2279,7 +2270,6 @@ const defaultValues = {
   accountNumber: '',
   phone: '',
   mobile: '',
-  bisnisType: '',
 };
 
 export default CreateMerchant;
-- 
cgit v1.2.3

