Compare commits

...

7 Commits

Author SHA1 Message Date
CHIEFSOFT\ameye e26b8ee02a Merge branch 'master' of https://gitlab.chiefsoft.net/DigiFi/digifi-FirstOffice 2025-11-13 11:09:57 -05:00
CHIEFSOFT\ameye 1d576c9e81 eligibility page 2025-11-13 11:09:41 -05:00
ameye 1bc07694e9 Merge branch 'confirmation-modal' of DigiFi/digifi-FirstOffice into master 2025-11-10 16:09:43 +00:00
victorAnumudu 4b2e73949e confirmation-modal 2025-11-10 13:16:14 +01:00
CHIEFSOFT\ameye 090892b51e Loan data 2025-11-09 14:30:11 -05:00
CHIEFSOFT\ameye 976c95b5fd Loan Repayment 2025-11-09 14:26:20 -05:00
ameye c8365d2cb6 Merge branch 'transaction-details-page-bugfix' of DigiFi/digifi-FirstOffice into master 2025-11-04 11:38:17 +00:00
12 changed files with 744 additions and 291 deletions
+1
View File
@@ -5,6 +5,7 @@ const RouteLinks = {
transactionsPage: '/transactions',
repaymentsPage: '/repayments',
loanChargesPage: '/loan-charges',
eligibility: '/eligibility',
offers: '/offers',
transaction_details_page: '/transaction/details',
errorPage: '*',
+29 -26
View File
@@ -1,5 +1,5 @@
import { lazy, Suspense } from 'react'
import { Routes, Route } from 'react-router-dom'
import {lazy, Suspense} from 'react'
import {Routes, Route} from 'react-router-dom'
import RouteLinks from './RouteLinks'
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 TransactionDetailsPage from './pages/TransactionDetailsPage' // TRANSACTION DETAILS 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'));
export default function SiteRoutes() {
return (
<Routes>
<Route path={RouteLinks.loginPage} element={<LoginPage />} /> {`*/LOGIN PAGE*/`}
return (
<Routes>
<Route path={RouteLinks.loginPage} element={<LoginPage/>}/> {`*/LOGIN PAGE*/`}
<Route element={<UserExist />}>
<Route path={RouteLinks.homePage} element={<HomePage />} /> {`*/HOME PAGE*/`}
<Route path={RouteLinks.loansPage} element={<LoansPage />} /> {`*/LOANS PAGE*/`}
<Route path={RouteLinks.transactionsPage} element={<TransactionsPage />} /> {`*/Transactions PAGE*/`}
<Route path={RouteLinks.repaymentsPage} element={<RepaymentsPage />} /> {`*/REPAYMENTS PAGE*/`}
<Route path={RouteLinks.loanChargesPage} element={<LoanChargesPage />} /> {`*/LOAN CHARGES PAGE*/`}
<Route path={RouteLinks.transaction_details_page} element={<TransactionDetailsPage />} /> {`*/TRANSACTION PAGE*/`}
<Route path={RouteLinks.offers} element={<OffersPage />} /> {`*/LOAN OFFERS PAGE*/`}
</Route>
<Route element={<UserExist/>}>
<Route path={RouteLinks.homePage} element={<HomePage/>}/> {`*/HOME PAGE*/`}
<Route path={RouteLinks.loansPage} element={<LoansPage/>}/> {`*/LOANS PAGE*/`}
<Route path={RouteLinks.transactionsPage} element={<TransactionsPage/>}/> {`*/Transactions PAGE*/`}
<Route path={RouteLinks.repaymentsPage} element={<RepaymentsPage/>}/> {`*/REPAYMENTS PAGE*/`}
<Route path={RouteLinks.loanChargesPage} element={<LoanChargesPage/>}/> {`*/LOAN CHARGES PAGE*/`}
<Route path={RouteLinks.eligibility} element={<EligibilityPage/>}/> {`*/ELIGIBILITY PAGE*/`}
<Route path={RouteLinks.transaction_details_page}
element={<TransactionDetailsPage/>}/> {`*/TRANSACTION PAGE*/`}
<Route path={RouteLinks.offers} element={<OffersPage/>}/> {`*/LOAN OFFERS PAGE*/`}
</Route>
{/* ERROR PAGE */}
<Route
path={RouteLinks.errorPage} // error page
element={
<Suspense fallback={<PageLoader />}>
<ErrorPage />
</Suspense>
}
/>
</Routes>
)
{/* ERROR PAGE */}
<Route
path={RouteLinks.errorPage} // error page
element={
<Suspense fallback={<PageLoader/>}>
<ErrorPage/>
</Suspense>
}
/>
</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>
)
}
+129 -118
View File
@@ -4,9 +4,9 @@ import DummyLogo from "../../DummyLogo";
import MainBtn from "../../MainBtn";
import AsideLink from "./AsideLink";
import AsideLinkWithSubLinks from "./AsideLinkWithSubLinks";
import { useSelector } from "react-redux";
import { generalLayoutContext } from "../../../context/GeneralLayoutContext";
import { TbLogout2 } from "react-icons/tb";
import {useSelector} from "react-redux";
import {generalLayoutContext} from "../../../context/GeneralLayoutContext";
import {TbLogout2} from "react-icons/tb";
import UserAvatar from '../../../assets/user_avatar.jpg'
import Icons from "../../Icons";
import localImgLoader from '../../../helpers/localImageLoader';
@@ -18,136 +18,147 @@ export default function DashboardAside() {
const {setLogoutModal, activeMenu, handleActiveMenu} = generalLayoutContext()
const {userDetails} = useSelector((state) => state.userDetails) // GETS LOGGED IN USER ROLE DETAILS
const {role}= userDetails
const {role} = userDetails
return (
<div className='w-full h-full flex flex-col'>
<div className="mb-3 w-full h-24 logo flex items-center">
{/* <DummyLogo /> */}
<img className='w-2/3 h-auto' src={localImgLoader('simbrella-bko-logo.png')} />
</div>
{/* <hr className="border-slate-400" /> */}
return (
<div className='w-full h-full flex flex-col'>
<div className="mb-3 w-full h-24 logo flex items-center">
{/* <DummyLogo /> */}
<img className='w-2/3 h-auto' src={localImgLoader('simbrella-bko-logo.png')}/>
</div>
{/* <hr className="border-slate-400" /> */}
<div className="aside-scroll-design w-full flex flex-col gap-2 h-full overflow-y-auto">
{asideNavLinks.map((link, index) => {
let active = link.status == 1 ? true : false
let hasSubLinks = (link.subLinks && link.subLinks.length > 0) ? true : false
if(active && !hasSubLinks){
return (
<div key={link.name}>
<AsideLink to={link.to} name={link.name} icon={link.icon} />
</div>
)
}
if(active && hasSubLinks){
let subLinkList = []
link.subLinks.forEach(item =>{
if(item.to){
subLinkList.push(item.to)
}else if(item.subLinks?.length > 0){
item.subLinks.forEach(item => {
<div className="aside-scroll-design w-full flex flex-col gap-2 h-full overflow-y-auto">
{asideNavLinks.map((link, index) => {
let active = link.status == 1 ? true : false
let hasSubLinks = (link.subLinks && link.subLinks.length > 0) ? true : false
if (active && !hasSubLinks) {
return (
<div key={link.name}>
<AsideLink to={link.to} name={link.name} icon={link.icon}/>
</div>
)
}
if (active && hasSubLinks) {
let subLinkList = []
link.subLinks.forEach(item => {
if (item.to) {
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>
}
<AsideLinkWithSubLinks name={link.name} icon={link.icon} isOpen={subLinkList.includes(pathname) || index==1} >
<>
{link.subLinks.map((subItem, index)=>{
let active = subItem.status == 1 ? true : false
let hasSubLinks = (subItem.subLinks && subItem.subLinks.length > 0) ? true : false
if(active && !hasSubLinks){
return (
<div key={subItem.name}>
<AsideLink to={subItem.to} name={subItem.name} icon={subItem.icon} />
</div>
)
}else if(active && hasSubLinks){
let subLinkList = subItem.subLinks.filter(value => value.to).map(item => { // specific open
if(item.to){
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} />
} 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>
}
<AsideLinkWithSubLinks name={link.name} icon={link.icon}
isOpen={subLinkList.includes(pathname) || index == 1}>
<>
{link.subLinks.map((subItem, index) => {
let active = subItem.status == 1 ? true : false
let hasSubLinks = (subItem.subLinks && subItem.subLinks.length > 0) ? true : false
if (active && !hasSubLinks) {
return (
<div key={subItem.name}>
<AsideLink to={subItem.to} name={subItem.name}
icon={subItem.icon}/>
</div>
)
}
})}
</>
</AsideLinkWithSubLinks>
)
}else{
return null
}
})}
</>
</AsideLinkWithSubLinks>
</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>
<button onClick={()=>handleActiveMenu('settings')} className="peer text-slate-500 dark:text-white-body">
<Icons name='settings' className='text-3xl' />
</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">
<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>
} else if (active && hasSubLinks) {
let subLinkList = subItem.subLinks.filter(value => value.to).map(item => { // specific open
if (item.to) {
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>
)
}
})}
</>
</AsideLinkWithSubLinks>
)
} else {
return null
}
})}
</>
</AsideLinkWithSubLinks>
</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 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>
<button onClick={() => handleActiveMenu('settings')}
className="peer text-slate-500 dark:text-white-body">
<Icons name='settings' className='text-3xl'/>
</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">
<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>
)
)
}
const asideNavLinks = [
{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: 'Loans', status:1, icon: 'dot', to: RouteLinks.loansPage},
{name: 'Repayments', status:1, icon: 'dot', to: RouteLinks.repaymentsPage},
{name: 'Loan Charges', status:1, icon: 'dot', to: RouteLinks.loanChargesPage},
{name: 'Configurations', status:1, icon: 'arrow-right', subLinks: [
{name: 'Loan Offers', status:1, icon: 'dot', to: RouteLinks.offers },
]
},
{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: 'Loans', status: 1, icon: 'dot', to: RouteLinks.loansPage},
{name: 'Repayments', status: 1, icon: 'dot', to: RouteLinks.repaymentsPage},
{name: 'Loan Charges', status: 1, icon: 'dot', to: RouteLinks.loanChargesPage},
{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: [
+1
View File
@@ -133,6 +133,7 @@ export default function LoansCom() {
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
<div
className="font-semibold text-green-500">#{formatNumber(item?.initial_loan_amount)}</div>
<div className="font-normal text-red-500">{item?.status}</div>
</div>
</td>
<td className="px-2">
+10 -10
View File
@@ -68,9 +68,9 @@ export default function OffersCom() {
<th scope="col" className="px-2 text-right">
Tenor
</th>
<th scope="col" className="px-2 text-right">
Action
</th>
{/*<th scope="col" className="px-2 text-right">*/}
{/* Action*/}
{/*</th>*/}
</tr>
</thead>
<tbody>
@@ -121,13 +121,13 @@ export default function OffersCom() {
<div className="font-normal text-gray-500">{item?.tenor}</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>
{/*<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>
))
:
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useState } from 'react'
import {useQuery} from "@tanstack/react-query";
import Icons from '../Icons'
@@ -9,10 +9,24 @@ import {getLoans} from '../../services/siteServices'
import getDateFromDateString from '../../helpers/GetDateFromDateString';
import formatNumber from '../../helpers/formatNumber'
import getTimeFromDateString from "../../helpers/GetTimeFromDateString";
import { initiateDisburseRetrials } from "../../services/siteEventService"
import {initiateDisburseRetrials, initiateDisburseVerify} from "../../services/siteEventService"
import ModalWrapper from '../modals/ModalWrapper';
import MainBtn from '../MainBtn';
export default function LoanDetails({transactionID}) {
const [retryDisbursementModal, setRetryDisbursementModal] = useState({})
const [retryVerifyModal, setRetryVerifyModal] = useState({})
const handleSetRetryDisbursementModal = (transactioID) => {
setRetryDisbursementModal({status:true, transactioID})
}
const closeRetryDisbursementModal = () => {setRetryDisbursementModal({})}
const handleSetRetryVerifyModal = (transactioID) => {
setRetryVerifyModal({status:true, transactioID})
}
const closeRetryVerifyModal = () => {setRetryVerifyModal({})}
const {data: allLoans, isFetching, isError, error} = useQuery({
queryKey: [...queryKeys.loans, transactionID],
queryFn: () => getLoans({transaction_id: transactionID})
@@ -22,14 +36,26 @@ export default function LoanDetails({transactionID}) {
// const loansCount = allLoans?.data?.count // LOANS LIST COUNT
const handleClick = (transactioID) => {
// alert(transactioID)
const fields={
// alert(transactioID)
const fields = {
"transactionId": transactioID
}
closeRetryDisbursementModal() // CLOSES THE DISBURSEMENT MODAL
return initiateDisburseRetrials(fields)
// console.log('Button clicked!');
// console.log('Button clicked!');
};
const handleRetryClick = (transactioID) => {
alert(transactioID)
const fields = {
"transactionId": transactioID
}
closeRetryVerifyModal() // CLOSES THE VERIFY MODAL
return initiateDisburseVerify(fields)
// console.log('Button clicked!');
};
return (
<>
{isFetching ?
@@ -43,7 +69,8 @@ export default function LoanDetails({transactionID}) {
<p className='text-red-500'>{error.message}</p>
</div>
: (loans && loans.length > 0) ?
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body' style={{backgroundColor: '#f7d9e3'}}>
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'
style={{backgroundColor: '#f7d9e3'}}>
<p className='pb-4 font-bold text-base'>Loan</p>
<table className="table-auto py-2 w-full text-sm">
<thead className="py-2 text-sm text-slate-500 text-left">
@@ -137,7 +164,8 @@ export default function LoanDetails({transactionID}) {
<div style={{width: '50%', textAlign: 'right'}}>
<button
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 roundede"
onClick={() => handleClick(item?.transaction_id)}>
// onClick={() => handleClick(item?.transaction_id)}>
onClick={() => handleSetRetryDisbursementModal(item?.transaction_id)}>
Retry Disbursement
</button>
</div>
@@ -150,12 +178,31 @@ export default function LoanDetails({transactionID}) {
<div className="font-bold text-red-500">Disburse Result
: {item?.disburseResult}</div>
<div><br/></div>
<div className="font-bold text-blue-500">Disburse Verify
Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>
<div className="font-bold text-gray-500">Verify Description
: {item?.verifyDescription}</div>
<div className="font-bold text-red-500">Verify Result
: {item?.verifyResult}</div>
<div style={{display: 'flex'}}>
<div style={{width: '70%'}}>
<div className="font-bold text-blue-500">Disburse Verify
Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>
<div className="font-bold text-gray-500">Verify Description
: {item?.verifyDescription}</div>
<div className="font-bold text-red-500">Verify Result
: {item?.verifyResult}</div>
</div>
<div style={{width: '30%', textAlign: 'right'}}>
<button
className="bg-blue-500 hover:bg-red-700 text-white font-bold py-2 px-4 roundede"
onClick={() => handleSetRetryVerifyModal(item?.transaction_id)}>
Retry Verification
</button>
</div>
</div>
{/*<div className="font-bold text-blue-500">Disburse Verify*/}
{/* Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>*/}
{/*<div className="font-bold text-gray-500">Verify Description*/}
{/* : {item?.verifyDescription}</div>*/}
{/*<div className="font-bold text-red-500">Verify Result*/}
{/* : {item?.verifyResult}</div>*/}
</div>
</td>
</tr>
@@ -171,6 +218,34 @@ export default function LoanDetails({transactionID}) {
:
null
}
{retryDisbursementModal.status &&
<ModalWrapper maxWidth='max-w-lg'>
<div className="p-4 md:p-5 text-center bg-white rounded-md">
<svg className="mx-auto mb-4 text-gray-400 w-12 h-12 dark:text-gray-200" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
</svg>
<h3 className="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">{'Confirm Retry Disbursement?'}</h3>
<div className="flex justify-center items-center gap-6 sm:gap-20">
<MainBtn onClick={closeRetryDisbursementModal} text='Cancel' className="border text-black dark:text-white" />
<MainBtn onClick={()=>handleClick(retryDisbursementModal.transactioID)} text='Yes' className="text-white bg-primary hover:bg-primary/90 focus:ring-0 focus:outline-none ring-0 font-medium rounded-lg text-sm px-5 py-2.5 text-center" />
</div>
</div>
</ModalWrapper>
}
{retryVerifyModal.status &&
<ModalWrapper maxWidth='max-w-lg'>
<div className="p-4 md:p-5 text-center bg-white rounded-md">
<svg className="mx-auto mb-4 text-gray-400 w-12 h-12 dark:text-gray-200" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
</svg>
<h3 className="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">{'Continue Verify Disburesement?'}</h3>
<div className="flex justify-center items-center gap-6 sm:gap-20">
<MainBtn onClick={closeRetryVerifyModal} text='Cancel' className="border text-black dark:text-white" />
<MainBtn onClick={()=>handleRetryClick(retryVerifyModal.transactioID)} text='Yes' className="text-white bg-primary hover:bg-primary/90 focus:ring-0 focus:outline-none ring-0 font-medium rounded-lg text-sm px-5 py-2.5 text-center" />
</div>
</div>
</ModalWrapper>
}
</>
)
}
@@ -1,15 +1,25 @@
import React, { useEffect, useState } from 'react'
import { useQuery } from "@tanstack/react-query";
import React, {useEffect, useState} from 'react'
import {useQuery} from "@tanstack/react-query";
import Icons from '../Icons'
import Avatar from '../../assets/user_avatar.jpg'
import queryKeys from '../../services/queryKeys'
import { getRepaymentSchedule } from '../../services/siteServices'
import {getRepaymentSchedule} from '../../services/siteServices'
import getDateFromDateString from '../../helpers/GetDateFromDateString';
import formatNumber from '../../helpers/formatNumber';
import localSiteIcons from "../../helpers/localSiteIcons";
import {initiateLoanPayment } from "../../services/siteEventService"
import ModalWrapper from '../modals/ModalWrapper';
import MainBtn from '../MainBtn';
export default function RepaymentScheduleDetails({transactionID}) {
const [retryPaymentModal, setRetryPaymentModal] = useState({})
const handleSetRetryPaymentModal = (transactioID) => {
setRetryPaymentModal({status:true, transactioID})
}
const closeRetryPaymentModal = () => {setRetryPaymentModal({})}
const [page, setPage] = useState(1)
@@ -22,23 +32,33 @@ export default function RepaymentScheduleDetails({transactionID}) {
const repaymentSchedule = data?.data?.repayment_schedules // LOAN CHARGES LIST
// const pagination = data?.data?.pagination
const handleClick = (transactioID) => {
alert(transactioID)
const fields = {
"transactionId": transactioID
}
closeRetryPaymentModal() // CLOSES PAYMENT INITIATE MODAL
return initiateLoanPayment(fields)
// console.log('Button clicked!');
};
useEffect(()=>{
},[])
useEffect(() => {
}, [])
return (
<>
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
<p className='pb-4 font-bold text-base'>Repayment Schedule</p>
{isFetching ?
<>
<p className='text-slate-800'>Loading...</p>
</>
: isError ?
<p className='text-red-500'>{error.message}</p>
:
<table className="py-2 w-full text-sm">
<thead className="py-2 text-sm text-slate-500 text-left">
{isFetching ?
<>
<p className='text-slate-800'>Loading...</p>
</>
: isError ?
<p className='text-red-500'>{error.message}</p>
:
<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">
ID/TrxID
@@ -61,56 +81,88 @@ export default function RepaymentScheduleDetails({transactionID}) {
<th scope="col" className="px-2 text-right">
Paid ?
</th>
<th scope="col" className="px-2 text-right">
</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
{(repaymentSchedule && repaymentSchedule.length > 0) ? repaymentSchedule?.map((item, index) => (
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.loan_id || ''}</div>
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="font-normal text-gray-500">{formatNumber(item?.total_repayment_amount)}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="font-normal text-gray-500">{formatNumber(item?.installment_amount)}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="font-normal text-gray-500">{getDateFromDateString(item?.due_date)}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="text-base font-semibold">{item?.paid || 'false'}</div>
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.loan_id || ''}</div>
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div
className="font-normal text-gray-500">{formatNumber(item?.total_repayment_amount)}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div
className="font-normal text-gray-500">{formatNumber(item?.installment_amount)}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div
className="font-normal text-gray-500">{getDateFromDateString(item?.due_date)}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div
className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="text-base font-semibold">{item?.paid || 'false'}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<button
className="bg-blue-500 hover:bg-red-700 text-white font-bold py-2 px-4 roundede"
onClick={() => handleSetRetryPaymentModal(item?.transaction_id)}>
Process Payment
</button>
</div>
</td>
</tr>
))
:
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-3 py-2" colSpan={6}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
))
:
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-3 py-2" colSpan={6}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
}
</tbody>
</table>
</tbody>
</table>
}
</div>
{retryPaymentModal.status &&
<ModalWrapper maxWidth='max-w-lg'>
<div className="p-4 md:p-5 text-center bg-white rounded-md">
<svg className="mx-auto mb-4 text-gray-400 w-12 h-12 dark:text-gray-200" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
</svg>
<h3 className="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">{'Continue Initiate Payment?'}</h3>
<div className="flex justify-center items-center gap-6 sm:gap-20">
<MainBtn onClick={closeRetryPaymentModal} text='Cancel' className="border text-black dark:text-white" />
<MainBtn onClick={()=>handleClick(retryDisbursementModal.transactioID)} text='Yes' className="text-white bg-primary hover:bg-primary/90 focus:ring-0 focus:outline-none ring-0 font-medium rounded-lg text-sm px-5 py-2.5 text-center" />
</div>
</div>
</ModalWrapper>
}
</>
)
}
+61 -61
View File
@@ -1,4 +1,4 @@
import { createContext, useContext, useEffect, useState } from 'react'
import {createContext, useContext, useEffect, useState} from 'react'
const GeneralContextProvider = createContext({})
@@ -10,7 +10,7 @@ export default function GeneralLayoutContext({children}) {
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
@@ -21,93 +21,93 @@ export default function GeneralLayoutContext({children}) {
const [showAsideDrawer, setShowAsideDrawer] = useState('')
const handleActiveMenu = (name) => {
if(activeMenu == name){
if (activeMenu == name) {
setActiveMenu('')
}else{
} else {
setActiveMenu(name)
}
}
const handleDrawer = (drawerToOpen) => { // FUNCTION TO DETERMINE WHICH ASIDE DRAWER TO SHOW
setDrawer((prev)=>{
if(!prev){
return drawerToOpen
}else if(drawerToOpen == prev){
return ''
}else{
return drawerToOpen
}
})
setDrawer((prev) => {
if (!prev) {
return drawerToOpen
} else if (drawerToOpen == prev) {
return ''
} else {
return drawerToOpen
}
})
}
const handleBooking = (bookingToOpen) => { // FUNCTION TO DETERMINE WHICH ASIDE DRAWER TO SHOW
setBooking((prev)=>{
if(!prev){
return bookingToOpen
}else if(bookingToOpen == prev){
return ''
}else{
return bookingToOpen
}
})
setBooking((prev) => {
if (!prev) {
return bookingToOpen
} else if (bookingToOpen == prev) {
return ''
} else {
return bookingToOpen
}
})
}
const handleAlertBox = (valObj) => {
setAlertBox(valObj)
setAlertBox(valObj)
}
const handleTheme = () => {
setTheme(theme === "dark" ? "light" : "dark");
}
setTheme(theme === "dark" ? "light" : "dark");
}
useEffect(() => {
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
setTheme("dark");
setTheme("dark");
} else {
setTheme("light");
setTheme("light");
}
}, []);
useEffect(() => {
if (theme === "dark") {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
}, [theme]);
}, []);
useEffect(()=>{
window.addEventListener('resize', ()=>{
setShrinkAside(false)
setShowAsideDrawer('')
setActiveMenu('')
})
return () => window.removeEventListener('resize', window.addEventListener('resize', ()=>{
setShrinkAside(false)
setShowAsideDrawer('')
setActiveMenu('')
}))
},[])
useEffect(() => {
if (theme === "dark") {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
}, [theme]);
useEffect(() => {
window.addEventListener('resize', () => {
setShrinkAside(false)
setShowAsideDrawer('')
setActiveMenu('')
})
return () => window.removeEventListener('resize', window.addEventListener('resize', () => {
setShrinkAside(false)
setShowAsideDrawer('')
setActiveMenu('')
}))
}, [])
let value = {
theme, handleTheme,
activeMenu, handleActiveMenu,
drawer, handleDrawer,
booking, handleBooking,
alertBox, handleAlertBox,
theme, handleTheme,
activeMenu, handleActiveMenu,
drawer, handleDrawer,
booking, handleBooking,
alertBox, handleAlertBox,
logoutModal, setLogoutModal,
shrinkAside, setShrinkAside,
showAsideDrawer, setShowAsideDrawer
}
return (
<GeneralContextProvider.Provider value={value}>
{children}
</GeneralContextProvider.Provider>
)
}
return (
<GeneralContextProvider.Provider value={value}>
{children}
</GeneralContextProvider.Provider>
)
}
export const generalLayoutContext = () => {
return useContext(GeneralContextProvider)
return useContext(GeneralContextProvider)
}
+9
View File
@@ -0,0 +1,9 @@
import React from 'react'
import EligibilityCom from '../components/eligibility/EligibilityCom';
export default function EligibilityPage() {
return (
<EligibilityCom />
)
}
+18 -5
View File
@@ -14,8 +14,8 @@ axios.interceptors.request.use(
return Promise.reject(error);
}
);
const postAuxEnd = (path, postData, media=false) => {
const basePath = media ? process.env.REACT_APP_EVENT_API : process.env.REACT_APP_EVENT_API
const postAuxEnd = (path, postData, media = false) => {
const basePath = media ? process.env.REACT_APP_EVENT_API : process.env.REACT_APP_EVENT_API
return axios.post(`${basePath}${path}`, postData).then(res => {
return res
}).catch(err => {
@@ -24,10 +24,10 @@ const postAuxEnd = (path, postData, media=false) => {
})
}
const getAuxEnd = (path, reqData= null) => {
const basePath = media ? process.env.REACT_APP_EVENT_API : process.env.REACT_APP_EVENT_API
const getAuxEnd = (path, reqData = null) => {
const basePath = media ? process.env.REACT_APP_EVENT_API : process.env.REACT_APP_EVENT_API
return axios.get(`${basePath}${path}`,{ params: reqData }).then(res => {
return axios.get(`${basePath}${path}`, {params: reqData}).then(res => {
return res
// localStorage.clear();
// window.location.href = `/login?sessionExpired=true`;
@@ -45,3 +45,16 @@ export const initiateDisburseRetrials = (reqData) => {
}
return postAuxEnd('/autocall/retry-disbursement', postData, false)
}
export const initiateDisburseVerify = (reqData) => {
let postData = {
...reqData
}
return postAuxEnd('/autocall/verify-disbursement', postData, false)
}
export const initiateLoanPayment = (reqData) => {
let postData = {
...reqData
}
return postAuxEnd('/autocall/start-repayment', postData, false)
}