fix fata
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from 'react'
|
import React, {useState} from 'react'
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import {useQuery} from "@tanstack/react-query";
|
||||||
|
|
||||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||||
@@ -7,7 +7,7 @@ import Icons from '../Icons'
|
|||||||
|
|
||||||
import Avatar from '../../assets/user_avatar.jpg'
|
import Avatar from '../../assets/user_avatar.jpg'
|
||||||
import queryKeys from '../../services/queryKeys'
|
import queryKeys from '../../services/queryKeys'
|
||||||
import { getLoanCharges } from '../../services/siteServices'
|
import {getLoanCharges} from '../../services/siteServices'
|
||||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||||
import formatNumber from '../../helpers/formatNumber';
|
import formatNumber from '../../helpers/formatNumber';
|
||||||
|
|
||||||
@@ -26,86 +26,92 @@ export default function LoanChargesCom() {
|
|||||||
const pagination = data?.data?.pagination
|
const pagination = data?.data?.pagination
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='w-full flex flex-col gap-8'>
|
<div className='w-full flex flex-col gap-8' style={{backgroundColor: 'aliceblue'}}>
|
||||||
<BreadcrumbCom title='Loan Charges' paths={['Dashboard', 'Loan Charges']} />
|
<BreadcrumbCom title='Loan Charges' paths={['Dashboard', 'Loan Charges']}/>
|
||||||
|
|
||||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||||
{isFetching ?
|
{isFetching ?
|
||||||
<>
|
<>
|
||||||
<p className='text-slate-800'>Loading...</p>
|
<p className='text-slate-800'>Loading...</p>
|
||||||
</>
|
</>
|
||||||
: isError ?
|
: isError ?
|
||||||
<p className='text-red-500'>{error.message}</p>
|
<p className='text-red-500'>{error.message}</p>
|
||||||
:
|
:
|
||||||
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
<TablePaginatedWrapper data={loanCharges} isFetching={isFetching} setPage={setPage}
|
||||||
{({ data }) => (
|
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">
|
<table className="py-2 w-full text-sm">
|
||||||
<tr>
|
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||||
<th scope="col" className="px-2 py-2">
|
<tr>
|
||||||
Name
|
<th scope="col" className="px-2 py-2">
|
||||||
</th>
|
Name
|
||||||
{/* <th scope="col" className="px-2">
|
</th>
|
||||||
|
{/* <th scope="col" className="px-2">
|
||||||
Loan
|
Loan
|
||||||
</th> */}
|
</th> */}
|
||||||
<th scope="col" className="px-2 text-right">
|
<th scope="col" className="px-2 text-right">
|
||||||
Amount
|
Amount
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" className="px-2 text-right">
|
<th scope="col" className="px-2 text-right">
|
||||||
Added
|
Added
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" className="px-2 text-right">
|
<th scope="col" className="px-2 text-right">
|
||||||
Action
|
Action
|
||||||
</th>
|
</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-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>
|
||||||
))
|
</thead>
|
||||||
:
|
<tbody>
|
||||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
{(data && data.length > 0) ? data?.map((item, index) => (
|
||||||
<td className="px-3 py-2" colSpan={4}>
|
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||||
<div className="flex justify-center items-center">
|
<td className="px-2 py-2">
|
||||||
No Record Found
|
<div
|
||||||
</div>
|
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
|
||||||
</td>
|
<div className="text-left">
|
||||||
</tr>
|
<div
|
||||||
}
|
className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||||
</tbody>
|
<div
|
||||||
</table>
|
className="font-normal text-gray-500 line-clamp-1">{item?.code}</div>
|
||||||
</>
|
</div>
|
||||||
)}
|
</div>
|
||||||
</TablePaginatedWrapper>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default function LoanChargeDetails({transactionID}) {
|
|||||||
// const pagination = data?.data?.pagination
|
// const pagination = data?.data?.pagination
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
<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>
|
<p className='pb-4 font-bold text-base'>Loan Charges</p>
|
||||||
{isFetching ?
|
{isFetching ?
|
||||||
<>
|
<>
|
||||||
@@ -58,7 +58,7 @@ export default function LoanChargeDetails({transactionID}) {
|
|||||||
<tr key={index} 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">
|
<td className="px-2 py-2">
|
||||||
<div className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
|
<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" />
|
{/*<img className="w-10 h-10 rounded-md" src={Avatar} alt="Jese image" />*/}
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||||
{/* <div className="font-normal text-gray-500 line-clamp-1">{item?.description}</div> */}
|
{/* <div className="font-normal text-gray-500 line-clamp-1">{item?.description}</div> */}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ export default function LoanDetails({transactionID}) {
|
|||||||
<p className='text-red-500'>{error.message}</p>
|
<p className='text-red-500'>{error.message}</p>
|
||||||
</div>
|
</div>
|
||||||
: (loans && loans.length > 0) ?
|
: (loans && loans.length > 0) ?
|
||||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
<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'>Loans</p>
|
<p className='pb-4 font-bold text-base'>Loan</p>
|
||||||
<table className="table-auto py-2 w-full text-sm">
|
<table className="table-auto py-2 w-full text-sm">
|
||||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" className="px-2 py-2">
|
<th scope="col" className="px-2 py-2">
|
||||||
ID
|
ID/TrxID
|
||||||
</th>
|
</th>
|
||||||
{/* <th scope="col" className="px-2">
|
{/* <th scope="col" className="px-2">
|
||||||
Loan
|
Loan
|
||||||
@@ -59,7 +59,7 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
Paid Date
|
Paid Date
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" className="px-2 text-right">
|
<th scope="col" className="px-2 text-right">
|
||||||
Action
|
Paid ?
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -67,12 +67,9 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
{(repaymentSchedule && repaymentSchedule.length > 0) ? repaymentSchedule?.map((item, index) => (
|
{(repaymentSchedule && repaymentSchedule.length > 0) ? repaymentSchedule?.map((item, index) => (
|
||||||
<tr key={index} 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">
|
<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-left">
|
||||||
<div className="text-base font-semibold">{item?.loan_id || ''}</div>
|
<div className="text-base font-semibold">{item?.loan_id || ''}</div>
|
||||||
{/* <div className="font-normal text-gray-500 line-clamp-1">{item?.description}</div> */}
|
<div className="text-base font-semibold">{item?.transaction_id || ''}</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
@@ -95,11 +92,9 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
<div className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
|
<div className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2 text-right">
|
<td className="px-2">
|
||||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
<div className="text-right">
|
||||||
<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'>
|
<div className="text-base font-semibold">{item?.paid || 'false'}</div>
|
||||||
<Icons name='eye' />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user