From 1d3f68f4a61bb084938523dea2869087f915bf61 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 20 Aug 2024 15:21:31 +0700
Subject: <iman> update new register

---
 .../register/components/RegistrasiBisnis.tsx       | 25 ++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'src-migrate/modules/register/components/RegistrasiBisnis.tsx')

diff --git a/src-migrate/modules/register/components/RegistrasiBisnis.tsx b/src-migrate/modules/register/components/RegistrasiBisnis.tsx
index c093d556..2c429f2d 100644
--- a/src-migrate/modules/register/components/RegistrasiBisnis.tsx
+++ b/src-migrate/modules/register/components/RegistrasiBisnis.tsx
@@ -20,8 +20,10 @@ const RegistrasiBisnis = () => {
   const [isIndividuRequired, setIsIndividuRequired] = useState(true);
   const [isBisnisRequired, setIsBisnisRequired] = useState(true);
   const [selectedValue, setSelectedValue] = useState('PKP');
+  const [selectedValueBisnis, setSelectedValueBisnis] = useState('true');
    const {
     form,
+    formBisnis,
     isCheckedTNC,
     isValidCaptcha,
     errors,
@@ -44,6 +46,15 @@ const RegistrasiBisnis = () => {
     }
   };
 
+  const handleChangeBisnis = (value: string) => {
+    setSelectedValueBisnis(value);
+    if (value === "true") {
+      setIsBisnisRequired(true); // Show and require Individu form
+    } else {
+      setIsBisnisRequired(false); // Hide and make optional the Individu form
+    }
+  };
+
   const handleClick = () => {
     setIsIndividuRequired(!isIndividuRequired)
   };
@@ -52,6 +63,15 @@ const RegistrasiBisnis = () => {
     setIsBisnisRequired(!isBisnisRequired)
   };
 
+  const handleSubmit = () => {
+    console.log("form",form)
+    console.log("form Bisnis",formBisnis)
+  };
+  console.log("isFormValid",isFormValid)
+  console.log("isCheckedTNC",isCheckedTNC)
+  console.log("mutation.isLoading",mutation.isLoading)
+  console.log("isValidCaptcha",isValidCaptcha)
+
   return (
     <>
       <div className="mt-4">
@@ -100,7 +120,7 @@ const RegistrasiBisnis = () => {
               <Divider  my={4} />
               <div>
                 <p className="text-black font-bold">Bisnis Terdaftar di Indoteknik?</p>
-                <RadioGroup onChange={handleChange} value={selectedValue}>
+                <RadioGroup onChange={handleChangeBisnis} value={selectedValueBisnis}>
                   <Stack direction='row'>
                     <Radio value='true'>Sudah Terdaftar</Radio>
                     <Radio value='false'>Belum Terdaftar</Radio>
@@ -112,15 +132,16 @@ const RegistrasiBisnis = () => {
           )}
         </div>
       </div>
-      <FormCaptcha />
       <TermCondition />
       <button
         type="submit"
         className="btn-yellow w-full mt-2"
+        onClick={handleSubmit}
         disabled={!isFormValid || !isCheckedTNC || mutation.isLoading || !isValidCaptcha}
       >
         {mutation.isLoading ? 'Loading...' : 'Daftar'}
       </button>
+      <FormCaptcha />
     </>
   );
 };
-- 
cgit v1.2.3

