Compare commits

...

7 Commits

Author SHA1 Message Date
victorAnumudu 1d14205656 customer API added 2024-07-17 20:01:27 +01:00
ameye d98624574f Merge branch 'loan-details-display' of DigiFi/digifi-bko into master 2024-07-15 17:16:37 +00:00
victorAnumudu fa46cae1cc made all data to show on details column 2024-07-15 18:13:28 +01:00
ameye 704681c32d Merge branch 'loan-details-update' of DigiFi/digifi-bko into master 2024-07-15 17:00:34 +00:00
victorAnumudu 251fe95a6b updated loan details page 2024-07-15 17:57:01 +01:00
victorAnumudu ca7db4b0aa updated loan details page 2024-07-15 17:38:11 +01:00
ameye 5fe90c3ead Merge branch 'loan-process-page' of DigiFi/digifi-bko into master 2024-07-15 16:14:17 +00:00
9 changed files with 51 additions and 49 deletions
@@ -6,6 +6,7 @@ const QUERIES = {
PENDING_LIST: 'pending-list', PENDING_LIST: 'pending-list',
APPROVED_LIST: 'approved-list', APPROVED_LIST: 'approved-list',
REJECTED_LIST: 'rejected-list', REJECTED_LIST: 'rejected-list',
CUSTOMERS_LIST: 'customers-list',
EMPLOYERS_LIST: 'employers-list', EMPLOYERS_LIST: 'employers-list',
SIGNATORY_LIST: 'signatory-list', SIGNATORY_LIST: 'signatory-list',
} }
@@ -4,7 +4,7 @@ import {UsersListWrapper} from './users-list/UsersList'
const usersBreadcrumbs: Array<PageLink> = [ const usersBreadcrumbs: Array<PageLink> = [
{ {
title: 'User Management', title: 'Customer Management',
path: '/tools/user-management/users', path: '/tools/user-management/users',
isSeparator: false, isSeparator: false,
isActive: false, isActive: false,
@@ -25,7 +25,7 @@ const UsersPage = () => {
path='users' path='users'
element={ element={
<> <>
<PageTitle breadcrumbs={usersBreadcrumbs}>Users list</PageTitle> <PageTitle breadcrumbs={usersBreadcrumbs}>Customer list</PageTitle>
<UsersListWrapper /> <UsersListWrapper />
</> </>
} }
@@ -11,7 +11,7 @@ import {
stringifyRequestQuery, stringifyRequestQuery,
WithChildren, WithChildren,
} from '../../../../../../_digifi/helpers' } from '../../../../../../_digifi/helpers'
import {getStartedUsers} from './_requests' import {getCustomerList} from './_requests'
import {User} from './_models' import {User} from './_models'
import {useQueryRequest} from './QueryRequestProvider' import {useQueryRequest} from './QueryRequestProvider'
@@ -32,9 +32,9 @@ const QueryResponseProvider: FC<WithChildren> = ({children}) => {
refetch, refetch,
data: response, data: response,
} = useQuery( } = useQuery(
`${QUERIES.USERS_LIST}-${query}`, `${QUERIES.CUSTOMERS_LIST}-${query}`,
() => { () => {
return getStartedUsers(query) return getCustomerList(query)
}, },
{cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false} {cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false}
) )
@@ -29,6 +29,7 @@ export type User = {
status?: string status?: string
added?: string added?: string
updated?: string updated?: string
bvn?: string
} }
export type UsersQueryResponse = Response<Array<User>> export type UsersQueryResponse = Response<Array<User>>
@@ -13,9 +13,9 @@ const NEW_USER_ENDPOINT = import.meta.env.VITE_APP_USER_ENDPOINT
// .get(`${GET_USERS_URL}?${query}`) // .get(`${GET_USERS_URL}?${query}`)
// .then((d: AxiosResponse<UsersQueryResponse>) => d.data); // .then((d: AxiosResponse<UsersQueryResponse>) => d.data);
// }; // };
const getStartedUsers = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE STARTED LOAN APPLICATION const getCustomerList = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE STARTED LOAN APPLICATION
return axios return axios
.get(`${NEW_USER_ENDPOINT}/loan/started`) .get(`${NEW_USER_ENDPOINT}/customers`)
.then((d: AxiosResponse<UsersQueryResponse>) => d.data); .then((d: AxiosResponse<UsersQueryResponse>) => d.data);
}; };
@@ -50,7 +50,7 @@ const deleteSelectedUsers = (userIds: Array<ID>): Promise<void> => {
}; };
export { export {
getStartedUsers, getCustomerList,
deleteUser, deleteUser,
deleteSelectedUsers, deleteSelectedUsers,
getUserById, getUserById,
@@ -1,11 +0,0 @@
import {FC} from 'react'
type Props = {
agent?: string
}
const AgentCell: FC<Props> = ({agent}) => (
<> {agent && <div className='badge badge-light-success fw-bolder'>{agent}</div>}</>
)
export {AgentCell}
@@ -0,0 +1,11 @@
import {FC} from 'react'
type Props = {
status?: string
}
const Status: FC<Props> = ({status}) => (
<> {status && <div className='badge badge-light-success fw-bolder'>{status}</div>}</>
)
export {Status}
@@ -1,7 +1,7 @@
import {Column} from 'react-table' import {Column} from 'react-table'
import {UserInfoCell} from './UserInfoCell' import {UserInfoCell} from './UserInfoCell'
import { PaymentMonthCell } from './UserLastLoginCell' import { PaymentMonthCell } from './UserLastLoginCell'
import {AgentCell} from './AgentCell' import {Status} from './Status'
import {UserActionsCell} from './UserActionsCell' import {UserActionsCell} from './UserActionsCell'
import {UserSelectionCell} from './UserSelectionCell' import {UserSelectionCell} from './UserSelectionCell'
import {UserCustomHeader} from './UserCustomHeader' import {UserCustomHeader} from './UserCustomHeader'
@@ -21,22 +21,22 @@ const usersColumns: ReadonlyArray<Column<User>> = [
Cell: ({...props}) => <UserInfoCell user={props.data[props.row.index]} />, Cell: ({...props}) => <UserInfoCell user={props.data[props.row.index]} />,
}, },
{ {
Header: (props) => <UserCustomHeader tableProps={props} title='Amount' className='min-w-125px' />, Header: (props) => <UserCustomHeader tableProps={props} title='BVN' className='min-w-125px' />,
accessor: 'loan_amount', accessor: 'bvn',
}, },
// {
// Header: (props) => (
// <UserCustomHeader tableProps={props} title='Payment Terms' className='min-w-125px' />
// ),
// id: 'payment_month',
// Cell: ({...props}) => <PaymentMonthCell payment_month={props.data[props.row.index].payment_month} />,
// },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Payment Terms' className='min-w-125px' /> <UserCustomHeader tableProps={props} title='Status' className='min-w-125px' />
), ),
id: 'payment_month', id: 'status',
Cell: ({...props}) => <PaymentMonthCell payment_month={props.data[props.row.index].payment_month} />, Cell: ({...props}) => <Status status={props.data[props.row.index].status} />,
},
{
Header: (props) => (
<UserCustomHeader tableProps={props} title='Agent' className='min-w-125px' />
),
id: 'sales_agent',
Cell: ({...props}) => <AgentCell agent={props.data[props.row.index].sales_agent} />,
}, },
{ {
Header: (props) => ( Header: (props) => (
@@ -72,20 +72,20 @@ export default function ApproveRejectPage() {
</button> </button>
</div> </div>
</div> </div>
<div className="card card-flash flex flex-col p-4 h-md-50 mb-5 mb-xl-10 bg-secondary"> <div className="card card-flash flex flex-col p-4 h-md-50 mb-5 mb-xl-10 bg-secondary overflow-scroll">
<h3 className='card-title text-gray-800 fw-bold mb-5'>Verification details</h3> <h3 className='card-title text-gray-800 fw-bold mb-5'>Verification details</h3>
<div className='w-100'> <div className='w-100'>
{loanDetails?.data?.verification.length > 0 ? {loanDetails?.data?.verification.length > 0 ?
<table className='w-100'> <table className='w-100'>
<tr>
<th>UID</th>
<th>EMPLOYER NAME</th>
</tr>
{loanDetails?.data?.verification?.map((item:any) => ( {loanDetails?.data?.verification?.map((item:any) => (
<tr key={item.uid || item.id}> <tbody key={item.uid || item.id}>
<td>{item.uid}</td> {Object.keys(item).map(key => (
<td>{item.employers_name}</td> <tr>
</tr> <th className='text-uppercase py-3'>{key}</th>
<td>{item[key]}</td>
</tr>
))}
</tbody>
))} ))}
</table> </table>
: :
@@ -103,15 +103,15 @@ export default function ApproveRejectPage() {
<div className='w-100'> <div className='w-100'>
{loanDetails?.data?.application.length > 0 ? {loanDetails?.data?.application.length > 0 ?
<table className='w-100'> <table className='w-100'>
<tr>
<th>UID</th>
<th>AMOUNT</th>
</tr>
{loanDetails?.data?.application?.map((item:any) => ( {loanDetails?.data?.application?.map((item:any) => (
<tr key={item.uid || item.id}> <tbody key={item.uid || item.id}>
<td>{item.uid}</td> {Object.keys(item).map(key => (
<td>{item.loan_amount}</td> <tr>
</tr> <th className='text-uppercase py-3'>{key}</th>
<td className='flex text-break'>{item[key]}</td>
</tr>
))}
</tbody>
))} ))}
</table> </table>
: :