Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 18967d720c | |||
| 044b2ef917 | |||
| 4f7fdfb2ba | |||
| ab389d6632 | |||
| 29538e3b6e | |||
| dd2df0d695 | |||
| a97db9a661 | |||
| 135cbce348 | |||
| 814bfe041a | |||
| d90d515f60 |
@@ -25,7 +25,6 @@ const validationSchema = Yup.object().shape({
|
|||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
sales_agent: Yup.string()
|
sales_agent: Yup.string()
|
||||||
.required("Required")
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function DashboardFormInit({handleNextStep}:Props) {
|
export default function DashboardFormInit({handleNextStep}:Props) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const DashboardHome: FC<DashboardHomeProps> = () => {
|
|||||||
{step === 5 && <DashboardHomeRefereeInfo handleNextStep={handleNextStep} />}
|
{step === 5 && <DashboardHomeRefereeInfo handleNextStep={handleNextStep} />}
|
||||||
{step === 6 && <DashboardHomeAttestation handleNextStep={handleNextStep} applicationDetails={applicationDetails} />}
|
{step === 6 && <DashboardHomeAttestation handleNextStep={handleNextStep} applicationDetails={applicationDetails} />}
|
||||||
{step === 7 && <DashboardHomeIntro step={step} handleNextStep={handleNextStep} />}
|
{step === 7 && <DashboardHomeIntro step={step} handleNextStep={handleNextStep} />}
|
||||||
|
{/* <DashboardHomeAttestation handleNextStep={handleNextStep} applicationDetails={applicationDetails} /> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ 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 { applyForLoan } from '../../../core/apiRequest';
|
||||||
|
|
||||||
// import { useNavigate } from "react-router-dom";
|
// import { useNavigate } from "react-router-dom";
|
||||||
// import { RouteHandler } from '../../../router/routes';
|
// import { RouteHandler } from '../../../router/routes';
|
||||||
|
|
||||||
@@ -27,11 +29,22 @@ export default function DashboardHomeAttestation({handleNextStep, applicationDet
|
|||||||
// let navigate = useNavigate();
|
// let navigate = useNavigate();
|
||||||
// const navigateToProfile = () => navigate(RouteHandler.dashboardProfile);
|
// const navigateToProfile = () => navigate(RouteHandler.dashboardProfile);
|
||||||
|
|
||||||
//FUNCTION TO HANDLE SUBMIT
|
//FUNCTION TO HANDLE LOAN APPLICATION
|
||||||
const handleSubmit = (values:any) => {
|
const handleSubmit = (values:any) => {
|
||||||
delete values.checked
|
delete values.checked
|
||||||
handleNextStep({disbursement: values})
|
applyForLoan({...applicationDetails, disbursement: values}).then(res=>{
|
||||||
console.log('ApplicationDetails', applicationDetails)
|
console.log('APPLY FOR LOAN', res)
|
||||||
|
handleNextStep({disbursement: values})
|
||||||
|
console.log('ApplicationDetails', {...applicationDetails, disbursement: values})
|
||||||
|
}).catch(err=>{
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
// applyForLoan(payload).then(res=>{
|
||||||
|
// console.log('APPLY FOR LOAN', res)
|
||||||
|
// // handleNextStep({disbursement: values})
|
||||||
|
// }).catch(err=>{
|
||||||
|
// console.log(err)
|
||||||
|
// })
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -89,3 +102,46 @@ export default function DashboardHomeAttestation({handleNextStep, applicationDet
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// const payload = {
|
||||||
|
// "loan_amount": "100000",
|
||||||
|
// "payment_month": "18",
|
||||||
|
// "sales_agent": "Testing1234",
|
||||||
|
// "gender": "male",
|
||||||
|
// "address": "World bank housing Estate, Umuahia",
|
||||||
|
// "marital_status": "single",
|
||||||
|
// "state": "abia",
|
||||||
|
// "email": "test5070@gmail.com",
|
||||||
|
// "country": "NG",
|
||||||
|
// "employment": {
|
||||||
|
// "job_title": "Information Officer",
|
||||||
|
// "name": "Testing Testing",
|
||||||
|
// "sector": "private (non academic)",
|
||||||
|
// "industry": "engineering",
|
||||||
|
// "resumption_date": "2024-04-05",
|
||||||
|
// "email": "test50700@gmail.com",
|
||||||
|
// "annual_income": "600000",
|
||||||
|
// "monthly_salary": "50000",
|
||||||
|
// "salary_payment_date": "2024-04-19",
|
||||||
|
// "employment_id": "2555566",
|
||||||
|
// "highest_eductaion": "b.sc + professional qualification"
|
||||||
|
// },
|
||||||
|
// "loan_reference": [
|
||||||
|
// {
|
||||||
|
// "fullname": "John Mike",
|
||||||
|
// "relationship": "Brother",
|
||||||
|
// "phone_number": "07055566611",
|
||||||
|
// "email": "refone@gmail.com",
|
||||||
|
// "bvn": "11111111111"
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "fullname": "Mary Paul",
|
||||||
|
// "relationship": "Brother",
|
||||||
|
// "phone_number": "07055577711",
|
||||||
|
// "email": "reftwo@gmail.com",
|
||||||
|
// "bvn": "22222222222"
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// disbursement:{account: '1122334456'}
|
||||||
|
// }
|
||||||
@@ -12,7 +12,8 @@ const initialValues = {
|
|||||||
address: "",
|
address: "",
|
||||||
marital_status: "",
|
marital_status: "",
|
||||||
state: "",
|
state: "",
|
||||||
email:""
|
email:"",
|
||||||
|
country:""
|
||||||
};
|
};
|
||||||
|
|
||||||
// To get the validation schema
|
// To get the validation schema
|
||||||
@@ -28,6 +29,8 @@ const validationSchema = Yup.object().shape({
|
|||||||
email: Yup.string()
|
email: Yup.string()
|
||||||
.email("Invalid")
|
.email("Invalid")
|
||||||
.required("Required"),
|
.required("Required"),
|
||||||
|
country: Yup.string()
|
||||||
|
.required("Required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function DashboardHomeDetail({handleNextStep}:Props) {
|
export default function DashboardHomeDetail({handleNextStep}:Props) {
|
||||||
@@ -102,18 +105,32 @@ export default function DashboardHomeDetail({handleNextStep}:Props) {
|
|||||||
error={(props.errors.state && props.touched.state) ? props.errors.state : ''}
|
error={(props.errors.state && props.touched.state) ? props.errors.state : ''}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<InputCompOne
|
<div className="flex items-center gap-[4.125rem]">
|
||||||
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
<InputCompOne
|
||||||
name="email"
|
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
||||||
label="Email address"
|
name="email"
|
||||||
labelClass="font-bold text-[1.125rem]"
|
label="Email address"
|
||||||
input
|
labelClass="font-bold text-[1.125rem]"
|
||||||
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
input
|
||||||
placeholder="johndoe@gmail.com"
|
inputClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
value={props.values.email}
|
placeholder="johndoe@gmail.com"
|
||||||
onChange={props.handleChange}
|
value={props.values.email}
|
||||||
error={(props.errors.email && props.touched.email) ? props.errors.email : ''}
|
onChange={props.handleChange}
|
||||||
/>
|
error={(props.errors.email && props.touched.email) ? props.errors.email : ''}
|
||||||
|
/>
|
||||||
|
<InputCompOne
|
||||||
|
parentClass="max-w-[25.875rem] w-full flex flex-col gap-4"
|
||||||
|
name="country"
|
||||||
|
label="Select your country"
|
||||||
|
labelClass="font-bold text-[1.125rem]"
|
||||||
|
select={true}
|
||||||
|
selectClass="w-full h-[3.625rem] bg-[#EFEFEF] px-4 rounded-[.375rem]"
|
||||||
|
selectOptions={country}
|
||||||
|
selectValue={props.values.country}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
error={(props.errors.country && props.touched.country) ? props.errors.country : ''}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<Button
|
<Button
|
||||||
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
|
className="my-8 max-w-[25.875rem] btn-Y text-black w-full h-11"
|
||||||
text="Next"
|
text="Next"
|
||||||
@@ -162,4 +179,12 @@ const state: SelectOption = {
|
|||||||
{ value: "imo", label: "Imo" },
|
{ value: "imo", label: "Imo" },
|
||||||
{ value: "lagos", label: "Lagos" },
|
{ value: "lagos", label: "Lagos" },
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const country: SelectOption = {
|
||||||
|
loading: false,
|
||||||
|
data: [
|
||||||
|
{ value: "", label: "Please Select" },
|
||||||
|
{ value: "NG", label: "Nigeria" },
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ const Header: React.FC<HiddenMenuItems> = ({
|
|||||||
<div className="flex flex-col-reverse lg:flex-col grow lg:grow-0 justify-between items-end">
|
<div className="flex flex-col-reverse lg:flex-col grow lg:grow-0 justify-between items-end">
|
||||||
<ul className="flex gap-0 lg:gap-[10px] items-center justify-end w-full flex-wrap">
|
<ul className="flex gap-0 lg:gap-[10px] items-center justify-end w-full flex-wrap">
|
||||||
{[
|
{[
|
||||||
{ text: "Open An Account", href: RouteHandler.getStarted },
|
{ text: "Open An Account", href: RouteHandler.letsGetStarted },
|
||||||
{
|
{
|
||||||
text: "Internet Banking",
|
text: "Internet Banking",
|
||||||
href: RouteHandler.businessBanking,
|
href: RouteHandler.businessBanking,
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ const LetsGetStarted: React.FC = () => {
|
|||||||
},4000)
|
},4000)
|
||||||
}
|
}
|
||||||
// console.log(res.data)
|
// console.log(res.data)
|
||||||
localStorage.setItem('token', res.data.token)
|
localStorage.setItem('token', res.data?.token)
|
||||||
localStorage.setItem('uid', res.data.uid)
|
localStorage.setItem('uid', res?.data?.customer[0]?.uid)
|
||||||
dispatch(updateUserDetails({ ...res.data }));
|
dispatch(updateUserDetails({ ...res?.data?.customer[0] }));
|
||||||
navigate(RouteHandler.dashboardHome, {replace:true})
|
navigate(RouteHandler.dashboardHome, {replace:true})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
setRequestStatusOTP({loading:false, status:false, message:'something went wrong, try again'})
|
setRequestStatusOTP({loading:false, status:false, message:'something went wrong, try again'})
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const Stepper: React.FC<StepperProps> = ({ step = 0 }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-between items-center gap-5">
|
<div className="flex justify-between items-center gap-5">
|
||||||
{[...Array(6)].map((_, index) => (
|
{[...Array(5)].map((_, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className={`w-[1.875rem] border-[.1875rem] rounded-sm ${(step === index
|
className={`w-[1.875rem] border-[.1875rem] rounded-sm ${(step === index
|
||||||
|
|||||||
+19
-1
@@ -1,4 +1,4 @@
|
|||||||
import { postAuxEnd } from "./axiosCall";
|
import { postAuxEnd, getAuxEnd } from "./axiosCall";
|
||||||
|
|
||||||
// FUNCTION TO START BVN VALIDATION
|
// FUNCTION TO START BVN VALIDATION
|
||||||
export const validateBVN = (postData:any) => {
|
export const validateBVN = (postData:any) => {
|
||||||
@@ -15,4 +15,22 @@ export const verifyOTP = (postData:any) => {
|
|||||||
...postData
|
...postData
|
||||||
}
|
}
|
||||||
return postAuxEnd('/bvn/verify', reqData)
|
return postAuxEnd('/bvn/verify', reqData)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO APPLY FOR LOAN
|
||||||
|
export const applyForLoan = (postData:any) => {
|
||||||
|
let reqData = {
|
||||||
|
customer_uid: localStorage.getItem('uid'),
|
||||||
|
...postData
|
||||||
|
}
|
||||||
|
return postAuxEnd('/loan/apply', reqData)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FUNCTION TO GET USER BY CUSTOMER UID
|
||||||
|
export const getUserByID = (uid:string) => {
|
||||||
|
let reqData = {
|
||||||
|
// customer_uid: localStorage.getItem('uid'),
|
||||||
|
}
|
||||||
|
return getAuxEnd(`/profile?uid=${uid}`, reqData)
|
||||||
}
|
}
|
||||||
+74
-42
@@ -1,49 +1,81 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export function postAuxEnd(uri:string, reqData:any):Promise<any> {
|
export function postAuxEnd(uri: string, reqData: any): Promise<any> {
|
||||||
const endPoint = import.meta.env.VITE_USERS_ENDPOINT + uri;
|
const endPoint = import.meta.env.VITE_USERS_ENDPOINT + uri;
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
for (let value in reqData) {
|
for (let value in reqData) {
|
||||||
|
if (typeof reqData[value] === "object") {
|
||||||
|
// for (let innerValue in reqData[value]) {
|
||||||
|
// let innerReqData = reqData[value]
|
||||||
|
// console.log('SAMPLE',innerReqData)
|
||||||
|
// formData.append(reqData[value][innerValue], reqData[value][innerValue]);
|
||||||
|
// }
|
||||||
|
// formData.append(value, JSON.stringify(reqData[value]));
|
||||||
|
formData.append(value, reqData[value]);
|
||||||
|
} else {
|
||||||
formData.append(value, reqData[value]);
|
formData.append(value, reqData[value]);
|
||||||
}
|
}
|
||||||
return axios.post(endPoint, formData)
|
|
||||||
.then((response:{}) => {
|
|
||||||
// if (response.data.internal_return == "-9999") {
|
|
||||||
// localStorage.clear();
|
|
||||||
// window.location.href = `/login?sessionExpired=true`;
|
|
||||||
// }
|
|
||||||
return response;
|
|
||||||
})
|
|
||||||
.catch((error:any) => {
|
|
||||||
if (error.response) {
|
|
||||||
//response status is an error code
|
|
||||||
console.log(
|
|
||||||
"ERROR-------------------------------------------------------"
|
|
||||||
);
|
|
||||||
console.log(error.response.status);
|
|
||||||
console.log(
|
|
||||||
"ERROR-------------------------------------------------------"
|
|
||||||
);
|
|
||||||
} else if (error.request) {
|
|
||||||
//response not received though the request was sent
|
|
||||||
console.log(
|
|
||||||
"ERROR2-------------------------------------------------------"
|
|
||||||
);
|
|
||||||
console.log(error?.request);
|
|
||||||
console.log(
|
|
||||||
"ERROR2-------------------------------------------------------"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
//an error occurred when setting up the request
|
|
||||||
console.log(
|
|
||||||
"ERROR3-------------------------------------------------------"
|
|
||||||
);
|
|
||||||
console.log(error);
|
|
||||||
console.log(
|
|
||||||
"ERROR3-------------------------------------------------------"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
return axios
|
||||||
|
.post(endPoint, formData)
|
||||||
|
.then((response: {}) => {
|
||||||
|
// if (response.data.internal_return == "-9999") {
|
||||||
|
// localStorage.clear();
|
||||||
|
// window.location.href = `/login?sessionExpired=true`;
|
||||||
|
// }
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
if (error.response) {
|
||||||
|
//response status is an error code
|
||||||
|
console.log(
|
||||||
|
"ERROR-------------------------------------------------------"
|
||||||
|
);
|
||||||
|
console.log(error.response.status);
|
||||||
|
console.log(
|
||||||
|
"ERROR-------------------------------------------------------"
|
||||||
|
);
|
||||||
|
} else if (error.request) {
|
||||||
|
//response not received though the request was sent
|
||||||
|
console.log(
|
||||||
|
"ERROR2-------------------------------------------------------"
|
||||||
|
);
|
||||||
|
console.log(error?.request);
|
||||||
|
console.log(
|
||||||
|
"ERROR2-------------------------------------------------------"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
//an error occurred when setting up the request
|
||||||
|
console.log(
|
||||||
|
"ERROR3-------------------------------------------------------"
|
||||||
|
);
|
||||||
|
console.log(error);
|
||||||
|
console.log(
|
||||||
|
"ERROR3-------------------------------------------------------"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getAuxEnd(uri: string, reqData: any): Promise<any> {
|
||||||
|
const endPoint = import.meta.env.VITE_USERS_ENDPOINT + uri;
|
||||||
|
const formData = new FormData();
|
||||||
|
for (let value in reqData) {
|
||||||
|
formData.append(value, reqData[value]);
|
||||||
|
}
|
||||||
|
return axios
|
||||||
|
.get(endPoint, reqData)
|
||||||
|
.then((response: {}) => {
|
||||||
|
// if (response.data.internal_return == "-9999") {
|
||||||
|
// localStorage.clear();
|
||||||
|
// window.location.href = `/login?sessionExpired=true`;
|
||||||
|
// }
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
console.log(
|
||||||
|
"ERROR3-------------------------------------------------------", error
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -13,6 +13,6 @@ export interface User {
|
|||||||
last_login?:string
|
last_login?:string
|
||||||
message?:string
|
message?:string
|
||||||
token?:string
|
token?:string
|
||||||
uid?:string
|
customer_uid?:string
|
||||||
call_return?:string
|
call_return?:string
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import { Outlet, useNavigate } from "react-router-dom";
|
|||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { RouteHandler } from '../../router/routes';
|
import { RouteHandler } from '../../router/routes';
|
||||||
import { updateUserDetails } from '../../store/UserDetails';
|
import { updateUserDetails } from '../../store/UserDetails';
|
||||||
|
import { getUserByID } from '../../core/apiRequest';
|
||||||
|
|
||||||
import Logo from '../../assets/images/logo.png'
|
import Logo from '../../assets/images/logo.png'
|
||||||
|
|
||||||
@@ -19,19 +20,27 @@ export default function DashboardAuth() {
|
|||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
let token = localStorage.getItem('token')
|
let token = localStorage.getItem('token')
|
||||||
if(!token){
|
let uid = localStorage.getItem('uid')
|
||||||
|
if(!token || !uid){
|
||||||
navigate(RouteHandler.letsGetStarted, {replace:true})
|
navigate(RouteHandler.letsGetStarted, {replace:true})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const getUserByToken = () => {
|
const getUser = () => { // FUNCTION TO GET USER BY ID
|
||||||
let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'}
|
// let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'}
|
||||||
setTimeout(()=>{
|
getUserByID(uid).then(res=>{
|
||||||
|
if(!res.data.call_return || !Object.keys(res.data.customer).length){
|
||||||
|
navigate(RouteHandler.letsGetStarted, {replace:true})
|
||||||
|
return
|
||||||
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
dispatch(updateUserDetails({...data}));
|
dispatch(updateUserDetails(res.data.customer));
|
||||||
},4000)
|
}).catch(err=>{
|
||||||
|
navigate(RouteHandler.letsGetStarted, {replace:true})
|
||||||
|
console.log('USER ERROR', err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if(!Object.keys(userDetails).length){
|
if(!Object.keys(userDetails).length){
|
||||||
getUserByToken()
|
getUser()
|
||||||
}
|
}
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user