From 54b6b618effc8416027ed884be1d6d37257c26c4 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 26 Aug 2024 11:59:57 +0700
Subject: <iman> update fungsion component

---
 .../register/components/RegistrasiBisnis.tsx       | 59 +---------------------
 1 file changed, 2 insertions(+), 57 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 c158e2f4..443ff0a0 100644
--- a/src-migrate/modules/register/components/RegistrasiBisnis.tsx
+++ b/src-migrate/modules/register/components/RegistrasiBisnis.tsx
@@ -14,7 +14,6 @@ import { useMutation } from "react-query";
 import { RegisterProps } from "~/types/auth";
 import { registerUser } from "~/services/auth";
 import router from "next/router";
-import toast from "react-hot-toast";
 import { useRouter } from "next/router";
 import { UseToastOptions, useToast } from "@chakra-ui/react";
 import Link from "next/link";
@@ -22,7 +21,6 @@ import Link from "next/link";
 const RegistrasiBisnis = () => {
   const [isPKP, setIsPKP] = useState(true);
   const [isTerdaftar, setIsTerdaftar] = useState(false);
-  const [isIndividuRequired, setIsIndividuRequired] = useState(true);
   const [isDropIndividu, setIsDropIndividu] = useState(true);
   const [isBisnisClicked, setisBisnisClicked] = useState(true);
   const [selectedValue, setSelectedValue] = useState('PKP');
@@ -55,19 +53,16 @@ const RegistrasiBisnis = () => {
     setSelectedValue(value);
     if (value === "PKP") {
       validate();
-      setIsIndividuRequired(true);
       setIsPKP(true);
     } else {
       validate();
       setIsPKP(false);
-      setIsIndividuRequired(false); // Hide and make optional the Individu form
       setIsPKP(false);
     }
   };
   
   const handleChangeBisnis = (value: string) => {
     setSelectedValueBisnis(value);
-    console.log('value',value)
     if (value === "true") {
       validate();
       updateForm('is_terdaftar','true')
@@ -87,46 +82,6 @@ const RegistrasiBisnis = () => {
     setisBisnisClicked(!isBisnisClicked)
   };
 
-  const handleSubmit = async () => {
-    console.log("form",form)
-    console.log("form Bisnis",form)
-    const response = await mutation.mutateAsync(form)
-
-    console.log("response",response)
-
-    if (response?.register === true) {
-      const urlParams = new URLSearchParams({
-        activation: 'otp',
-        email: form.email,
-        redirect: (router.query?.next || '/') as string
-      })
-      router.push(`${router.route}?${urlParams}`)
-    }
-
-    const toastProps: UseToastOptions = {
-      duration: 5000,
-      isClosable: true
-    }
-
-    switch (response?.reason) {
-      case 'EMAIL_USED':
-        toast({
-          ...toastProps,
-          title: 'Email sudah digunakan',
-          status: 'warning'
-        })
-        break;
-      case 'NOT_ACTIVE':
-        const activationUrl = `${router.route}?activation=email`
-        toast({
-          ...toastProps,
-          title: 'Akun belum aktif',
-          description: <>Akun sudah terdaftar namun belum aktif. <Link href={activationUrl} className="underline">Klik untuk aktivasi akun</Link></>,
-          status: 'warning'
-        })
-        break
-    }
-  };
   return (
     <>
       
@@ -192,19 +147,9 @@ const RegistrasiBisnis = () => {
           )}
         </div>
       </div>
+      
       <h1 className=""></h1>
-      <FormCaptcha />
-      <TermCondition />
-      <Button
-        type="submit"
-        colorScheme="red"
-        className="w-full mt-2"
-        size='lg'
-        onClick={handleSubmit}
-        // disabled={!isFormValid || !isCheckedTNC || mutation.isLoading || !isValidCaptcha}  
-      >
-        {mutation.isLoading ? 'Loading...' : 'Daftar'}
-      </Button>
+      
     </>
   );
 };
-- 
cgit v1.2.3

