From 00df44e6f25eaeabc56ebba8b4e9b1cb692928d7 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 20 Aug 2024 10:27:32 +0700
Subject: <iman> add new register

---
 src-migrate/modules/register/components/Form.tsx | 89 +++++++++++-------------
 1 file changed, 42 insertions(+), 47 deletions(-)

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

diff --git a/src-migrate/modules/register/components/Form.tsx b/src-migrate/modules/register/components/Form.tsx
index b834f97a..7d18f4ee 100644
--- a/src-migrate/modules/register/components/Form.tsx
+++ b/src-migrate/modules/register/components/Form.tsx
@@ -9,7 +9,12 @@ import { useRouter } from "next/router";
 import { UseToastOptions, useToast } from "@chakra-ui/react";
 import Link from "next/link";
 
-const Form = () => {
+interface FormProps {
+  type: string;
+  required: boolean;
+}
+
+const Form: React.FC<FormProps> = ({ type, required }) => {
   const {
     form,
     isCheckedTNC,
@@ -75,25 +80,9 @@ const Form = () => {
 
   return (
     <form className="mt-6 grid grid-cols-1 gap-y-4" onSubmit={handleSubmit}>
-      <div>
-        <label htmlFor="company">
-          Nama Perusahaan <span className='text-gray_r-11'>(opsional)</span>
-        </label>
-
-        <input
-          type="text"
-          name="company"
-          id="company"
-          className="form-input mt-3"
-          placeholder="cth: INDOTEKNIK DOTCOM GEMILANG"
-          autoCapitalize="true"
-          value={form.company}
-          onChange={handleInputChange}
-        />
-      </div>
 
       <div>
-        <label htmlFor='name'>Nama Lengkap</label>
+        <label htmlFor='name' className="text-black font-bold">Nama Lengkap</label>
 
         <input
           type='text'
@@ -110,24 +99,7 @@ const Form = () => {
       </div>
 
       <div>
-        <label htmlFor='phone'>No Handphone</label>
-
-        <input
-          type='tel'
-          id='phone'
-          name='phone'
-          className='form-input mt-3'
-          placeholder='08xxxxxxxx'
-          value={form.phone}
-          onChange={handleInputChange}
-          aria-invalid={!!errors.phone}
-        />
-
-        {!!errors.phone && <span className="form-msg-danger">{errors.phone}</span>}
-      </div>
-
-      <div>
-        <label htmlFor='email'>Alamat Email</label>
+        <label htmlFor='email' className="text-black font-bold">Alamat Email</label>
 
         <input
           type='text'
@@ -143,9 +115,9 @@ const Form = () => {
 
         {!!errors.email && <span className="form-msg-danger">{errors.email}</span>}
       </div>
-
+      
       <div>
-        <label htmlFor='password'>Kata Sandi</label>
+        <label htmlFor='password' className="text-black font-bold">Kata Sandi</label>
         <input
           type='password'
           name='password'
@@ -161,17 +133,40 @@ const Form = () => {
         {!!errors.password && <span className="form-msg-danger">{errors.password}</span>}
       </div>
 
-      <FormCaptcha />
+      <div>
+        <label htmlFor='phone' className="text-black font-bold">No Handphone</label>
+
+        <input
+          type='tel'
+          id='phone'
+          name='phone'
+          className='form-input mt-3'
+          placeholder='08xxxxxxxx'
+          value={form.phone}
+          onChange={handleInputChange}
+          aria-invalid={!!errors.phone}
+        />
+
+        {!!errors.phone && <span className="form-msg-danger">{errors.phone}</span>}
+      </div>
+
+      {type==='individu' && (
+        <>
+          <FormCaptcha />
+    
+          <TermCondition />
+          <button
+            type="submit"
+            className="btn-yellow w-full mt-2"
+            disabled={!isFormValid || !isCheckedTNC || mutation.isLoading || !isValidCaptcha}
+          >
+            {mutation.isLoading ? 'Loading...' : 'Daftar'}
+          </button>
+        </>
+
+      )}
 
-      <TermCondition />
 
-      <button
-        type="submit"
-        className="btn-yellow w-full mt-2"
-        disabled={!isFormValid || !isCheckedTNC || mutation.isLoading || !isValidCaptcha}
-      >
-        {mutation.isLoading ? 'Loading...' : 'Daftar'}
-      </button>
     </form>
   )
 }
-- 
cgit v1.2.3

