Some code fix
This commit is contained in:
@@ -44,7 +44,7 @@ export default function CustomerCom() {
|
|||||||
setAllCustomers(prev => ({...prev, loading: true}))
|
setAllCustomers(prev => ({...prev, loading: true}))
|
||||||
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||||
getCustomers({...payload, page}).then(res => {
|
getCustomers({...payload, page}).then(res => {
|
||||||
if(res?.status != 200){
|
if (res?.status !== 200) {
|
||||||
setAllCustomers(prev => ({...prev, error: 'Opps, an error occurred', loading: false}))
|
setAllCustomers(prev => ({...prev, error: 'Opps, an error occurred', loading: false}))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -68,20 +68,26 @@ export default function CustomerCom() {
|
|||||||
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
<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'/>
|
<Icons name='filter' className='text-3xl'/>
|
||||||
<div className='w-full sm:max-w-48'>
|
<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}>
|
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||||
|
onChange={handleFilter}>
|
||||||
<option value=''>All</option>
|
<option value=''>All</option>
|
||||||
<option value='username'>Username</option>
|
<option value='username'>Username</option>
|
||||||
<option value='email'>Email</option>
|
<option value='email'>Email</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className='w-full sm:max-w-48'>
|
<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} />
|
<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>
|
</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'}`}>Refresh</button>
|
<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'}`}>Refresh
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/* end of filter section */}
|
{/* end of filter section */}
|
||||||
|
|
||||||
<TablePaginatedWrapper data={customers} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination} >
|
<TablePaginatedWrapper data={customers} isFetching={isFetching} setPage={setPage}
|
||||||
|
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||||
{({data}) => (
|
{({data}) => (
|
||||||
<>
|
<>
|
||||||
<table className="py-2 w-full text-sm">
|
<table className="py-2 w-full text-sm">
|
||||||
@@ -102,11 +108,14 @@ export default function CustomerCom() {
|
|||||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
{(data && data.length > 0) ? data?.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'>
|
<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" /> */}
|
{/* <img className="w-10 h-10 rounded-md" src={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" /> */}
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<div className="text-base font-semibold">{item?.firstname} {item?.lastname}</div>
|
<div
|
||||||
<div className="font-normal text-gray-500">{item?.email}</div>
|
className="text-base font-semibold">{item?.firstname} {item?.lastname}</div>
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500">{item?.email}</div>
|
||||||
<div className="font-normal text-gray-500">{item?.id}</div>
|
<div className="font-normal text-gray-500">{item?.id}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,13 +123,16 @@ export default function CustomerCom() {
|
|||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<div className="text-base font-semibold">{item?.username}</div>
|
<div className="text-base font-semibold">{item?.username}</div>
|
||||||
<div className="font-normal text-gray-500">{item?.member_uid}</div>
|
<div
|
||||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.profile_completed)}</div>
|
className="font-normal text-gray-500">{item?.member_uid}</div>
|
||||||
|
<div
|
||||||
|
className="font-normal text-gray-500">{getDateFromDateString(item?.profile_completed)}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2 text-right">
|
<td className="px-2 text-right">
|
||||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
<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'>
|
<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={''} state={{customerID: item?.id}}>
|
<Link to={''} state={{customerID: item?.id}}>
|
||||||
<Icons name='eye'/>
|
<Icons name='eye'/>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ export default function DashboardAside() {
|
|||||||
{link.title &&
|
{link.title &&
|
||||||
<h1 className="px-4 py-2 text-sm sm:text-sm text-slate-500 dark:text-white font-semibold uppercase mt-3 mb-1 border-b border-slate-500 dark:border-white">{link.title}</h1>
|
<h1 className="px-4 py-2 text-sm sm:text-sm text-slate-500 dark:text-white font-semibold uppercase mt-3 mb-1 border-b border-slate-500 dark:border-white">{link.title}</h1>
|
||||||
}
|
}
|
||||||
<AsideLinkWithSubLinks name={link.name} icon={link.icon} isOpen={subLinkList.includes(pathname) || index===1} >
|
<AsideLinkWithSubLinks name={link.name} icon={link.icon}
|
||||||
|
isOpen={subLinkList.includes(pathname) || index === 1}>
|
||||||
<>
|
<>
|
||||||
{link.subLinks.map((subItem, index) => {
|
{link.subLinks.map((subItem, index) => {
|
||||||
let active = subItem.status === 1 ? true : false
|
let active = subItem.status === 1 ? true : false
|
||||||
@@ -61,7 +62,8 @@ export default function DashboardAside() {
|
|||||||
if (active && !hasSubLinks) {
|
if (active && !hasSubLinks) {
|
||||||
return (
|
return (
|
||||||
<div key={subItem.name}>
|
<div key={subItem.name}>
|
||||||
<AsideLink to={subItem.to} name={subItem.name} icon={subItem.icon} />
|
<AsideLink to={subItem.to} name={subItem.name}
|
||||||
|
icon={subItem.icon}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
} else if (active && hasSubLinks) {
|
} else if (active && hasSubLinks) {
|
||||||
@@ -71,14 +73,18 @@ export default function DashboardAside() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<AsideLinkWithSubLinks key={subItem.name} name={subItem.name} icon={subItem.icon} isOpen={subLinkList.includes(pathname)}>
|
<AsideLinkWithSubLinks key={subItem.name} name={subItem.name}
|
||||||
|
icon={subItem.icon}
|
||||||
|
isOpen={subLinkList.includes(pathname)}>
|
||||||
<>
|
<>
|
||||||
{subItem.subLinks.map((item, index) => {
|
{subItem.subLinks.map((item, index) => {
|
||||||
let active = item.status === 1 ? true : false
|
let active = item.status === 1 ? true : false
|
||||||
if (active) {
|
if (active) {
|
||||||
return (
|
return (
|
||||||
<div key={index}>
|
<div key={index}>
|
||||||
<AsideLink key={index} to={item.to} name={item.name} icon={item.icon} />
|
<AsideLink key={index} to={item.to}
|
||||||
|
name={item.name}
|
||||||
|
icon={item.icon}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@@ -111,10 +117,12 @@ export default function DashboardAside() {
|
|||||||
<p className="text-12 text-black-box/90 dark:text-white-body/80">username@gmail.com</p>
|
<p className="text-12 text-black-box/90 dark:text-white-body/80">username@gmail.com</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button onClick={()=>handleActiveMenu('settings')} className="peer text-slate-500 dark:text-white-body">
|
<button onClick={() => handleActiveMenu('settings')}
|
||||||
|
className="peer text-slate-500 dark:text-white-body">
|
||||||
<Icons name='settings' className='text-3xl'/>
|
<Icons name='settings' className='text-3xl'/>
|
||||||
</button>
|
</button>
|
||||||
<div className="hidden group-hover:block pop-modal-down absolute p-4 w-full bg-white dark:bg-black-box left-0 bottom-[60%] rounded shadow-round_black dark:shadow-round_white">
|
<div
|
||||||
|
className="hidden group-hover:block pop-modal-down absolute p-4 w-full bg-white dark:bg-black-box left-0 bottom-[60%] rounded shadow-round_black dark:shadow-round_white">
|
||||||
<div className="w-full min-h-48 flex flex-col justify-between gap-4">
|
<div className="w-full min-h-48 flex flex-col justify-between gap-4">
|
||||||
<div className="w-full h-full">
|
<div className="w-full h-full">
|
||||||
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
||||||
@@ -141,12 +149,14 @@ export default function DashboardAside() {
|
|||||||
|
|
||||||
const asideNavLinks = [
|
const asideNavLinks = [
|
||||||
{name: 'Dashboard', status: 1, icon: 'dashboard', to: RouteLinks.homePage},
|
{name: 'Dashboard', status: 1, icon: 'dashboard', to: RouteLinks.homePage},
|
||||||
{name:'Deployments', title:'Activities', status:1, icon: 'arrow-right', subLinks: [
|
{
|
||||||
|
name: 'Deployments', title: 'Activities', status: 1, icon: 'arrow-right', subLinks: [
|
||||||
{name: 'Active', status: 1, icon: 'dot', to: RouteLinks.transactionsPage},
|
{name: 'Active', status: 1, icon: 'dot', to: RouteLinks.transactionsPage},
|
||||||
{name: 'Provisions', status: 1, icon: 'dot', to: RouteLinks.subscriptions},
|
{name: 'Provisions', status: 1, icon: 'dot', to: RouteLinks.subscriptions},
|
||||||
{name: 'Customers', status: 1, icon: 'dot', to: RouteLinks.customerPage},
|
{name: 'Customers', status: 1, icon: 'dot', to: RouteLinks.customerPage},
|
||||||
{name: 'Billings', status: 1, icon: 'dot', to: RouteLinks.billings},
|
{name: 'Billings', status: 1, icon: 'dot', to: RouteLinks.billings},
|
||||||
{name: 'Configurations', status:1, icon: 'arrow-right', subLinks: [
|
{
|
||||||
|
name: 'Configurations', status: 1, icon: 'arrow-right', subLinks: [
|
||||||
{name: 'Product Settings', status: 1, icon: 'dot', to: RouteLinks.offers},
|
{name: 'Product Settings', status: 1, icon: 'dot', to: RouteLinks.offers},
|
||||||
{name: 'Admin Manager', status: 1, icon: 'dot', to: RouteLinks.offers},
|
{name: 'Admin Manager', status: 1, icon: 'dot', to: RouteLinks.offers},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default function LoansCom() {
|
|||||||
setAllLoans(prev => ({...prev, loading: true}))
|
setAllLoans(prev => ({...prev, loading: true}))
|
||||||
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
const payload = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||||
getLoans({...payload, page}).then(res => {
|
getLoans({...payload, page}).then(res => {
|
||||||
if(res?.status != 200){
|
if (res?.status !== 200) {
|
||||||
setAllLoans(prev => ({...prev, loading: false}))
|
setAllLoans(prev => ({...prev, loading: false}))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -67,20 +67,26 @@ export default function LoansCom() {
|
|||||||
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
|
<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'/>
|
<Icons name='filter' className='text-3xl'/>
|
||||||
<div className='w-full sm:max-w-48'>
|
<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}>
|
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
|
||||||
|
onChange={handleFilter}>
|
||||||
<option value=''>All</option>
|
<option value=''>All</option>
|
||||||
<option value='transaction_id'>Transaction ID</option>
|
<option value='transaction_id'>Transaction ID</option>
|
||||||
<option value='account_id'>Account ID</option>
|
<option value='account_id'>Account ID</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className='w-full sm:max-w-48'>
|
<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} />
|
<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>
|
</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>
|
<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>
|
</div>
|
||||||
{/* end of filter section */}
|
{/* end of filter section */}
|
||||||
|
|
||||||
<TablePaginatedWrapper data={loans} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
|
<TablePaginatedWrapper data={loans} isFetching={isFetching} setPage={setPage}
|
||||||
|
itemsPerPage={pagination?.limit} pagination={pagination}>
|
||||||
{({data}) => (
|
{({data}) => (
|
||||||
<>
|
<>
|
||||||
<table className="table-auto py-2 w-full text-sm">
|
<table className="table-auto py-2 w-full text-sm">
|
||||||
@@ -110,41 +116,52 @@ export default function LoansCom() {
|
|||||||
{(data && data.length > 0) ? data?.map((item, index) => (
|
{(data && data.length > 0) ? data?.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'>
|
<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"/>
|
<img className="w-10 h-10 rounded-md" src={Avatar} alt="Jese"/>
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<div className="text-base font-semibold">{item?.account_id || ''}</div>
|
<div
|
||||||
<div className="font-normal text-gray-500">{item?.id} : {item?.transaction_id}</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>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
{/* <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
|
||||||
|
className="font-normal text-gray-500">{formatNumber(item?.initial_loan_amount)}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{formatNumber(item?.product_id)}</div>
|
<div
|
||||||
<div className="font-normal text-gray-500">{item?.tenor} days</div>
|
className="font-normal text-gray-500">{formatNumber(item?.product_id)}</div>
|
||||||
|
<div className="font-normal text-gray-500">{item?.tenor} days
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{formatNumber(item?.repayment_amount)}</div>
|
<div
|
||||||
<div className="font-normal text-gray-500">{formatNumber(item?.installment_amount)}</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>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{getDateFromDateString(item?.created_at)}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2 text-right">
|
<td className="px-2 text-right">
|
||||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
<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'>
|
<div
|
||||||
<Link to={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}>
|
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'/>
|
<Icons name='eye'/>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ export default function LoanChargeDetails({transactionID}) {
|
|||||||
<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> */}
|
||||||
<div className="font-normal text-gray-500">{item?.loan_id} : {item?.code}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{item?.loan_id} : {item?.code}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -74,7 +75,8 @@ export default function LoanChargeDetails({transactionID}) {
|
|||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{item?.created_at ? getDateFromDateString(item?.created_at) : 'Not available'}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{item?.created_at ? getDateFromDateString(item?.created_at) : 'Not available'}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
{/* <td className="px-2 text-right">
|
{/* <td className="px-2 text-right">
|
||||||
|
|||||||
Reference in New Issue
Block a user