Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 858bd7c0f7 | |||
| b995c36a8e | |||
| 2363bc3fd7 |
@@ -53,7 +53,7 @@ function Wallet({wallet, familyData, setFamilyWalletReload}) {
|
|||||||
name="plan"
|
name="plan"
|
||||||
// onClick={onClose}
|
// onClick={onClose}
|
||||||
>
|
>
|
||||||
Plan Wallet
|
Add Card
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,20 +24,18 @@ const validationSchema = Yup.object().shape({
|
|||||||
birthDay: Yup.string()
|
birthDay: Yup.string()
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
address: Yup.string()
|
address: Yup.string()
|
||||||
.min(5, "Minimum 3 characters")
|
.min(5, "Min 3 characters")
|
||||||
.max(50, "Maximum 25 characters")
|
.max(50, "Max 25 characters")
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
city: Yup.string()
|
city: Yup.string()
|
||||||
.min(2, "Minimum 3 characters")
|
.min(2, "Min 3 characters")
|
||||||
.max(25, "Maximum 25 characters")
|
.max(25, "Max 25 characters")
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
state: Yup.string()
|
state: Yup.string()
|
||||||
.min(2, "Minimum 3 characters")
|
|
||||||
.max(25, "Maximum 25 characters")
|
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
zipCode: Yup.string()
|
zipCode: Yup.string()
|
||||||
.min(1, "Minimum 3 characters")
|
.min(1, "Min 3 characters")
|
||||||
.max(10, "Maximum 25 characters")
|
.max(8, "Max 8 characters")
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -45,15 +43,20 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
|
|
||||||
const { userDetails } = useSelector((state) => state.userDetails);
|
const { userDetails } = useSelector((state) => state.userDetails);
|
||||||
|
|
||||||
|
const countryCode = userDetails?.country
|
||||||
|
|
||||||
const userApi = new usersService()
|
const userApi = new usersService()
|
||||||
|
|
||||||
const [requestStatus, setRequestStatus] = useState({loading: false, status:false, message: ''})
|
const [requestStatus, setRequestStatus] = useState({loading: false, status:false, message: ''})
|
||||||
|
|
||||||
const [allCountries, setAllCountries] = useState({loading: true, data: []}) // VARIABLE TO HOLD COUNTRY LIST
|
const [allCountries, setAllCountries] = useState({loading: true, data: []}) // VARIABLE TO HOLD COUNTRY LIST
|
||||||
|
|
||||||
|
const [state, setState] = useState({loading: true, data: {}}) // VARIABLE TO HOLD STATE LIST
|
||||||
|
|
||||||
|
|
||||||
let initialValues = {
|
let initialValues = {
|
||||||
// initial values for formik
|
// initial values for formik
|
||||||
country: '',
|
country: countryCode ? countryCode : '',
|
||||||
phone_number: '',
|
phone_number: '',
|
||||||
email: userDetails?.email,
|
email: userDetails?.email,
|
||||||
firstname: userDetails?.firstname,
|
firstname: userDetails?.firstname,
|
||||||
@@ -67,6 +70,7 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
zipCode: ''
|
zipCode: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleSubmit = (values) => {
|
const handleSubmit = (values) => {
|
||||||
const reqData = {
|
const reqData = {
|
||||||
name: values.firstname + ' ' + values.firstname,
|
name: values.firstname + ' ' + values.firstname,
|
||||||
@@ -98,6 +102,9 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
if(!res?.data?.result_list){
|
if(!res?.data?.result_list){
|
||||||
return setAllCountries({ loading: false, data: [] });
|
return setAllCountries({ loading: false, data: [] });
|
||||||
}
|
}
|
||||||
|
// if(countryCode){
|
||||||
|
// return setAllCountries({ loading: false, data: res?.data?.result_list?.filter(item => item?.code == countryCode) });
|
||||||
|
// }
|
||||||
setAllCountries({ loading: false, data: res?.data?.result_list });
|
setAllCountries({ loading: false, data: res?.data?.result_list });
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
setAllCountries({ loading: false, data: [] });
|
setAllCountries({ loading: false, data: [] });
|
||||||
@@ -105,6 +112,20 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
})
|
})
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
// GET STATE API
|
||||||
|
setState({loading: true, data: {}})
|
||||||
|
userApi.getStateFromCountry({country: countryCode}).then(res =>{
|
||||||
|
if(!res?.data?.country_state){
|
||||||
|
return setState({ loading: false, data: {} });
|
||||||
|
}
|
||||||
|
setState({ loading: false, data: res?.data?.country_state});
|
||||||
|
}).catch(err => {
|
||||||
|
setState({ loading: false, data: {} });
|
||||||
|
console.log('err', err)
|
||||||
|
})
|
||||||
|
},[initialValues.country])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalCom
|
<ModalCom
|
||||||
action={onClose}
|
action={onClose}
|
||||||
@@ -171,6 +192,7 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
value={props.values.country}
|
value={props.values.country}
|
||||||
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none border`}
|
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none border`}
|
||||||
onChange={props.handleChange}
|
onChange={props.handleChange}
|
||||||
|
disabled={countryCode ? true : false}
|
||||||
>
|
>
|
||||||
{allCountries.loading ?
|
{allCountries.loading ?
|
||||||
<option className="text-slate-500 text-lg" value="">
|
<option className="text-slate-500 text-lg" value="">
|
||||||
@@ -386,50 +408,63 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
inputHandler={props.handleChange}
|
inputHandler={props.handleChange}
|
||||||
error={(props.errors.state && props.touched.state) && props.errors.state}
|
error={(props.errors.state && props.touched.state) && props.errors.state}
|
||||||
/> */}
|
/> */}
|
||||||
<div className="field w-full">
|
|
||||||
<label
|
<div className="field w-full grid md:grid-cols-2 gap-4">
|
||||||
htmlFor="state"
|
<div className="field w-full">
|
||||||
className="job-label job-label-flex"
|
<label
|
||||||
>
|
htmlFor="state"
|
||||||
<span>State/Province</span>
|
className="job-label job-label-flex"
|
||||||
{props.errors.state && props.touched.state && (
|
>
|
||||||
<span className="text-[12px] text-red-500">
|
<span>State/Province</span>
|
||||||
{props.errors.state}
|
{props.errors.state && props.touched.state && (
|
||||||
</span>
|
<span className="text-[12px] text-red-500">
|
||||||
)}
|
{props.errors.state}
|
||||||
</label>
|
</span>
|
||||||
<select
|
)}
|
||||||
id="state"
|
</label>
|
||||||
name="state"
|
<select
|
||||||
value={props.values.state}
|
id="state"
|
||||||
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none border`}
|
name="state"
|
||||||
onChange={props.handleChange}
|
value={props.values.state}
|
||||||
>
|
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none border`}
|
||||||
<>
|
onChange={props.handleChange}
|
||||||
<option className="text-slate-500 text-lg" value=''>
|
>
|
||||||
select
|
{state.loading ?
|
||||||
</option>
|
<option className="text-slate-500 text-lg" value="">
|
||||||
{state.map(item => (
|
Loading...
|
||||||
<option key={item.value} className="text-slate-500 text-lg" value={item.value}>
|
</option>
|
||||||
{item.name}
|
: Object.keys(state.data)?.length > 0 ?
|
||||||
</option>
|
<>
|
||||||
))}
|
<option className="text-slate-500 text-lg" value="">
|
||||||
</>
|
Select State
|
||||||
</select>
|
</option>
|
||||||
|
{Object.keys(state.data)?.map((item, index) => (
|
||||||
|
<option key={index} className="text-slate-500 text-lg" value={item}>
|
||||||
|
{state?.data[item]}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
:
|
||||||
|
<option className="text-slate-500 text-lg" value="">
|
||||||
|
Not Found
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<InputCom
|
||||||
|
fieldClass="px-6"
|
||||||
|
label="Zip Code"
|
||||||
|
labelClass="tracking-wide"
|
||||||
|
inputBg="bg-slate-100"
|
||||||
|
inputClass="input-curve lg border border-light-purple"
|
||||||
|
type="text"
|
||||||
|
name="zipCode"
|
||||||
|
value={props.values.zipCode}
|
||||||
|
inputHandler={props.handleChange}
|
||||||
|
error={(props.errors.zipCode && props.touched.zipCode) && props.errors.zipCode}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<InputCom
|
|
||||||
fieldClass="px-6"
|
|
||||||
label="Zip Code"
|
|
||||||
labelClass="tracking-wide"
|
|
||||||
inputBg="bg-slate-100"
|
|
||||||
inputClass="input-curve lg border border-light-purple"
|
|
||||||
type="text"
|
|
||||||
name="zipCode"
|
|
||||||
value={props.values.zipCode}
|
|
||||||
inputHandler={props.handleChange}
|
|
||||||
error={(props.errors.zipCode && props.touched.zipCode) && props.errors.zipCode}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||||
@@ -488,8 +523,8 @@ 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 = [
|
// const state = [
|
||||||
{value: 'abia', name: 'Abia'},
|
// {value: 'abia', name: 'Abia'},
|
||||||
{value: 'imo', name: 'Imo'},
|
// {value: 'imo', name: 'Imo'},
|
||||||
{value: 'anambra', name: 'Anambra'},
|
// {value: 'anambra', name: 'Anambra'},
|
||||||
]
|
// ]
|
||||||
@@ -78,6 +78,8 @@ export const apiConst = {
|
|||||||
WRENCHBOARD_START_JOBLIST: 11028,
|
WRENCHBOARD_START_JOBLIST: 11028,
|
||||||
WRENCHBOARD_ACCOUNT_DASHDATA: 11029,
|
WRENCHBOARD_ACCOUNT_DASHDATA: 11029,
|
||||||
|
|
||||||
|
WRENCHBOARD_COUNTRY_STATE: 649,
|
||||||
|
|
||||||
WRENCHBOARD_SEND_CONTACTUS: 11030,
|
WRENCHBOARD_SEND_CONTACTUS: 11030,
|
||||||
WRENCHBOARD_ACCOUNT_SENDREFER: 11032,
|
WRENCHBOARD_ACCOUNT_SENDREFER: 11032,
|
||||||
WRENCHBOARD_ACCOUNT_REFERLINK: 11033,
|
WRENCHBOARD_ACCOUNT_REFERLINK: 11033,
|
||||||
|
|||||||
@@ -1536,6 +1536,18 @@ class usersService {
|
|||||||
return this.postAuxEnd("/recentpastdue", postData);
|
return this.postAuxEnd("/recentpastdue", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//API TO GET STATES FROM COUNTRY
|
||||||
|
getStateFromCountry(reqData){
|
||||||
|
var postData = {
|
||||||
|
member_uid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
action: apiConst.WRENCHBOARD_COUNTRY_STATE,
|
||||||
|
...reqData
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/countrystate", postData);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
||||||
|
|||||||
Reference in New Issue
Block a user