Compare commits

...

2 Commits

Author SHA1 Message Date
victorAnumudu 0207bf631a started input validation on forms 2024-04-23 19:25:50 +01:00
ameye fe759c6d0a Merge branch 'select-input' of DigiFi/digifi-www into master 2024-04-23 10:26:53 +00:00
8 changed files with 819 additions and 444 deletions
+97 -52
View File
@@ -1,73 +1,118 @@
import { Button, InputCompOne, Stepper } from ".."; import { Button, InputCompOne, Stepper } from "..";
// import { useNavigate } from "react-router-dom"; import {Formik, Form} from 'formik'
// import { RouteHandler } from "../../router/routes"; import * as Yup from "yup";
type Props = { type Props = {
handleNextStep:()=>any handleNextStep:()=>any
} }
const initialValues = {
amount: "",
duration: "",
id: "",
};
// To get the validation schema
const validationSchema = Yup.object().shape({
duration: Yup.string()
.required("Required"),
amount: Yup.string()
.required("Required")
.test("no-e", "Invalid", (value:any) => {
if (value && /^[0-9]*$/.test(value) == false) {
return false;
}
return true;
}),
id: Yup.string()
.required("Required")
});
export default function DashboardFormInit({handleNextStep}:Props) { export default function DashboardFormInit({handleNextStep}:Props) {
// let navigate = useNavigate(); //FUNCTION TO HANDLE SUBMIT
// const navigateToProfile = () => navigate(RouteHandler.dashboardProfile); const handleSubmit = (values:any) => {
console.log(values)
handleNextStep()
};
return ( return (
<div className="w-full"> <div className="w-full">
<div className="w-full flex justify-center"> <div className="w-full flex justify-center">
<Stepper step={0} /> <Stepper step={0} />
</div> </div>
<div className="mt-[3.25rem] flex flex-col gap-9"> <Formik
<InputCompOne initialValues={initialValues}
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" validationSchema={validationSchema}
name="applyIshInput" onSubmit={handleSubmit}
label="How Much Do You Want To Apply For?" >
labelClass="font-bold text-[1.125rem]" {(props)=>(
input <Form>
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" <div className="mt-[3.25rem] flex flex-col gap-9">
placeholder="350,000" <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<InputCompOne name="amount"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" label="How Much Do You Want To Apply For?"
name="applyIshInput" labelClass="font-bold text-[1.125rem]"
label="For How Many Months?" input
labelClass="font-bold text-[1.125rem]" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
select={true} placeholder="350,000"
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" value={props.values.amount}
// selectValue='' onChange={props.handleChange}
selectOptions={duration} error={(props.errors.amount && props.touched.amount) ? props.errors.amount : ''}
// onChange={()=>{}} />
/> <InputCompOne
<InputCompOne parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" name="duration"
name="applyIshInput" label="For How Many Months?"
label="Direct sales agent ID ( Optional )" labelClass="font-bold text-[1.125rem]"
labelClass="font-bold text-[1.125rem]" select={true}
floatLabel='Enter agent ID' selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
input selectOptions={duration}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" selectValue={props.values.duration}
placeholder="Agent ID" onChange={props.handleChange}
/> error={(props.errors.duration && props.touched.duration) ? props.errors.duration : ''}
<Button />
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11" <InputCompOne
text="Next" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
type="button" name="id"
onClick={handleNextStep} label="Direct sales agent ID ( Optional )"
/> labelClass="font-bold text-[1.125rem]"
</div> floatLabel='Enter agent ID'
input
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
placeholder="Agent ID"
value={props.values.id}
onChange={props.handleChange}
error={(props.errors.id && props.touched.id) ? props.errors.id : ''}
/>
<Button
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
text="Next"
type="submit"
/>
</div>
</Form>
)}
</Formik>
</div> </div>
); );
} }
interface Option { interface SelectOption {
value: string; loading: boolean;
label: string; data: {value: string;
label: string}[]
} }
const duration: Option[] = [ const duration: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "6", label: "6 Months" }, data: [
{ value: "12", label: "12 Months" }, { value: "", label: "Please Select" },
{ value: "18", label: "18 Months" }, { value: "6", label: "6 Months" },
{ value: "24", label: "24 Months" }, { value: "12", label: "12 Months" },
]; { value: "18", label: "18 Months" },
{ value: "24", label: "24 Months" },
]
}
@@ -1,4 +1,7 @@
import { Button, InputCompOne, Stepper } from '../../shared/index'; import { Button, InputCompOne, Stepper } from '../../shared/index';
import {Formik, Form} from 'formik'
import * as Yup from "yup";
// import { useNavigate } from "react-router-dom"; // import { useNavigate } from "react-router-dom";
// import { RouteHandler } from '../../../router/routes'; // import { RouteHandler } from '../../../router/routes';
@@ -6,9 +9,29 @@ type Props = {
handleNextStep:()=>any handleNextStep:()=>any
} }
const initialValues = {
account_number: "",
checked: false
};
// To get the validation schema
const validationSchema = Yup.object().shape({
account_number: Yup.string()
.required("Required"),
checked: Yup.bool() // use bool instead of boolean
.oneOf([true], "You must accept the terms and conditions")
});
export default function DashboardHomeAttestation({handleNextStep}:Props) { export default function DashboardHomeAttestation({handleNextStep}:Props) {
// let navigate = useNavigate(); // let navigate = useNavigate();
// const navigateToProfile = () => navigate(RouteHandler.dashboardProfile); // const navigateToProfile = () => navigate(RouteHandler.dashboardProfile);
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (values:any) => {
console.log(values)
handleNextStep()
};
return ( return (
<div className="w-full"> <div className="w-full">
<div className="w-full flex justify-center"> <div className="w-full flex justify-center">
@@ -16,31 +39,51 @@ export default function DashboardHomeAttestation({handleNextStep}:Props) {
</div> </div>
<p className='my-10 text-red-500 text-lg md:text-2xl'>Applicant's Attestation and Debit Instruction</p> <p className='my-10 text-red-500 text-lg md:text-2xl'>Applicant's Attestation and Debit Instruction</p>
<p className='text-red-500 text-base'>NB: Must be your FCMB account number</p> <p className='text-red-500 text-base'>NB: Must be your FCMB account number</p>
<div className="flex flex-col gap-9"> <Formik
<div className="flex items-center gap-[4.125rem]"> initialValues={initialValues}
<InputCompOne validationSchema={validationSchema}
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" onSubmit={handleSubmit}
name="applyIshInput" >
floatLabel="Disbursement account number" {(props)=>(
// labelClass="font-bold text-[1.125rem]" <Form>
input <div className="flex flex-col gap-9">
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" <div className="flex items-center gap-[4.125rem]">
placeholder="0102547896" <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
</div> name="account_number"
<div className='max-w-[25.875rem] flex gap-4 items-start'> floatLabel="Disbursement account number"
<input type='checkbox' className='w-4 h-4 p-2 accent-purple-600 text-purple-600 bg-gray-100 border-gray-300 rounded focus:ring-purple-500' /> // labelClass="font-bold text-[1.125rem]"
<p className='text-[12px] text-justify'>By pressing, you agree that you have read, understood and accept the <span className='text-blue-600'>applicatant's attestation</span> and <span className='text-blue-600'>terms and conditions</span> for FCMB input
premium salary loan. You also give us permission to collect financial information and run credit checks on the account provided through our partners inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
</p> placeholder="0102547896"
</div> value={props.values.account_number}
<Button onChange={props.handleChange}
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11" error={(props.errors.account_number && props.touched.account_number) ? props.errors.account_number : ''}
text="Apply" />
type="button" </div>
onClick={handleNextStep} <div className='max-w-[25.875rem]'>
/> <div className='flex gap-4 items-start'>
</div> <input
type='checkbox'
name="checked"
className='w-4 h-4 p-2 accent-purple-600 text-purple-600 bg-gray-100 border-gray-300 rounded focus:ring-purple-500'
onChange={props.handleChange}
/>
<p className='text-[12px] text-justify'>By pressing, you agree that you have read, understood and accept the <span className='text-blue-600'>applicatant's attestation</span> and <span className='text-blue-600'>terms and conditions</span> for FCMB
premium salary loan. You also give us permission to collect financial information and run credit checks on the account provided through our partners
</p>
</div>
{props.errors.checked && props.touched.checked && <span className='text-[10px] text-red-500'>{props.errors.checked}</span>}
</div>
<Button
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
text="Apply"
type="submit"
/>
</div>
</Form>
)}
</Formik>
</div> </div>
); );
} }
@@ -1,105 +1,166 @@
import { Button, InputCompOne, Stepper } from '../../shared/index'; import { Button, InputCompOne, Stepper } from '../../shared/index';
import {Formik, Form} from 'formik'
import * as Yup from "yup";
type Props = { type Props = {
handleNextStep:()=>any handleNextStep:()=>any
} }
const initialValues = {
gender: "",
address: "",
marital_status: "",
state: "",
email:""
};
// To get the validation schema
const validationSchema = Yup.object().shape({
gender: Yup.string()
.required("Required"),
address: Yup.string()
.required("Required"),
marital_status: Yup.string()
.required("Required"),
state: Yup.string()
.required("Required"),
email: Yup.string()
.email("Invalid")
.required("Required"),
});
export default function DashboardHomeDetail({handleNextStep}:Props) { export default function DashboardHomeDetail({handleNextStep}:Props) {
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (values:any) => {
console.log(values)
handleNextStep()
};
return ( return (
<div className="w-full"> <div className="w-full">
<div className="w-full flex justify-center"> <div className="w-full flex justify-center">
<Stepper step={1} /> <Stepper step={1} />
</div> </div>
<div className="mt-[3.25rem] flex flex-col gap-9"> <Formik
<div className="flex items-center gap-[4.125rem]"> initialValues={initialValues}
<InputCompOne validationSchema={validationSchema}
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" onSubmit={handleSubmit}
name="applyIshInput" >
label="Select your gender" {(props)=>(
labelClass="font-bold text-[1.125rem]" <Form>
select={true} <div className="mt-[3.25rem] flex flex-col gap-9">
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" <div className="flex items-center gap-[4.125rem]">
// selectValue='' <InputCompOne
selectOptions={gender} parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
// onChange={()=>{}} name="gender"
/> label="Select your gender"
<InputCompOne labelClass="font-bold text-[1.125rem]"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" select={true}
name="applyIshInput" selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
label="Residential address" selectOptions={gender}
labelClass="font-bold text-[1.125rem]" selectValue={props.values.gender}
input onChange={props.handleChange}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" error={(props.errors.gender && props.touched.gender) ? props.errors.gender : ''}
placeholder="Somewhere in lagos" />
/> <InputCompOne
</div> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<div className="flex items-center gap-[4.125rem]"> name="address"
<InputCompOne label="Residential address"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" labelClass="font-bold text-[1.125rem]"
name="applyIshInput" input
label="Marital status" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
labelClass="font-bold text-[1.125rem]" placeholder="Somewhere in lagos"
select={true} value={props.values.address}
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" onChange={props.handleChange}
// selectValue='' error={(props.errors.address && props.touched.address) ? props.errors.address : ''}
selectOptions={maritalStatus} />
// onChange={()=>{}} </div>
/> <div className="flex items-center gap-[4.125rem]">
<InputCompOne <InputCompOne
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
name="applyIshInput" name="marital_status"
label="Select your state" label="Marital status"
labelClass="font-bold text-[1.125rem]" labelClass="font-bold text-[1.125rem]"
select={true} select={true}
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
// selectValue='' selectOptions={maritalStatus}
selectOptions={state} selectValue={props.values.marital_status}
// onChange={()=>{}} onChange={props.handleChange}
/> error={(props.errors.marital_status && props.touched.marital_status) ? props.errors.marital_status : ''}
</div> />
<InputCompOne <InputCompOne
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
name="applyIshInput" name="state"
label="Email address" label="Select your state"
labelClass="font-bold text-[1.125rem]" labelClass="font-bold text-[1.125rem]"
input select={true}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
placeholder="johndoe@gmail.com" selectOptions={state}
/> selectValue={props.values.state}
<Button onChange={props.handleChange}
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11" error={(props.errors.state && props.touched.state) ? props.errors.state : ''}
text="Next" />
type="button" </div>
onClick={handleNextStep} <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
</div> name="email"
label="Email address"
labelClass="font-bold text-[1.125rem]"
input
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
placeholder="johndoe@gmail.com"
value={props.values.email}
onChange={props.handleChange}
error={(props.errors.email && props.touched.email) ? props.errors.email : ''}
/>
<Button
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
text="Next"
type="submit"
/>
</div>
</Form>
)}
</Formik>
</div> </div>
); );
} }
interface Option { interface SelectOption {
value: string; loading: boolean;
label: string; data: {value: string;
label: string}[]
} }
const gender: Option[] = [ const gender: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "male", label: "Male" }, data: [
{ value: "female", label: "Female" }, { value: "", label: "Please Select" },
{ value: "others", label: "Prefer not to say" }, { value: "male", label: "Male" },
]; { value: "female", label: "Female" },
{ value: "others", label: "Prefer not to say" },
]
}
const maritalStatus: Option[] = [ const maritalStatus: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "single", label: "Single" }, data: [
{ value: "married", label: "Married" }, { value: "", label: "Please Select" },
{ value: "divorced", label: "Divorced" }, { value: "single", label: "Single" },
]; { value: "married", label: "Married" },
{ value: "divorced", label: "Divorced" },
]
}
const state: Option[] = [ const state: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "abia", label: "Abia" }, data: [
{ value: "imo", label: "Imo" }, { value: "", label: "Please Select" },
{ value: "lagos", label: "Lagos" }, { value: "abia", label: "Abia" },
]; { value: "imo", label: "Imo" },
{ value: "lagos", label: "Lagos" },
]
}
@@ -1,162 +1,275 @@
import { Button, InputCompOne, Stepper } from '../../shared/index'; import { Button, InputCompOne, Stepper } from '../../shared/index';
import {Formik, Form} from 'formik'
import * as Yup from "yup";
type Props = { type Props = {
handleNextStep:()=>any handleNextStep:()=>any
} }
const initialValues = {
job_title: "",
employer_name: "",
job_sector: "",
industry: "",
date_of_resumption: "",
employer_email:"",
annual_income: "",
monthly_salary: "",
salary_payment_date: "",
employee_id: "",
qualification: ""
};
// To get the validation schema
const validationSchema = Yup.object().shape({
job_title: Yup.string()
.required("Required"),
employer_name: Yup.string()
.required("Required"),
job_sector: Yup.string()
.required("Required"),
industry: Yup.string()
.required("Required"),
date_of_resumption: Yup.string()
.required("Required"),
employer_email: Yup.string()
.email("Invalid")
.required("Required"),
annual_income: Yup.string()
.required("Required")
.test("no-e", "Invalid", (value:any) => {
if (value && /^[0-9]*$/.test(value) == false) {
return false;
}
return true;
}),
monthly_salary: Yup.string()
.required("Required")
.test("no-e", "Invalid", (value:any) => {
if (value && /^[0-9]*$/.test(value) == false) {
return false;
}
return true;
}),
salary_payment_date: Yup.string()
.required("Required"),
employee_id: Yup.string()
.required("Required"),
qualification: Yup.string()
.required("Required"),
});
export default function DashboardHomeEmploymentInfo({handleNextStep}:Props) { export default function DashboardHomeEmploymentInfo({handleNextStep}:Props) {
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (values:any) => {
console.log(values)
handleNextStep()
};
return ( return (
<div className="w-full"> <div className="w-full">
<div className="w-full flex justify-center"> <div className="w-full flex justify-center">
<Stepper step={2} /> <Stepper step={2} />
</div> </div>
<div className="mt-[3.25rem] flex flex-col gap-9"> <Formik
<p className='text-red-500 text-lg md:text-2xl'>Employment Informaton</p> initialValues={initialValues}
<div className="flex items-center gap-[4.125rem]"> validationSchema={validationSchema}
<InputCompOne onSubmit={handleSubmit}
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" >
name="applyIshInput" {(props)=>(
floatLabel="Job Title" <Form>
// labelClass="font-bold text-[1.125rem]" <div className="mt-[3.25rem] flex flex-col gap-9">
input <p className='text-red-500 text-lg md:text-2xl'>Employment Informaton</p>
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" <div className="flex items-center gap-[4.125rem]">
placeholder="Software Engineer" <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<InputCompOne name="job_title"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" floatLabel="Job Title"
name="applyIshInput" // labelClass="font-bold text-[1.125rem]"
floatLabel="Employer name" input
// labelClass="font-bold text-[1.125rem]" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
input placeholder="Software Engineer"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" value={props.values.job_title}
placeholder="Mr. Mark John" onChange={props.handleChange}
/> error={(props.errors.job_title && props.touched.job_title) ? props.errors.job_title : ''}
</div> />
<div className="flex items-center gap-[4.125rem]"> <InputCompOne
<InputCompOne parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" name="employer_name"
name="applyIshInput" floatLabel="Employer name"
floatLabel="Job Sector" // labelClass="font-bold text-[1.125rem]"
// labelClass="font-bold text-[1.125rem]" input
select={true} inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" placeholder="Mr. Mark John"
// selectValue='' value={props.values.employer_name}
selectOptions={jobSection} onChange={props.handleChange}
// onChange={()=>{}} error={(props.errors.employer_name && props.touched.employer_name) ? props.errors.employer_name : ''}
/> />
<InputCompOne </div>
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" <div className="flex items-center gap-[4.125rem]">
name="applyIshInput" <InputCompOne
floatLabel="Select your industry" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
// labelClass="font-bold text-[1.125rem]" name="job_sector"
select={true} floatLabel="Job Sector"
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" // labelClass="font-bold text-[1.125rem]"
// selectValue='' select={true}
selectOptions={industry} selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
// onChange={()=>{}} selectOptions={jobSector}
/> selectValue={props.values.job_sector}
</div> onChange={props.handleChange}
<div className="flex items-center gap-[4.125rem]"> error={(props.errors.job_sector && props.touched.job_sector) ? props.errors.job_sector : ''}
<InputCompOne />
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" <InputCompOne
name="applyIshInput" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
floatLabel="Date of resumption" name="industry"
// labelClass="font-bold text-[1.125rem]" floatLabel="Select your industry"
input // labelClass="font-bold text-[1.125rem]"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" select={true}
placeholder="12/12/2015" selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
/> selectOptions={industry}
<InputCompOne selectValue={props.values.industry}
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" onChange={props.handleChange}
name="applyIshInput" error={(props.errors.industry && props.touched.industry) ? props.errors.industry : ''}
floatLabel="Employers official email" />
// labelClass="font-bold text-[1.125rem]" </div>
input <div className="flex items-center gap-[4.125rem]">
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" <InputCompOne
placeholder="example@gmail.com" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
/> name="date_of_resumption"
</div> floatLabel="Date of resumption"
<div className="flex items-center gap-[4.125rem]"> // labelClass="font-bold text-[1.125rem]"
<InputCompOne input
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" inputType='date'
name="applyIshInput" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
floatLabel="Annual Income" placeholder="12/12/2015"
// labelClass="font-bold text-[1.125rem]" value={props.values.date_of_resumption}
input onChange={props.handleChange}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" error={(props.errors.date_of_resumption && props.touched.date_of_resumption) ? props.errors.date_of_resumption : ''}
placeholder="1,200,000" />
/> <InputCompOne
<InputCompOne parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" name="employer_email"
name="applyIshInput" floatLabel="Employers official email"
floatLabel="Net monthly salary" // labelClass="font-bold text-[1.125rem]"
// labelClass="font-bold text-[1.125rem]" input
input inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" placeholder="example@gmail.com"
placeholder="100,000" value={props.values.employer_email}
/> onChange={props.handleChange}
</div> error={(props.errors.employer_email && props.touched.employer_email) ? props.errors.employer_email : ''}
<div className="flex items-center gap-[4.125rem]"> />
<InputCompOne </div>
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" <div className="flex items-center gap-[4.125rem]">
name="applyIshInput" <InputCompOne
floatLabel="Salary payment date" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
// labelClass="font-bold text-[1.125rem]" name="annual_income"
input floatLabel="Annual Income"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" // labelClass="font-bold text-[1.125rem]"
placeholder="30th of every month" input
/>{" "} inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
<InputCompOne placeholder="1,200,000"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" value={props.values.annual_income}
name="applyIshInput" onChange={props.handleChange}
floatLabel="Employee ID" error={(props.errors.annual_income && props.touched.annual_income) ? props.errors.annual_income : ''}
// labelClass="font-bold text-[1.125rem]" />
input <InputCompOne
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
placeholder="LS/001/005" name="monthly_salary"
/> floatLabel="Net monthly salary"
</div> // labelClass="font-bold text-[1.125rem]"
<InputCompOne input
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
name="applyIshInput" placeholder="100,000"
floatLabel="Highest level of education" value={props.values.monthly_salary}
// labelClass="font-bold text-[1.125rem]" onChange={props.handleChange}
select={true} error={(props.errors.monthly_salary && props.touched.monthly_salary) ? props.errors.monthly_salary : ''}
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" />
// selectValue='' </div>
selectOptions={qualification} <div className="flex items-center gap-[4.125rem]">
// onChange={()=>{}} <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<Button name="salary_payment_date"
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11" floatLabel="Salary payment date"
text="Next" // labelClass="font-bold text-[1.125rem]"
type="button" input
onClick={handleNextStep} inputType='date'
/> inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
</div> placeholder="30th of every month"
value={props.values.salary_payment_date}
onChange={props.handleChange}
error={(props.errors.salary_payment_date && props.touched.salary_payment_date) ? props.errors.salary_payment_date : ''}
/>
<InputCompOne
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
name="employee_id"
floatLabel="Employee ID"
// labelClass="font-bold text-[1.125rem]"
input
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
placeholder="LS/001/005"
value={props.values.employee_id}
onChange={props.handleChange}
error={(props.errors.employee_id && props.touched.employee_id) ? props.errors.employee_id : ''}
/>
</div>
<InputCompOne
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
name="qualification"
floatLabel="Highest level of education"
// labelClass="font-bold text-[1.125rem]"
select={true}
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
selectOptions={qualification}
selectValue={props.values.qualification}
onChange={props.handleChange}
error={(props.errors.qualification && props.touched.qualification) ? props.errors.qualification : ''}
/>
<Button
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
text="Next"
type="submit"
/>
</div>
</Form>
)}
</Formik>
</div> </div>
); );
} }
interface Option { interface SelectOption {
value: string; loading: boolean;
label: string; data: {value: string;
label: string}[]
} }
const jobSection: Option[] = [ const jobSector: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "private (non academic)", label: "Private (non academic)" }, data: [
]; { value: "", label: "Please Select" },
{ value: "private (non academic)", label: "Private (non academic)" },
]
}
const industry: Option[] = [ const industry: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "engineering", label: "Engineering" }, data: [
]; { value: "", label: "Please Select" },
{ value: "engineering", label: "Engineering" },
]
}
const qualification: Option[] = [ const qualification: SelectOption = {
{ value: "", label: "Please Select" }, loading: false,
{ value: "b.sc + professional qualification", label: "B.Sc + Professional Qualification" }, data: [
]; { value: "", label: "Please Select" },
{ value: "b.sc + professional qualification", label: "B.Sc + Professional Qualification" },
]
}
@@ -1,126 +1,215 @@
import { Button, InputCompOne, Stepper } from '../../shared/index'; import { Button, InputCompOne, Stepper } from '../../shared/index';
import {Formik, Form} from 'formik'
import * as Yup from "yup";
type Props = { type Props = {
handleNextStep:()=>any handleNextStep:()=>any
} }
const initialValues = {
ref_name: "",
ref_email: "",
ref_number: "",
ref_relationship: "",
ref_bvn: "",
ref_two_name: "",
ref_two_email: "",
ref_two_number: "",
ref_two_relationship: "",
ref_two_bvn: "",
};
// To get the validation schema
const validationSchema = Yup.object().shape({
ref_name: Yup.string()
.required("Required"),
ref_email: Yup.string()
.email("Invalid")
.required("Required"),
ref_number: Yup.string()
.required("Required"),
ref_relationship: Yup.string()
.required("Required"),
ref_bvn: Yup.string()
.required("Required"),
ref_two_name: Yup.string()
.required("Required"),
ref_two_email: Yup.string()
.email("Invalid")
.required("Required"),
ref_two_number: Yup.string()
.required("Required"),
ref_two_relationship: Yup.string()
.required("Required"),
ref_two_bvn: Yup.string()
.required("Required"),
});
export default function DashboardHomeRefereeInfo({handleNextStep}:Props) { export default function DashboardHomeRefereeInfo({handleNextStep}:Props) {
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (values:any) => {
console.log(values)
handleNextStep()
};
return ( return (
<div className="w-full"> <div className="w-full">
<div className="w-full flex justify-center"> <div className="w-full flex justify-center">
<Stepper step={3} /> <Stepper step={3} />
</div> </div>
<div className="mt-[3.25rem] flex flex-col gap-9"> <Formik
<p className='text-red-500 text-lg md:text-2xl'>Reference Details <span className='text-base'>(Must be 18 years and above)</span></p> initialValues={initialValues}
<div className="flex items-center gap-[4.125rem]"> validationSchema={validationSchema}
<div className='w-full max-w-[25.875rem]'> onSubmit={handleSubmit}
<p className='text-red-500 text-base'>Reference one</p> >
<div className='w-full flex flex-col gap-9'> {(props)=>(
<InputCompOne <Form>
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" <div className="mt-[3.25rem] flex flex-col gap-9">
name="applyIshInput" <p className='text-red-500 text-lg md:text-2xl'>Reference Details <span className='text-base'>(Must be 18 years and above)</span></p>
floatLabel="Full name" <div className="flex items-center gap-[4.125rem]">
// labelClass="font-bold text-[1.125rem]" <div className='w-full max-w-[25.875rem]'>
input <p className='text-red-500 text-base'>Reference one</p>
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" <div className='w-full flex flex-col gap-9'>
placeholder="John James" <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<InputCompOne name="ref_name"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" floatLabel="Full name"
name="applyIshInput" // labelClass="font-bold text-[1.125rem]"
floatLabel="Relationship" input
// labelClass="font-bold text-[1.125rem]" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
input placeholder="John James"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" value={props.values.ref_name}
placeholder="Sister" onChange={props.handleChange}
/> error={(props.errors.ref_name && props.touched.ref_name) ? props.errors.ref_name : ''}
<InputCompOne />
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" <InputCompOne
name="applyIshInput" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
floatLabel="Phone number" name="ref_relationship"
// labelClass="font-bold text-[1.125rem]" floatLabel="Relationship"
input // labelClass="font-bold text-[1.125rem]"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" input
placeholder="07000000000" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
/> placeholder="Sister"
<InputCompOne value={props.values.ref_relationship}
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" onChange={props.handleChange}
name="applyIshInput" error={(props.errors.ref_relationship && props.touched.ref_relationship) ? props.errors.ref_relationship : ''}
floatLabel="Email address" />
// labelClass="font-bold text-[1.125rem]" <InputCompOne
input parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" name="ref_number"
placeholder="demo@gamil.com" floatLabel="Phone number"
/> // labelClass="font-bold text-[1.125rem]"
<InputCompOne input
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
name="applyIshInput" placeholder="07000000000"
floatLabel="BVN" value={props.values.ref_number}
// labelClass="font-bold text-[1.125rem]" onChange={props.handleChange}
input error={(props.errors.ref_number && props.touched.ref_number) ? props.errors.ref_number : ''}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" />
placeholder="2228457896" <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
</div> name="ref_email"
</div> floatLabel="Email address"
<div className='w-full max-w-[25.875rem]'> // labelClass="font-bold text-[1.125rem]"
<p className='text-red-500 text-base'>Reference two</p> input
<div className='w-full flex flex-col gap-9'> inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
<InputCompOne placeholder="demo@gamil.com"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" value={props.values.ref_email}
name="applyIshInput" onChange={props.handleChange}
floatLabel="Full name" error={(props.errors.ref_email && props.touched.ref_email) ? props.errors.ref_email : ''}
// labelClass="font-bold text-[1.125rem]" />
input <InputCompOne
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
placeholder="John James" name="ref_bvn"
/> floatLabel="BVN"
<InputCompOne // labelClass="font-bold text-[1.125rem]"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" input
name="applyIshInput" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
floatLabel="Relationship" placeholder="2228457896"
// labelClass="font-bold text-[1.125rem]" value={props.values.ref_bvn}
input onChange={props.handleChange}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" error={(props.errors.ref_bvn && props.touched.ref_bvn) ? props.errors.ref_bvn : ''}
placeholder="Sister" />
/> </div>
<InputCompOne </div>
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" <div className='w-full max-w-[25.875rem]'>
name="applyIshInput" <p className='text-red-500 text-base'>Reference two</p>
floatLabel="Phone number" <div className='w-full flex flex-col gap-9'>
// labelClass="font-bold text-[1.125rem]" <InputCompOne
input parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" name="ref_two_name"
placeholder="07000000000" floatLabel="Full name"
/> // labelClass="font-bold text-[1.125rem]"
<InputCompOne input
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
name="applyIshInput" placeholder="John James"
floatLabel="Email address" value={props.values.ref_two_name}
// labelClass="font-bold text-[1.125rem]" onChange={props.handleChange}
input error={(props.errors.ref_two_name && props.touched.ref_two_name) ? props.errors.ref_two_name : ''}
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" />
placeholder="demo@gamil.com" <InputCompOne
/> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<InputCompOne name="ref_two_relationship"
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4" floatLabel="Relationship"
name="applyIshInput" // labelClass="font-bold text-[1.125rem]"
floatLabel="BVN" input
// labelClass="font-bold text-[1.125rem]" inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
input placeholder="Sister"
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]" value={props.values.ref_two_relationship}
placeholder="2228457896" onChange={props.handleChange}
/> error={(props.errors.ref_two_relationship && props.touched.ref_two_relationship) ? props.errors.ref_two_relationship : ''}
</div> />
</div> <InputCompOne
</div> parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
<Button name="ref_two_number"
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11" floatLabel="Phone number"
text="Next" // labelClass="font-bold text-[1.125rem]"
type="button" input
onClick={handleNextStep} inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
/> placeholder="07000000000"
</div> value={props.values.ref_two_number}
onChange={props.handleChange}
error={(props.errors.ref_two_number && props.touched.ref_two_number) ? props.errors.ref_two_number : ''}
/>
<InputCompOne
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
name="ref_two_email"
floatLabel="Email address"
// labelClass="font-bold text-[1.125rem]"
input
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
placeholder="demo@gamil.com"
value={props.values.ref_two_email}
onChange={props.handleChange}
error={(props.errors.ref_two_email && props.touched.ref_two_email) ? props.errors.ref_two_email : ''}
/>
<InputCompOne
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
name="ref_two_bvn"
floatLabel="BVN"
// labelClass="font-bold text-[1.125rem]"
input
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
placeholder="2228457896"
value={props.values.ref_two_bvn}
onChange={props.handleChange}
error={(props.errors.ref_two_bvn && props.touched.ref_two_bvn) ? props.errors.ref_two_bvn : ''}
/>
</div>
</div>
</div>
<Button
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
text="Next"
type="submit"
/>
</div>
</Form>
)}
</Formik>
</div> </div>
); );
} }
+1 -1
View File
@@ -32,6 +32,7 @@ const BVN = ({handleNextStep}:Props) => {
const handleSubmit = (values:any) => { const handleSubmit = (values:any) => {
console.log('values', values) console.log('values', values)
handleNextStep()
}; };
return ( return (
@@ -70,7 +71,6 @@ const BVN = ({handleNextStep}:Props) => {
<button <button
type='submit' type='submit'
className="w-full h-[3.625rem] rounded bg-[#FBB700] rounded-2 px-4 text-[18px] text-[#282828] font-semibold disabled:text-[#282828] disabled:text-opacity-50" className="w-full h-[3.625rem] rounded bg-[#FBB700] rounded-2 px-4 text-[18px] text-[#282828] font-semibold disabled:text-[#282828] disabled:text-opacity-50"
onClick={handleNextStep}
> >
Enter Enter
</button> </button>
+25 -18
View File
@@ -1,9 +1,10 @@
import React from "react"; import React from "react";
import InputCompOne from "../shared/InputCompOne"; import InputCompOne from "../shared/InputCompOne";
interface Option { interface SelectOption {
value: string; loading: boolean;
label: string; data: {value: string;
label: string}[]
} }
interface InputSectionProps { interface InputSectionProps {
@@ -56,7 +57,7 @@ const InputSection: React.FC<InputSectionProps> = ({
"font-bold text-[18px] leading-[21.78px] tracking-[2%] text-[#5C2684] mb-[2px]", "font-bold text-[18px] leading-[21.78px] tracking-[2%] text-[#5C2684] mb-[2px]",
select: true, select: true,
selectClass: "w-full h-[36px] rounded-[6px]", selectClass: "w-full h-[36px] rounded-[6px]",
selectOptions: [{ value: "", label: "Select" }], selectOptions: {loading: false, data:[{ value: "", label: "Select" }]},
value: inputValues.agentId, value: inputValues.agentId,
onInput: handleInput, onInput: handleInput,
}, },
@@ -116,18 +117,24 @@ const InputSection: React.FC<InputSectionProps> = ({
export default InputSection; export default InputSection;
const maritalStatusOptions: Option[] = [ const maritalStatusOptions: SelectOption = {
{ value: "", label: "Select" }, loading: false,
{ value: "single", label: "Single" }, data: [
{ value: "married", label: "Married" }, { value: "", label: "Select" },
{ value: "divorced", label: "Divorced" }, { value: "single", label: "Single" },
{ value: "widowed", label: "Widowed" }, { value: "married", label: "Married" },
]; { value: "divorced", label: "Divorced" },
{ value: "widowed", label: "Widowed" },
]
}
const titleOptions: Option[] = [ const titleOptions: SelectOption = {
{ value: "", label: "Select" }, loading: false,
{ value: "ms", label: "Ms" }, data: [
{ value: "mr", label: "Mr" }, { value: "", label: "Select" },
{ value: "miss", label: "Miss" }, { value: "ms", label: "Ms" },
{ value: "mrs", label: "Mrs" }, { value: "mr", label: "Mr" },
]; { value: "miss", label: "Miss" },
{ value: "mrs", label: "Mrs" },
]
}
+31 -14
View File
@@ -8,16 +8,16 @@ export interface InputCompOneProps {
labelSpanClass?: string; labelSpanClass?: string;
floatLabel?: string; floatLabel?: string;
placeholder?: string; placeholder?: string;
value?: string; value?: string | any;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void; onChange?: (e:any) => any;
onInput?: (e: React.FormEvent<HTMLInputElement>) => void; onInput?: (e:any) => any;
name: string; name: string;
tabIndex?: number; tabIndex?: number;
ref?: React.RefObject<HTMLInputElement>; ref?: React.RefObject<HTMLInputElement>;
selectValue?: string; selectValue?: string;
input?: boolean; input?: boolean;
select?: boolean; select?: boolean;
selectOptions?: { value: string; label: string }[]; selectOptions?: {loading:boolean, data:{ value: string; label: string }[]};
inputType?: string; inputType?: string;
inputClass?: string; inputClass?: string;
parentInputClass?: string; parentInputClass?: string;
@@ -44,7 +44,7 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
selectValue, selectValue,
input = false, input = false,
select = false, select = false,
selectOptions = [], selectOptions = {loading:false, data:[]},
inputType = "text", inputType = "text",
inputClass, inputClass,
parentInputClass, parentInputClass,
@@ -58,10 +58,10 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
return ( return (
<div className={parentClass}> <div className={parentClass}>
{label && ( {label && (
<label htmlFor={label ? label : floatLabel} className={labelClass}> <label htmlFor={label ? label : floatLabel} className={`flex gap-2 items-center ${labelClass}`}>
{label} {label}
{labelSpan && <span className={labelSpanClass}>{labelSpan}</span>} {labelSpan && <span className={labelSpanClass}>{labelSpan}</span>}
{error && <span className='text-[10px] text-red-500'>{error}</span>} {error && label && <span className='text-[10px] text-red-500'>{error}</span>}
</label> </label>
)} )}
{input && ( {input && (
@@ -82,8 +82,11 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
{floatLabel && {floatLabel &&
<label <label
htmlFor={label ? label : floatLabel} htmlFor={label ? label : floatLabel}
className={`cursor-pointer text-sm text-black/70 dark:text-white absolute left-4 top-0 translate-y-0 peer-focus:top-0 peer-focus:translate-y-0 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 transition-all duration-500`} className={`flex items-center gap-2 cursor-pointer text-sm text-black/70 dark:text-white absolute left-4 top-0 translate-y-0 peer-focus:top-0 peer-focus:translate-y-0 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 transition-all duration-500`}
>{floatLabel}</label> >
{floatLabel}
{error && floatLabel && !label && <span className='text-[10px] text-red-500'>{error}</span>}
</label>
} }
</div> </div>
)} )}
@@ -94,19 +97,33 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
id={label ? label : floatLabel} id={label ? label : floatLabel}
value={selectValue} value={selectValue}
className={`px-4 appearance-none ${floatLabel && 'peer pt-4'} ${selectClass}`} className={`px-4 appearance-none ${floatLabel && 'peer pt-4'} ${selectClass}`}
// onChange={onChange} onChange={onChange}
> >
{selectOptions.map(({ value, label }) => ( {selectOptions.loading ?
<option value=''>Loading</option>
: selectOptions.data.length ?
selectOptions.data.map(({ value, label }) => (
<option key={value} value={value}>
{label}
</option>
))
:
<option value=''>Not Found</option>
}
{/* {selectOptions.map(({ value, label }) => (
<option key={value} value={value}> <option key={value} value={value}>
{label} {label}
</option> </option>
))} ))} */}
</select> </select>
{floatLabel && {floatLabel &&
<label <label
htmlFor={label ? label : floatLabel} htmlFor={label ? label : floatLabel}
className={`cursor-pointer text-sm text-black/70 dark:text-white absolute left-4 top-0 translate-y-0 peer-focus:top-0 peer-focus:translate-y-0 transition-all duration-500`} className={`flex items-center gap-2 cursor-pointer text-sm text-black/70 dark:text-white absolute left-4 top-0 translate-y-0 peer-focus:top-0 peer-focus:translate-y-0 transition-all duration-500`}
>{floatLabel}</label> >
{floatLabel}
{error && floatLabel && !label && <span className='text-[10px] text-red-500'>{error}</span>}
</label>
} }
{/* select custon arrow */} {/* select custon arrow */}
<div className='absolute right-4 top-1/2 -translate-y-1/2'> <div className='absolute right-4 top-1/2 -translate-y-1/2'>