Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ef784dc6ed | |||
| 682745c321 | |||
| c63fbfc147 | |||
| 9b0f847bc1 |
@@ -28,7 +28,9 @@ export default function InputCom({
|
|||||||
direction,
|
direction,
|
||||||
tabIndex,
|
tabIndex,
|
||||||
error,
|
error,
|
||||||
autoComplete="on"
|
autoComplete="on",
|
||||||
|
minDate='1900-01-01',
|
||||||
|
maxDate='2099-09-13'
|
||||||
}) {
|
}) {
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
// Entry Validation
|
// Entry Validation
|
||||||
@@ -90,26 +92,51 @@ export default function InputCom({
|
|||||||
: "text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] border"
|
: "text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] border"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<input
|
<>
|
||||||
placeholder={placeholder}
|
{type == 'date' ?
|
||||||
value={value}
|
<input
|
||||||
onChange={inputHandler}
|
placeholder={placeholder}
|
||||||
className={`input-field placeholder:text-base text-dark-gray w-full h-full ${iconName && 'pr-6'} ${
|
value={value}
|
||||||
inputBg && inputBg} tracking-wide focus:ring-0 focus:outline-none ${fieldClass}`}
|
onChange={inputHandler}
|
||||||
type={type}
|
className={`input-field placeholder:text-base text-dark-gray w-full h-full ${iconName && 'pr-6'} ${
|
||||||
id={name}
|
inputBg && inputBg} tracking-wide focus:ring-0 focus:outline-none ${fieldClass}`}
|
||||||
name={name}
|
type={type}
|
||||||
onInput={onInput}
|
id={name}
|
||||||
minLength={minLengthValidation()}
|
name={name}
|
||||||
maxLength={maxLengthValidation()}
|
onInput={onInput}
|
||||||
tabIndex={tabIndex}
|
min={minDate}
|
||||||
// pattern={inputPatterns()}
|
max={maxDate}
|
||||||
ref={inputRef}
|
tabIndex={tabIndex}
|
||||||
readOnly={disable}
|
// pattern={inputPatterns()}
|
||||||
onBlur={blurHandler}
|
ref={inputRef}
|
||||||
dir={direction}
|
readOnly={disable}
|
||||||
autoComplete={autoComplete}
|
onBlur={blurHandler}
|
||||||
/>
|
dir={direction}
|
||||||
|
autoComplete={autoComplete}
|
||||||
|
/>
|
||||||
|
:
|
||||||
|
<input
|
||||||
|
placeholder={placeholder}
|
||||||
|
value={value}
|
||||||
|
onChange={inputHandler}
|
||||||
|
className={`input-field placeholder:text-base text-dark-gray w-full h-full ${iconName && 'pr-6'} ${
|
||||||
|
inputBg && inputBg} tracking-wide focus:ring-0 focus:outline-none ${fieldClass}`}
|
||||||
|
type={type}
|
||||||
|
id={name}
|
||||||
|
name={name}
|
||||||
|
onInput={onInput}
|
||||||
|
minLength={minLengthValidation()}
|
||||||
|
maxLength={maxLengthValidation()}
|
||||||
|
tabIndex={tabIndex}
|
||||||
|
// pattern={inputPatterns()}
|
||||||
|
ref={inputRef}
|
||||||
|
readOnly={disable}
|
||||||
|
onBlur={blurHandler}
|
||||||
|
dir={direction}
|
||||||
|
autoComplete={autoComplete}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</>
|
||||||
{iconName && (
|
{iconName && (
|
||||||
<div className="absolute right-6 bottom-3 z-10 flex gap-2">
|
<div className="absolute right-6 bottom-3 z-10 flex gap-2">
|
||||||
{iconName.split(" ").map((item, index) => (
|
{iconName.split(" ").map((item, index) => (
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ const validationSchema = Yup.object().shape({
|
|||||||
.min(9, "Min 9 characters")
|
.min(9, "Min 9 characters")
|
||||||
.max(11, "Max 11 characters")
|
.max(11, "Max 11 characters")
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
birthYear: Yup.string()
|
// birthYear: Yup.string()
|
||||||
.required("Required"),
|
// .required("Required"),
|
||||||
birthMonth: Yup.string()
|
// birthMonth: Yup.string()
|
||||||
.required("Required"),
|
// .required("Required"),
|
||||||
birthDay: Yup.string()
|
// birthDay: Yup.string()
|
||||||
.required("Required"),
|
// .required("Required"),
|
||||||
address: Yup.string()
|
address: Yup.string()
|
||||||
.min(5, "Min 3 characters")
|
.min(5, "Min 3 characters")
|
||||||
.max(50, "Max 25 characters")
|
.max(50, "Max 25 characters")
|
||||||
@@ -37,6 +37,8 @@ const validationSchema = Yup.object().shape({
|
|||||||
.min(1, "Min 3 characters")
|
.min(1, "Min 3 characters")
|
||||||
.max(8, "Max 8 characters")
|
.max(8, "Max 8 characters")
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
|
dob: Yup.string()
|
||||||
|
.required("Required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
||||||
@@ -67,32 +69,33 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
address: '',
|
address: '',
|
||||||
city: userDetails?.city ? userDetails.city : '',
|
city: userDetails?.city ? userDetails.city : '',
|
||||||
state: '',
|
state: '',
|
||||||
zipCode: ''
|
zipCode: '',
|
||||||
|
dob: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleSubmit = (values) => {
|
const handleSubmit = (values) => {
|
||||||
const reqData1 = {
|
// const reqData1 = {
|
||||||
name: values.firstname + ' ' + values.firstname,
|
// name: values.firstname + ' ' + values.firstname,
|
||||||
email: values.email,
|
// email: values.email,
|
||||||
phone_number: values.phone_number,
|
// phone_number: values.phone_number,
|
||||||
status: 'active',
|
// status: 'active',
|
||||||
type: 'individual',
|
// type: 'individual',
|
||||||
individual: {
|
// individual: {
|
||||||
first_name: values.firstname,
|
// first_name: values.firstname,
|
||||||
last_name: values.lastname,
|
// last_name: values.lastname,
|
||||||
dob: {day: values.birthDay, month: values.birthMonth, year: values.birthYear}
|
// dob: {day: values.birthDay, month: values.birthMonth, year: values.birthYear}
|
||||||
},
|
// },
|
||||||
billing:{
|
// billing:{
|
||||||
address : {
|
// address : {
|
||||||
line1: values.address,
|
// line1: values.address,
|
||||||
city: values.city,
|
// city: values.city,
|
||||||
state: values.state,
|
// state: values.state,
|
||||||
postal_code: values.zipCode,
|
// postal_code: values.zipCode,
|
||||||
country: values.country
|
// country: values.country
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
const reqData = {
|
const reqData = {
|
||||||
request_type: '100',
|
request_type: '100',
|
||||||
address: values.address,
|
address: values.address,
|
||||||
@@ -101,9 +104,13 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
country: values.country,
|
country: values.country,
|
||||||
postal_code: values.zipCode,
|
postal_code: values.zipCode,
|
||||||
phone_number: values.phone_number,
|
phone_number: values.phone_number,
|
||||||
dob_day: values.birthDay,
|
// dob_day: values.birthDay,
|
||||||
dob_month: values.birthMonth,
|
// dob_month: values.birthMonth,
|
||||||
dob_year: values.birthYear,
|
// dob_year: values.birthYear,
|
||||||
|
dob_day: Number(new Date(values.dob).getDate()),
|
||||||
|
dob_month: Number(new Date(values.dob).getMonth()) + 1,
|
||||||
|
dob_year: Number(new Date(values.dob).getFullYear()),
|
||||||
|
dob: values.dob
|
||||||
}
|
}
|
||||||
// console.log('Values', reqData)
|
// console.log('Values', reqData)
|
||||||
setRequestStatus({loading: true, status:false, message: ''})
|
setRequestStatus({loading: true, status:false, message: ''})
|
||||||
@@ -306,8 +313,8 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="field w-full flex flex-col gap-4">
|
<div className="field w-full flex flex-col gap-4">
|
||||||
<p className='job-label'>Date of Birth</p>
|
<p className='hidden job-label'>Date of Birth</p>
|
||||||
<div className='grid xxs:grid-cols-3 gap-4'>
|
<div className='hidden xxs:grid-cols-3 gap-4'>
|
||||||
<div className="field w-full">
|
<div className="field w-full">
|
||||||
<label
|
<label
|
||||||
htmlFor="birthDay"
|
htmlFor="birthDay"
|
||||||
@@ -402,6 +409,23 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className=''>
|
||||||
|
<InputCom
|
||||||
|
fieldClass="px-6"
|
||||||
|
label="Date of Birth"
|
||||||
|
labelClass="tracking-wide"
|
||||||
|
inputBg="bg-slate-100"
|
||||||
|
inputClass="input-curve lg border border-light-purple"
|
||||||
|
type="date"
|
||||||
|
name="dob"
|
||||||
|
value={props.values.dob}
|
||||||
|
inputHandler={props.handleChange}
|
||||||
|
error={(props.errors.dob && props.touched.dob) && props.errors.dob}
|
||||||
|
maxDate={year[0] + '-12-31'}
|
||||||
|
minDate={year[year?.length - 1] + '-01-01'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -543,29 +567,24 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
export default VirtualAddCardPopout;
|
export default VirtualAddCardPopout;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const day = new Array(31).fill(0).map((_,i) => i+1 )
|
const day = new Array(31).fill(0).map((_,i) => i+1 )
|
||||||
|
|
||||||
const month = [
|
const month = [
|
||||||
{value: 0, name: 'January'},
|
{value: 1, name: 'January'},
|
||||||
{value: 1, name: 'February'},
|
{value: 2, name: 'February'},
|
||||||
{value: 2, name: 'March'},
|
{value: 3, name: 'March'},
|
||||||
{value: 3, name: 'April'},
|
{value: 4, name: 'April'},
|
||||||
{value: 4, name: 'May'},
|
{value: 5, name: 'May'},
|
||||||
{value: 5, name: 'June'},
|
{value: 6, name: 'June'},
|
||||||
{value: 6, name: 'July'},
|
{value: 7, name: 'July'},
|
||||||
{value: 7, name: 'August'},
|
{value: 8, name: 'August'},
|
||||||
{value: 8, name: 'September'},
|
{value: 9, name: 'September'},
|
||||||
{value: 9, name: 'October'},
|
{value: 10, name: 'October'},
|
||||||
{value: 10, name: 'November'},
|
{value: 11, name: 'November'},
|
||||||
{value: 11, name: 'December'},
|
{value: 12, name: 'December'},
|
||||||
]
|
]
|
||||||
|
|
||||||
const date = new Date().getFullYear()
|
const date = new Date().getFullYear()
|
||||||
|
|
||||||
const year = new Array(100).fill(0).map((_,i) => (date-2) - i+1 )
|
const year = new Array(100).fill(0).map((_,i) => (date-2) - i+1 )
|
||||||
|
|
||||||
// const state = [
|
|
||||||
// {value: 'abia', name: 'Abia'},
|
|
||||||
// {value: 'imo', name: 'Imo'},
|
|
||||||
// {value: 'anambra', name: 'Anambra'},
|
|
||||||
// ]
|
|
||||||
Reference in New Issue
Block a user