Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ac97537cd | |||
| fc214b4bad |
@@ -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} />,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {lazy, FC, Suspense} from 'react'
|
||||
import {Route, Routes, Navigate} from 'react-router-dom'
|
||||
import {MasterLayout} from '../../_digifi/layout/MasterLayout'
|
||||
import TopBarProgress from 'react-topbar-progress-indicator'
|
||||
import {DashboardWrapper} from '../pages/dashboard/DashboardWrapper'
|
||||
import { lazy, FC, Suspense } from "react";
|
||||
import { Route, Routes, Navigate } from "react-router-dom";
|
||||
import { MasterLayout } from "../../_digifi/layout/MasterLayout";
|
||||
import TopBarProgress from "react-topbar-progress-indicator";
|
||||
import { DashboardWrapper } from "../pages/dashboard/DashboardWrapper";
|
||||
// import {MenuTestPage} from '../pages/MenuTestPage'
|
||||
import {getCSSVariableValue} from '../../_digifi/assets/ts/_utils'
|
||||
import {WithChildren} from '../../_digifi/helpers'
|
||||
import { getCSSVariableValue } from "../../_digifi/assets/ts/_utils";
|
||||
import { WithChildren } from "../../_digifi/helpers";
|
||||
// import BuilderPageWrapper from '../pages/layout-builder/BuilderPageWrapper'
|
||||
|
||||
const PrivateRoutes = () => {
|
||||
@@ -13,28 +13,43 @@ const PrivateRoutes = () => {
|
||||
// const AccountPage = lazy(() => import('../modules/accounts/AccountPage'))
|
||||
// const WidgetsPage = lazy(() => import('../modules/widgets/WidgetsPage'))
|
||||
// const ChatPage = lazy(() => import('../modules/apps/chat/ChatPage'))
|
||||
const ProcessPage = lazy(() => import('../modules/process/ProcessPage'))
|
||||
const UsersPage = lazy(() => import('../modules/apps/user-management/UsersPage'))
|
||||
const EmployersPage =lazy(() => import('../modules/employers/employers-list/UsersPage'))
|
||||
const ProcessPage = lazy(() => import("../modules/process/ProcessPage"));
|
||||
const UsersPage = lazy(
|
||||
() => import("../modules/apps/user-management/UsersPage")
|
||||
);
|
||||
const EmployersPage = lazy(
|
||||
() => import("../modules/employers/employers-list/UsersPage")
|
||||
);
|
||||
const ApproveRejectRoutes = lazy(
|
||||
() => import("../modules/process/approve-reject-page/ApproveRejectRoutes")
|
||||
);
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<MasterLayout />}>
|
||||
{/* Redirect to Dashboard after success login/registartion */}
|
||||
<Route path='auth/*' element={<Navigate to='/dashboard' />} />
|
||||
<Route path="auth/*" element={<Navigate to="/dashboard" />} />
|
||||
{/* Pages */}
|
||||
<Route path='dashboard' element={<DashboardWrapper />} />
|
||||
<Route path="dashboard" element={<DashboardWrapper />} />
|
||||
{/* <Route path='builder' element={<BuilderPageWrapper />} /> */}
|
||||
{/* <Route path='menu-test' element={<MenuTestPage />} /> */}
|
||||
{/* Lazy Modules */}
|
||||
<Route
|
||||
path='loan/pages/process/*'
|
||||
path="loan/pages/process/*"
|
||||
element={
|
||||
<SuspensedView>
|
||||
<ProcessPage />
|
||||
</SuspensedView>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="loan/verified/*"
|
||||
element={
|
||||
<SuspensedView>
|
||||
<ApproveRejectRoutes />
|
||||
</SuspensedView>
|
||||
}
|
||||
/>
|
||||
{/* <Route
|
||||
path='crafted/pages/wizards/*'
|
||||
element={
|
||||
@@ -68,7 +83,7 @@ const PrivateRoutes = () => {
|
||||
}
|
||||
/> */}
|
||||
<Route
|
||||
path='tools/user-management/*'
|
||||
path="tools/user-management/*"
|
||||
element={
|
||||
<SuspensedView>
|
||||
<UsersPage />
|
||||
@@ -76,7 +91,7 @@ const PrivateRoutes = () => {
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='/employers/*'
|
||||
path="/employers/*"
|
||||
element={
|
||||
<SuspensedView>
|
||||
<EmployersPage />
|
||||
@@ -84,22 +99,22 @@ const PrivateRoutes = () => {
|
||||
}
|
||||
/>
|
||||
{/* Page Not Found */}
|
||||
<Route path='*' element={<Navigate to='/error/404' />} />
|
||||
<Route path="*" element={<Navigate to="/error/404" />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const SuspensedView: FC<WithChildren> = ({children}) => {
|
||||
const baseColor = getCSSVariableValue('--bs-primary')
|
||||
const SuspensedView: FC<WithChildren> = ({ children }) => {
|
||||
const baseColor = getCSSVariableValue("--bs-primary");
|
||||
TopBarProgress.config({
|
||||
barColors: {
|
||||
'0': baseColor,
|
||||
"0": baseColor,
|
||||
},
|
||||
barThickness: 1,
|
||||
shadowBlur: 5,
|
||||
})
|
||||
return <Suspense fallback={<TopBarProgress />}>{children}</Suspense>
|
||||
}
|
||||
});
|
||||
return <Suspense fallback={<TopBarProgress />}>{children}</Suspense>;
|
||||
};
|
||||
|
||||
export {PrivateRoutes}
|
||||
export { PrivateRoutes };
|
||||
|
||||
Reference in New Issue
Block a user