Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 409acd300d | |||
| fc7edec093 | |||
| 4637944fbd | |||
| cc44af7e55 |
@@ -1,12 +1,20 @@
|
|||||||
|
import {useState, useEffect} from 'react'
|
||||||
import { Button, InputCompOne, Stepper } from '../../shared/index';
|
import { Button, InputCompOne, Stepper } from '../../shared/index';
|
||||||
|
|
||||||
import {Formik, Form} from 'formik'
|
import {Formik, Form} from 'formik'
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
|
import { getEmployersList } from '../../../core/apiRequest';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
handleNextStep:(value:{})=>any
|
handleNextStep:(value:{})=>any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// type EmployerProps = {
|
||||||
|
// loading?: boolean,
|
||||||
|
// data?: Array<{[index:string]: string}> | {[index:string]: Array<{[index:string]: string}> }
|
||||||
|
// }
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
job_title: "",
|
job_title: "",
|
||||||
name: "",
|
name: "",
|
||||||
@@ -18,24 +26,37 @@ const initialValues = {
|
|||||||
monthly_salary: "",
|
monthly_salary: "",
|
||||||
salary_payment_date: "",
|
salary_payment_date: "",
|
||||||
employment_id: "",
|
employment_id: "",
|
||||||
highest_eductaion: ""
|
highest_eductaion: "",
|
||||||
|
employer_uid: "",
|
||||||
|
isChecked: false
|
||||||
};
|
};
|
||||||
|
|
||||||
// To get the validation schema
|
// To get the validation schema
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
|
isChecked: Yup.bool(), // use bool instead of boolean
|
||||||
|
// .oneOf([true, false], "You must accept the terms and conditions"),
|
||||||
job_title: Yup.string()
|
job_title: Yup.string()
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
name: Yup.string()
|
name: Yup.string().when('isChecked', {
|
||||||
.required("Required"),
|
is: true,
|
||||||
sector: Yup.string()
|
then: () => Yup.string().required('required'),
|
||||||
.required("Required"),
|
otherwise: () => Yup.string(),
|
||||||
industry: Yup.string()
|
}),
|
||||||
.required("Required"),
|
sector: Yup.string().when('isChecked', {
|
||||||
|
is: true,
|
||||||
|
then: () => Yup.string().required('required'),
|
||||||
|
}),
|
||||||
|
industry: Yup.string().when('isChecked', {
|
||||||
|
is: true,
|
||||||
|
then: () => Yup.string().required('required'),
|
||||||
|
}),
|
||||||
resumption_date: Yup.string()
|
resumption_date: Yup.string()
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
email: Yup.string()
|
email: Yup.string().when('isChecked', {
|
||||||
.email("Invalid")
|
is: true,
|
||||||
.required("Required"),
|
then: () => Yup.string().required('required'),
|
||||||
|
})
|
||||||
|
.email("Invalid"),
|
||||||
annual_income: Yup.string()
|
annual_income: Yup.string()
|
||||||
.required("Required")
|
.required("Required")
|
||||||
.test("no-e", "Invalid", (value:any) => {
|
.test("no-e", "Invalid", (value:any) => {
|
||||||
@@ -58,16 +79,35 @@ const validationSchema = Yup.object().shape({
|
|||||||
.required("Required"),
|
.required("Required"),
|
||||||
highest_eductaion: Yup.string()
|
highest_eductaion: Yup.string()
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
|
employer_uid: Yup.string().when('isChecked', {
|
||||||
|
is: false,
|
||||||
|
then: () => Yup.string().required('required'),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function DashboardHomeEmploymentInfo({handleNextStep}:Props) {
|
export default function DashboardHomeEmploymentInfo({handleNextStep}:Props) {
|
||||||
|
|
||||||
|
const [employersList, setEmployersList] = useState<any>({
|
||||||
|
loading: true,
|
||||||
|
data: []
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
//FUNCTION TO HANDLE SUBMIT
|
//FUNCTION TO HANDLE SUBMIT
|
||||||
const handleSubmit = (values:any) => {
|
const handleSubmit = (values:any) => {
|
||||||
|
// Remember to changed the checked value's name
|
||||||
handleNextStep({employment: values})
|
handleNextStep({employment: values})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
getEmployersList().then(res => {
|
||||||
|
setEmployersList({loading:false, data:res?.data})
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
setEmployersList({loading:false, data:[]})
|
||||||
|
})
|
||||||
|
},[])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
@@ -83,155 +123,188 @@ export default function DashboardHomeEmploymentInfo({handleNextStep}:Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<div className="mt-[3.25rem] flex flex-col gap-9">
|
<div className="mt-[3.25rem] flex flex-col gap-9">
|
||||||
<p className='text-red-500 text-lg md:text-2xl'>Employment Informaton</p>
|
<p className='text-red-500 text-lg md:text-2xl'>Employment Informaton</p>
|
||||||
<div className="flex items-center gap-[4.125rem]">
|
<div className="flex flex-col lg:flex-row items-start gap-[2rem]">
|
||||||
<InputCompOne
|
<div className='w-full lg:max-w-[30rem] flex flex-col'>
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
<div className='w-full gap-[2rem]'>
|
||||||
name="job_title"
|
<InputCompOne
|
||||||
floatLabel="Job Title"
|
parentClass="w-full"
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
name="employer_uid"
|
||||||
input
|
floatLabel="Employer Name"
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
placeholder="Software Engineer"
|
select={true}
|
||||||
value={props.values.job_title}
|
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
onChange={props.handleChange}
|
selectOptions={{loading:employersList?.loading, data: employersList?.data?.records}}
|
||||||
error={(props.errors.job_title && props.touched.job_title) ? props.errors.job_title : ''}
|
selectValue={props.values.employer_uid}
|
||||||
/>
|
onChange={props.handleChange}
|
||||||
<InputCompOne
|
error={(props.errors.employer_uid && props.touched.employer_uid) ? props.errors.employer_uid : ''}
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
disabled={props.values.isChecked}
|
||||||
name="name"
|
/>
|
||||||
floatLabel="Employer name"
|
<div className='flex gap-4 items-start my-2'>
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
<input
|
||||||
input
|
type='checkbox'
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
name="isChecked"
|
||||||
placeholder="Mr. Mark John"
|
className='w-4 h-4 p-2 accent-purple-600 text-purple-600 bg-gray-100 border-gray-300 rounded focus:ring-purple-500'
|
||||||
value={props.values.name}
|
onChange={props.handleChange}
|
||||||
onChange={props.handleChange}
|
checked={props.values.isChecked}
|
||||||
error={(props.errors.name && props.touched.name) ? props.errors.name : ''}
|
/>
|
||||||
/>
|
<p className='text-[12px] text-justify'>Check here if employer is not on the list</p>
|
||||||
|
</div>
|
||||||
|
<div className={`hidden p-4 ${props.values.isChecked && 'hidden'}`}>
|
||||||
|
Name: {'Name'}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={`w-full flex flex-col gap-[2rem] ${!props.values.isChecked && 'hidden'}`}>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="name"
|
||||||
|
floatLabel="Employer name"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
placeholder="Mr. Mark John"
|
||||||
|
value={props.values.name}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.name && props.touched.name) ? props.errors.name : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="email"
|
||||||
|
floatLabel="Employers official email"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
placeholder="example@gmail.com"
|
||||||
|
value={props.values.email}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.email && props.touched.email) ? props.errors.email : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="industry"
|
||||||
|
floatLabel="Select your industry"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
select={true}
|
||||||
|
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
selectOptions={industry}
|
||||||
|
selectValue={props.values.industry}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.industry && props.touched.industry) ? props.errors.industry : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="sector"
|
||||||
|
floatLabel="Job Sector"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
select={true}
|
||||||
|
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
selectOptions={jobSector}
|
||||||
|
selectValue={props.values.sector}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.sector && props.touched.sector) ? props.errors.sector : ''}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='w-full lg:max-w-[30rem] flex flex-col gap-[2rem]'>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="job_title"
|
||||||
|
floatLabel="Job Title"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
placeholder="Software Engineer"
|
||||||
|
value={props.values.job_title}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.job_title && props.touched.job_title) ? props.errors.job_title : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="highest_eductaion"
|
||||||
|
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={highestEductaion}
|
||||||
|
selectValue={props.values.highest_eductaion}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.highest_eductaion && props.touched.highest_eductaion) ? props.errors.highest_eductaion : ''}
|
||||||
|
/>
|
||||||
|
<div className="w-full flex flex-col sm:flex-row items-center gap-4">
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="resumption_date"
|
||||||
|
floatLabel="Date of resumption"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputType='date'
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
placeholder="12/12/2015"
|
||||||
|
value={props.values.resumption_date}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.resumption_date && props.touched.resumption_date) ? props.errors.resumption_date : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="salary_payment_date"
|
||||||
|
floatLabel="Salary payment date"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputType='date'
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
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 : ''}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="w-full flex flex-col sm:flex-row items-center gap-4">
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="annual_income"
|
||||||
|
floatLabel="Annual Income"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
|
||||||
|
placeholder="1,200,000"
|
||||||
|
value={props.values.annual_income}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.annual_income && props.touched.annual_income) ? props.errors.annual_income : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="monthly_salary"
|
||||||
|
floatLabel="Net monthly salary"
|
||||||
|
// labelClass="font-bold text-[1.125rem]"
|
||||||
|
input
|
||||||
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
|
||||||
|
placeholder="100,000"
|
||||||
|
value={props.values.monthly_salary}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.monthly_salary && props.touched.monthly_salary) ? props.errors.monthly_salary : ''}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="w-full"
|
||||||
|
name="employment_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.employment_id}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.employment_id && props.touched.employment_id) ? props.errors.employment_id : ''}
|
||||||
|
/>
|
||||||
|
<div className="w-full">
|
||||||
|
<Button
|
||||||
|
className="my-4 btn-Y text-black w-full h-11"
|
||||||
|
text="Next"
|
||||||
|
type="submit"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-[4.125rem]">
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="sector"
|
|
||||||
floatLabel="Job Sector"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
select={true}
|
|
||||||
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
|
||||||
selectOptions={jobSector}
|
|
||||||
selectValue={props.values.sector}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.sector && props.touched.sector) ? props.errors.sector : ''}
|
|
||||||
/>
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="industry"
|
|
||||||
floatLabel="Select your industry"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
select={true}
|
|
||||||
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
|
||||||
selectOptions={industry}
|
|
||||||
selectValue={props.values.industry}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.industry && props.touched.industry) ? props.errors.industry : ''}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-[4.125rem]">
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="resumption_date"
|
|
||||||
floatLabel="Date of resumption"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
input
|
|
||||||
inputType='date'
|
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
|
||||||
placeholder="12/12/2015"
|
|
||||||
value={props.values.resumption_date}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.resumption_date && props.touched.resumption_date) ? props.errors.resumption_date : ''}
|
|
||||||
/>
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="email"
|
|
||||||
floatLabel="Employers official email"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
input
|
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
|
||||||
placeholder="example@gmail.com"
|
|
||||||
value={props.values.email}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.email && props.touched.email) ? props.errors.email : ''}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-[4.125rem]">
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="annual_income"
|
|
||||||
floatLabel="Annual Income"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
input
|
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
|
|
||||||
placeholder="1,200,000"
|
|
||||||
value={props.values.annual_income}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.annual_income && props.touched.annual_income) ? props.errors.annual_income : ''}
|
|
||||||
/>
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="monthly_salary"
|
|
||||||
floatLabel="Net monthly salary"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
input
|
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem] text-right"
|
|
||||||
placeholder="100,000"
|
|
||||||
value={props.values.monthly_salary}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.monthly_salary && props.touched.monthly_salary) ? props.errors.monthly_salary : ''}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-[4.125rem]">
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="salary_payment_date"
|
|
||||||
floatLabel="Salary payment date"
|
|
||||||
// labelClass="font-bold text-[1.125rem]"
|
|
||||||
input
|
|
||||||
inputType='date'
|
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
|
||||||
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="employment_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.employment_id}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.employment_id && props.touched.employment_id) ? props.errors.employment_id : ''}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<InputCompOne
|
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
|
||||||
name="highest_eductaion"
|
|
||||||
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={highestEductaion}
|
|
||||||
selectValue={props.values.highest_eductaion}
|
|
||||||
onChange={props.handleChange}
|
|
||||||
error={(props.errors.highest_eductaion && props.touched.highest_eductaion) ? props.errors.highest_eductaion : ''}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
|
|
||||||
text="Next"
|
|
||||||
type="submit"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export interface InputCompOneProps {
|
|||||||
selectValue?: string;
|
selectValue?: string;
|
||||||
input?: boolean;
|
input?: boolean;
|
||||||
select?: boolean;
|
select?: boolean;
|
||||||
selectOptions?: {loading:boolean, data:{ value: string; label: string }[]};
|
selectOptions?: {loading:boolean, data:{ [index: string]: string; }[]};
|
||||||
inputType?: string;
|
inputType?: string;
|
||||||
inputClass?: string;
|
inputClass?: string;
|
||||||
parentInputClass?: string;
|
parentInputClass?: string;
|
||||||
@@ -25,6 +25,7 @@ export interface InputCompOneProps {
|
|||||||
parentClass?: string;
|
parentClass?: string;
|
||||||
maxLength?: number;
|
maxLength?: number;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
disabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
|
const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
|
||||||
@@ -52,6 +53,7 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
|
|||||||
parentClass,
|
parentClass,
|
||||||
maxLength,
|
maxLength,
|
||||||
error,
|
error,
|
||||||
|
disabled=false
|
||||||
},
|
},
|
||||||
forwardedRef
|
forwardedRef
|
||||||
) => {
|
) => {
|
||||||
@@ -78,6 +80,7 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
|
|||||||
className={`px-4 ${floatLabel && 'peer pt-4 placeholder:text-transparent'} ${inputClass}`}
|
className={`px-4 ${floatLabel && 'peer pt-4 placeholder:text-transparent'} ${inputClass}`}
|
||||||
maxLength={maxLength}
|
maxLength={maxLength}
|
||||||
id={label ? label : floatLabel}
|
id={label ? label : floatLabel}
|
||||||
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
{floatLabel &&
|
{floatLabel &&
|
||||||
<label
|
<label
|
||||||
@@ -96,17 +99,27 @@ const InputCompOne = forwardRef<HTMLInputElement, InputCompOneProps>(
|
|||||||
name={name}
|
name={name}
|
||||||
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} ${disabled && 'opacity-50'}`}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
{selectOptions.loading ?
|
{selectOptions.loading ?
|
||||||
<option value=''>Loading</option>
|
<option value=''>Loading...</option>
|
||||||
: selectOptions.data.length ?
|
: selectOptions.data.length && name == 'employer_uid' ?
|
||||||
selectOptions.data.map(({ value, label }) => (
|
<>
|
||||||
<option key={value} value={value}>
|
<option value=''>Please Select</option>
|
||||||
{label}
|
{selectOptions.data.map(({ uid, name }) => (
|
||||||
</option>
|
<option key={uid} value={uid}>
|
||||||
))
|
{name}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
: selectOptions.data.length && name != 'employer_uid' ?
|
||||||
|
selectOptions.data.map(({ value, label }) => (
|
||||||
|
<option key={value} value={value}>
|
||||||
|
{label}
|
||||||
|
</option>
|
||||||
|
))
|
||||||
:
|
:
|
||||||
<option value=''>Not Found</option>
|
<option value=''>Not Found</option>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,12 @@ export const getUserPendingLoanList = (uid:string) => {
|
|||||||
// customer_uid: localStorage.getItem('uid'),
|
// customer_uid: localStorage.getItem('uid'),
|
||||||
}
|
}
|
||||||
return getAuxEnd(`/dash?uid=${uid}`, reqData)
|
return getAuxEnd(`/dash?uid=${uid}`, reqData)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET LIST OF EMPLOYERS
|
||||||
|
export const getEmployersList = () => {
|
||||||
|
let reqData = {
|
||||||
|
// customer_uid: localStorage.getItem('uid'),
|
||||||
|
}
|
||||||
|
return getAuxEnd(`/employers`, reqData)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user