summaryrefslogtreecommitdiff
path: root/src-migrate/modules/register/components/Form.tsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-08-20 10:27:32 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-08-20 10:27:32 +0700
commit00df44e6f25eaeabc56ebba8b4e9b1cb692928d7 (patch)
tree8a5c8aa1a0890aa2afa9966db457cd98a43fe625 /src-migrate/modules/register/components/Form.tsx
parent6d302bb338e26810a7f90326b84086217f1f4ae0 (diff)
<iman> add new register
Diffstat (limited to 'src-migrate/modules/register/components/Form.tsx')
-rw-r--r--src-migrate/modules/register/components/Form.tsx89
1 files changed, 42 insertions, 47 deletions
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>
)
}