Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 827d0a1c30 | |||
| 0fc549f1b5 | |||
| ee1fe4a5b6 |
@@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react'
|
|||||||
import {useLocation, useNavigate} from 'react-router-dom'
|
import {useLocation, useNavigate} from 'react-router-dom'
|
||||||
import { Content } from '../../../../_digifi/layout/components/content'
|
import { Content } from '../../../../_digifi/layout/components/content'
|
||||||
import { ToolbarWrapper } from '../../../../_digifi/layout/components/toolbar'
|
import { ToolbarWrapper } from '../../../../_digifi/layout/components/toolbar'
|
||||||
import { UsersListLoading } from '../user-started/components/loading/UsersListLoading'
|
import { CustomLoading, UsersListLoading } from '../user-started/components/loading/UsersListLoading'
|
||||||
|
import { getVerifiedLoanDetailsByUID } from '../core/_requests'
|
||||||
|
|
||||||
export default function ApproveRejectPage() {
|
export default function ApproveRejectPage() {
|
||||||
const {state:{selectedUser}} = useLocation()
|
const {state:{selectedUser}} = useLocation()
|
||||||
@@ -10,6 +11,8 @@ export default function ApproveRejectPage() {
|
|||||||
|
|
||||||
const [requestStatus, setRequestStatus] = useState<any>({loading:false, status:false, data:null})
|
const [requestStatus, setRequestStatus] = useState<any>({loading:false, status:false, data:null})
|
||||||
|
|
||||||
|
const [loanDetails, setLoanDetails] = useState<any>({loading:true, data:null})
|
||||||
|
|
||||||
const handleSubmit = ():any => {
|
const handleSubmit = ():any => {
|
||||||
setRequestStatus({loading:true, status:false, data:null})
|
setRequestStatus({loading:true, status:false, data:null})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
@@ -19,59 +22,109 @@ export default function ApproveRejectPage() {
|
|||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(!selectedUser){
|
if(!selectedUser){
|
||||||
navigate('/', {replace:true})
|
return navigate('/', {replace:true})
|
||||||
}
|
}
|
||||||
|
getVerifiedLoanDetailsByUID(selectedUser?.uid).then(res => {
|
||||||
|
setLoanDetails({loading:false, data:res?.data})
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
setLoanDetails({loading:false, data:null})
|
||||||
|
})
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <ToolbarWrapper /> */}
|
{/* <ToolbarWrapper /> */}
|
||||||
<Content>
|
<Content>
|
||||||
<div className='w-100'>
|
{loanDetails.loading ?
|
||||||
<h3 className='py-3 py-xl-5 card-title text-gray-800 fw-bold'>Processing: {selectedUser?.uid}</h3>
|
<div className='position-relative w-100 vh-100'>
|
||||||
|
<CustomLoading />
|
||||||
</div>
|
</div>
|
||||||
{/* begin::Row */}
|
:
|
||||||
<div className="row g-5 g-xl-10 mb-5 mb-xl-10">
|
<>
|
||||||
{/* begin::Col */}
|
<div className='w-100'>
|
||||||
<div className="col-xl-6 mb-md-5 mb-xl-10">
|
<h3 className='py-3 py-xl-5 card-title text-gray-800 fw-bold'>Processing: {selectedUser?.uid}</h3>
|
||||||
<div className="card card-flash flex flex-col justify-content-between p-4 h-md-50 mb-5 mb-xl-10 bg-secondary">
|
</div>
|
||||||
<h3 className='card-title text-gray-800 fw-bold'>Process Loan</h3>
|
{/* begin::Row */}
|
||||||
<div className='w-100 d-flex justify-content-between'>
|
<div className="row g-5 g-xl-10 mb-5 mb-xl-10">
|
||||||
<button
|
{/* begin::Col */}
|
||||||
className='btn btn-light btn-active-light-secondary text-success btn-lg'
|
<div className="col-xl-6 mb-md-5 mb-xl-10">
|
||||||
onClick={()=>navigate('/loan/pages/process/verified', {replace:true})}
|
<div className="card card-flash flex flex-col justify-content-between p-4 h-md-50 mb-5 mb-xl-10 bg-secondary">
|
||||||
>
|
<h3 className='card-title text-gray-800 fw-bold'>Process Loan</h3>
|
||||||
Return
|
<div className='w-100 d-flex justify-content-between'>
|
||||||
</button>
|
<button
|
||||||
<button
|
className='btn btn-light btn-active-light-secondary text-success btn-lg'
|
||||||
className='btn btn-light btn-active-light-secondary text-danger btn-lg'
|
onClick={()=>navigate('/loan/pages/process/verified', {replace:true})}
|
||||||
onClick={handleSubmit}
|
>
|
||||||
>
|
Return
|
||||||
Reject
|
</button>
|
||||||
</button>
|
<button
|
||||||
<button
|
className='btn btn-light btn-active-light-secondary text-danger btn-lg'
|
||||||
className='btn btn-light btn-active-light-secondary text-primary btn-lg'
|
onClick={handleSubmit}
|
||||||
onClick={handleSubmit}
|
>
|
||||||
>
|
Reject
|
||||||
Approve
|
</button>
|
||||||
</button>
|
<button
|
||||||
|
className='btn btn-light btn-active-light-secondary text-primary btn-lg'
|
||||||
|
onClick={handleSubmit}
|
||||||
|
>
|
||||||
|
Approve
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="card card-flash flex flex-col p-4 h-md-50 mb-5 mb-xl-10 bg-secondary">
|
||||||
|
<h3 className='card-title text-gray-800 fw-bold mb-5'>Verification details</h3>
|
||||||
|
<div className='w-100'>
|
||||||
|
{loanDetails?.data?.verification.length > 0 ?
|
||||||
|
<table className='w-100'>
|
||||||
|
<tr>
|
||||||
|
<th>UID</th>
|
||||||
|
<th>EMPLOYER NAME</th>
|
||||||
|
</tr>
|
||||||
|
{loanDetails?.data?.verification?.map((item:any) => (
|
||||||
|
<tr key={item.uid || item.id}>
|
||||||
|
<td>{item.uid}</td>
|
||||||
|
<td>{item.employers_name}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</table>
|
||||||
|
:
|
||||||
|
null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="card card-flash flex flex-col justify-content-between p-4 h-md-50 mb-5 mb-xl-10 bg-secondary">
|
{/* end::Col */}
|
||||||
<h3 className='card-title text-gray-800 fw-bold'>Verification details</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* end::Col */}
|
|
||||||
|
|
||||||
{/* begin::Col */}
|
{/* begin::Col */}
|
||||||
<div className="col-xl-6">
|
<div className="col-xl-6">
|
||||||
<div className="card card-flash flex flex-col justify-content-between p-4 h-md-100 bg-secondary">
|
<div className="card card-flash flex flex-col p-4 h-md-100 bg-secondary">
|
||||||
<h3 className='card-title text-gray-800 fw-bold'>Loan Details</h3>
|
<h3 className='card-title text-gray-800 fw-bold mb-5'>Loan Details</h3>
|
||||||
|
<div className='w-100'>
|
||||||
|
{loanDetails?.data?.application.length > 0 ?
|
||||||
|
<table className='w-100'>
|
||||||
|
<tr>
|
||||||
|
<th>UID</th>
|
||||||
|
<th>AMOUNT</th>
|
||||||
|
</tr>
|
||||||
|
{loanDetails?.data?.application?.map((item:any) => (
|
||||||
|
<tr key={item.uid || item.id}>
|
||||||
|
<td>{item.uid}</td>
|
||||||
|
<td>{item.loan_amount}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</table>
|
||||||
|
:
|
||||||
|
null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/* end::Col */}
|
||||||
{/* end::Col */}
|
</div>
|
||||||
</div>
|
{/* end::Row */}
|
||||||
{/* end::Row */}
|
</>
|
||||||
|
}
|
||||||
</Content>
|
</Content>
|
||||||
{requestStatus.loading && <UsersListLoading />}
|
{requestStatus.loading && <UsersListLoading />}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -33,8 +33,57 @@ export type User = {
|
|||||||
employer_name?: string
|
employer_name?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type VerifiedLoanDetails = {
|
||||||
|
application_uid?: string
|
||||||
|
application?: Array<{[index: string]: string}>
|
||||||
|
// application?: [
|
||||||
|
// {
|
||||||
|
// "id": "21",
|
||||||
|
// "uid": "006915e9-cb0d-42e9-b4af-c047da51e2ac",
|
||||||
|
// "customer_uid": "9cb678e0-0697-4cc9-9bf0-3f40a3c989fb",
|
||||||
|
// "loan_amount": "2220",
|
||||||
|
// "payment_month": "18",
|
||||||
|
// "sales_agent": "866969",
|
||||||
|
// "gender": null,
|
||||||
|
// "marital_status": "single",
|
||||||
|
// "email": "ameye+update@chiefsoft.com",
|
||||||
|
// "address": "4201 Defoors Farm Trail",
|
||||||
|
// "state": "abia",
|
||||||
|
// "country": "NG",
|
||||||
|
// "loan_detail": "{\"customer_uid\":\"9cb678e0-0697-4cc9-9bf0-3f40a3c989fb\",\"loan_amount\":\"2220\",\"payment_month\":\"18\",\"sales_agent\":\"866969\",\"gender\":\"female\",\"address\":\"4201 Defoors Farm Trail\",\"marital_status\":\"single\",\"state\":\"abia\",\"email\":\"ameye+update@chiefsoft.com\",\"country\":\"NG\",\"employer_uid\":\"3a9ec95a-090c-4c98-bc01-e96d76b93952\",\"employment\":\"[object Object]\",\"loan_reference\":\"[object Object],[object Object]\",\"disbursement\":\"[object Object]\"}",
|
||||||
|
// "status": "4",
|
||||||
|
// "added": "2024-07-10 21:28:13.404726",
|
||||||
|
// "updated": "2024-07-10 21:28:13.404726",
|
||||||
|
// "employer_uid": "3a9ec95a-090c-4c98-bc01-e96d76b93952"
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
verification?: Array<{[index: string]: string}>
|
||||||
|
// "verification": [
|
||||||
|
// {
|
||||||
|
// "id": "56",
|
||||||
|
// "uid": "e041279c-875d-4973-b042-48efec05fecf",
|
||||||
|
// "employer_uid": "3a9ec95a-090c-4c98-bc01-e96d76b93952",
|
||||||
|
// "status": "1",
|
||||||
|
// "added": "2024-07-11 16:03:25.343553",
|
||||||
|
// "updated": "2024-07-11 16:03:25.343553",
|
||||||
|
// "username": "ameye+update@chiefsoft.com",
|
||||||
|
// "password": "5769407ab4409037161a51692c6bb617",
|
||||||
|
// "signatory_uid": "db444b87-ec0f-483b-a8cf-eea9e8466f10",
|
||||||
|
// "application_uid": "006915e9-cb0d-42e9-b4af-c047da51e2ac",
|
||||||
|
// "education": "b.sc",
|
||||||
|
// "grade": "Test 001",
|
||||||
|
// "applicant_date": "2024-07-10 00:00:00",
|
||||||
|
// "ippis_number": "",
|
||||||
|
// "employers_name": "bshshsjss",
|
||||||
|
// "designation": "jdjdjddk"
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
}
|
||||||
|
|
||||||
export type UsersQueryResponse = Response<Array<User>>
|
export type UsersQueryResponse = Response<Array<User>>
|
||||||
|
|
||||||
|
export type VerifiedLoanDetailsResponse = Response<VerifiedLoanDetails>
|
||||||
|
|
||||||
export const initialUser: User = {
|
export const initialUser: User = {
|
||||||
avatar: 'avatars/300-6.jpg',
|
avatar: 'avatars/300-6.jpg',
|
||||||
position: 'Art Director',
|
position: 'Art Director',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios, { AxiosResponse } from "axios";
|
import axios, { AxiosResponse } from "axios";
|
||||||
import { ID, Response } from "../../../../_digifi/helpers"
|
import { ID, Response } from "../../../../_digifi/helpers"
|
||||||
import { User, UsersQueryResponse } from "./_models";
|
import { User, UsersQueryResponse, VerifiedLoanDetailsResponse } from "./_models";
|
||||||
import { postAuxEnd } from "../../auth/core/AxiosCallHelper";
|
import { postAuxEnd, getAuxEnd } from "../../auth/core/AxiosCallHelper";
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_APP_THEME_API_URL;
|
const API_URL = import.meta.env.VITE_APP_THEME_API_URL;
|
||||||
const USER_URL = `${API_URL}/user`;
|
const USER_URL = `${API_URL}/user`;
|
||||||
@@ -54,6 +54,10 @@ const employersVerify = (uid: ID): Promise<UsersQueryResponse> => { // FUNCTION
|
|||||||
return postAuxEnd('/employers/verify', {application_uid:uid})
|
return postAuxEnd('/employers/verify', {application_uid:uid})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getVerifiedLoanDetailsByUID = (uid: string): Promise<VerifiedLoanDetailsResponse> => { // FUNCTION TO GET VERIFIED LOAN DETAILS IN ORDER TO PROCESS
|
||||||
|
return getAuxEnd(`/loan/process/${uid}`)
|
||||||
|
};
|
||||||
|
|
||||||
const getUserById = (id: ID): Promise<User | undefined> => {
|
const getUserById = (id: ID): Promise<User | undefined> => {
|
||||||
return axios
|
return axios
|
||||||
.get(`${USER_URL}/${id}`)
|
.get(`${USER_URL}/${id}`)
|
||||||
@@ -92,6 +96,8 @@ export {
|
|||||||
getVerifiedUsers,
|
getVerifiedUsers,
|
||||||
getApprovedUsers,
|
getApprovedUsers,
|
||||||
employersVerify,
|
employersVerify,
|
||||||
|
getVerifiedLoanDetailsByUID,
|
||||||
|
|
||||||
deleteUser,
|
deleteUser,
|
||||||
deleteSelectedUsers,
|
deleteSelectedUsers,
|
||||||
getUserById,
|
getUserById,
|
||||||
|
|||||||
@@ -15,4 +15,21 @@ const UsersListLoading = () => {
|
|||||||
return <div style={{...styles, position: 'absolute', textAlign: 'center'}}>Processing...</div>
|
return <div style={{...styles, position: 'absolute', textAlign: 'center'}}>Processing...</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
export {UsersListLoading}
|
const CustomLoading = () => {
|
||||||
|
const styles = {
|
||||||
|
borderRadius: '0.475rem',
|
||||||
|
boxShadow: '0 0 50px 0 rgb(82 63 105 / 15%)',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
color: '#7e8299',
|
||||||
|
fontWeight: '500',
|
||||||
|
margin: '0',
|
||||||
|
width: 'auto',
|
||||||
|
padding: '1rem 2rem',
|
||||||
|
top: 'calc(50% - 2rem)',
|
||||||
|
left: 'calc(50% - 4rem)',
|
||||||
|
}
|
||||||
|
|
||||||
|
return <div style={{...styles, position: 'absolute', textAlign: 'center'}}>Loading...</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
export {UsersListLoading, CustomLoading}
|
||||||
|
|||||||
Reference in New Issue
Block a user