Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9edc036eb | |||
| 3c8a738454 | |||
| 3a0c27a60a | |||
| a2c6a1fd20 | |||
| 2b22d7132a | |||
| 53092d1ad7 | |||
| 27e4b1601c | |||
| dfc2165432 | |||
| 2852d5654e | |||
| d5cd2a6360 | |||
| 2abcfa6671 | |||
| 74cf8a522a | |||
| 645d752702 | |||
| 0df1e401c9 | |||
| 7d207813d2 | |||
| 82551d2c27 | |||
| cf409cbac2 | |||
| fcc60a6e46 | |||
| eee60e0462 | |||
| 62ff68d254 | |||
| 2a5d6b5b39 | |||
| b3a73942bc | |||
| c66662653e | |||
| 164cd4b59e | |||
| 7cb5e06fbc | |||
| e15bc9db4b | |||
| 1423057bdf | |||
| 9e4c8271d1 | |||
| 6f8615ebc5 | |||
| dc4b8b67c0 | |||
| 6f9393606f | |||
| 7bc0e90fe7 | |||
| db3afdda2f | |||
| 3c0f8938fc | |||
| ee1e6586c3 | |||
| 26401f8664 | |||
| eb9ec59eb2 | |||
| 397146d4c6 | |||
| 3a5f3662aa | |||
| 59c1ce6ae7 | |||
| d0847b4096 | |||
| 0109809b42 | |||
| 83cf0a9770 | |||
| 945e756276 | |||
| 457d48cd3b | |||
| aed12d4ce9 | |||
| c2bda67ab1 | |||
| cea0ebfe82 |
@@ -7,6 +7,7 @@ INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API='https://backoffice-apidev.simbrellang.net'
|
||||
REACT_APP_EVENT_API='https://event-core.simbrellang.net'
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
@@ -14,4 +15,7 @@ VITE_EMAIL_ENDPOINT='fcmbloan@support.com'
|
||||
|
||||
#BANK NAME
|
||||
VITE_BANK_NAME='First City Monument Bank'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
|
||||
# Inactivity timeout/logout AT 10MINS
|
||||
REACT_APP_TIMEOUT=600000
|
||||
@@ -7,6 +7,7 @@ VITE_INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API='https://backoffice-apidev.simbrellang.net'
|
||||
REACT_APP_EVENT_API='https://event-core.simbrellang.net'
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
@@ -14,4 +15,7 @@ VITE_EMAIL_ENDPOINT='fcmbloan@support.com'
|
||||
|
||||
#BANK NAME
|
||||
VITE_BANK_NAME='First City Monument Bank'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
|
||||
# Inactivity timeout/logout AT 10MINS
|
||||
REACT_APP_TIMEOUT=600000
|
||||
@@ -7,6 +7,7 @@ INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API='https://backoffice-apidev.simbrellang.net'
|
||||
REACT_APP_EVENT_API='https://event-core.simbrellang.net'
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
@@ -14,4 +15,7 @@ VITE_EMAIL_ENDPOINT='fcmbloan@support.com'
|
||||
|
||||
#BANK NAME
|
||||
VITE_BANK_NAME='First City Monument Bank'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
|
||||
# Inactivity timeout/logout AT 10MINS
|
||||
REACT_APP_TIMEOUT=600000
|
||||
@@ -24,9 +24,9 @@ services:
|
||||
volumes:
|
||||
src:
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.15.56.0/24
|
||||
#networks:
|
||||
# default:
|
||||
# driver: bridge
|
||||
# ipam:
|
||||
# config:
|
||||
# - subnet: 172.15.56.0/24
|
||||
|
||||
@@ -8,6 +8,18 @@ import { generalLayoutContext } from './context/GeneralLayoutContext';
|
||||
|
||||
import './App.css';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 3,
|
||||
staleTime: 300000 //5 mins
|
||||
// refetchOnMount: false,
|
||||
// staleTime: Infinity // can also be a number in millisecond
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
function App() {
|
||||
|
||||
const {pathname} = useLocation()
|
||||
@@ -18,17 +30,6 @@ function App() {
|
||||
window.scrollTo(0,0)
|
||||
},[pathname])
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 3,
|
||||
staleTime: 300000 //5 mins
|
||||
// refetchOnMount: false,
|
||||
// staleTime: Infinity // can also be a number in millisecond
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
}
|
||||
/>
|
||||
|
||||
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
@@ -6,15 +6,56 @@ import DashboardLayout from "../components/layouts/DashboardLayout"
|
||||
import PageLoader from "../components/PageLoader"
|
||||
import { updateUserDetails } from "../store/UserDetails"
|
||||
import RouteLinks from "../RouteLinks"
|
||||
import debounceFunction from '../helpers/debounceFunction'
|
||||
|
||||
|
||||
export default function UserExist() {
|
||||
const dispatch = useDispatch()
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [lastActivityTime, setLastActivityTime] = useState(Date.now()); // HOLDS THE INITIAL TIME USER LOGS IN
|
||||
|
||||
const [pageIsLoading, setPageIsLoading] = useState(true)
|
||||
|
||||
const {userDetails} = useSelector((state) => state.userDetails)
|
||||
|
||||
|
||||
// Function to log the user out
|
||||
const logoutUser = () => {
|
||||
localStorage.clear()
|
||||
navigate(RouteLinks.login, {replace:true})
|
||||
window.location.reload()
|
||||
};
|
||||
|
||||
// Function to reset the activity time
|
||||
const resetTimer = () => {
|
||||
debounceFunction(setLastActivityTime(Date.now()), 1000)
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
const timer = setTimeout(()=>{
|
||||
if(Date.now() - Number(lastActivityTime) >= Number(process.env.REACT_APP_TIMEOUT)){
|
||||
logoutUser()
|
||||
}
|
||||
}, Number(process.env.REACT_APP_TIMEOUT))
|
||||
|
||||
// Listen for activity events
|
||||
const events = ['mousemove', 'keydown', 'click', 'scroll', 'touchstart'];
|
||||
|
||||
// Adding event listeners
|
||||
events.forEach(event => {
|
||||
window.addEventListener(event, resetTimer);
|
||||
});
|
||||
|
||||
return () => {
|
||||
clearTimeout(timer)
|
||||
events.forEach(event => {
|
||||
window.removeEventListener(event, resetTimer);
|
||||
})
|
||||
}
|
||||
},[lastActivityTime])
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
const loadUser = (token) =>{
|
||||
const userExist = [{name:'dummy'}]
|
||||
|
||||
@@ -11,7 +11,7 @@ import { LuPanelRight } from "react-icons/lu";
|
||||
import { FcGoogle } from "react-icons/fc";
|
||||
import { IoLogoApple } from "react-icons/io5";
|
||||
import { FcSalesPerformance } from "react-icons/fc";
|
||||
import { FaLongArrowAltRight } from "react-icons/fa";
|
||||
import { FaLongArrowAltRight, FaFilter } from "react-icons/fa";
|
||||
|
||||
export default function Icons({name, className}) {
|
||||
return (
|
||||
@@ -50,6 +50,8 @@ export default function Icons({name, className}) {
|
||||
<FcSalesPerformance className={`text-base ${className}`} />
|
||||
:name.toLowerCase() == 'arrow-right' ?
|
||||
<FaLongArrowAltRight className={`text-base ${className}`} />
|
||||
:name.toLowerCase() == 'filter' ?
|
||||
<FaFilter className={`text-base ${className}`} />
|
||||
:
|
||||
null
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { loginUser } from '../../services/siteServices'
|
||||
|
||||
import RouteLinks from '../../RouteLinks'
|
||||
import Icons from '../Icons'
|
||||
import localImgLoader from '../../helpers/localImageLoader'
|
||||
|
||||
|
||||
const initialValues = {
|
||||
@@ -83,13 +84,17 @@ export default function LoginCom() {
|
||||
{(props)=>(
|
||||
<Form>
|
||||
<div className='flex flex-col gap-8 w-full bg-white rounded-xl p-16 sm:px-20 sm:py-16 shadow'>
|
||||
<div className='flex justify-center w-full mb-10'>
|
||||
<img className='w-auto h-8 xs:h-16' src={localImgLoader('simbrella-bko-logo.png')} />
|
||||
</div>
|
||||
|
||||
<div className='w-full flex flex-col gap-1 items-center'>
|
||||
<h1 className='text-2xl md:text-3xl font-bold text-black-body'>Sign In</h1>
|
||||
<p className='text-sm font-medium text-slate-500'>Welcome back, please login to your account</p>
|
||||
</div>
|
||||
|
||||
{/* social login */}
|
||||
<div className='grid grid-cols-2 gap-4 text-sm'>
|
||||
{/* <div className='grid grid-cols-2 gap-4 text-sm'>
|
||||
<div className='px-4 py-2 flex gap-2 items-center justify-center text-black-body font-medium border border-slate-300/50 rounded-md hover:text-primary hover:bg-sky-50 cursor-pointer'>
|
||||
<Icons name='google' />
|
||||
<span>Sign in with Google</span>
|
||||
@@ -102,7 +107,7 @@ export default function LoginCom() {
|
||||
|
||||
<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> */}
|
||||
|
||||
<div className='flex flex-col gap-6'>
|
||||
<div className='relative text-input flex flex-col gap-2'>
|
||||
@@ -146,11 +151,11 @@ export default function LoginCom() {
|
||||
|
||||
{/* <p className='text-sm text-center font-medium text-slate-500'>Not yet a member? <span className='text-primary'>Sign Up</span></p> */}
|
||||
|
||||
<div className='flex justify-end gap-4 mt-6 text-[13px] font-medium'>
|
||||
{/* <div className='flex justify-end gap-4 mt-6 text-[13px] font-medium'>
|
||||
<Link className='text-primary' to=''>Terms</Link>
|
||||
<Link className='text-primary' to=''>Plans</Link>
|
||||
<Link className='text-primary' to=''>Contact Us</Link>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,6 @@ export default function BreadcrumbCom({title, span, paths}) {
|
||||
const [stickNav, setStickNav] = useState(false)
|
||||
|
||||
useEffect(()=>{
|
||||
console.log('tru')
|
||||
|
||||
// var rect = navRef?.current?.getBoundingClientRect()?.bottom;
|
||||
var rect = 10;
|
||||
window.addEventListener('scroll', ()=>{
|
||||
@@ -30,7 +28,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,92 +1,105 @@
|
||||
import React from 'react'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
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 formatNumber from '../../helpers/formatNumber'
|
||||
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { getDashData } from '../../services/siteServices'
|
||||
import {getDashData} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
import localSiteIcons from "../../helpers/localSiteIcons";
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function HomeCom() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.dashboard,
|
||||
queryFn: () => getDashData(),
|
||||
})
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.dashboard,
|
||||
queryFn: () => getDashData(),
|
||||
})
|
||||
|
||||
const dashData = data?.data // DASHBOARD DATA
|
||||
const dashData = data?.data // DASHBOARD DATA
|
||||
|
||||
// console.log('dashData', dashData)
|
||||
// loans, payments, recent_transactions [], request_summary
|
||||
// console.log('dashData', dashData)
|
||||
// loans, payments, recent_transactions [], request_summary
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Dashboard' paths={['Home', 'Dashboard']} />
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Dashboard' paths={['Home', 'Dashboard']}/>
|
||||
|
||||
{(isFetching || isError) ?
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isError ? <p className='text-red-500'>{error.message}</p> : <p className='text-slate-800'>Loading...</p>}
|
||||
</div>
|
||||
:
|
||||
<div className='grid grid-cols-1 gap-8'>
|
||||
<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>
|
||||
<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-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>
|
||||
<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>
|
||||
<div className='box min-h-[230] justify-between bg-[#CBD4F4] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='mb-4 text-base sm:text-lg font-bold hover:text-primary'>Request Summary</p>
|
||||
<div className='grid grid-cols-2 gap-4 font-bold'>
|
||||
{
|
||||
Object.values(dashData?.request_summary).map((item, index) => {
|
||||
return (
|
||||
<div key={index} className='flex items-center gap-2'>
|
||||
<div className='min-w-10 min-h-10 bg-white-body dark:bg-black-box dark:shadow-[0_0_0_1px_#f9f9f9] rounded-md flex justify-center items-center'>
|
||||
<Icons name='sales' />
|
||||
{(isFetching || isError) ?
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isError ? <p className='text-red-500'>{error.message}</p> :
|
||||
<p className='text-slate-800'>Loading...</p>}
|
||||
</div>
|
||||
:
|
||||
<div className='grid grid-cols-1 gap-8'>
|
||||
<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>
|
||||
<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={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>
|
||||
<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>
|
||||
<div
|
||||
className='box min-h-[230] justify-between bg-[#CBD4F4] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='mb-4 text-base sm:text-lg font-bold hover:text-primary'>Request Summary</p>
|
||||
<div className='grid grid-cols-2 gap-4 font-bold'>
|
||||
{
|
||||
Object.values(dashData?.request_summary).map((item, index) => {
|
||||
return (
|
||||
<div key={index} className='flex items-center gap-2'>
|
||||
<div
|
||||
className='min-w-10 min-h-10 bg-white-body dark:bg-black-box dark:shadow-[0_0_0_1px_#f9f9f9] rounded-md flex justify-center items-center'>
|
||||
<Icons name='sales'/>
|
||||
</div>
|
||||
<div>
|
||||
<p className='font-bold text-base'><CustomCounter
|
||||
targetNumber={Object.values(item)[0]} timeInSeconds='1'/></p>
|
||||
<p className='text-12 text-slate-500'>{Object.keys(item)[0]}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p className='font-bold text-base'>$<CustomCounter targetNumber={formatNumber(Object.values(item)[0])} timeInSeconds='1' />K</p>
|
||||
<p className='text-12 text-slate-500'>{Object.keys(item)[0]}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='w-full'>
|
||||
<div className='box gap-8 bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<div className='grid grid-cols-1 xs:grid-cols-2 gap-4'>
|
||||
<div className='flex flex-col gap-1 order-2 xs:order-1'>
|
||||
<p className='font-bold text-base'>Recent Request</p>
|
||||
{/* <p className='text-12'>Over 500 members</p> */}
|
||||
</div>
|
||||
{/* <div className='order-1 xs:order-2 text-left xs:text-right'>
|
||||
<div className='w-full'>
|
||||
<div className='box gap-8 bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<div className='grid grid-cols-1 xs:grid-cols-2 gap-4'>
|
||||
<div className='flex flex-col gap-1 order-2 xs:order-1'>
|
||||
<p className='font-bold text-base'>Recent Request</p>
|
||||
{/* <p className='text-12'>Over 500 members</p> */}
|
||||
</div>
|
||||
{/* <div className='order-1 xs:order-2 text-left xs:text-right'>
|
||||
<button className='font-bold bg-white-aside text-black-body text-12 px-4 py-2 hover:text-primary hover:bg-sky-50 dark:hover:text-white dark:hover:bg-primary dark:text-white-body dark:bg-black-body rounded-md'>+ New Member</button>
|
||||
</div> */}
|
||||
</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">
|
||||
<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
|
||||
@@ -95,72 +108,94 @@ export default function HomeCom() {
|
||||
Account
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Activity
|
||||
Channel
|
||||
</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>
|
||||
</>
|
||||
)}
|
||||
</TableWrapper>
|
||||
</div>
|
||||
</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={localSiteIcons(`loan_icons/${item?.type}`)}
|
||||
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)} {getTimeFromDateString(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="text-base font-semibold">{item?.channel}</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>
|
||||
}
|
||||
<>
|
||||
{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>
|
||||
}
|
||||
</>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -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">
|
||||
@@ -60,6 +57,8 @@ export default function DashboardHeader() {
|
||||
<div onClick={()=>handleActiveMenu('avatar')} className='relative cursor-pointer w-10 h-10 rounded shadow-round_black dark:shadow-round_white'>
|
||||
<img src={UserAvatar} alt='user avatar' className='w-full h-full p-1 rounded-full' />
|
||||
{activeMenu == 'avatar' &&
|
||||
<>
|
||||
<div className="fixed top-0 left-0 right-0 bottom-0 bg-black/10"></div>
|
||||
<div className="pop-modal z-[777] absolute p-4 w-52 sm:w-96 bg-white dark:bg-black-box right-0 top-16 rounded shadow-round_black dark:shadow-round_white">
|
||||
<div className="w-full h-full flex flex-col gap-4">
|
||||
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
||||
@@ -77,6 +76,7 @@ export default function DashboardHeader() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { generalLayoutContext } from "../../../context/GeneralLayoutContext";
|
||||
import { TbLogout2 } from "react-icons/tb";
|
||||
import UserAvatar from '../../../assets/user_avatar.jpg'
|
||||
import Icons from "../../Icons";
|
||||
import localImgLoader from '../../../helpers/localImageLoader';
|
||||
|
||||
export default function DashboardAside() {
|
||||
|
||||
@@ -22,7 +23,8 @@ export default function DashboardAside() {
|
||||
return (
|
||||
<div className='w-full h-full flex flex-col'>
|
||||
<div className="mb-3 w-full h-24 logo flex items-center">
|
||||
<DummyLogo />
|
||||
{/* <DummyLogo /> */}
|
||||
<img className='w-2/3 h-auto' src={localImgLoader('simbrella-bko-logo.png')} />
|
||||
</div>
|
||||
{/* <hr className="border-slate-400" /> */}
|
||||
|
||||
@@ -138,15 +140,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 },
|
||||
]
|
||||
},
|
||||
],
|
||||
|
||||
@@ -2,77 +2,25 @@ import React from 'react'
|
||||
import Img from '../../../assets/user_avatar.jpg'
|
||||
import CustomCounter from '../../CustomCounter'
|
||||
|
||||
export default function Orders() {
|
||||
export default function Orders({data}) {
|
||||
return (
|
||||
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Support Ticket</p>
|
||||
<div className='grid grid-cols-2 gap-4 sm:gap-6 large:gap-8'>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={18} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Pending</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={5} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Approved</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={1} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Rejected</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={1} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Created</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Best Ticket</p>
|
||||
<p className='text-base text-white-body font-bold'>Recent Loans</p>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order Image" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order Image" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order Image" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order Image" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
{data.map((item, index)=>{
|
||||
return (
|
||||
<div key={index} className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order Image" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import React, { useState } from 'react'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import queryKeys from '../../../services/queryKeys'
|
||||
import { getRecentLoans } from '../../../services/siteServices'
|
||||
import Icons from '../../Icons'
|
||||
import Orders from './Orders'
|
||||
import Tickets from './Tickets'
|
||||
@@ -13,25 +16,41 @@ export default function RightAsideBar() {
|
||||
setActive(lowerStr)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='w-full h-full flex flex-col gap-8'>
|
||||
{/* Menu */}
|
||||
<div className='grid grid-cols-3 gap-8'>
|
||||
<button name='orders' onClick={() => handleActiveMenu('orders')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active == 'orders' && 'scale-[1.2]'}`}>
|
||||
<Icons name='dashboard' className='text-3xl' />
|
||||
</button>
|
||||
<button name='tickets' onClick={() => handleActiveMenu('tickets')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active == 'tickets' && 'scale-[1.2]'}`}>
|
||||
<Icons name='settings' className='text-3xl' />
|
||||
</button>
|
||||
<button name='tasks' onClick={() => handleActiveMenu('tasks')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active == 'tasks' && 'scale-[1.2]'}`}>
|
||||
<Icons name='dashboard' className='text-3xl' />
|
||||
</button>
|
||||
</div>
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.recent_loans,
|
||||
queryFn: () => getRecentLoans()
|
||||
})
|
||||
|
||||
{/* Body */}
|
||||
{active == 'orders' && <Orders />}
|
||||
{active == 'tickets' && <Tickets />}
|
||||
{active == 'tasks' && <Tasks />}
|
||||
</div>
|
||||
)
|
||||
console.log('data', data?.data)
|
||||
|
||||
return (
|
||||
<div className='w-full h-full flex flex-col gap-8'>
|
||||
{/* Menu */}
|
||||
<div className='grid grid-cols-3 gap-8'>
|
||||
<button name='orders' onClick={() => handleActiveMenu('orders')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active == 'orders' && 'scale-[1.2]'}`}>
|
||||
<Icons name='dashboard' className='text-3xl' />
|
||||
</button>
|
||||
{/*<button name='tickets' onClick={() => handleActiveMenu('tickets')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active == 'tickets' && 'scale-[1.2]'}`}>*/}
|
||||
{/* <Icons name='settings' className='text-3xl' />*/}
|
||||
{/*</button>*/}
|
||||
{/*<button name='tasks' onClick={() => handleActiveMenu('tasks')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active == 'tasks' && 'scale-[1.2]'}`}>*/}
|
||||
{/* <Icons name='dashboard' className='text-3xl' />*/}
|
||||
{/*</button>*/}
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
{(isFetching || isError) ?
|
||||
<div className=''>
|
||||
{isError ? <p className='p-8 bg-white text-red-500'>{error.message}</p> :
|
||||
<p className='text-white'>Loading...</p>}
|
||||
</div>
|
||||
:
|
||||
<div className='w-full'>
|
||||
{active === 'orders' && <Orders data={[1,2,3,4,5]} />}
|
||||
{/*{active == 'tickets' && <Tickets />}*/}
|
||||
{/*{active == 'tasks' && <Tasks />}*/}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export default function Tickets() {
|
||||
return (
|
||||
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Support Ticket</p>
|
||||
<p className='text-base text-white-body font-bold'>Recent Repayment</p>
|
||||
<div className='grid grid-cols-2 gap-4 sm:gap-6 large:gap-8'>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
@@ -35,7 +35,7 @@ export default function Tickets() {
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Best Ticket</p>
|
||||
<p className='text-base text-white-body font-bold'>Tracked Errors</p>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import {getLoanCharges} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
import Avatar from '../../assets/repay.png'
|
||||
|
||||
|
||||
export default function LoansChargesCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [allLoanCharges, setAllLoanCharges] = useState({loading: true, error: '', data: {}})
|
||||
|
||||
const [willFilter, setWillFilter] = useState(false)
|
||||
const [filter, setFilter] = useState({type: '', id: ''})
|
||||
const handleFilter = ({target: {name, value}}) => {
|
||||
setFilter(prev => ({...prev, [name]: value}))
|
||||
}
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
if (filter.type && !filter.id) {
|
||||
return
|
||||
} else if (!filter.type) {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
setFilter({type: '', id: ''})
|
||||
} else {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
}
|
||||
}
|
||||
|
||||
const loanCharges = allLoanCharges?.data?.loan_charges // LOAN CHARGES LIST
|
||||
const pagination = allLoanCharges?.data?.pagination
|
||||
const isFetching = allLoanCharges?.loading
|
||||
const isError = allLoanCharges?.error
|
||||
|
||||
useEffect(() => {
|
||||
setAllLoanCharges(prev => ({...prev, loading: true}))
|
||||
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
getLoanCharges({...payload, page}).then(res => {
|
||||
if (res?.status != 200) {
|
||||
setAllLoanCharges(prev => ({...prev, loading: false}))
|
||||
return
|
||||
}
|
||||
setAllLoanCharges({loading: false, error: '', data: res?.data})
|
||||
}).catch(err => {
|
||||
setAllLoanCharges({loading: false, error: 'error occurred', data: {}})
|
||||
console.log('ERR', err)
|
||||
})
|
||||
}, [page, willFilter])
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Charges' paths={['Dashboard', 'Charges']}/>
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isError ?
|
||||
<p className='text-red-500'>{allLoanCharges?.error}</p>
|
||||
:
|
||||
<>
|
||||
{/* filter section */}
|
||||
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
||||
<Icons name='filter' className='text-3xl'/>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||
onChange={handleFilter}>
|
||||
<option value=''>All</option>
|
||||
<option value='transaction_id'>Transaction ID</option>
|
||||
<option value='account_id'>Account ID</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<input name='id' value={filter?.id} disabled={!filter.type}
|
||||
className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`}
|
||||
onChange={handleFilter}/>
|
||||
</div>
|
||||
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id}
|
||||
className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit
|
||||
</button>
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage}
|
||||
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({data}) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
TransactionID/Fee Type
|
||||
</th>
|
||||
{/* <th scope="col" className="px-2">
|
||||
Loan
|
||||
</th> */}
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Added
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2 py-2">
|
||||
<div
|
||||
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
|
||||
<img className="w-10 h-10 rounded-md" src={Avatar}
|
||||
alt="Jese image"/>
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||
<div
|
||||
className="font-normal text-gray-500 line-clamp-1">{item?.code}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||
<div
|
||||
className="font-semibold text-green-500">#{formatNumber(item?.amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div
|
||||
className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<div
|
||||
className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
|
||||
<Icons name='eye'/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={4}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TablePaginatedWrapper>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import React, {useState} from 'react'
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
|
||||
import Avatar from '../../assets/user_avatar.jpg'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import {getLoanCharges} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function LoanChargesCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.loan_charges, page],
|
||||
queryFn: () => getLoanCharges({page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const loanCharges = data?.data?.loan_charges // LOAN CHARGES LIST
|
||||
const pagination = data?.data?.pagination
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8' style={{backgroundColor: 'aliceblue'}}>
|
||||
<BreadcrumbCom title='Loan Charges' paths={['Dashboard', 'Loan Charges']}/>
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isFetching ?
|
||||
<>
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
</>
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage}
|
||||
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({data}) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Name
|
||||
</th>
|
||||
{/* <th scope="col" className="px-2">
|
||||
Loan
|
||||
</th> */}
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Added
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2 py-2">
|
||||
<div
|
||||
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||
<div
|
||||
className="font-normal text-gray-500 line-clamp-1">{item?.code}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||
<div
|
||||
className="font-normal text-gray-500">{formatNumber(item?.amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div
|
||||
className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<div
|
||||
className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
|
||||
<Icons name='eye'/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={4}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TablePaginatedWrapper>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,112 +1,190 @@
|
||||
import React from 'react'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {useEffect, useState} from 'react'
|
||||
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 { getLoans } from '../../services/siteServices'
|
||||
import {getLoans} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import Avatar from '../../assets/loans.png'
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
|
||||
export default function LoansCom() {
|
||||
|
||||
const {data:allLoans, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.loans,
|
||||
queryFn: () => getLoans()
|
||||
})
|
||||
const [page, setPage] = useState(1)
|
||||
const [allLoans, setAllLoans] = useState({loading: true, error: '', data: {}})
|
||||
|
||||
const [willFilter, setWillFilter] = useState(false)
|
||||
const [filter, setFilter] = useState({type: '', id: ''})
|
||||
const handleFilter = ({target: {name, value}}) => {
|
||||
setFilter(prev => ({...prev, [name]: value}))
|
||||
}
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
if (filter.type && !filter.id) {
|
||||
return
|
||||
} else if (!filter.type) {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
setFilter({type: '', id: ''})
|
||||
} else {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
}
|
||||
}
|
||||
|
||||
const loans = allLoans?.data?.loans // LOANS LIST
|
||||
const loansCount = allLoans?.data?.count // LOANS LIST COUNT
|
||||
// console.log('LOANS', loans)
|
||||
const pagination = allLoans?.data?.pagination
|
||||
const isFetching = allLoans?.loading
|
||||
const isError = allLoans?.error
|
||||
|
||||
useEffect(() => {
|
||||
setAllLoans(prev => ({...prev, loading: true}))
|
||||
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
getLoans({...payload, page}).then(res => {
|
||||
if (res?.status != 200) {
|
||||
setAllLoans(prev => ({...prev, loading: false}))
|
||||
return
|
||||
}
|
||||
setAllLoans({loading: false, error: '', data: res?.data})
|
||||
}).catch(err => {
|
||||
setAllLoans({loading: false, error: 'error occurred', data: {}})
|
||||
console.log('ERR', err)
|
||||
})
|
||||
}, [page, willFilter])
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Loans' paths={['Dashboard', 'Loans']} />
|
||||
<BreadcrumbCom title='Loans' paths={['Dashboard', 'Loans']}/>
|
||||
|
||||
<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>
|
||||
:
|
||||
<TableWrapper data={loans} itemsPerPage={15}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<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">
|
||||
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?.account_id || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.customer_id}</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">{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>
|
||||
</td>
|
||||
{isError ?
|
||||
<p className='text-red-500'>{allLoans?.error}</p>
|
||||
:
|
||||
<>
|
||||
{/* filter section */}
|
||||
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
||||
<Icons name='filter' className='text-3xl'/>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||
onChange={handleFilter}>
|
||||
<option value=''>All</option>
|
||||
<option value='transaction_id'>Transaction ID</option>
|
||||
<option value='account_id'>Account ID</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<input name='id' value={filter?.id} disabled={!filter.type}
|
||||
className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`}
|
||||
onChange={handleFilter}/>
|
||||
</div>
|
||||
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id}
|
||||
className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit
|
||||
</button>
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={loans} isFetching={isFetching} setPage={setPage}
|
||||
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({data}) => (
|
||||
<>
|
||||
<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>
|
||||
))
|
||||
:
|
||||
<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>
|
||||
</>
|
||||
)}
|
||||
</TableWrapper>
|
||||
</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?.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-right">
|
||||
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||
<div
|
||||
className="font-semibold text-green-500">#{formatNumber(item?.initial_loan_amount)}</div>
|
||||
</div>
|
||||
</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-red-500">{item?.tenor} days
|
||||
</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'>
|
||||
<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={6}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TablePaginatedWrapper>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
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 { getLoans } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function LoansCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data:allLoans, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.loans, page],
|
||||
queryFn: () => getLoans({page}),
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
const loans = allLoans?.data?.loans // LOANS LIST
|
||||
const pagination = allLoans?.data?.pagination
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Loans' paths={['Dashboard', 'Loans']} />
|
||||
|
||||
<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={loans} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<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>
|
||||
{(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?.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-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">{item?.tenor} days</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'>
|
||||
<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={6}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TablePaginatedWrapper>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
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-1 py-1">
|
||||
ID
|
||||
</th>
|
||||
<th scope="col" className="px-1 py-1">
|
||||
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-1 text-right">
|
||||
Mgt. Rate
|
||||
</th>
|
||||
<th scope="col" className="px-1 text-right">
|
||||
Vat. 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">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{item?.id || ''}</div>
|
||||
</div>
|
||||
</td>
|
||||
<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-1">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.management_rate)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-1">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.vat_rate)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.max_amount)}</div>
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.min_amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{item?.tenor}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<div className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
|
||||
<Icons name='eye' />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</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,165 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import {getRepayments} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import Avatar from '../../assets/loans2.png';
|
||||
|
||||
|
||||
export default function RepaymentsCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [allRepayments, setAllRepayments] = useState({loading: true, error: '', data: {}})
|
||||
|
||||
const [willFilter, setWillFilter] = useState(false)
|
||||
const [filter, setFilter] = useState({type: '', id: ''})
|
||||
const handleFilter = ({target: {name, value}}) => {
|
||||
setFilter(prev => ({...prev, [name]: value}))
|
||||
}
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
if (filter.type && !filter.id) {
|
||||
return
|
||||
} else if (!filter.type) {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
setFilter({type: '', id: ''})
|
||||
} else {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
}
|
||||
}
|
||||
|
||||
const repayments = allRepayments?.data?.repayments // LOAN REPAYMENTS LIST
|
||||
const pagination = allRepayments?.data?.pagination
|
||||
const isFetching = allRepayments?.loading
|
||||
const isError = allRepayments?.error
|
||||
|
||||
useEffect(() => {
|
||||
setAllRepayments(prev => ({...prev, loading: true}))
|
||||
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
getRepayments({...payload, page}).then(res => {
|
||||
if (res?.status != 200) {
|
||||
setAllRepayments(prev => ({...prev, loading: false}))
|
||||
return
|
||||
}
|
||||
setAllRepayments({loading: false, error: '', data: res?.data})
|
||||
}).catch(err => {
|
||||
setAllRepayments({loading: false, error: 'error occurred', data: {}})
|
||||
console.log('ERR', err)
|
||||
})
|
||||
}, [page, willFilter])
|
||||
|
||||
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'>
|
||||
{isError ?
|
||||
<p className='text-red-500'>{allRepayments?.error}</p>
|
||||
:
|
||||
<>
|
||||
{/* filter section */}
|
||||
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
||||
<Icons name='filter' className='text-3xl'/>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||
onChange={handleFilter}>
|
||||
<option value=''>All</option>
|
||||
<option value='transaction_id'>Transaction ID</option>
|
||||
<option value='account_id'>Account ID</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<input name='id' value={filter?.id} disabled={!filter.type}
|
||||
className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`}
|
||||
onChange={handleFilter}/>
|
||||
</div>
|
||||
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id}
|
||||
className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit
|
||||
</button>
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={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">
|
||||
CustomerID / ID:TrxID
|
||||
</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-blue-500">{item?.loan_id} :<b> {item?.transaction_id}</b>
|
||||
</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>
|
||||
)
|
||||
}
|
||||
@@ -1,29 +1,32 @@
|
||||
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 { getRepayments } from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
|
||||
export default function RequestCom() {
|
||||
export default function RepaymentsCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.select_loan,
|
||||
queryFn: () => selectLoan()
|
||||
queryKey: [...queryKeys.transactions, page],
|
||||
queryFn: () => getRepayments({page}),
|
||||
staleTime: 0,
|
||||
// placeholderData: keepPreviousData,
|
||||
})
|
||||
|
||||
const selectUsers = data?.data?.result_data?.data // APPLY LOAN LIST
|
||||
const repayments = data?.data?.repayments // REPAYMENTS LIST
|
||||
const pagination = data?.data?.pagination
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Request' paths={['Dashboard', 'Request']} />
|
||||
<BreadcrumbCom title='Repayments' paths={['Dashboard', 'Repayments']} />
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isFetching ?
|
||||
@@ -33,7 +36,7 @@ export default function RequestCom() {
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<TableWrapper data={selectUsers} itemsPerPage={15}>
|
||||
<TablePaginatedWrapper data={repayments} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||
{({ data }) => (
|
||||
<>
|
||||
<table className="py-2 w-full text-sm">
|
||||
@@ -42,9 +45,9 @@ 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> */}
|
||||
<th scope="col" className="px-2">
|
||||
Added
|
||||
</th>
|
||||
@@ -55,45 +58,39 @@ 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?.customer_id || ''}</div>
|
||||
<div className="font-normal text-gray-500">{item?.loan_id} : {item?.transaction_id}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
{/* <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> */}
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}</div>
|
||||
<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>
|
||||
))
|
||||
:
|
||||
<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={3}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
@@ -104,7 +101,7 @@ export default function RequestCom() {
|
||||
</table>
|
||||
</>
|
||||
)}
|
||||
</TableWrapper>
|
||||
</TablePaginatedWrapper>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
import { useState } from "react";
|
||||
import MainBtn from "../MainBtn";
|
||||
import Icons from "../Icons";
|
||||
|
||||
|
||||
export default function TablePaginatedWrapper({
|
||||
data = [],
|
||||
isFetching,
|
||||
pagination,
|
||||
setPage,
|
||||
children,
|
||||
}) {
|
||||
|
||||
const handlePrev = () => {
|
||||
setPage(prev => prev - 1)
|
||||
};
|
||||
const handleNext = () => {
|
||||
setPage(prev => prev + 1)
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="relative w-full">
|
||||
<div className="flex flex-col">
|
||||
<div className="w-full overflow-x-auto">
|
||||
{children({ data })}
|
||||
</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">
|
||||
{isFetching ? '----' : `page ${pagination?.current_page}`}</span> of <span className="font-semibold text-gray-900 dark:text-white">{pagination?.total_pages}</span>
|
||||
</div>
|
||||
<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={isFetching || !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={isFetching || !pagination?.has_next}
|
||||
>
|
||||
<Icons name='next' />
|
||||
</MainBtn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isFetching && <TableIsLoading />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const TableIsLoading = () => {
|
||||
return (
|
||||
<div className="w-full fixed z-[991] inset-0 flex justify-center items-center bg-black/10">
|
||||
<p className="rounded-md shadow-md p-4 bg-white/90 dark:bg-gray-900 text-brown dark:text-white">Loading...</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -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' style={{backgroundColor: 'aliceblue'}}>
|
||||
<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">{item?.created_at ? getDateFromDateString(item?.created_at) : 'Not available'}</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,176 @@
|
||||
import React from 'react'
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
|
||||
import Icons from '../Icons'
|
||||
|
||||
import Avatar from '../../assets/loans.png'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import {getLoans} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
import getTimeFromDateString from "../../helpers/GetTimeFromDateString";
|
||||
import { initiateDisburseRetrials } from "../../services/siteEventService"
|
||||
|
||||
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
|
||||
|
||||
const handleClick = (transactioID) => {
|
||||
// alert(transactioID)
|
||||
const fields={
|
||||
"transactionId": transactioID
|
||||
}
|
||||
return initiateDisburseRetrials(fields)
|
||||
// console.log('Button clicked!');
|
||||
};
|
||||
|
||||
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' style={{backgroundColor: '#f7d9e3'}}>
|
||||
<p className='pb-4 font-bold text-base'>Loan</p>
|
||||
<table className="table-auto py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Name
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Loan/Eligible 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/Due
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Status
|
||||
</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-semibold text-red-500">ORIGIN
|
||||
: {item?.original_transaction}</div>
|
||||
<div className="font-bold text-blue-500">OFFER
|
||||
: {item?.offer_id}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||
<div
|
||||
className="font-semibold text-green-500">#{formatNumber(item?.initial_loan_amount)}</div>
|
||||
<div
|
||||
className="font-semibold text-red-500">#{formatNumber(item?.eligible_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">{item?.tenor} days</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div
|
||||
className="font-semibold text-gray-500">#{formatNumber(item?.repayment_amount)}</div>
|
||||
<div
|
||||
className="font-semibold text-red-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
|
||||
className="font-semibold text-red-500">{getDateFromDateString(item?.due_date)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className="font-semibold text-red-500">{item?.status}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colSpan="8">
|
||||
<div>
|
||||
<div style={{display: 'flex'}}>
|
||||
<div style={{width: '50%'}}>
|
||||
<p className='pb-4 font-bold text-base'>Loans Disbursement
|
||||
Details</p>
|
||||
</div>
|
||||
<div style={{width: '50%', textAlign: 'right'}}>
|
||||
<button
|
||||
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 roundede"
|
||||
onClick={() => handleClick(item?.transaction_id)}>
|
||||
Retry Disbursement
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="font-bold text-blue-500">Disburse Date
|
||||
: {getDateFromDateString(item?.disburseDate)} {getTimeFromDateString(item?.disburseDate)} </div>
|
||||
<div className="font-bold text-gray-500">Disburse Description
|
||||
: {item?.disburseDescription}</div>
|
||||
<div className="font-bold text-red-500">Disburse Result
|
||||
: {item?.disburseResult}</div>
|
||||
<div><br/></div>
|
||||
<div className="font-bold text-blue-500">Disburse Verify
|
||||
Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>
|
||||
<div className="font-bold text-gray-500">Verify Description
|
||||
: {item?.verifyDescription}</div>
|
||||
<div className="font-bold text-red-500">Verify Result
|
||||
: {item?.verifyResult}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</>
|
||||
|
||||
|
||||
))
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
:
|
||||
null
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
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';
|
||||
import localSiteIcons from "../../helpers/localSiteIcons";
|
||||
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/TrxID
|
||||
</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">
|
||||
Paid ?
|
||||
</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="text-left">
|
||||
<div className="text-base font-semibold">{item?.loan_id || ''}</div>
|
||||
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.total_repayment_amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{formatNumber(item?.installment_amount)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.due_date)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="text-base font-semibold">{item?.paid || 'false'}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={6}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
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 getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
import localSiteIcons from '../../helpers/localSiteIcons';
|
||||
|
||||
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">
|
||||
Customer
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Channel
|
||||
</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={localSiteIcons(`loan_icons/${item?.type}`)} 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)} {getTimeFromDateString(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="text-base font-semibold">{item?.customer_id}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className="text-base font-semibold">{item?.channel}</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,168 @@
|
||||
import {useEffect, 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 {getTransactions} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
import localSiteIcons from '../../helpers/localSiteIcons';
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
export default function TransactionsCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [filter, setFilter] = useState({type: '', id: ''})
|
||||
const [willFilter, setWillFilter] = useState(false)
|
||||
|
||||
const handleFilter = ({target:{name, value}}) => {
|
||||
setFilter(prev => ({...prev, [name]:value}))
|
||||
}
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
if(filter.type && !filter.id){
|
||||
return
|
||||
}else if(!filter.type){
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
setFilter({type: '', id: ''})
|
||||
}else{
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
}
|
||||
}
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.transactions, page, willFilter],
|
||||
queryFn: () => {
|
||||
const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
page,
|
||||
...filterData
|
||||
}
|
||||
return getTransactions(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
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'>
|
||||
{isError ?
|
||||
<p className='text-red-500'>{error?.message}</p>
|
||||
:
|
||||
<>
|
||||
{/* filter section */}
|
||||
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
||||
<Icons name='filter' className='text-3xl'/>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||
onChange={handleFilter}>
|
||||
<option value=''>All</option>
|
||||
<option value='transaction_id'>Transaction ID</option>
|
||||
<option value='account_id'>Account ID</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
<input name='id' value={filter?.id} disabled={!filter.type}
|
||||
className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`}
|
||||
onChange={handleFilter}/>
|
||||
</div>
|
||||
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id}
|
||||
className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit
|
||||
</button>
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={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">
|
||||
Customer/ID
|
||||
</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={localSiteIcons(`loan_icons/${item?.type}`)}
|
||||
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)} {getTimeFromDateString(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="text-base font-semibold">{item?.customer_id}</div>
|
||||
<div className="font-normal text-red-500"><b>ID:</b>{item?.id}</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>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
import React, { useState } from 'react'
|
||||
import { useQuery, useQueryClient } 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 getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function TransactionsCom() {
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const [filter, setFilter] = useState({transaction_id: '', account_id: ''})
|
||||
const handleFilter = ({target:{name, value}}) => {
|
||||
setFilter(prev => ({...prev, [name]:value}))
|
||||
}
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
// setPage(1)
|
||||
queryClient.invalidateQueries({ queryKey: [...queryKeys.transactions] })
|
||||
}
|
||||
|
||||
const {data, isFetching, isError, error, isPlaceholderData, isPending} = useQuery({
|
||||
queryKey: [...queryKeys.transactions, page],
|
||||
queryFn: () => getTransactions({...filter, 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>
|
||||
:
|
||||
<>
|
||||
{/* filter section */}
|
||||
<div className='px-2 py-2 mb-4 flex items-end gap-2'>
|
||||
<Icons name='filter' className='text-3xl' />
|
||||
<div className='flex gap-4 items-center'>
|
||||
<div className=''>
|
||||
<p>Transaction ID</p>
|
||||
<select name='transaction_id' value={filter?.transaction_id} className='p-2' onChange={handleFilter}>
|
||||
<option value=''>select</option>
|
||||
<>
|
||||
{transactions.map((item, index) => (
|
||||
<option key={index} value={item?.transaction_id}>{item?.transaction_id}</option>
|
||||
))}
|
||||
</>
|
||||
</select>
|
||||
</div>
|
||||
<div className=''>
|
||||
<p>Account ID</p>
|
||||
<select name='account_id' value={filter?.account_id} className='p-2' onChange={handleFilter}>
|
||||
<option value=''>select</option>
|
||||
<>
|
||||
{transactions.map((item, index) => (
|
||||
<option key={index} value={item?.account_id}>{item?.account_id}</option>
|
||||
))}
|
||||
</>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<button onClick={handleFilterByParams} className={`bg-primary px-2 py-1 rounded-md text-white font-medium`}>Submit</button>
|
||||
</div>
|
||||
{/* end of filter section */}
|
||||
|
||||
<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)} {getTimeFromDateString(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,8 @@
|
||||
function getDateFromDateString(dateString) {
|
||||
const date = new Date(dateString);
|
||||
|
||||
|
||||
if (dateString == null || dateString.trim() === '' ) return '';
|
||||
|
||||
// Ensure the date is valid
|
||||
if (isNaN(date)) {
|
||||
return "Invalid date string";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
function getTimeFromDateString(dateString) {
|
||||
const date = new Date(dateString);
|
||||
|
||||
|
||||
if (dateString == null || dateString.trim() === '' ) return '';
|
||||
|
||||
// Ensure the date is valid
|
||||
if (isNaN(date)) {
|
||||
return "Invalid date string";
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
function debounceFunction(func, delay) {
|
||||
let timer;
|
||||
|
||||
return function(...args) {
|
||||
// Clear the previous timer if the function is called before the delay
|
||||
clearTimeout(timer);
|
||||
|
||||
// Set a new timer to execute the function after the specified delay
|
||||
timer = setTimeout(() => {
|
||||
func(...args);
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
export default debounceFunction
|
||||
@@ -1,6 +1,10 @@
|
||||
const formatNumber = (number = 0) => {
|
||||
return new Intl.NumberFormat().format(number);
|
||||
// return new Intl.NumberFormat().format(number);
|
||||
// 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
|
||||
@@ -0,0 +1,7 @@
|
||||
const localSiteIcons = (location) => {
|
||||
|
||||
let localParts;
|
||||
localParts = location.split(".")
|
||||
return require(`../assets/${localParts[0]}.png`);
|
||||
}
|
||||
export default localSiteIcons
|
||||
@@ -29,7 +29,7 @@ code {
|
||||
@apply [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 [&::-webkit-scrollbar-track]:rounded-full [&::-webkit-scrollbar-thumb]:rounded-full
|
||||
}
|
||||
.box {
|
||||
@apply flex flex-col w-full p-8 cursor-pointer rounded-lg h-full border-[1px] border-[#F1F1F4] dark:border-[#1E2027] shadow-[0px_3px_4px_0px_rgba(0,_0,_0,_0.03)]
|
||||
@apply flex flex-col w-full p-8 rounded-lg h-full border-[1px] border-[#F1F1F4] dark:border-[#1E2027] shadow-[0px_3px_4px_0px_rgba(0,_0,_0,_0.03)]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,10 +1,17 @@
|
||||
const queryKeys = {
|
||||
dashboard: ['dashboard'],
|
||||
loans: ['loans'],
|
||||
repayment_schedule: ['repayment-schedule'],
|
||||
loan_charges: ['loan-charges'],
|
||||
offers: ['offers'],
|
||||
apply_loan: ['apply'],
|
||||
select_loan: ['select-loan'],
|
||||
approved_loan: ['approved-loan'],
|
||||
loan_offers: ['loan-offers'],
|
||||
|
||||
//new
|
||||
transactions: ['transactions'],
|
||||
recent_loans: ['recent_loans'],
|
||||
}
|
||||
|
||||
export default queryKeys
|
||||
@@ -0,0 +1,47 @@
|
||||
import axios from "axios"
|
||||
// import dotenv from 'dotenv';
|
||||
//dotenv.config();
|
||||
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
config.headers = {
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
};
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
const postAuxEnd = (path, postData, media=false) => {
|
||||
const basePath = media ? process.env.REACT_APP_EVENT_API : process.env.REACT_APP_EVENT_API
|
||||
return axios.post(`${basePath}${path}`, postData).then(res => {
|
||||
return res
|
||||
}).catch(err => {
|
||||
// throw new Error(err.response.data.message);
|
||||
throw new Error(err);
|
||||
})
|
||||
}
|
||||
|
||||
const getAuxEnd = (path, reqData= null) => {
|
||||
const basePath = media ? process.env.REACT_APP_EVENT_API : process.env.REACT_APP_EVENT_API
|
||||
|
||||
return axios.get(`${basePath}${path}`,{ params: reqData }).then(res => {
|
||||
return res
|
||||
// localStorage.clear();
|
||||
// window.location.href = `/login?sessionExpired=true`;
|
||||
}).catch(err => {
|
||||
throw new Error(err);
|
||||
// throw new Error(err.response.data.message);
|
||||
// return err
|
||||
})
|
||||
}
|
||||
|
||||
// FUNCTION TO GET SALARY RECEIVED
|
||||
export const initiateDisburseRetrials = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/autocall/retry-disbursement', postData, false)
|
||||
}
|
||||
@@ -56,35 +56,44 @@ export const getDashData = (reqData) => {
|
||||
return getAuxEnd(`/dashboard`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
// FUNCTION TO GET LOANS TABLE
|
||||
export const getLoans = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/loans`, postData)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const applyLoan = (reqData) => {
|
||||
// FUNCTION TO GET TRANSACTIONS TABLE
|
||||
export const getTransactions = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/loan/apply`, postData)
|
||||
return getAuxEnd(`/transactions`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const loanOffers = (reqData) => {
|
||||
// FUNCTION TO GET REPAYMENTS TABLE
|
||||
export const getRepayments = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/offers`, postData)
|
||||
return getAuxEnd(`/repayments`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const selectLoan = (reqData) => {
|
||||
// FUNCTION TO GET LOAN CHARGES TABLE
|
||||
export const getLoanCharges = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/loan/select`, postData)
|
||||
return getAuxEnd(`/loan-charges`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET APPLIED LOANS TABLE
|
||||
export const approvedLoan = (reqData) => {
|
||||
// FUNCTION TO GET OFFERS LIST TABLE
|
||||
export const getOffers = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/office/loan/approved`, postData)
|
||||
return getAuxEnd(`/offers`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET REPAYMENT SCHEDULE TABLE
|
||||
export const getRepaymentSchedule = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/repayment-schedules`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET RECENT LOANS
|
||||
export const getRecentLoans = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/recent-loans`, postData)
|
||||
}
|
||||