Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e26b8ee02a | |||
| 1d576c9e81 | |||
| 1bc07694e9 |
@@ -5,6 +5,7 @@ const RouteLinks = {
|
|||||||
transactionsPage: '/transactions',
|
transactionsPage: '/transactions',
|
||||||
repaymentsPage: '/repayments',
|
repaymentsPage: '/repayments',
|
||||||
loanChargesPage: '/loan-charges',
|
loanChargesPage: '/loan-charges',
|
||||||
|
eligibility: '/eligibility',
|
||||||
offers: '/offers',
|
offers: '/offers',
|
||||||
transaction_details_page: '/transaction/details',
|
transaction_details_page: '/transaction/details',
|
||||||
errorPage: '*',
|
errorPage: '*',
|
||||||
|
|||||||
+29
-26
@@ -1,5 +1,5 @@
|
|||||||
import { lazy, Suspense } from 'react'
|
import {lazy, Suspense} from 'react'
|
||||||
import { Routes, Route } from 'react-router-dom'
|
import {Routes, Route} from 'react-router-dom'
|
||||||
import RouteLinks from './RouteLinks'
|
import RouteLinks from './RouteLinks'
|
||||||
|
|
||||||
import UserExist from './authorization/UserExist'
|
import UserExist from './authorization/UserExist'
|
||||||
@@ -13,35 +13,38 @@ import RepaymentsPage from './pages/RepaymentsPage' // REPAYMENTS PAGE
|
|||||||
import LoanChargesPage from './pages/LoanChargesPage' // LOAN CHARGES PAGE
|
import LoanChargesPage from './pages/LoanChargesPage' // LOAN CHARGES PAGE
|
||||||
import TransactionDetailsPage from './pages/TransactionDetailsPage' // TRANSACTION DETAILS PAGE
|
import TransactionDetailsPage from './pages/TransactionDetailsPage' // TRANSACTION DETAILS PAGE
|
||||||
import OffersPage from './pages/OffersPage' // LOAN OFFERS PAGE
|
import OffersPage from './pages/OffersPage' // LOAN OFFERS PAGE
|
||||||
import ErrorPage from './pages/ErrorPage' // ERROR PAGE
|
import ErrorPage from './pages/ErrorPage'
|
||||||
|
import EligibilityPage from "./pages/EligibilityPage"; // ERROR PAGE
|
||||||
|
|
||||||
|
|
||||||
// const Home = lazy(() => import('./pages/Home'));
|
// const Home = lazy(() => import('./pages/Home'));
|
||||||
|
|
||||||
export default function SiteRoutes() {
|
export default function SiteRoutes() {
|
||||||
return (
|
return (
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path={RouteLinks.loginPage} element={<LoginPage />} /> {`*/LOGIN PAGE*/`}
|
<Route path={RouteLinks.loginPage} element={<LoginPage/>}/> {`*/LOGIN PAGE*/`}
|
||||||
|
|
||||||
<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.loansPage} element={<LoansPage />} /> {`*/LOANS PAGE*/`}
|
<Route path={RouteLinks.loansPage} element={<LoansPage/>}/> {`*/LOANS PAGE*/`}
|
||||||
<Route path={RouteLinks.transactionsPage} element={<TransactionsPage />} /> {`*/Transactions PAGE*/`}
|
<Route path={RouteLinks.transactionsPage} element={<TransactionsPage/>}/> {`*/Transactions PAGE*/`}
|
||||||
<Route path={RouteLinks.repaymentsPage} element={<RepaymentsPage />} /> {`*/REPAYMENTS PAGE*/`}
|
<Route path={RouteLinks.repaymentsPage} element={<RepaymentsPage/>}/> {`*/REPAYMENTS PAGE*/`}
|
||||||
<Route path={RouteLinks.loanChargesPage} element={<LoanChargesPage />} /> {`*/LOAN CHARGES PAGE*/`}
|
<Route path={RouteLinks.loanChargesPage} element={<LoanChargesPage/>}/> {`*/LOAN CHARGES PAGE*/`}
|
||||||
<Route path={RouteLinks.transaction_details_page} element={<TransactionDetailsPage />} /> {`*/TRANSACTION PAGE*/`}
|
<Route path={RouteLinks.eligibility} element={<EligibilityPage/>}/> {`*/ELIGIBILITY PAGE*/`}
|
||||||
<Route path={RouteLinks.offers} element={<OffersPage />} /> {`*/LOAN OFFERS PAGE*/`}
|
<Route path={RouteLinks.transaction_details_page}
|
||||||
</Route>
|
element={<TransactionDetailsPage/>}/> {`*/TRANSACTION PAGE*/`}
|
||||||
|
<Route path={RouteLinks.offers} element={<OffersPage/>}/> {`*/LOAN OFFERS PAGE*/`}
|
||||||
|
</Route>
|
||||||
|
|
||||||
{/* ERROR PAGE */}
|
{/* ERROR PAGE */}
|
||||||
<Route
|
<Route
|
||||||
path={RouteLinks.errorPage} // error page
|
path={RouteLinks.errorPage} // error page
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<PageLoader />}>
|
<Suspense fallback={<PageLoader/>}>
|
||||||
<ErrorPage />
|
<ErrorPage/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
import {useEffect, useState} from 'react'
|
||||||
|
|
||||||
|
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||||
|
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||||
|
import Icons from '../Icons'
|
||||||
|
import {getLoanCharges} from '../../services/siteServices'
|
||||||
|
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||||
|
import formatNumber from '../../helpers/formatNumber'
|
||||||
|
import Avatar from '../../assets/repay.png'
|
||||||
|
|
||||||
|
|
||||||
|
export default function EligibilityCom() {
|
||||||
|
|
||||||
|
const [page, setPage] = useState(1)
|
||||||
|
const [allLoanCharges, setAllLoanCharges] = useState({loading: true, error: '', data: {}})
|
||||||
|
|
||||||
|
const [willFilter, setWillFilter] = useState(false)
|
||||||
|
const [filter, setFilter] = useState({type: '', id: ''})
|
||||||
|
const handleFilter = ({target: {name, value}}) => {
|
||||||
|
setFilter(prev => ({...prev, [name]: value}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleFilterByParams = () => {
|
||||||
|
if (filter.type && !filter.id) {
|
||||||
|
return
|
||||||
|
} else if (!filter.type) {
|
||||||
|
setPage(1)
|
||||||
|
setWillFilter(prev => !prev)
|
||||||
|
setFilter({type: '', id: ''})
|
||||||
|
} else {
|
||||||
|
setPage(1)
|
||||||
|
setWillFilter(prev => !prev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const loanCharges = allLoanCharges?.data?.loan_charges // LOAN CHARGES LIST
|
||||||
|
const pagination = allLoanCharges?.data?.pagination
|
||||||
|
const isFetching = allLoanCharges?.loading
|
||||||
|
const isError = allLoanCharges?.error
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setAllLoanCharges(prev => ({...prev, loading: true}))
|
||||||
|
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||||
|
getLoanCharges({...payload, page}).then(res => {
|
||||||
|
if (res?.status != 200) {
|
||||||
|
setAllLoanCharges(prev => ({...prev, loading: false}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setAllLoanCharges({loading: false, error: '', data: res?.data})
|
||||||
|
}).catch(err => {
|
||||||
|
setAllLoanCharges({loading: false, error: 'error occurred', data: {}})
|
||||||
|
console.log('ERR', err)
|
||||||
|
})
|
||||||
|
}, [page, willFilter])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-col gap-8'>
|
||||||
|
<BreadcrumbCom title='Eligibility' paths={['Dashboard', 'Eligibility']}/>
|
||||||
|
|
||||||
|
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||||
|
{isError ?
|
||||||
|
<p className='text-red-500'>{allLoanCharges?.error}</p>
|
||||||
|
:
|
||||||
|
<>
|
||||||
|
{/* filter section */}
|
||||||
|
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
||||||
|
<Icons name='filter' className='text-3xl'/>
|
||||||
|
<div className='w-full sm:max-w-48'>
|
||||||
|
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||||
|
onChange={handleFilter}>
|
||||||
|
<option value=''>All</option>
|
||||||
|
<option value='transaction_id'>Transaction ID</option>
|
||||||
|
<option value='account_id'>Account ID</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div className='w-full sm:max-w-48'>
|
||||||
|
<input name='id' value={filter?.id} disabled={!filter.type}
|
||||||
|
className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`}
|
||||||
|
onChange={handleFilter}/>
|
||||||
|
</div>
|
||||||
|
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id}
|
||||||
|
className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/* end of filter section */}
|
||||||
|
|
||||||
|
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage}
|
||||||
|
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||||
|
{({data}) => (
|
||||||
|
<>
|
||||||
|
<table className="py-2 w-full text-sm">
|
||||||
|
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||||
|
<tr>
|
||||||
|
<th scope="col" className="px-2 py-2">
|
||||||
|
TransactionID/Fee Type
|
||||||
|
</th>
|
||||||
|
{/* <th scope="col" className="px-2">
|
||||||
|
Loan
|
||||||
|
</th> */}
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
Amount
|
||||||
|
</th>
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
Added
|
||||||
|
</th>
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
Action
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||||
|
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||||
|
<td className="px-2 py-2">
|
||||||
|
<div
|
||||||
|
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
|
||||||
|
<img className="w-10 h-10 rounded-md" src={Avatar}
|
||||||
|
alt="Jese image"/>
|
||||||
|
<div className="text-left">
|
||||||
|
<div
|
||||||
|
className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500 line-clamp-1">{item?.code}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="px-2">
|
||||||
|
<div className="text-right">
|
||||||
|
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||||
|
<div
|
||||||
|
className="font-semibold text-green-500">#{formatNumber(item?.amount)}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="px-2">
|
||||||
|
<div className="text-right">
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="px-2 text-right">
|
||||||
|
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||||
|
<div
|
||||||
|
className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
|
||||||
|
<Icons name='eye'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||||
|
<td className="px-3 py-2" colSpan={4}>
|
||||||
|
<div className="flex justify-center items-center">
|
||||||
|
No Record Found
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</TablePaginatedWrapper>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
import React, {useState} from 'react'
|
||||||
|
import {useQuery} from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||||
|
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||||
|
import Icons from '../Icons'
|
||||||
|
|
||||||
|
import Avatar from '../../assets/user_avatar.jpg'
|
||||||
|
import queryKeys from '../../services/queryKeys'
|
||||||
|
import {getLoanCharges} from '../../services/siteServices'
|
||||||
|
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||||
|
import formatNumber from '../../helpers/formatNumber';
|
||||||
|
|
||||||
|
export default function LoanChargesCom() {
|
||||||
|
|
||||||
|
const [page, setPage] = useState(1)
|
||||||
|
|
||||||
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: [...queryKeys.loan_charges, page],
|
||||||
|
queryFn: () => getLoanCharges({page}),
|
||||||
|
staleTime: 0,
|
||||||
|
// placeholderData: keepPreviousData,
|
||||||
|
})
|
||||||
|
|
||||||
|
const loanCharges = data?.data?.loan_charges // LOAN CHARGES LIST
|
||||||
|
const pagination = data?.data?.pagination
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-col gap-8' style={{backgroundColor: 'aliceblue'}}>
|
||||||
|
<BreadcrumbCom title='Loan Charges' paths={['Dashboard', 'Loan Charges']}/>
|
||||||
|
|
||||||
|
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<p className='text-slate-800'>Loading...</p>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<p className='text-red-500'>{error.message}</p>
|
||||||
|
:
|
||||||
|
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage}
|
||||||
|
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||||
|
{({data}) => (
|
||||||
|
<>
|
||||||
|
<table className="py-2 w-full text-sm">
|
||||||
|
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||||
|
<tr>
|
||||||
|
<th scope="col" className="px-2 py-2">
|
||||||
|
Name
|
||||||
|
</th>
|
||||||
|
{/* <th scope="col" className="px-2">
|
||||||
|
Loan
|
||||||
|
</th> */}
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
Amount
|
||||||
|
</th>
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
Added
|
||||||
|
</th>
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
Action
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||||
|
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||||
|
<td className="px-2 py-2">
|
||||||
|
<div
|
||||||
|
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
|
||||||
|
<div className="text-left">
|
||||||
|
<div
|
||||||
|
className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500 line-clamp-1">{item?.code}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="px-2">
|
||||||
|
<div className="text-right">
|
||||||
|
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500">{formatNumber(item?.amount)}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="px-2">
|
||||||
|
<div className="text-right">
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="px-2 text-right">
|
||||||
|
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||||
|
<div
|
||||||
|
className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
|
||||||
|
<Icons name='eye'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||||
|
<td className="px-3 py-2" colSpan={4}>
|
||||||
|
<div className="flex justify-center items-center">
|
||||||
|
No Record Found
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</TablePaginatedWrapper>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -4,9 +4,9 @@ import DummyLogo from "../../DummyLogo";
|
|||||||
import MainBtn from "../../MainBtn";
|
import MainBtn from "../../MainBtn";
|
||||||
import AsideLink from "./AsideLink";
|
import AsideLink from "./AsideLink";
|
||||||
import AsideLinkWithSubLinks from "./AsideLinkWithSubLinks";
|
import AsideLinkWithSubLinks from "./AsideLinkWithSubLinks";
|
||||||
import { useSelector } from "react-redux";
|
import {useSelector} from "react-redux";
|
||||||
import { generalLayoutContext } from "../../../context/GeneralLayoutContext";
|
import {generalLayoutContext} from "../../../context/GeneralLayoutContext";
|
||||||
import { TbLogout2 } from "react-icons/tb";
|
import {TbLogout2} from "react-icons/tb";
|
||||||
import UserAvatar from '../../../assets/user_avatar.jpg'
|
import UserAvatar from '../../../assets/user_avatar.jpg'
|
||||||
import Icons from "../../Icons";
|
import Icons from "../../Icons";
|
||||||
import localImgLoader from '../../../helpers/localImageLoader';
|
import localImgLoader from '../../../helpers/localImageLoader';
|
||||||
@@ -18,136 +18,147 @@ export default function DashboardAside() {
|
|||||||
const {setLogoutModal, activeMenu, handleActiveMenu} = generalLayoutContext()
|
const {setLogoutModal, activeMenu, handleActiveMenu} = generalLayoutContext()
|
||||||
|
|
||||||
const {userDetails} = useSelector((state) => state.userDetails) // GETS LOGGED IN USER ROLE DETAILS
|
const {userDetails} = useSelector((state) => state.userDetails) // GETS LOGGED IN USER ROLE DETAILS
|
||||||
const {role}= userDetails
|
const {role} = userDetails
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='w-full h-full flex flex-col'>
|
<div className='w-full h-full flex flex-col'>
|
||||||
<div className="mb-3 w-full h-24 logo flex items-center">
|
<div className="mb-3 w-full h-24 logo flex items-center">
|
||||||
{/* <DummyLogo /> */}
|
{/* <DummyLogo /> */}
|
||||||
<img className='w-2/3 h-auto' src={localImgLoader('simbrella-bko-logo.png')} />
|
<img className='w-2/3 h-auto' src={localImgLoader('simbrella-bko-logo.png')}/>
|
||||||
</div>
|
</div>
|
||||||
{/* <hr className="border-slate-400" /> */}
|
{/* <hr className="border-slate-400" /> */}
|
||||||
|
|
||||||
<div className="aside-scroll-design w-full flex flex-col gap-2 h-full overflow-y-auto">
|
<div className="aside-scroll-design w-full flex flex-col gap-2 h-full overflow-y-auto">
|
||||||
{asideNavLinks.map((link, index) => {
|
{asideNavLinks.map((link, index) => {
|
||||||
let active = link.status == 1 ? true : false
|
let active = link.status == 1 ? true : 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 (
|
||||||
<div key={link.name}>
|
<div key={link.name}>
|
||||||
<AsideLink to={link.to} name={link.name} icon={link.icon} />
|
<AsideLink to={link.to} name={link.name} icon={link.icon}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if(active && hasSubLinks){
|
if (active && hasSubLinks) {
|
||||||
let subLinkList = []
|
let subLinkList = []
|
||||||
link.subLinks.forEach(item =>{
|
link.subLinks.forEach(item => {
|
||||||
if(item.to){
|
if (item.to) {
|
||||||
subLinkList.push(item.to)
|
|
||||||
}else if(item.subLinks?.length > 0){
|
|
||||||
item.subLinks.forEach(item => {
|
|
||||||
subLinkList.push(item.to)
|
subLinkList.push(item.to)
|
||||||
})
|
} else if (item.subLinks?.length > 0) {
|
||||||
}
|
item.subLinks.forEach(item => {
|
||||||
})
|
subLinkList.push(item.to)
|
||||||
return (
|
})
|
||||||
<div key={link.name} className="w-full">
|
}
|
||||||
{link.title &&
|
})
|
||||||
<h1 className="px-4 py-2 text-sm sm:text-sm text-slate-500 dark:text-white font-semibold uppercase mt-3 mb-1 border-b border-slate-500 dark:border-white">{link.title}</h1>
|
return (
|
||||||
}
|
<div key={link.name} className="w-full">
|
||||||
<AsideLinkWithSubLinks name={link.name} icon={link.icon} isOpen={subLinkList.includes(pathname) || index==1} >
|
{link.title &&
|
||||||
<>
|
<h1 className="px-4 py-2 text-sm sm:text-sm text-slate-500 dark:text-white font-semibold uppercase mt-3 mb-1 border-b border-slate-500 dark:border-white">{link.title}</h1>
|
||||||
{link.subLinks.map((subItem, index)=>{
|
}
|
||||||
let active = subItem.status == 1 ? true : false
|
<AsideLinkWithSubLinks name={link.name} icon={link.icon}
|
||||||
let hasSubLinks = (subItem.subLinks && subItem.subLinks.length > 0) ? true : false
|
isOpen={subLinkList.includes(pathname) || index == 1}>
|
||||||
if(active && !hasSubLinks){
|
<>
|
||||||
return (
|
{link.subLinks.map((subItem, index) => {
|
||||||
<div key={subItem.name}>
|
let active = subItem.status == 1 ? true : false
|
||||||
<AsideLink to={subItem.to} name={subItem.name} icon={subItem.icon} />
|
let hasSubLinks = (subItem.subLinks && subItem.subLinks.length > 0) ? true : false
|
||||||
</div>
|
if (active && !hasSubLinks) {
|
||||||
)
|
return (
|
||||||
}else if(active && hasSubLinks){
|
<div key={subItem.name}>
|
||||||
let subLinkList = subItem.subLinks.filter(value => value.to).map(item => { // specific open
|
<AsideLink to={subItem.to} name={subItem.name}
|
||||||
if(item.to){
|
icon={subItem.icon}/>
|
||||||
return item.to
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return(
|
|
||||||
<AsideLinkWithSubLinks key={subItem.name} name={subItem.name} icon={subItem.icon} isOpen={subLinkList.includes(pathname)}>
|
|
||||||
<>
|
|
||||||
{subItem.subLinks.map((item, index)=>{
|
|
||||||
let active = item.status == 1 ? true : false
|
|
||||||
if(active){
|
|
||||||
return (
|
|
||||||
<div key={index}>
|
|
||||||
<AsideLink key={index} to={item.to} name={item.name} icon={item.icon} />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
} else if (active && hasSubLinks) {
|
||||||
})}
|
let subLinkList = subItem.subLinks.filter(value => value.to).map(item => { // specific open
|
||||||
</>
|
if (item.to) {
|
||||||
</AsideLinkWithSubLinks>
|
return item.to
|
||||||
)
|
}
|
||||||
}else{
|
})
|
||||||
return null
|
return (
|
||||||
}
|
<AsideLinkWithSubLinks key={subItem.name} name={subItem.name}
|
||||||
})}
|
icon={subItem.icon}
|
||||||
</>
|
isOpen={subLinkList.includes(pathname)}>
|
||||||
</AsideLinkWithSubLinks>
|
<>
|
||||||
</div>
|
{subItem.subLinks.map((item, index) => {
|
||||||
)
|
let active = item.status == 1 ? true : false
|
||||||
}
|
if (active) {
|
||||||
})}
|
return (
|
||||||
</div>
|
<div key={index}>
|
||||||
|
<AsideLink key={index} to={item.to}
|
||||||
<div className='py-2 mt-4 relative'>
|
name={item.name}
|
||||||
<div className="group w-full flex items-center gap-2">
|
icon={item.icon}/>
|
||||||
<div className="w-full flex items-center gap-2">
|
</div>
|
||||||
<img src={UserAvatar} alt='user avatar' className='w-12 h-12 p-1 rounded-full' />
|
)
|
||||||
<div>
|
}
|
||||||
<p className="text-sm font-bold text-black-body dark:text-white-body">Username</p>
|
})}
|
||||||
<p className="text-12 text-black-box/90 dark:text-white-body/80">username@gmail.com</p>
|
</>
|
||||||
</div>
|
</AsideLinkWithSubLinks>
|
||||||
</div>
|
)
|
||||||
<button onClick={()=>handleActiveMenu('settings')} className="peer text-slate-500 dark:text-white-body">
|
} else {
|
||||||
<Icons name='settings' className='text-3xl' />
|
return null
|
||||||
</button>
|
}
|
||||||
<div className="hidden group-hover:block pop-modal-down absolute p-4 w-full bg-white dark:bg-black-box left-0 bottom-[60%] rounded shadow-round_black dark:shadow-round_white">
|
})}
|
||||||
<div className="w-full min-h-48 flex flex-col justify-between gap-4">
|
</>
|
||||||
<div className="w-full h-full">
|
</AsideLinkWithSubLinks>
|
||||||
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
|
||||||
<h1 className="font-semibold">Username</h1>
|
|
||||||
<p className="-mt-2">username@gmail.com</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='py-2 mt-4 relative'>
|
||||||
|
<div className="group w-full flex items-center gap-2">
|
||||||
|
<div className="w-full flex items-center gap-2">
|
||||||
|
<img src={UserAvatar} alt='user avatar' className='w-12 h-12 p-1 rounded-full'/>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm font-bold text-black-body dark:text-white-body">Username</p>
|
||||||
|
<p className="text-12 text-black-box/90 dark:text-white-body/80">username@gmail.com</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded w-full flex items-center gap-2">
|
</div>
|
||||||
<MainBtn
|
<button onClick={() => handleActiveMenu('settings')}
|
||||||
text='Logout'
|
className="peer text-slate-500 dark:text-white-body">
|
||||||
className="w-full text-center text-black-body hover:text-red-500 dark:text-white-body font-bold text-lg flex justify-center gap-2 items-center"
|
<Icons name='settings' className='text-3xl'/>
|
||||||
onClick={()=>setLogoutModal(true)}
|
</button>
|
||||||
>
|
<div
|
||||||
<TbLogout2 className="text-base" />
|
className="hidden group-hover:block pop-modal-down absolute p-4 w-full bg-white dark:bg-black-box left-0 bottom-[60%] rounded shadow-round_black dark:shadow-round_white">
|
||||||
</MainBtn>
|
<div className="w-full min-h-48 flex flex-col justify-between gap-4">
|
||||||
|
<div className="w-full h-full">
|
||||||
|
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
||||||
|
<h1 className="font-semibold">Username</h1>
|
||||||
|
<p className="-mt-2">username@gmail.com</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="rounded w-full flex items-center gap-2">
|
||||||
|
<MainBtn
|
||||||
|
text='Logout'
|
||||||
|
className="w-full text-center text-black-body hover:text-red-500 dark:text-white-body font-bold text-lg flex justify-center gap-2 items-center"
|
||||||
|
onClick={() => setLogoutModal(true)}
|
||||||
|
>
|
||||||
|
<TbLogout2 className="text-base"/>
|
||||||
|
</MainBtn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const asideNavLinks = [
|
const asideNavLinks = [
|
||||||
{name:'Dashboard', status:1, icon: 'dashboard', to: RouteLinks.homePage},
|
{name: 'Dashboard', status: 1, icon: 'dashboard', to: RouteLinks.homePage},
|
||||||
{name:'First Advance', title:'Loan', status:1, icon: 'arrow-right', subLinks: [
|
{
|
||||||
{name: 'Transactions', status:1, icon: 'dot', to: RouteLinks.transactionsPage},
|
name: 'First Advance', title: 'Loan', status: 1, icon: 'arrow-right', subLinks: [
|
||||||
{name: 'Loans', status:1, icon: 'dot', to: RouteLinks.loansPage},
|
{name: 'Transactions', status: 1, icon: 'dot', to: RouteLinks.transactionsPage},
|
||||||
{name: 'Repayments', status:1, icon: 'dot', to: RouteLinks.repaymentsPage},
|
{name: 'Loans', status: 1, icon: 'dot', to: RouteLinks.loansPage},
|
||||||
{name: 'Loan Charges', status:1, icon: 'dot', to: RouteLinks.loanChargesPage},
|
{name: 'Repayments', status: 1, icon: 'dot', to: RouteLinks.repaymentsPage},
|
||||||
{name: 'Configurations', status:1, icon: 'arrow-right', subLinks: [
|
{name: 'Loan Charges', status: 1, icon: 'dot', to: RouteLinks.loanChargesPage},
|
||||||
{name: 'Loan Offers', status:1, icon: 'dot', to: RouteLinks.offers },
|
{name: 'Eligibility', status: 1, icon: 'dot', to: RouteLinks.eligibility},
|
||||||
]
|
{
|
||||||
},
|
name: 'Configurations', status: 1, icon: 'arrow-right', subLinks: [
|
||||||
|
{name: 'Loan Offers', status: 1, icon: 'dot', to: RouteLinks.offers},
|
||||||
|
]
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// {name:'Product 2', title:'Product 2', status:1, icon: 'product', subLinks: [
|
// {name:'Product 2', title:'Product 2', status:1, icon: 'product', subLinks: [
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createContext, useContext, useEffect, useState } from 'react'
|
import {createContext, useContext, useEffect, useState} from 'react'
|
||||||
|
|
||||||
const GeneralContextProvider = createContext({})
|
const GeneralContextProvider = createContext({})
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ export default function GeneralLayoutContext({children}) {
|
|||||||
|
|
||||||
const [booking, setBooking] = useState('')
|
const [booking, setBooking] = useState('')
|
||||||
|
|
||||||
const [alertBox, setAlertBox] = useState({status:false, msg:''}) // USE TO SHOW SUcCESS OR FAILED ALERT MESSAGE
|
const [alertBox, setAlertBox] = useState({status: false, msg: ''}) // USE TO SHOW SUcCESS OR FAILED ALERT MESSAGE
|
||||||
|
|
||||||
const [logoutModal, setLogoutModal] = useState(false) // USE TO SHOW LOGOUT MODAL BOX
|
const [logoutModal, setLogoutModal] = useState(false) // USE TO SHOW LOGOUT MODAL BOX
|
||||||
|
|
||||||
@@ -21,73 +21,73 @@ export default function GeneralLayoutContext({children}) {
|
|||||||
const [showAsideDrawer, setShowAsideDrawer] = useState('')
|
const [showAsideDrawer, setShowAsideDrawer] = useState('')
|
||||||
|
|
||||||
const handleActiveMenu = (name) => {
|
const handleActiveMenu = (name) => {
|
||||||
if(activeMenu == name){
|
if (activeMenu == name) {
|
||||||
setActiveMenu('')
|
setActiveMenu('')
|
||||||
}else{
|
} else {
|
||||||
setActiveMenu(name)
|
setActiveMenu(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDrawer = (drawerToOpen) => { // FUNCTION TO DETERMINE WHICH ASIDE DRAWER TO SHOW
|
const handleDrawer = (drawerToOpen) => { // FUNCTION TO DETERMINE WHICH ASIDE DRAWER TO SHOW
|
||||||
setDrawer((prev)=>{
|
setDrawer((prev) => {
|
||||||
if(!prev){
|
if (!prev) {
|
||||||
return drawerToOpen
|
return drawerToOpen
|
||||||
}else if(drawerToOpen == prev){
|
} else if (drawerToOpen == prev) {
|
||||||
return ''
|
return ''
|
||||||
}else{
|
} else {
|
||||||
return drawerToOpen
|
return drawerToOpen
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleBooking = (bookingToOpen) => { // FUNCTION TO DETERMINE WHICH ASIDE DRAWER TO SHOW
|
const handleBooking = (bookingToOpen) => { // FUNCTION TO DETERMINE WHICH ASIDE DRAWER TO SHOW
|
||||||
setBooking((prev)=>{
|
setBooking((prev) => {
|
||||||
if(!prev){
|
if (!prev) {
|
||||||
return bookingToOpen
|
return bookingToOpen
|
||||||
}else if(bookingToOpen == prev){
|
} else if (bookingToOpen == prev) {
|
||||||
return ''
|
return ''
|
||||||
}else{
|
} else {
|
||||||
return bookingToOpen
|
return bookingToOpen
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAlertBox = (valObj) => {
|
const handleAlertBox = (valObj) => {
|
||||||
setAlertBox(valObj)
|
setAlertBox(valObj)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTheme = () => {
|
const handleTheme = () => {
|
||||||
setTheme(theme === "dark" ? "light" : "dark");
|
setTheme(theme === "dark" ? "light" : "dark");
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
setTheme("dark");
|
setTheme("dark");
|
||||||
} else {
|
} else {
|
||||||
setTheme("light");
|
setTheme("light");
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (theme === "dark") {
|
if (theme === "dark") {
|
||||||
document.documentElement.classList.add("dark");
|
document.documentElement.classList.add("dark");
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.classList.remove("dark");
|
document.documentElement.classList.remove("dark");
|
||||||
}
|
}
|
||||||
}, [theme]);
|
}, [theme]);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
window.addEventListener('resize', ()=>{
|
window.addEventListener('resize', () => {
|
||||||
setShrinkAside(false)
|
setShrinkAside(false)
|
||||||
setShowAsideDrawer('')
|
setShowAsideDrawer('')
|
||||||
setActiveMenu('')
|
setActiveMenu('')
|
||||||
})
|
})
|
||||||
return () => window.removeEventListener('resize', window.addEventListener('resize', ()=>{
|
return () => window.removeEventListener('resize', window.addEventListener('resize', () => {
|
||||||
setShrinkAside(false)
|
setShrinkAside(false)
|
||||||
setShowAsideDrawer('')
|
setShowAsideDrawer('')
|
||||||
setActiveMenu('')
|
setActiveMenu('')
|
||||||
}))
|
}))
|
||||||
},[])
|
}, [])
|
||||||
|
|
||||||
let value = {
|
let value = {
|
||||||
theme, handleTheme,
|
theme, handleTheme,
|
||||||
@@ -98,16 +98,16 @@ export default function GeneralLayoutContext({children}) {
|
|||||||
logoutModal, setLogoutModal,
|
logoutModal, setLogoutModal,
|
||||||
shrinkAside, setShrinkAside,
|
shrinkAside, setShrinkAside,
|
||||||
showAsideDrawer, setShowAsideDrawer
|
showAsideDrawer, setShowAsideDrawer
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GeneralContextProvider.Provider value={value}>
|
<GeneralContextProvider.Provider value={value}>
|
||||||
{children}
|
{children}
|
||||||
</GeneralContextProvider.Provider>
|
</GeneralContextProvider.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const generalLayoutContext = () => {
|
export const generalLayoutContext = () => {
|
||||||
return useContext(GeneralContextProvider)
|
return useContext(GeneralContextProvider)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import EligibilityCom from '../components/eligibility/EligibilityCom';
|
||||||
|
|
||||||
|
|
||||||
|
export default function EligibilityPage() {
|
||||||
|
return (
|
||||||
|
<EligibilityCom />
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user