disbursements dummy page added

This commit is contained in:
victorAnumudu
2025-02-20 19:44:17 +01:00
parent 777f58ae23
commit 60e434b511
14 changed files with 179 additions and 73 deletions
+4 -3
View File
@@ -3,9 +3,10 @@ const RouteLinks = {
errorPage: '*', errorPage: '*',
homePage: '/', homePage: '/',
usersPage: '/users', usersPage: '/users',
approvedLoans: '/loans/approved', approvedLoansPage: '/loans/approved',
applyPage: '/loans/apply', applicationsLoanPage: '/loans/apply',
selectPage: '/loans/select', disbursementsLoanPage: '/loans/disbursements',
selectedLoanPage: '/loans/select',
} }
export default RouteLinks export default RouteLinks
+7 -5
View File
@@ -9,8 +9,9 @@ import LoginPage from './pages/LoginPage' // LOGIN PAGE
import HomePage from './pages/HomePage' // Home PAGE import HomePage from './pages/HomePage' // Home PAGE
import UsersPage from './pages/UsersPage' // Users PAGE import UsersPage from './pages/UsersPage' // Users PAGE
import ApprovedLoansPage from './pages/ApprovedLoansPage' // APPROVED LOANS PAGE import ApprovedLoansPage from './pages/ApprovedLoansPage' // APPROVED LOANS PAGE
import ApplyPage from './pages/ApplyPage' // APPLY LOANS PAGE import DisbursementsLoanPage from './pages/DisbursementsLoanPage' // DISBURSEMENTS LOANS PAGE
import SelectPage from './pages/SelectPage' // SELECT LOANS PAGE import ApplicationsLoanPage from './pages/ApplicationsLoanPage' // APPLICATIONS LOANS PAGE
import SelectedLoanPage from './pages/SelectedLoanPage' // SELECTED LOANS PAGE
// const Home = lazy(() => import('./pages/Home')); // const Home = lazy(() => import('./pages/Home'));
@@ -23,9 +24,10 @@ export default function SiteRoutes() {
<Route element={<UserExist />}> <Route element={<UserExist />}>
<Route path={RouteLinks.homePage} element={<HomePage />} /> {`*/HOME PAGE*/`} <Route path={RouteLinks.homePage} element={<HomePage />} /> {`*/HOME PAGE*/`}
<Route path={RouteLinks.usersPage} element={<UsersPage />} /> {`*/USERS PAGE*/`} <Route path={RouteLinks.usersPage} element={<UsersPage />} /> {`*/USERS PAGE*/`}
<Route path={RouteLinks.approvedLoans} element={<ApprovedLoansPage />} /> {`*/APPROVED LOANS PAGE*/`} <Route path={RouteLinks.approvedLoansPage} element={<ApprovedLoansPage />} /> {`*/APPROVED LOANS PAGE*/`}
<Route path={RouteLinks.applyPage} element={<ApplyPage />} /> {`*/APPLY LOANS PAGE*/`} <Route path={RouteLinks.disbursementsLoanPage} element={<DisbursementsLoanPage />} /> {`*/DISBURSEMENTS LOANS PAGE*/`}
<Route path={RouteLinks.selectPage} element={<SelectPage />} /> {`*/SELECT LOANS PAGE*/`} <Route path={RouteLinks.applicationsLoanPage} element={<ApplicationsLoanPage />} /> {`*/APPLICATIONS LOANS PAGE*/`}
<Route path={RouteLinks.selectedLoanPage} element={<SelectedLoanPage />} /> {`*/SELECTED LOANS PAGE*/`}
</Route> </Route>
{/* ERROR PAGE */} {/* ERROR PAGE */}
+5 -5
View File
@@ -20,15 +20,15 @@ export default function Icons({name, className}) {
:name.toLowerCase() == 'product' ? :name.toLowerCase() == 'product' ?
<AiFillProduct className={`text-base ${className}`} /> <AiFillProduct className={`text-base ${className}`} />
:name.toLowerCase() == 'trash' ? :name.toLowerCase() == 'trash' ?
<IoTrash lassName={`text-base ${className}`} /> <IoTrash className={`text-base ${className}`} />
:name.toLowerCase() == 'eye' ? :name.toLowerCase() == 'eye' ?
<FaEye lassName={`text-base ${className}`} /> <FaEye className={`text-base ${className}`} />
:name.toLowerCase() == 'next' ? :name.toLowerCase() == 'next' ?
<TbPlayerTrackNext lassName={`text-base ${className}`} /> <TbPlayerTrackNext className={`text-base ${className}`} />
:name.toLowerCase() == 'prev' ? :name.toLowerCase() == 'prev' ?
<TbPlayerTrackPrev lassName={`text-base ${className}`} /> <TbPlayerTrackPrev className={`text-base ${className}`} />
:name.toLowerCase() == 'edit' ? :name.toLowerCase() == 'edit' ?
<FaEdit lassName={`text-base ${className}`} /> <FaEdit className={`text-base ${className}`} />
: :
null null
} }
@@ -13,7 +13,7 @@ import { applyLoan } from '../../services/siteServices'
import getTimeFromDateString from '../../helpers/GetTimeFromDateString'; import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
import getDateFromDateString from '../../helpers/GetDateFromDateString'; import getDateFromDateString from '../../helpers/GetDateFromDateString';
export default function ApplyCom() { export default function ApplicationsLoanCom() {
const {data, isFetching, isError, error} = useQuery({ const {data, isFetching, isError, error} = useQuery({
queryKey: queryKeys.apply_loan, queryKey: queryKeys.apply_loan,
@@ -24,7 +24,7 @@ export default function ApplyCom() {
return ( return (
<div className='w-full flex flex-col gap-8'> <div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Apply' paths={['Dashboard', 'Apply']} /> <BreadcrumbCom title='Applications' paths={['Dashboard', 'Applications']} />
{isFetching ? {isFetching ?
<> <>
@@ -37,7 +37,7 @@ export default function ApplyCom() {
<p className='text-red-500'>{error.message}</p> <p className='text-red-500'>{error.message}</p>
</div> </div>
: :
<TableWrapper data={appliedUsers} itemsPerPage={8}> <TableWrapper data={appliedUsers} itemsPerPage={15}>
{({ data }) => ( {({ data }) => (
<> <>
<table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"> <table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
@@ -96,15 +96,9 @@ export default function ApplyCom() {
</Link> */} </Link> */}
{/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */} {/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */}
{/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */} {/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */}
<span className='text-primary text-xl'> <Icons name='edit' />
<Icons name='edit' /> <Icons name='eye' />
</span> <Icons name='trash' className={'hidden text-red-500'} />
<span className='text-primary text-xl'>
<Icons name='eye' />
</span>
<span className='hidden text-red-500 text-xl'>
<Icons name='trash' />
</span>
</td> </td>
</tr> </tr>
)) ))
@@ -23,7 +23,7 @@ export default function ApprovedLoanCom() {
return ( return (
<div className='w-full flex flex-col gap-8'> <div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Approved Loan' paths={['Dashboard', 'Approved Loan']} /> <BreadcrumbCom title='Approved' paths={['Dashboard', 'Approved']} />
{isFetching ? {isFetching ?
<> <>
@@ -36,7 +36,7 @@ export default function ApprovedLoanCom() {
<p className='text-red-500'>{error.message}</p> <p className='text-red-500'>{error.message}</p>
</div> </div>
: :
<TableWrapper data={approvedUsers} itemsPerPage={8}> <TableWrapper data={approvedUsers} itemsPerPage={15}>
{({ data }) => ( {({ data }) => (
<> <>
<table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"> <table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
@@ -81,15 +81,9 @@ export default function ApprovedLoanCom() {
</Link> */} </Link> */}
{/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */} {/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */}
{/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */} {/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */}
<span className='text-primary text-xl'> <Icons name='edit' />
<Icons name='edit' /> <Icons name='eye' />
</span> <Icons name='trash' className={'hidden text-red-500'} />
<span className='text-primary text-xl'>
<Icons name='eye' />
</span>
<span className='hidden text-red-500 text-xl'>
<Icons name='trash' />
</span>
</td> </td>
</tr> </tr>
)) ))
+5 -2
View File
@@ -1,10 +1,13 @@
import { MdKeyboardDoubleArrowRight } from 'react-icons/md' import { MdKeyboardDoubleArrowRight } from 'react-icons/md'
import { TiHomeOutline } from 'react-icons/ti' import { TiHomeOutline } from 'react-icons/ti'
export default function BreadcrumbCom({title, paths}) { export default function BreadcrumbCom({title, span, paths}) {
return ( return (
<div className='w-full py-2 flex justify-between items-center'> <div className='w-full py-2 flex justify-between items-center'>
<h1 className='text-12 sm:text-lg md:text-2xl text-black dark:text-black-gray font-semibold'>{title}</h1> <div className='flex flex-col md:flex-row gap-1 md:items-center'>
<h1 className='text-12 sm:text-lg md:text-2xl text-black dark:text-black-gray font-semibold'>{title}</h1>
<span className='text-red-500 text-10 sm:text-base md:text-xl'>{span && span}</span>
</div>
<div className='flex gap-2 items-center text-black-gray dark:text-black-gray text-base'> <div className='flex gap-2 items-center text-black-gray dark:text-black-gray text-base'>
<TiHomeOutline className='text-black dark:text-black-gray' /> <TiHomeOutline className='text-black dark:text-black-gray' />
{paths.map((item, index) => ( {paths.map((item, index) => (
@@ -0,0 +1,107 @@
import React from 'react'
import { useQuery } from "@tanstack/react-query";
import {Link} from 'react-router-dom'
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import TableWrapper from '../tableWrapper/TableWrapper'
import Icons from '../Icons'
import Avatar from '../../assets/user_avatar.jpg'
import queryKeys from '../../services/queryKeys'
import { approvedLoan } from '../../services/siteServices'
import getDateFromDateString from '../../helpers/GetDateFromDateString';
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
export default function DisbursementsLoanCom() {
const {data, isFetching, isError, error} = useQuery({
queryKey: queryKeys.approved_loan,
queryFn: () => approvedLoan()
})
const approvedUsers = data?.data?.result_data?.data // DISBURSED LOAN LIST
return (
<div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Disbursements' paths={['Dashboard', 'Disbursements']} />
{isFetching ?
<>
<div className="w-full py-4">
<p className='text-slate-800'>Loading...</p>
</div>
</>
: isError ?
<div className="w-full py-4">
<p className='text-red-500'>{error.message}</p>
</div>
:
<TableWrapper data={approvedUsers} itemsPerPage={15}>
{({ data }) => (
<>
<table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
<thead className="text-sm md:text-base text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr>
<th scope="col" className="px-4 py-2">
Name
</th>
<th scope="col" className="px-4 py-2">
Loan
</th>
<th scope="col" className="px-4 py-2">
Added
</th>
<th scope="col" className="px-4 py-2">
Action
</th>
</tr>
</thead>
<tbody>
{(data && data.length > 0) ? data?.map((item, index) => (
<tr key={index} className="bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600">
<th scope="row" className="mr-4 flex items-center px-3 py-2 text-gray-900 whitespace-nowrap dark:text-white">
<img className="w-10 h-10 rounded-full" src={Avatar} alt="Jese image" />
<div className="px-3">
<div className="text-base font-semibold">{item?.name || ''}</div>
<div className="font-normal text-gray-500">{item?.bvn}</div>
</div>
</th>
<td className="px-3 py-2">
{item?.loan} - {item?.description}
</td>
<td className="px-3 py-2">
<div className="flex items-center">
{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}
</div>
</td>
<td className="px-3 py-2 flex gap-3 md:gap-4">
{/* <!-- Modal toggle --> */}
{/* <Link to={RouteLinks.manageAdminPage}>
<i onClick={handleShowEditModal} className="fa-solid fa-eye text-base md:text-lg cursor-pointer p-2 text-sky-600"></i>
</Link> */}
{/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */}
{/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */}
<Icons name='edit' />
<Icons name='eye' />
<Icons name='trash' className={'hidden text-red-500'} />
</td>
</tr>
))
:
<tr className="w-3 p-3">
<td className="px-3 py-2" colSpan={4}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
}
</tbody>
</table>
</>
)}
</TableWrapper>
}
</div>
)
}
@@ -45,7 +45,9 @@ export default function DashboardAside({shrinkAside=false}) {
let hasSubLinks = (link.subLinks && link.subLinks.length > 0) ? true : false let hasSubLinks = (link.subLinks && link.subLinks.length > 0) ? true : false
if(active && !hasSubLinks){ if(active && !hasSubLinks){
return ( return (
<AsideLink key={index} to={link.to} shrinkAside={shrinkAside} name={link.name} icon={link.icon} /> <div key={index}>
<AsideLink key={index} to={link.to} shrinkAside={shrinkAside} name={link.name} icon={link.icon} />
</div>
) )
}else if(active && hasSubLinks){ }else if(active && hasSubLinks){
return ( return (
@@ -59,9 +61,9 @@ export default function DashboardAside({shrinkAside=false}) {
let active = subItem.status == 1 ? true : false let active = subItem.status == 1 ? true : false
if(active){ if(active){
return ( return (
<> <div key={index}>
<AsideLink key={index} to={subItem.to} shrinkAside={shrinkAside} name={subItem.name} icon={subItem.icon} /> <AsideLink key={index} to={subItem.to} shrinkAside={shrinkAside} name={subItem.name} icon={subItem.icon} />
</> </div>
) )
} }
})} })}
@@ -93,11 +95,12 @@ export default function DashboardAside({shrinkAside=false}) {
const asideNavLinks = [ const asideNavLinks = [
{name:'Dashboard', status:1, icon: 'dashboard', to: RouteLinks.homePage}, {name:'Dashboard', status:1, icon: 'dashboard', to: RouteLinks.homePage},
{name:'Salary Loan', title:'Loan', status:1, icon: 'money', subLinks: [ {name:'Salary Loan', title:'Loan', status:1, icon: 'money', subLinks: [
{name: 'Select', status:1, icon: 'dot', to: RouteLinks.selectPage}, {name: 'Selected Loans', status:1, icon: 'dot', to: RouteLinks.selectedLoanPage},
{name: 'Apply', status:1, icon: 'dot', to: RouteLinks.applyPage}, {name: 'Applications', status:1, icon: 'dot', to: RouteLinks.applicationsLoanPage},
{name: 'Approved', status:1, icon: 'dot', to: RouteLinks.approvedLoans}, {name: 'Approved Loans', status:1, icon: 'dot', to: RouteLinks.approvedLoansPage},
{name: 'Disbursements', status:1, icon: 'dot', to: RouteLinks.disbursementsLoanPage},
{name: 'Payments', status:1, icon: 'dot', to: '#'}, {name: 'Payments', status:1, icon: 'dot', to: '#'},
{name: 'Configuration', status:1, icon: 'dot', to: '#'}, {name: 'Configurations', status:1, icon: 'dot', to: '#'},
], ],
}, },
{name:'Product 2', title:'Product 2', status:1, icon: 'product', subLinks: [ {name:'Product 2', title:'Product 2', status:1, icon: 'product', subLinks: [
@@ -12,7 +12,7 @@ import { selectLoan } from '../../services/siteServices'
import getDateFromDateString from '../../helpers/GetDateFromDateString'; import getDateFromDateString from '../../helpers/GetDateFromDateString';
import getTimeFromDateString from '../../helpers/GetTimeFromDateString'; import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
export default function SelectLoanCom() { export default function SelectedLoanCom() {
const {data, isFetching, isError, error} = useQuery({ const {data, isFetching, isError, error} = useQuery({
queryKey: queryKeys.select_loan, queryKey: queryKeys.select_loan,
@@ -23,7 +23,7 @@ export default function SelectLoanCom() {
return ( return (
<div className='w-full flex flex-col gap-8'> <div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Apply' paths={['Dashboard', 'Apply']} /> <BreadcrumbCom title='Selected - ' span='Loan options selected by the users before applying' paths={['Dashboard', 'Selected']} />
{isFetching ? {isFetching ?
<> <>
@@ -36,7 +36,7 @@ export default function SelectLoanCom() {
<p className='text-red-500'>{error.message}</p> <p className='text-red-500'>{error.message}</p>
</div> </div>
: :
<TableWrapper data={selectUsers} itemsPerPage={8}> <TableWrapper data={selectUsers} itemsPerPage={15}>
{({ data }) => ( {({ data }) => (
<> <>
<table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"> <table className="py-2 w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
@@ -81,15 +81,9 @@ export default function SelectLoanCom() {
</Link> */} </Link> */}
{/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */} {/* <i onClick={handleShowEditModal} className="fa-solid fa-pen-to-square text-base md:text-lg cursor-pointer p-2"></i> */}
{/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */} {/* <i onClick={handleDeleteModal} className="fa-solid fa-trash text-base md:text-lg cursor-pointer p-2 text-red-500"></i> */}
<span className='text-primary text-xl'> <Icons name='edit' />
<Icons name='edit' /> <Icons name='eye' />
</span> <Icons name='trash' className={'hidden text-red-500'} />
<span className='text-primary text-xl'>
<Icons name='eye' />
</span>
<span className='hidden text-red-500 text-xl'>
<Icons name='trash' />
</span>
</td> </td>
</tr> </tr>
)) ))
+8
View File
@@ -0,0 +1,8 @@
import React from 'react'
import ApplicationsLoanCom from '../components/applicationsloancom/ApplicationsLoanCom'
export default function ApplicationsLoanPage() {
return (
<ApplicationsLoanCom />
)
}
-8
View File
@@ -1,8 +0,0 @@
import React from 'react'
import ApplyCom from '../components/applyloancom/ApplyCom'
export default function ApplyPage() {
return (
<ApplyCom />
)
}
+8
View File
@@ -0,0 +1,8 @@
import React from 'react'
import DisbursementsLoanCom from '../components/disbursementsloancom/DisbursementsLoanCom'
export default function DisbursementsLoanPage() {
return (
<DisbursementsLoanCom />
)
}
-8
View File
@@ -1,8 +0,0 @@
import React from 'react'
import SelectLoanCom from '../components/selectloancom/SelectLoanCom'
export default function SelectPage() {
return (
<SelectLoanCom />
)
}
+8
View File
@@ -0,0 +1,8 @@
import React from 'react'
import SelectedLoanCom from '../components/selectedloancom/SelectedLoanCom'
export default function SelectedLoanPage() {
return (
<SelectedLoanCom />
)
}