process page added
This commit was merged in pull request #38.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import {useLocation, useNavigate} from 'react-router-dom'
|
||||
import { Content } from '../../../../_digifi/layout/components/content'
|
||||
import { ToolbarWrapper } from '../../../../_digifi/layout/components/toolbar'
|
||||
import { UsersListLoading } from '../user-started/components/loading/UsersListLoading'
|
||||
|
||||
export default function ApproveRejectPage() {
|
||||
const {state:{selectedUser}} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [requestStatus, setRequestStatus] = useState<any>({loading:false, status:false, data:null})
|
||||
|
||||
const handleSubmit = ():any => {
|
||||
setRequestStatus({loading:true, status:false, data:null})
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading:false, status:false, data:null})
|
||||
},2000)
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
if(!selectedUser){
|
||||
navigate('/', {replace:true})
|
||||
}
|
||||
},[])
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <ToolbarWrapper /> */}
|
||||
<Content>
|
||||
<div className='w-100'>
|
||||
<h3 className='py-3 py-xl-5 card-title text-gray-800 fw-bold'>Processing: {selectedUser?.uid}</h3>
|
||||
</div>
|
||||
{/* begin::Row */}
|
||||
<div className="row g-5 g-xl-10 mb-5 mb-xl-10">
|
||||
{/* begin::Col */}
|
||||
<div className="col-xl-6 mb-md-5 mb-xl-10">
|
||||
<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>
|
||||
<div className='w-100 d-flex justify-content-between'>
|
||||
<button
|
||||
className='btn btn-light btn-active-light-secondary text-success btn-lg'
|
||||
onClick={()=>navigate('/loan/pages/process/verified', {replace:true})}
|
||||
>
|
||||
Return
|
||||
</button>
|
||||
<button
|
||||
className='btn btn-light btn-active-light-secondary text-danger btn-lg'
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
Reject
|
||||
</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 justify-content-between p-4 h-md-50 mb-5 mb-xl-10 bg-secondary">
|
||||
<h3 className='card-title text-gray-800 fw-bold'>Verification details</h3>
|
||||
</div>
|
||||
</div>
|
||||
{/* end::Col */}
|
||||
|
||||
{/* begin::Col */}
|
||||
<div className="col-xl-6">
|
||||
<div className="card card-flash flex flex-col justify-content-between p-4 h-md-100 bg-secondary">
|
||||
<h3 className='card-title text-gray-800 fw-bold'>Loan Details</h3>
|
||||
</div>
|
||||
</div>
|
||||
{/* end::Col */}
|
||||
</div>
|
||||
{/* end::Row */}
|
||||
</Content>
|
||||
{requestStatus.loading && <UsersListLoading />}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { Navigate, Routes, Route, Outlet } from "react-router-dom";
|
||||
import { PageLink, PageTitle } from "../../../../_digifi/layout/core";
|
||||
|
||||
import ApproveRejectPage from "./ApproveRejectPage";
|
||||
|
||||
const processBreadCrumbs: Array<PageLink> = [
|
||||
{
|
||||
title: "Loan",
|
||||
path: "/loan/pages/process/verified",
|
||||
isSeparator: false,
|
||||
isActive: false,
|
||||
},
|
||||
{
|
||||
title: "",
|
||||
path: "",
|
||||
isSeparator: true,
|
||||
isActive: false,
|
||||
},
|
||||
];
|
||||
|
||||
const ApproveRejectRoutes = () => (
|
||||
<Routes>
|
||||
<Route
|
||||
element={
|
||||
<>
|
||||
{/* <ProcessHeader /> */}
|
||||
<Outlet />
|
||||
</>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path="process"
|
||||
element={
|
||||
<>
|
||||
<PageTitle breadcrumbs={processBreadCrumbs}>Verified</PageTitle>
|
||||
<ApproveRejectPage />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<Route index element={<Navigate to="/loan/verified/process" />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
|
||||
export default ApproveRejectRoutes;
|
||||
@@ -1,46 +1,29 @@
|
||||
import { FC, useEffect } from "react";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { useQueryClient } from "react-query";
|
||||
import { MenuComponent } from "../../../../../../_digifi/assets/ts/components";
|
||||
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
||||
import { useListView } from "../../core/ListViewProvider";
|
||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||
import { employersVerify } from "../../../core/_requests";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { User } from "../../../core/_models";
|
||||
|
||||
type Props = {
|
||||
id: ID;
|
||||
data: Array<User> | any
|
||||
};
|
||||
|
||||
const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
const { setItemIdForUpdate } = useListView();
|
||||
const { query } = useQueryResponse();
|
||||
const queryClient = useQueryClient();
|
||||
const UserActionsCell: FC<Props> = ({ id, data }) => {
|
||||
// const { setItemIdForUpdate } = useListView();
|
||||
// const { query } = useQueryResponse();
|
||||
// const queryClient = useQueryClient();
|
||||
|
||||
// let selectedUser = data?.filter((item:User) => item.uid == id)[0]
|
||||
let selectedUser = data?.filter((item:User) => item.uid == id)[0]
|
||||
|
||||
useEffect(() => {
|
||||
MenuComponent.reinitialization();
|
||||
}, []);
|
||||
|
||||
const openEditModal = () => {
|
||||
setItemIdForUpdate(id);
|
||||
};
|
||||
|
||||
const empsVerify = useMutation(() => employersVerify(id), {
|
||||
// 💡 response of the mutation is passed to onSuccess
|
||||
onSuccess: () => {
|
||||
// ✅ update detail view directly
|
||||
queryClient.invalidateQueries([`${QUERIES.READY_LIST}-${query}`]);
|
||||
},
|
||||
});
|
||||
|
||||
const resendVerification = async () => { // FUNCTION TO RESEND VERIFICATION
|
||||
let cont = confirm('Are you sure, you want to send resend verification?')
|
||||
if(cont){
|
||||
await empsVerify.mutateAsync()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<a
|
||||
@@ -59,21 +42,9 @@ const UserActionsCell: FC<Props> = ({ id }) => {
|
||||
>
|
||||
{/* begin::Menu item */}
|
||||
<div className="menu-item px-3">
|
||||
<a className="menu-link px-3" onClick={openEditModal}>
|
||||
Edit
|
||||
</a>
|
||||
</div>
|
||||
{/* end::Menu item */}
|
||||
|
||||
{/* begin::Menu item */}
|
||||
<div className="menu-item px-3">
|
||||
<a
|
||||
className="menu-link px-3"
|
||||
data-kt-users-table-filter="delete_row"
|
||||
onClick={async () => resendVerification()}
|
||||
>
|
||||
Resend Verification
|
||||
</a>
|
||||
<Link state={{selectedUser}} to='/loan/verified/process' className="menu-link px-3">
|
||||
Process
|
||||
</Link>
|
||||
</div>
|
||||
{/* end::Menu item */}
|
||||
</div>
|
||||
|
||||
@@ -58,7 +58,7 @@ const usersColumns: ReadonlyArray<Column<User>> = [
|
||||
<UserCustomHeader tableProps={props} title='Actions' className='text-end min-w-100px' />
|
||||
),
|
||||
id: 'actions',
|
||||
Cell: ({...props}) => <UserActionsCell id={props.data[props.row.index].uid} />,
|
||||
Cell: ({...props}) => <UserActionsCell id={props.data[props.row.index].uid} data={props.data} />,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user