Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| abde91f46b | |||
| 6f9393606f | |||
| 7bc0e90fe7 | |||
| db3afdda2f | |||
| 3c0f8938fc | |||
| ee1e6586c3 | |||
| 26401f8664 | |||
| eb9ec59eb2 | |||
| 397146d4c6 | |||
| 3a5f3662aa | |||
| 59c1ce6ae7 | |||
| d0847b4096 | |||
| 0109809b42 | |||
| 83cf0a9770 | |||
| 945e756276 | |||
| 457d48cd3b | |||
| aed12d4ce9 | |||
| c2bda67ab1 | |||
| cea0ebfe82 | |||
| e4d161c0a9 | |||
| f3b09a0ea2 | |||
| 321122258a | |||
| fc9925a837 | |||
| 239b912585 | |||
| db2fe102f8 | |||
| d1524b84d3 | |||
| 669ba34a8b | |||
| e0e227ec02 | |||
| 7325d8eeb1 |
@@ -6,7 +6,7 @@ TWITTER_URL=https://twitter.com
|
||||
INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API='http://backoffice-apidev.simbrellang.net:14700'
|
||||
REACT_APP_MAIN_API='https://backoffice-apidev.simbrellang.net'
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ VITE_TWITTER_URL=https://twitter.com
|
||||
VITE_INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API='http://backoffice-apidev.simbrellang.net:14700'
|
||||
REACT_APP_MAIN_API='https://backoffice-apidev.simbrellang.net'
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ TWITTER_URL=https://twitter.com
|
||||
INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API='http://backoffice-apidev.simbrellang.net:14700'
|
||||
REACT_APP_MAIN_API='https://backoffice-apidev.simbrellang.net'
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
|
||||
+2
-1
@@ -23,8 +23,9 @@ function App() {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 3,
|
||||
staleTime: 300000 //5 mins
|
||||
// refetchOnMount: false,
|
||||
staleTime: Infinity // can also be a number in millisecond
|
||||
// staleTime: Infinity // can also be a number in millisecond
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
+6
-8
@@ -1,15 +1,13 @@
|
||||
const RouteLinks = {
|
||||
loginPage: '/auth/login',
|
||||
errorPage: '*',
|
||||
homePage: '/',
|
||||
usersPage: '/users',
|
||||
approvedLoansPage: '/loans/approved',
|
||||
applicationsLoanPage: '/loans/apply',
|
||||
disbursementsLoanPage: '/loans/disbursements',
|
||||
selectedLoanPage: '/loans/select',
|
||||
loanOffersPage: '/loans/offers',
|
||||
loansPage: '/loans',
|
||||
requestPage: '/request',
|
||||
transactionsPage: '/transactions',
|
||||
repaymentsPage: '/repayments',
|
||||
loanChargesPage: '/loan-charges',
|
||||
offers: '/offers',
|
||||
transaction_details_page: '/transaction/details',
|
||||
errorPage: '*',
|
||||
}
|
||||
|
||||
export default RouteLinks
|
||||
+12
-16
@@ -7,14 +7,13 @@ import PageLoader from './components/PageLoader'
|
||||
|
||||
import LoginPage from './pages/LoginPage' // LOGIN PAGE
|
||||
import HomePage from './pages/HomePage' // Home PAGE
|
||||
import UsersPage from './pages/UsersPage' // Users PAGE
|
||||
import ApprovedLoansPage from './pages/ApprovedLoansPage' // APPROVED LOANS PAGE
|
||||
import DisbursementsLoanPage from './pages/DisbursementsLoanPage' // DISBURSEMENTS LOANS PAGE
|
||||
import ApplicationsLoanPage from './pages/ApplicationsLoanPage' // APPLICATIONS LOANS PAGE
|
||||
import SelectedLoanPage from './pages/SelectedLoanPage' // SELECTED LOANS PAGE
|
||||
import LoanOffersPage from './pages/LoanOffersPage' // SELECTED LOANS PAGE
|
||||
import LoansPage from './pages/LoansPage' // SELECTED LOANS PAGE
|
||||
import RequestPage from './pages/RequestPage' // SELECTED LOANS PAGE
|
||||
import TransactionsPage from './pages/TransactionsPage' // TRANSACTIONS PAGE
|
||||
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
|
||||
|
||||
|
||||
// const Home = lazy(() => import('./pages/Home'));
|
||||
@@ -26,15 +25,12 @@ export default function SiteRoutes() {
|
||||
|
||||
<Route element={<UserExist />}>
|
||||
<Route path={RouteLinks.homePage} element={<HomePage />} /> {`*/HOME PAGE*/`}
|
||||
<Route path={RouteLinks.usersPage} element={<UsersPage />} /> {`*/USERS PAGE*/`}
|
||||
<Route path={RouteLinks.approvedLoansPage} element={<ApprovedLoansPage />} /> {`*/APPROVED LOANS PAGE*/`}
|
||||
<Route path={RouteLinks.disbursementsLoanPage} element={<DisbursementsLoanPage />} /> {`*/DISBURSEMENTS LOANS PAGE*/`}
|
||||
<Route path={RouteLinks.applicationsLoanPage} element={<ApplicationsLoanPage />} /> {`*/APPLICATIONS LOANS PAGE*/`}
|
||||
<Route path={RouteLinks.selectedLoanPage} element={<SelectedLoanPage />} /> {`*/SELECTED LOANS PAGE*/`}
|
||||
<Route path={RouteLinks.loanOffersPage} element={<LoanOffersPage />} /> {`*/LOANS OFFERS PAGE*/`}
|
||||
|
||||
<Route path={RouteLinks.loansPage} element={<LoansPage />} /> {`*/LOANS PAGE*/`}
|
||||
<Route path={RouteLinks.requestPage} element={<RequestPage />} /> {`*/Request 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>
|
||||
|
||||
{/* ERROR PAGE */}
|
||||
@@ -42,7 +38,7 @@ export default function SiteRoutes() {
|
||||
path={RouteLinks.errorPage} // error page
|
||||
element={
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<p>Error Page 1</p>
|
||||
<ErrorPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -29,11 +29,12 @@
|
||||
// export default CustomCounter;
|
||||
|
||||
|
||||
import React from 'react';
|
||||
import CountUp from 'react-countup';
|
||||
// import React from 'react';
|
||||
// import CountUp from 'react-countup';
|
||||
|
||||
const CustomCounter = ({ targetNumber, timeInSeconds }) => {
|
||||
return <CountUp end={targetNumber} duration={timeInSeconds} />;
|
||||
// return <CountUp end={targetNumber} duration={timeInSeconds} />;
|
||||
return targetNumber
|
||||
};
|
||||
|
||||
export default CustomCounter;
|
||||
@@ -30,7 +30,7 @@ export default function BreadcrumbCom({title, span, paths}) {
|
||||
<div className='flex flex-col gap-2'>
|
||||
<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-white-body font-semibold'>{title}</h1>
|
||||
<span className='text-red-500 text-10 sm:text-base md:text-xl'>{span && span}</span>
|
||||
<span className='text-red-500 text-10 sm:text-base'>{span && span}</span>
|
||||
</div>
|
||||
<div className='flex gap-2 items-center text-black-gray dark:text-white-body text-base'>
|
||||
<TiHomeOutline className='text-black dark:text-white-body' />
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import React from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import ErrorLogo from '../../assets/404-error.png'
|
||||
|
||||
export default function ErrorCom() {
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`h-screen bg-sky-300 flex flex-col items-center justify-center bg-[url('./assets/login-bg.jpg')] bg-cover bg-center bg-no-repeat`}>
|
||||
<div className='p-4 sm:p-8 w-full max-w-7xl mx-auto grid gap-8 place-content-center'>
|
||||
<div className='w-4/5 md:w-[650px] h-full'>
|
||||
<div className='flex flex-col gap-8 w-full bg-white rounded-xl p-16 sm:px-20 sm:py-16 shadow'>
|
||||
<div className='w-full flex flex-col gap-1 items-center'>
|
||||
<h1 className='text-2xl md:text-3xl font-bold text-black-body'>Oops!</h1>
|
||||
<p className='text-sm font-medium text-slate-500'>We can't find that page.</p>
|
||||
</div>
|
||||
|
||||
{/* <div className='relative h-[1px] bg-slate-300/50'>
|
||||
<p className='absolute left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2 bg-white p-4 text-12 text-slate-500'>Or with email</p>
|
||||
</div> */}
|
||||
|
||||
<div className='flex flex-col items-center gap-6'>
|
||||
<img src={ErrorLogo} className='w-4/5 md:w-80 h-auto' alt='error logo' />
|
||||
<div className='h-10 mb-10 flex justify-center'>
|
||||
<button onClick={()=>navigate('/', {replace:true})} className='px-2 h-full bg-primary text-sm text-white font-medium rounded-md'>Return Home</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
import React from 'react'
|
||||
import {Link} from 'react-router-dom'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import BreadcrumbCom from '../../components/breadcrumb/BreadcrumbCom'
|
||||
import CustomCounter from '../../components/CustomCounter'
|
||||
import Icons from '../../components/Icons'
|
||||
import TableWrapper from '../../components/tableWrapper/TableWrapper'
|
||||
import Avatar from '../../assets/user_avatar.jpg'
|
||||
import { Widget1 } from './Widget1'
|
||||
import { Widget2 } from './Widget2'
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { getDashData } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function HomeCom() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.dashboard,
|
||||
queryFn: () => getDashData()
|
||||
queryFn: () => getDashData(),
|
||||
})
|
||||
|
||||
const dashData = data?.data // DASHBOARD DATA
|
||||
@@ -37,18 +37,16 @@ export default function HomeCom() {
|
||||
<div className='w-full grid grid-cols-1 xl:grid-cols-3 gap-8'>
|
||||
<div className='box min-h-[230] justify-between bg-[#F7D9E3] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='text-base sm:text-lg font-bold hover:text-primary'>Loans</p>
|
||||
<Widget1 />
|
||||
<div className='flex gap-2 items-end font-bold'>
|
||||
<div className='flex flex-wrap gap-2 items-end font-bold'>
|
||||
{/* <p className='text-3xl sm:text-[39px]'><span className='text-xl sm:text-2xl'>{dashData?.loans?.currency_text}</span><CustomCounter targetNumber={formatNumber(dashData?.loans?.value)} timeInSeconds='1' /></p> */}
|
||||
<p className='text-base sm:text-lg'><span className='text-sm'>{dashData?.loans?.currency_text}</span><CustomCounter targetNumber={formatNumber(dashData?.loans?.value)} timeInSeconds='1' /></p>
|
||||
<p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>{dashData?.loans?.currency_text}</span><CustomCounter targetNumber={formatNumber(dashData?.loans?.value)} timeInSeconds='1' /></p>
|
||||
<p className='sm:text-[13.9px]'>{dashData?.loans?.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='box min-h-[230] justify-between bg-[#CBF0F5] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='text-base sm:text-lg font-bold hover:text-primary'>Payments</p>
|
||||
{/* <Widget2 /> */}
|
||||
<div className='flex gap-2 items-end font-bold'>
|
||||
<p className='text-sm sm:text-base'><span className='text-sm'>{dashData?.payments?.currency_text}</span><CustomCounter targetNumber={formatNumber(dashData?.payments?.value)} timeInSeconds='1' /></p>
|
||||
<div className='flex flex-wrap gap-2 items-end font-bold'>
|
||||
<p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>{dashData?.payments?.currency_text}</span><CustomCounter targetNumber={formatNumber(dashData?.payments?.value)} timeInSeconds='1' /></p>
|
||||
<p className='sm:text-[13.9px]'>{dashData?.payments?.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -86,81 +84,94 @@ export default function HomeCom() {
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
<TableWrapper data={dashData?.recent_transactions} itemsPerPage={10}>
|
||||
{({ data }) => (
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left font-semibold">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Request
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Account
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Activity
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(dashData?.recent_transactions && dashData?.recent_transactions.length > 0) ? dashData?.recent_transactions?.map((item, index) => {
|
||||
if(index <= 10) {
|
||||
return (
|
||||
<tr key={item?.id} 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={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" />
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.transaction_id}</div>
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.account_id}</div>
|
||||
<div className="font-normal text-gray-500">{item?.type}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">50%</div>
|
||||
<div className="relative h-[6px] w-full bg-white-body dark:bg-black-body rounded-full overflow-hidden">
|
||||
<div className={`absolute left-0 h-full w-1/2 bg-emerald-600`}></div>
|
||||
</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='edit' />
|
||||
</div> */}
|
||||
<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'>
|
||||
<Link to={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}>
|
||||
<Icons name='eye' />
|
||||
</Link>
|
||||
</div>
|
||||
{/* <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='trash' />
|
||||
</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>
|
||||
}
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left font-semibold">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Request
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Account
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Activity
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||
<tr key={item?.id} 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?.account_id}</div>
|
||||
<div className="font-normal text-gray-500">{item?.channel}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.transaction_id}</div>
|
||||
<div className="font-normal text-gray-500">{item?.type}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">50%</div>
|
||||
<div className="relative h-[6px] w-full bg-white-body dark:bg-black-body rounded-full overflow-hidden">
|
||||
<div className={`absolute left-0 h-full w-1/2 bg-emerald-600`}></div>
|
||||
</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='edit' />
|
||||
</div> */}
|
||||
<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 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='trash' />
|
||||
</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>
|
||||
{dashData?.recent_transactions.length > 10 &&
|
||||
<tr className="py-2 border-t border-dashed text-right text-primary border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={4}>
|
||||
<Link to={RouteLinks.transactionsPage} className="flex justify-end items-center">
|
||||
More ...
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</>
|
||||
)}
|
||||
</TableWrapper>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+176
-176
@@ -1,187 +1,187 @@
|
||||
import {useEffect, useRef} from 'react'
|
||||
import ApexCharts from 'apexcharts'
|
||||
// import {useEffect, useRef} from 'react'
|
||||
// import ApexCharts from 'apexcharts'
|
||||
|
||||
const Widget1 = ({chartHeight='50px'}) => {
|
||||
const chartRef = useRef(null)
|
||||
// const Widget1 = ({chartHeight='50px'}) => {
|
||||
// const chartRef = useRef(null)
|
||||
|
||||
const {mode} = '' // to be replaced by theme mode value later
|
||||
// const {mode} = '' // to be replaced by theme mode value later
|
||||
|
||||
useEffect(() => {
|
||||
const chart = refreshChart()
|
||||
// useEffect(() => {
|
||||
// const chart = refreshChart()
|
||||
|
||||
return () => {
|
||||
if (chart) {
|
||||
chart.destroy()
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [chartRef, mode])
|
||||
// return () => {
|
||||
// if (chart) {
|
||||
// chart.destroy()
|
||||
// }
|
||||
// }
|
||||
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// }, [chartRef, mode])
|
||||
|
||||
const refreshChart = () => {
|
||||
if (!chartRef.current) {
|
||||
return
|
||||
}
|
||||
// const refreshChart = () => {
|
||||
// if (!chartRef.current) {
|
||||
// return
|
||||
// }
|
||||
|
||||
const chart = new ApexCharts(chartRef.current, chartOptions(chartHeight))
|
||||
if (chart) {
|
||||
chart.render()
|
||||
}
|
||||
// const chart = new ApexCharts(chartRef.current, chartOptions(chartHeight))
|
||||
// if (chart) {
|
||||
// chart.render()
|
||||
// }
|
||||
|
||||
return chart
|
||||
}
|
||||
// return chart
|
||||
// }
|
||||
|
||||
return (
|
||||
<div className='w-full'>
|
||||
{/* end::Title */}
|
||||
<div
|
||||
ref={chartRef}
|
||||
className='mixed-widget-13-chart'
|
||||
style={{height: chartHeight, minHeight: chartHeight}}
|
||||
></div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
// return (
|
||||
// <div className='w-full'>
|
||||
// {/* end::Title */}
|
||||
// <div
|
||||
// ref={chartRef}
|
||||
// className='mixed-widget-13-chart'
|
||||
// style={{height: chartHeight, minHeight: chartHeight}}
|
||||
// ></div>
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
|
||||
const chartOptions = (chartHeight) => {
|
||||
// const labelColor = getCSSVariableValue('--bs-gray-800')
|
||||
// const strokeColor = getCSSVariableValue('--bs-gray-300')
|
||||
const labelColor = '#e9e9e9'
|
||||
const strokeColor = '#e3e3e3'
|
||||
// const strokeColor = getCSSVariableValue('--bs-gray-300') as string
|
||||
// const chartOptions = (chartHeight) => {
|
||||
// // const labelColor = getCSSVariableValue('--bs-gray-800')
|
||||
// // const strokeColor = getCSSVariableValue('--bs-gray-300')
|
||||
// const labelColor = '#e9e9e9'
|
||||
// const strokeColor = '#e3e3e3'
|
||||
// // const strokeColor = getCSSVariableValue('--bs-gray-300') as string
|
||||
|
||||
return {
|
||||
series: [
|
||||
{
|
||||
name: 'Loans',
|
||||
data: [15, 25, 15, 40, 20, 50],
|
||||
},
|
||||
],
|
||||
grid: {
|
||||
show: false,
|
||||
padding: {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
},
|
||||
chart: {
|
||||
fontFamily: 'inherit',
|
||||
type: 'area',
|
||||
height: chartHeight,
|
||||
toolbar: {
|
||||
show: false,
|
||||
},
|
||||
zoom: {
|
||||
enabled: false,
|
||||
},
|
||||
sparkline: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
plotOptions: {},
|
||||
legend: {
|
||||
show: false,
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
},
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
opacityFrom: 0.4,
|
||||
opacityTo: 0,
|
||||
stops: [20, 120, 120, 120],
|
||||
},
|
||||
},
|
||||
stroke: {
|
||||
curve: 'smooth',
|
||||
show: true,
|
||||
width: 3,
|
||||
colors: ['#FFFFFF'],
|
||||
},
|
||||
xaxis: {
|
||||
categories: ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
|
||||
axisBorder: {
|
||||
show: false,
|
||||
},
|
||||
axisTicks: {
|
||||
show: false,
|
||||
},
|
||||
labels: {
|
||||
show: false,
|
||||
style: {
|
||||
colors: labelColor,
|
||||
fontSize: '12px',
|
||||
},
|
||||
},
|
||||
crosshairs: {
|
||||
show: false,
|
||||
position: 'front',
|
||||
stroke: {
|
||||
color: strokeColor,
|
||||
width: 1,
|
||||
dashArray: 3,
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
enabled: true,
|
||||
formatter: undefined,
|
||||
offsetY: 0,
|
||||
style: {
|
||||
fontSize: '12px',
|
||||
},
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
min: 0,
|
||||
max: 60,
|
||||
labels: {
|
||||
show: false,
|
||||
style: {
|
||||
colors: labelColor,
|
||||
fontSize: '12px',
|
||||
},
|
||||
},
|
||||
},
|
||||
states: {
|
||||
normal: {
|
||||
filter: {
|
||||
type: 'none',
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
hover: {
|
||||
filter: {
|
||||
type: 'none',
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
active: {
|
||||
allowMultipleDataPointsSelection: false,
|
||||
filter: {
|
||||
type: 'none',
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
style: {
|
||||
fontSize: '12px',
|
||||
},
|
||||
y: {
|
||||
formatter: function (val) {
|
||||
return '$' + val + ' thousand'
|
||||
},
|
||||
},
|
||||
},
|
||||
colors: ['#ffffff'],
|
||||
markers: {
|
||||
colors: [labelColor],
|
||||
strokeColors: [strokeColor],
|
||||
strokeWidth: 3,
|
||||
},
|
||||
}
|
||||
}
|
||||
// return {
|
||||
// series: [
|
||||
// {
|
||||
// name: 'Loans',
|
||||
// data: [15, 25, 15, 40, 20, 50],
|
||||
// },
|
||||
// ],
|
||||
// grid: {
|
||||
// show: false,
|
||||
// padding: {
|
||||
// top: 0,
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// right: 0,
|
||||
// },
|
||||
// },
|
||||
// chart: {
|
||||
// fontFamily: 'inherit',
|
||||
// type: 'area',
|
||||
// height: chartHeight,
|
||||
// toolbar: {
|
||||
// show: false,
|
||||
// },
|
||||
// zoom: {
|
||||
// enabled: false,
|
||||
// },
|
||||
// sparkline: {
|
||||
// enabled: true,
|
||||
// },
|
||||
// },
|
||||
// plotOptions: {},
|
||||
// legend: {
|
||||
// show: false,
|
||||
// },
|
||||
// dataLabels: {
|
||||
// enabled: false,
|
||||
// },
|
||||
// fill: {
|
||||
// type: 'gradient',
|
||||
// gradient: {
|
||||
// opacityFrom: 0.4,
|
||||
// opacityTo: 0,
|
||||
// stops: [20, 120, 120, 120],
|
||||
// },
|
||||
// },
|
||||
// stroke: {
|
||||
// curve: 'smooth',
|
||||
// show: true,
|
||||
// width: 3,
|
||||
// colors: ['#FFFFFF'],
|
||||
// },
|
||||
// xaxis: {
|
||||
// categories: ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
|
||||
// axisBorder: {
|
||||
// show: false,
|
||||
// },
|
||||
// axisTicks: {
|
||||
// show: false,
|
||||
// },
|
||||
// labels: {
|
||||
// show: false,
|
||||
// style: {
|
||||
// colors: labelColor,
|
||||
// fontSize: '12px',
|
||||
// },
|
||||
// },
|
||||
// crosshairs: {
|
||||
// show: false,
|
||||
// position: 'front',
|
||||
// stroke: {
|
||||
// color: strokeColor,
|
||||
// width: 1,
|
||||
// dashArray: 3,
|
||||
// },
|
||||
// },
|
||||
// tooltip: {
|
||||
// enabled: true,
|
||||
// formatter: undefined,
|
||||
// offsetY: 0,
|
||||
// style: {
|
||||
// fontSize: '12px',
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// yaxis: {
|
||||
// min: 0,
|
||||
// max: 60,
|
||||
// labels: {
|
||||
// show: false,
|
||||
// style: {
|
||||
// colors: labelColor,
|
||||
// fontSize: '12px',
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// states: {
|
||||
// normal: {
|
||||
// filter: {
|
||||
// type: 'none',
|
||||
// value: 0,
|
||||
// },
|
||||
// },
|
||||
// hover: {
|
||||
// filter: {
|
||||
// type: 'none',
|
||||
// value: 0,
|
||||
// },
|
||||
// },
|
||||
// active: {
|
||||
// allowMultipleDataPointsSelection: false,
|
||||
// filter: {
|
||||
// type: 'none',
|
||||
// value: 0,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// tooltip: {
|
||||
// style: {
|
||||
// fontSize: '12px',
|
||||
// },
|
||||
// y: {
|
||||
// formatter: function (val) {
|
||||
// return '$' + val + ' thousand'
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// colors: ['#ffffff'],
|
||||
// markers: {
|
||||
// colors: [labelColor],
|
||||
// strokeColors: [strokeColor],
|
||||
// strokeWidth: 3,
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
export {Widget1}
|
||||
// export {Widget1}
|
||||
|
||||
+136
-136
@@ -1,147 +1,147 @@
|
||||
import {useEffect, useRef} from 'react'
|
||||
import ApexCharts from 'apexcharts'
|
||||
// import {useEffect, useRef} from 'react'
|
||||
// import ApexCharts from 'apexcharts'
|
||||
|
||||
const Widget2 = ({chartHeight='100px'}) => {
|
||||
const chartRef = useRef(null)
|
||||
// const Widget2 = ({chartHeight='100px'}) => {
|
||||
// const chartRef = useRef(null)
|
||||
|
||||
const {mode} = '' // to be replaced by theme mode value later
|
||||
// const {mode} = '' // to be replaced by theme mode value later
|
||||
|
||||
useEffect(() => {
|
||||
const chart = refreshChart()
|
||||
// useEffect(() => {
|
||||
// const chart = refreshChart()
|
||||
|
||||
return () => {
|
||||
if (chart) {
|
||||
chart.destroy()
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [chartRef, mode])
|
||||
// return () => {
|
||||
// if (chart) {
|
||||
// chart.destroy()
|
||||
// }
|
||||
// }
|
||||
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// }, [chartRef, mode])
|
||||
|
||||
const refreshChart = () => {
|
||||
if (!chartRef.current) {
|
||||
return
|
||||
}
|
||||
// const refreshChart = () => {
|
||||
// if (!chartRef.current) {
|
||||
// return
|
||||
// }
|
||||
|
||||
const chart = new ApexCharts(chartRef.current, chartOptions(chartHeight))
|
||||
if (chart) {
|
||||
chart.render()
|
||||
}
|
||||
// const chart = new ApexCharts(chartRef.current, chartOptions(chartHeight))
|
||||
// if (chart) {
|
||||
// chart.render()
|
||||
// }
|
||||
|
||||
return chart
|
||||
}
|
||||
// return chart
|
||||
// }
|
||||
|
||||
return (
|
||||
<div className='w-full'>
|
||||
{/* end::Title */}
|
||||
<div
|
||||
ref={chartRef}
|
||||
className='mixed-widget-13-chart'
|
||||
style={{height: chartHeight, minHeight: chartHeight}}
|
||||
></div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
// return (
|
||||
// <div className='w-full'>
|
||||
// {/* end::Title */}
|
||||
// <div
|
||||
// ref={chartRef}
|
||||
// className='mixed-widget-13-chart'
|
||||
// style={{height: chartHeight, minHeight: chartHeight}}
|
||||
// ></div>
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
|
||||
const chartOptions = (chartHeight) => {
|
||||
// const labelColor = getCSSVariableValue('--bs-gray-800')
|
||||
// const chartOptions = (chartHeight) => {
|
||||
// // const labelColor = getCSSVariableValue('--bs-gray-800')
|
||||
|
||||
return {
|
||||
series: [
|
||||
{
|
||||
name: 'Payments',
|
||||
data: [1, 2.1, 1, 2.1, 4.1, 6.1, 4.1, 4.1, 2.1, 4.1, 2.1, 3.1, 1, 1, 2.1],
|
||||
},
|
||||
],
|
||||
chart: {
|
||||
fontFamily: 'inherit',
|
||||
height: chartHeight,
|
||||
type: 'bar',
|
||||
toolbar: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
show: false,
|
||||
padding: {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
},
|
||||
colors: ['#ffffff'],
|
||||
plotOptions: {
|
||||
bar: {
|
||||
borderRadius: 2.5,
|
||||
dataLabels: {
|
||||
position: 'top', // top, center, bottom
|
||||
},
|
||||
columnWidth: '20%',
|
||||
},
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
formatter: function (val) {
|
||||
return val + '%'
|
||||
},
|
||||
offsetY: -20,
|
||||
style: {
|
||||
fontSize: '12px',
|
||||
colors: ['#304758'],
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
labels: {
|
||||
show: false,
|
||||
},
|
||||
categories: [
|
||||
'Jan',
|
||||
'Feb',
|
||||
'Mar',
|
||||
'Apr',
|
||||
'May',
|
||||
'Jun',
|
||||
'Jul',
|
||||
'Aug',
|
||||
'Sep',
|
||||
'Oct',
|
||||
'Nov',
|
||||
'Dec',
|
||||
'Jan',
|
||||
'Feb',
|
||||
'Mar',
|
||||
],
|
||||
position: 'top',
|
||||
axisBorder: {
|
||||
show: false,
|
||||
},
|
||||
axisTicks: {
|
||||
show: false,
|
||||
},
|
||||
crosshairs: {
|
||||
show: false,
|
||||
},
|
||||
tooltip: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
show: false,
|
||||
axisBorder: {
|
||||
show: false,
|
||||
},
|
||||
axisTicks: {
|
||||
show: false,
|
||||
// background: labelColor,
|
||||
},
|
||||
labels: {
|
||||
show: false,
|
||||
formatter: function (val) {
|
||||
return val + '%'
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// return {
|
||||
// series: [
|
||||
// {
|
||||
// name: 'Payments',
|
||||
// data: [1, 2.1, 1, 2.1, 4.1, 6.1, 4.1, 4.1, 2.1, 4.1, 2.1, 3.1, 1, 1, 2.1],
|
||||
// },
|
||||
// ],
|
||||
// chart: {
|
||||
// fontFamily: 'inherit',
|
||||
// height: chartHeight,
|
||||
// type: 'bar',
|
||||
// toolbar: {
|
||||
// show: false,
|
||||
// },
|
||||
// },
|
||||
// grid: {
|
||||
// show: false,
|
||||
// padding: {
|
||||
// top: 0,
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// right: 0,
|
||||
// },
|
||||
// },
|
||||
// colors: ['#ffffff'],
|
||||
// plotOptions: {
|
||||
// bar: {
|
||||
// borderRadius: 2.5,
|
||||
// dataLabels: {
|
||||
// position: 'top', // top, center, bottom
|
||||
// },
|
||||
// columnWidth: '20%',
|
||||
// },
|
||||
// },
|
||||
// dataLabels: {
|
||||
// enabled: false,
|
||||
// formatter: function (val) {
|
||||
// return val + '%'
|
||||
// },
|
||||
// offsetY: -20,
|
||||
// style: {
|
||||
// fontSize: '12px',
|
||||
// colors: ['#304758'],
|
||||
// },
|
||||
// },
|
||||
// xaxis: {
|
||||
// labels: {
|
||||
// show: false,
|
||||
// },
|
||||
// categories: [
|
||||
// 'Jan',
|
||||
// 'Feb',
|
||||
// 'Mar',
|
||||
// 'Apr',
|
||||
// 'May',
|
||||
// 'Jun',
|
||||
// 'Jul',
|
||||
// 'Aug',
|
||||
// 'Sep',
|
||||
// 'Oct',
|
||||
// 'Nov',
|
||||
// 'Dec',
|
||||
// 'Jan',
|
||||
// 'Feb',
|
||||
// 'Mar',
|
||||
// ],
|
||||
// position: 'top',
|
||||
// axisBorder: {
|
||||
// show: false,
|
||||
// },
|
||||
// axisTicks: {
|
||||
// show: false,
|
||||
// },
|
||||
// crosshairs: {
|
||||
// show: false,
|
||||
// },
|
||||
// tooltip: {
|
||||
// enabled: false,
|
||||
// },
|
||||
// },
|
||||
// yaxis: {
|
||||
// show: false,
|
||||
// axisBorder: {
|
||||
// show: false,
|
||||
// },
|
||||
// axisTicks: {
|
||||
// show: false,
|
||||
// // background: labelColor,
|
||||
// },
|
||||
// labels: {
|
||||
// show: false,
|
||||
// formatter: function (val) {
|
||||
// return val + '%'
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
export {Widget2}
|
||||
// export {Widget2}
|
||||
|
||||
@@ -5,16 +5,15 @@ import { generalLayoutContext } from "../../context/GeneralLayoutContext"
|
||||
|
||||
import UserAvatar from '../../assets/user_avatar.jpg'
|
||||
import HandBurger from "./HandBurger"
|
||||
import { Link, useLocation } from "react-router-dom"
|
||||
import { Link } from "react-router-dom"
|
||||
import RouteLinks from "../../RouteLinks"
|
||||
import { useState } from "react";
|
||||
import MainBtn from "../MainBtn";
|
||||
import { TbLogout2 } from "react-icons/tb";
|
||||
import Icons from "../Icons";
|
||||
|
||||
export default function DashboardHeader() {
|
||||
|
||||
let {pathname} = useLocation()
|
||||
// let {pathname} = useLocation()
|
||||
|
||||
const {theme, handleTheme, setLogoutModal, activeMenu, handleActiveMenu, showAsideDrawer, setShowAsideDrawer} = generalLayoutContext()
|
||||
|
||||
@@ -36,11 +35,9 @@ export default function DashboardHeader() {
|
||||
</Link>
|
||||
|
||||
{/* RIGHT DRAWER BUTTON */}
|
||||
{pathname == '/' &&
|
||||
<div onClick={()=>setShowAsideDrawer('right-aside')} className='large:hidden w-10 h-10 border border-slate-300 text-slate-500 dark:text-white-body rounded-md px-2 flex justify-center items-center gap-2 cursor-pointer' title='Switch Color Mode'>
|
||||
<Icons name='right-panel' className="text-sm md:text-xl font-bold" />
|
||||
</div>
|
||||
}
|
||||
|
||||
{/* MESSAGE */}
|
||||
{/* <button onClick={()=>handleDrawer(drawerName.chat)} className="relative px-2 flex justify-center items-center gap-2 cursor-pointer">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Outlet, useLocation } from 'react-router-dom'
|
||||
import { Outlet } from 'react-router-dom'
|
||||
|
||||
import DashboardHeader from './DashboardHeader'
|
||||
import { generalLayoutContext } from '../../context/GeneralLayoutContext'
|
||||
@@ -8,7 +7,7 @@ import RightAsideBar from './rightaside/RightAsideBar'
|
||||
|
||||
export default function DashboardLayout() {
|
||||
|
||||
let {pathname} = useLocation()
|
||||
// let {pathname} = useLocation()
|
||||
|
||||
const {showAsideDrawer, setShowAsideDrawer} = generalLayoutContext()
|
||||
|
||||
@@ -18,9 +17,6 @@ export default function DashboardLayout() {
|
||||
<DashboardAside />
|
||||
</div>
|
||||
|
||||
{/* <div className={`${showAsideDrawer =='aside' ? 'left-0' : '-left-full'} w-4/5 sm:w-72 px-8 py-4 lg:hidden fixed inset-0 z-[999] bg-white-aside dark:bg-black-aside dark:text-white-light`}>
|
||||
<DashboardAside />
|
||||
</div> */}
|
||||
<div className={`${showAsideDrawer =='aside' ? 'left-0' : '-left-full'} lg:hidden w-full fixed inset-0 z-[999]`}>
|
||||
<div className={`${showAsideDrawer =='aside' ? 'fixed left-0 top-0 inset-0' : '-left-full'} w-full bg-[rgba(0,_0,_0,_0.2)] dark:bg-[rgba(0,_0,_0,_0.4)] transition-all cursor-pointer`} onClick={()=>setShowAsideDrawer('')} ></div>
|
||||
<div className={`fixed px-8 py-4 h-full w-4/5 sm:w-[400px] bg-white-aside dark:bg-black-aside dark:text-white-light`}>
|
||||
@@ -28,7 +24,7 @@ export default function DashboardLayout() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={`main w-full bg-inherit ${pathname == '/' && 'large:mr-[400px]'}`}>
|
||||
<div className={`main w-full bg-inherit large:mr-[400px]`}>
|
||||
<div className='fixed top-0 left-0 z-[980] w-full px-8 bg-inherit lg:hidden'>
|
||||
<DashboardHeader />
|
||||
</div>
|
||||
@@ -45,7 +41,6 @@ export default function DashboardLayout() {
|
||||
</div>
|
||||
|
||||
{/* Right Aisde */}
|
||||
{pathname == '/' &&
|
||||
<>
|
||||
<div className={`px-8 py-4 hidden large:flex fixed right-5 top-0 bottom-0 sm:w-[400px] bg-[#192440] dark:bg-[#1E1E2D] text-white-body`}>
|
||||
<RightAsideBar />
|
||||
@@ -57,7 +52,6 @@ export default function DashboardLayout() {
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function DashboardAside() {
|
||||
let hasSubLinks = (link.subLinks && link.subLinks.length > 0) ? true : false
|
||||
if(active && !hasSubLinks){
|
||||
return (
|
||||
<div key={index}>
|
||||
<div key={link.name}>
|
||||
<AsideLink to={link.to} name={link.name} icon={link.icon} />
|
||||
</div>
|
||||
)
|
||||
@@ -49,7 +49,7 @@ export default function DashboardAside() {
|
||||
}
|
||||
})
|
||||
return (
|
||||
<div key={index} className="w-full">
|
||||
<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>
|
||||
}
|
||||
@@ -60,8 +60,8 @@ export default function DashboardAside() {
|
||||
let hasSubLinks = (subItem.subLinks && subItem.subLinks.length > 0) ? true : false
|
||||
if(active && !hasSubLinks){
|
||||
return (
|
||||
<div key={index}>
|
||||
<AsideLink key={index} to={subItem.to} name={subItem.name} icon={subItem.icon} />
|
||||
<div key={subItem.name}>
|
||||
<AsideLink to={subItem.to} name={subItem.name} icon={subItem.icon} />
|
||||
</div>
|
||||
)
|
||||
}else if(active && hasSubLinks){
|
||||
@@ -71,7 +71,7 @@ export default function DashboardAside() {
|
||||
}
|
||||
})
|
||||
return(
|
||||
<AsideLinkWithSubLinks name={subItem.name} icon={subItem.icon} isOpen={subLinkList.includes(pathname)}>
|
||||
<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
|
||||
@@ -138,15 +138,12 @@ export default function DashboardAside() {
|
||||
const asideNavLinks = [
|
||||
{name:'Dashboard', status:1, icon: 'dashboard', to: RouteLinks.homePage},
|
||||
{name:'First Advance', title:'Loan', status:1, icon: 'arrow-right', subLinks: [
|
||||
{name: 'Request', status:1, icon: 'dot', to: RouteLinks.requestPage},
|
||||
{name: 'Transactions', status:1, icon: 'dot', to: RouteLinks.transactionsPage},
|
||||
{name: 'Loans', status:1, icon: 'dot', to: RouteLinks.loansPage},
|
||||
{name: 'Selected Loans', status:1, icon: 'dot', to: RouteLinks.selectedLoanPage},
|
||||
{name: 'Applications', status:1, icon: 'dot', to: RouteLinks.applicationsLoanPage},
|
||||
{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: '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.loanOffersPage },
|
||||
{name: 'Loan Offers', status:1, icon: 'dot', to: RouteLinks.offers },
|
||||
]
|
||||
},
|
||||
],
|
||||
|
||||
+32
-31
@@ -1,29 +1,33 @@
|
||||
import React from 'react'
|
||||
import React, { useState } 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 TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
|
||||
import Avatar from '../../assets/user_avatar.jpg'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { selectLoan } from '../../services/siteServices'
|
||||
import { getLoanCharges } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function RequestCom() {
|
||||
export default function LoanChargesCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.select_loan,
|
||||
queryFn: () => selectLoan()
|
||||
queryKey: [...queryKeys.loan_charges, page],
|
||||
queryFn: () => getLoanCharges({page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const selectUsers = data?.data?.result_data?.data // APPLY LOAN LIST
|
||||
const loanCharges = data?.data?.loan_charges // LOAN CHARGES LIST
|
||||
const pagination = data?.data?.pagination
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Request' paths={['Dashboard', 'Request']} />
|
||||
<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 ?
|
||||
@@ -33,7 +37,7 @@ export default function RequestCom() {
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<TableWrapper data={selectUsers} itemsPerPage={15}>
|
||||
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
@@ -42,10 +46,13 @@ export default function RequestCom() {
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Name
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
{/* <th scope="col" className="px-2">
|
||||
Loan
|
||||
</th> */}
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Added
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
@@ -55,38 +62,32 @@ export default function RequestCom() {
|
||||
</thead>
|
||||
<tbody>
|
||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<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?.name || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.bvn}</div>
|
||||
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||
<div className="font-normal text-gray-500 line-clamp-1">{item?.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.loan}</div>
|
||||
<div className="font-normal text-gray-500">{item?.description}</div>
|
||||
<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-left">
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}</div>
|
||||
<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='edit' />
|
||||
</div>
|
||||
<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 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='trash' />
|
||||
</div>
|
||||
<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>
|
||||
@@ -104,7 +105,7 @@ export default function RequestCom() {
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TableWrapper>
|
||||
</TablePaginatedWrapper>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,18 +8,21 @@ import Icons from '../Icons'
|
||||
|
||||
import Avatar from '../../assets/user_avatar.jpg'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { selectLoan } from '../../services/siteServices'
|
||||
import { getLoans } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function LoansCom() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.select_loan,
|
||||
queryFn: () => selectLoan()
|
||||
const {data:allLoans, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.loans,
|
||||
queryFn: () => getLoans()
|
||||
})
|
||||
|
||||
const selectUsers = data?.data?.result_data?.data // APPLY LOAN LIST
|
||||
const loans = allLoans?.data?.loans // LOANS LIST
|
||||
const loansCount = allLoans?.data?.count // LOANS LIST COUNT
|
||||
// console.log('LOANS', loans)
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
@@ -33,19 +36,25 @@ export default function LoansCom() {
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<TableWrapper data={selectUsers} itemsPerPage={15}>
|
||||
<TableWrapper data={loans} itemsPerPage={15}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<table className="table-auto 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 scope="col" className="px-2 text-right">
|
||||
Loan Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Product/Tenor
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Repay/Install Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Added
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
@@ -55,45 +64,53 @@ export default function LoansCom() {
|
||||
</thead>
|
||||
<tbody>
|
||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<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?.name || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.bvn}</div>
|
||||
<div className="text-base font-semibold">{item?.account_id || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.id} : {item?.transaction_id}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.loan}</div>
|
||||
<div className="font-normal text-gray-500">{item?.description}</div>
|
||||
<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?.initial_loan_amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}</div>
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.product_id)}</div>
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.tenor)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.repayment_amount)}</div>
|
||||
<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?.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='edit' />
|
||||
</div>
|
||||
<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 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='trash' />
|
||||
</div>
|
||||
<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'>
|
||||
<Link to={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}>
|
||||
<Icons name='eye' />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={4}>
|
||||
<td className="px-3 py-2" colSpan={6}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
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 { getOffers } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function OffersCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.offers, page],
|
||||
queryFn: () => getOffers({page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const offers = data?.data?.offers // LOAN CHARGES LIST
|
||||
const pagination = data?.data?.pagination
|
||||
console.log('offers', offers)
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Offers' paths={['Dashboard', 'Offers']} />
|
||||
|
||||
<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={offers} 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 text-right">
|
||||
Interest Rate
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Insurance Rate
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Mgt. Rate
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Max/Min Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Tenor
|
||||
</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?.product_id || ''}</div>
|
||||
{/* <div className="font-normal text-gray-500 line-clamp-1">{item?.description}</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.interest_rate)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.insurance_rate)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.management_rate)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.maximum_amount)}</div>
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.minimum_amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(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>
|
||||
</tr>
|
||||
))
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={7}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TablePaginatedWrapper>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
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 { getRepayments } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
|
||||
export default function RepaymentsCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.transactions, page],
|
||||
queryFn: () => getRepayments({page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const repayments = data?.data?.repayments // REPAYMENTS LIST
|
||||
const pagination = data?.data?.pagination
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Repayments' paths={['Dashboard', 'Repayments']} />
|
||||
|
||||
<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={repayments} 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">
|
||||
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?.customer_id || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.transaction_id}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{/* <td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.loan}</div>
|
||||
<div className="font-normal text-gray-500">{item?.description}</div>
|
||||
</div>
|
||||
</td> */}
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<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={3}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TablePaginatedWrapper>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import MainBtn from "../MainBtn";
|
||||
import Icons from "../Icons";
|
||||
|
||||
|
||||
export default function TablePaginatedWrapper({
|
||||
data = [],
|
||||
itemsPerPage = 5,
|
||||
pagination,
|
||||
setPage,
|
||||
isFetching,
|
||||
filterItem,
|
||||
children,
|
||||
}) {
|
||||
const [isLoading, setIsLoading] = useState(isFetching)
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [filteredData, setFilteredData] = useState(data);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
const [newData, setNewData] = useState([]);
|
||||
|
||||
const numberOfSelection = itemsPerPage;
|
||||
|
||||
const handlePrev = () => {
|
||||
setPage(prev => prev - 1)
|
||||
};
|
||||
const handleNext = () => {
|
||||
setPage(prev => prev + 1)
|
||||
};
|
||||
|
||||
const handleSearch = ({ target: { value } }, name) => {
|
||||
setSearchTerm(value);
|
||||
let newFilteredData = data.filter((item) =>
|
||||
item[name].toLowerCase().startsWith(value.toLowerCase())
|
||||
);
|
||||
setFilteredData(newFilteredData);
|
||||
setCurrentPage(0);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setIsLoading(true)
|
||||
setTimeout(()=>{
|
||||
setNewData(
|
||||
filteredData?.slice(currentPage, numberOfSelection + currentPage)
|
||||
);
|
||||
setIsLoading(false)
|
||||
},1000)
|
||||
}, [currentPage, filteredData, numberOfSelection]);
|
||||
|
||||
useEffect(()=>{
|
||||
setCurrentPage(0)
|
||||
},[itemsPerPage])
|
||||
|
||||
return (
|
||||
<div className="relative w-full">
|
||||
{data.length > 0 && filterItem && (
|
||||
<div className="mb-10 flex justify-end items-center gap-2">
|
||||
{filterItem.map((item, index) => (
|
||||
<label
|
||||
key={index}
|
||||
className="flex flex-col sm:flex-row items-center gap-2 text-slate-600 dark:text-slate-100 transition-all duration-500"
|
||||
>
|
||||
Search by {item[0].toUpperCase() + item.slice(1)}
|
||||
<input
|
||||
name={item}
|
||||
type="text"
|
||||
className="py-1 px-2 text-sm min-w-[100px] text-black dark:text-white bg-white dark:bg-slate-800 rounded-full border-0 outline-none ring-1 ring-slate-300 dark:ring-white transition-all duration-500"
|
||||
value={searchTerm}
|
||||
onChange={(e) => {
|
||||
handleSearch(e, item);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex flex-col">
|
||||
<div className="w-full overflow-x-auto">
|
||||
{children({ data: newData })}
|
||||
</div>
|
||||
|
||||
<div className='w-full flex flex-col lg:flex-row justify-center items-center gap-3 md:gap-6'>
|
||||
<div className="text-sm text-center lg:text-left font-normal text-gray-500 dark:text-gray-400 block w-full">Showing <span className="font-semibold text-gray-900 dark:text-white">
|
||||
{isLoading ? '----' : `page ${pagination?.current_page}`}</span> of <span className="font-semibold text-gray-900 dark:text-white">{pagination?.total_pages}</span>
|
||||
</div>
|
||||
{(newData.length >= 0) &&
|
||||
<div className='flex items-center gap-3 md:gap-6'>
|
||||
<MainBtn
|
||||
onClick={handlePrev}
|
||||
// text='Prev'
|
||||
className={`${!pagination?.has_prev ? 'bg-primary/50 pointer-events-none' : 'bg-primary'} text-white-light text-center flex justify-center gap-2 items-center`}
|
||||
disabled={isLoading || !pagination?.has_prev}
|
||||
>
|
||||
<Icons name='prev' />
|
||||
</MainBtn>
|
||||
<MainBtn
|
||||
onClick={handleNext}
|
||||
// text='Next'
|
||||
className={`${!pagination?.has_next ? 'bg-primary/50 pointer-events-none' : 'bg-primary'} text-white-light text-center flex justify-center gap-2 items-center`}
|
||||
disabled={isLoading || !pagination?.has_next}
|
||||
>
|
||||
<Icons name='next' />
|
||||
</MainBtn>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isLoading && <TableIsLoading />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const TableIsLoading = () => {
|
||||
return (
|
||||
<div className="w-full absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[991] inset-0 flex justify-center items-center">
|
||||
<p className="rounded-md shadow-md p-4 bg-white/90 dark:bg-gray-900 text-brown dark:text-white">Loading...</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import MainBtn from "../MainBtn";
|
||||
import Icons from "../Icons";
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function TableWrapper({
|
||||
const numberOfSelection = itemsPerPage;
|
||||
|
||||
const handlePrev = () => {
|
||||
if (currentPage != 0) {
|
||||
if (currentPage !== 0) {
|
||||
setCurrentPage((prev) => prev - numberOfSelection);
|
||||
}
|
||||
};
|
||||
@@ -46,7 +46,7 @@ export default function TableWrapper({
|
||||
);
|
||||
setIsLoading(false)
|
||||
},1000)
|
||||
}, [currentPage, filteredData]);
|
||||
}, [currentPage, filteredData, numberOfSelection]);
|
||||
|
||||
useEffect(()=>{
|
||||
setCurrentPage(0)
|
||||
@@ -92,7 +92,7 @@ export default function TableWrapper({
|
||||
<MainBtn
|
||||
onClick={handlePrev}
|
||||
// text='Prev'
|
||||
className={`${currentPage == 0 ? 'bg-primary/50 pointer-events-none' : 'bg-primary'} text-white-light text-center flex justify-center gap-2 items-center`}
|
||||
className={`${currentPage === 0 ? 'bg-primary/50 pointer-events-none' : 'bg-primary'} text-white-light text-center flex justify-center gap-2 items-center`}
|
||||
disabled={isLoading}
|
||||
>
|
||||
<Icons name='prev' />
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import React, { 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 { getLoanCharges } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function LoanChargeDetails({transactionID}) {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.loan_charges, page],
|
||||
queryFn: () => getLoanCharges({transaction_id: transactionID, page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const loanCharges = data?.data?.loan_charges // LOAN CHARGES LIST
|
||||
// const pagination = data?.data?.pagination
|
||||
|
||||
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'>Loan Charges</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">
|
||||
<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>
|
||||
{(loanCharges && loanCharges.length > 0) ? loanCharges?.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?.description}</div> */}
|
||||
<div className="font-normal text-gray-500">{item?.loan_id} : {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={3}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import React 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 { getLoans } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
|
||||
export default function LoanDetails({transactionID}) {
|
||||
|
||||
const {data:allLoans, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.loans,
|
||||
queryFn: () => getLoans({transaction_id: transactionID})
|
||||
})
|
||||
|
||||
const loans = allLoans?.data?.loans // LOANS LIST
|
||||
// const loansCount = allLoans?.data?.count // LOANS LIST COUNT
|
||||
|
||||
return (
|
||||
<>
|
||||
{isFetching ?
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='pb-4 font-bold text-base'>Loans</p>
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
</div>
|
||||
: isError ?
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='pb-4 font-bold text-base'>Loans</p>
|
||||
<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'>
|
||||
<p className='pb-4 font-bold text-base'>Loans</p>
|
||||
<table className="table-auto 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 text-right">
|
||||
Loan Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Product/Tenor
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Repay/Install 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>
|
||||
{loans?.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?.account_id || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.id} : {item?.transaction_id}</div>
|
||||
<div className="font-normal text-gray-500">ORIGIN : {item?.original_transaction}</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?.initial_loan_amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.product_id)}</div>
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.tenor)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.repayment_amount)}</div>
|
||||
<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?.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>
|
||||
))
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
:
|
||||
null
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
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 getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function RepaymentScheduleDetails({transactionID}) {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.repayment_schedule, page],
|
||||
queryFn: () => getRepaymentSchedule({transaction_id: transactionID, page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const repaymentSchedule = data?.data?.repayment_schedules // LOAN CHARGES LIST
|
||||
// const pagination = data?.data?.pagination
|
||||
|
||||
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">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
ID
|
||||
</th>
|
||||
{/* <th scope="col" className="px-2">
|
||||
Loan
|
||||
</th> */}
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Repay Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Install Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Due Date
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Paid Date
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</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='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?.loan_id || ''}</div>
|
||||
{/* <div className="font-normal text-gray-500 line-clamp-1">{item?.description}</div> */}
|
||||
</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) : 'NULL'}</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={5}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import React, { useState } from 'react'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import Icons from '../Icons'
|
||||
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { getTransactions } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
|
||||
export default function TransactionDetails({transactionID}) {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.transactions, page],
|
||||
queryFn: () => getTransactions({transaction_id: transactionID, page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const transactions = data?.data?.transactions // TRANSACTIONS LIST
|
||||
// const pagination = data?.data?.pagination
|
||||
|
||||
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'>Transactions</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">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Request
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Account
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Activity
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(transactions && transactions.length > 0) ? transactions?.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={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" />
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.transaction_id}</div>
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.account_id}</div>
|
||||
<div className="font-normal text-gray-500">{item?.type}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">50%</div>
|
||||
<div className="relative h-[6px] w-full bg-white-body dark:bg-black-body rounded-full overflow-hidden">
|
||||
<div className={`absolute left-0 h-full w-1/2 bg-emerald-600`}></div>
|
||||
</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>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from 'react'
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TransactionDetails from './TransactionDetails'
|
||||
import LoanDetails from './LoanDetails'
|
||||
import LoanChargeDetails from './LoanChargeDetails'
|
||||
import RepaymentScheduleDetails from './RepaymentScheduleDetails'
|
||||
|
||||
export default function TransactionDetailsCom({id}) {
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Transaction Details' span={`[${id}]`} paths={['Dashboard', 'Transactions Details']} />
|
||||
<TransactionDetails transactionID={id} />
|
||||
<LoanDetails transactionID={id} />
|
||||
<RepaymentScheduleDetails transactionID={id} />
|
||||
<LoanChargeDetails transactionID={id} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
import React, { useState } from 'react'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {Link} from 'react-router-dom'
|
||||
|
||||
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 { getTransactions } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function TransactionsCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error, isPlaceholderData, isPending} = useQuery({
|
||||
queryKey: [...queryKeys.transactions, page],
|
||||
queryFn: () => getTransactions({page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const transactions = data?.data?.transactions // TRANSACTIONS LIST
|
||||
const pagination = data?.data?.pagination
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Transactions' paths={['Dashboard', 'Transactions']} />
|
||||
|
||||
<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={transactions} 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">
|
||||
Request
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Account
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Activity
|
||||
</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={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" />
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.transaction_id}</div>
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.account_id}</div>
|
||||
<div className="font-normal text-gray-500">{item?.type}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">50%</div>
|
||||
<div className="relative h-[6px] w-full bg-white-body dark:bg-black-body rounded-full overflow-hidden">
|
||||
<div className={`absolute left-0 h-full w-1/2 bg-emerald-600`}></div>
|
||||
</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'>
|
||||
<Link to={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}>
|
||||
<Icons name='eye' />
|
||||
</Link>
|
||||
</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>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
const formatNumber = (number = 0) => {
|
||||
// return new Intl.NumberFormat().format(number);
|
||||
return number.toFixed(2);
|
||||
// return number.toFixed(2);
|
||||
return number.toLocaleString('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
};
|
||||
|
||||
export default formatNumber
|
||||
@@ -0,0 +1,2 @@
|
||||
const localImgLoader = (location) => require(`../assets/${location}`);
|
||||
export default localImgLoader
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import ApplicationsLoanCom from '../components/applicationsloancom/ApplicationsLoanCom'
|
||||
|
||||
export default function ApplicationsLoanPage() {
|
||||
return (
|
||||
<ApplicationsLoanCom />
|
||||
)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import ApprovedLoanCom from '../components/approvedloancom/ApprovedLoanCom'
|
||||
|
||||
export default function ApprovedLoansPage() {
|
||||
return (
|
||||
<ApprovedLoanCom />
|
||||
)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import DisbursementsLoanCom from '../components/disbursementsloancom/DisbursementsLoanCom'
|
||||
|
||||
export default function DisbursementsLoanPage() {
|
||||
return (
|
||||
<DisbursementsLoanCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import ErrorCom from '../components/error/ErrorCom'
|
||||
|
||||
export default function ErrorPage() {
|
||||
return (
|
||||
<ErrorCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import LoanChargesCom from '../components/loan_charges/LoanChargesCom'
|
||||
|
||||
export default function LoanChargesPage() {
|
||||
return (
|
||||
<LoanChargesCom />
|
||||
)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import LoanOffersCom from '../components/loanofferscom/LoanOffersCom'
|
||||
|
||||
export default function LoanOffersPage() {
|
||||
return (
|
||||
<LoanOffersCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import OffersCom from '../components/offers/OffersCom'
|
||||
|
||||
export default function OffersPage() {
|
||||
return (
|
||||
<OffersCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import RepaymentsCom from '../components/repayments/RepaymentsCom'
|
||||
|
||||
export default function RepaymentsPage() {
|
||||
return (
|
||||
<RepaymentsCom />
|
||||
)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import RequestCom from '../components/request/RequestCom'
|
||||
|
||||
export default function RequestPage() {
|
||||
return (
|
||||
<RequestCom/>
|
||||
)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import SelectedLoanCom from '../components/selectedloancom/SelectedLoanCom'
|
||||
|
||||
export default function SelectedLoanPage() {
|
||||
return (
|
||||
<SelectedLoanCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import React, { useEffect } from 'react'
|
||||
import {useLocation, useNavigate} from 'react-router-dom'
|
||||
import TransactionDetailsCom from '../components/transactionDetails/TransactionDetailsCom'
|
||||
|
||||
|
||||
export default function TransactionDetailsPage() {
|
||||
const {state} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(()=>{
|
||||
if(!state?.transactionID){
|
||||
navigate('/', {replace: true})
|
||||
}
|
||||
},[])
|
||||
return (
|
||||
<TransactionDetailsCom id={state?.transactionID} />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import TransactionsCom from '../components/transactions/TransactionsCom'
|
||||
|
||||
export default function TransactionsPage() {
|
||||
return (
|
||||
<TransactionsCom />
|
||||
)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import React from 'react'
|
||||
import BreadcrumbCom from '../components/breadcrumb/BreadcrumbCom'
|
||||
|
||||
export default function UsersPage() {
|
||||
return (
|
||||
<div className='w-full'>
|
||||
<BreadcrumbCom title='Users' paths={['Dashboard', 'Users']} />
|
||||
<p className=''>
|
||||
coming soon ...
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
const queryKeys = {
|
||||
dashboard: ['dashboard'],
|
||||
loans: ['loans'],
|
||||
transactions: ['transactions'],
|
||||
repayment_schedule: ['repayment-schedule'],
|
||||
loan_charges: ['loan-charges'],
|
||||
offers: ['offers'],
|
||||
apply_loan: ['apply'],
|
||||
select_loan: ['select-loan'],
|
||||
approved_loan: ['approved-loan'],
|
||||
|
||||
@@ -8,7 +8,7 @@ axios.interceptors.request.use(
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
// "Access-Control-Expose-Headers": "Access-Control-Allow-Origin",
|
||||
// "Access-Control-Allow-Headers": "Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token",
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
// "Content-Type": "application/json;charset=UTF-8",
|
||||
'Authorization': (localStorage && localStorage.getItem('token')) ? `Bearer ${localStorage.getItem('token')}` : ''
|
||||
};
|
||||
// config.headers['Authorization'] = `Bearer ${localStorage.getItem('token')}`;
|
||||
@@ -56,26 +56,38 @@ export const getDashData = (reqData) => {
|
||||
return getAuxEnd(`/dashboard`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const applyLoan = (reqData) => {
|
||||
// FUNCTION TO GET LOANS TABLE
|
||||
export const getLoans = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/loan/apply`, postData)
|
||||
return getAuxEnd(`/loans`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const loanOffers = (reqData) => {
|
||||
// FUNCTION TO GET TRANSACTIONS TABLE
|
||||
export const getTransactions = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/offers`, postData)
|
||||
return getAuxEnd(`/transactions`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const selectLoan = (reqData) => {
|
||||
// FUNCTION TO GET REPAYMENTS TABLE
|
||||
export const getRepayments = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/loan/select`, postData)
|
||||
return getAuxEnd(`/repayments`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const approvedLoan = (reqData) => {
|
||||
// FUNCTION TO GET LOAN CHARGES TABLE
|
||||
export const getLoanCharges = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/loan/approved`, postData)
|
||||
return getAuxEnd(`/loan-charges`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET OFFERS LIST TABLE
|
||||
export const getOffers = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/offers`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET REPAYMENT SCHEDULE TABLE
|
||||
export const getRepaymentSchedule = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/repayment-schedules`, postData)
|
||||
}
|
||||
Reference in New Issue
Block a user