From 1d142056569216b5799d941377545a2e608a2747 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 17 Jul 2024 20:01:27 +0100 Subject: [PATCH] customer API added --- src/_digifi/helpers/crud-helper/consts.ts | 1 + .../apps/user-management/UsersPage.tsx | 4 +-- .../users-list/core/QueryResponseProvider.tsx | 6 ++--- .../users-list/core/_models.ts | 1 + .../users-list/core/_requests.ts | 6 ++--- .../users-list/table/columns/AgentCell.tsx | 11 -------- .../users-list/table/columns/Status.tsx | 11 ++++++++ .../users-list/table/columns/_columns.tsx | 26 +++++++++---------- 8 files changed, 34 insertions(+), 32 deletions(-) delete mode 100644 src/app/modules/apps/user-management/users-list/table/columns/AgentCell.tsx create mode 100644 src/app/modules/apps/user-management/users-list/table/columns/Status.tsx diff --git a/src/_digifi/helpers/crud-helper/consts.ts b/src/_digifi/helpers/crud-helper/consts.ts index ad3c2fe..6c5badb 100644 --- a/src/_digifi/helpers/crud-helper/consts.ts +++ b/src/_digifi/helpers/crud-helper/consts.ts @@ -6,6 +6,7 @@ const QUERIES = { PENDING_LIST: 'pending-list', APPROVED_LIST: 'approved-list', REJECTED_LIST: 'rejected-list', + CUSTOMERS_LIST: 'customers-list', EMPLOYERS_LIST: 'employers-list', SIGNATORY_LIST: 'signatory-list', } diff --git a/src/app/modules/apps/user-management/UsersPage.tsx b/src/app/modules/apps/user-management/UsersPage.tsx index 02fbdef..79c2ff1 100644 --- a/src/app/modules/apps/user-management/UsersPage.tsx +++ b/src/app/modules/apps/user-management/UsersPage.tsx @@ -4,7 +4,7 @@ import {UsersListWrapper} from './users-list/UsersList' const usersBreadcrumbs: Array = [ { - title: 'User Management', + title: 'Customer Management', path: '/tools/user-management/users', isSeparator: false, isActive: false, @@ -25,7 +25,7 @@ const UsersPage = () => { path='users' element={ <> - Users list + Customer list } diff --git a/src/app/modules/apps/user-management/users-list/core/QueryResponseProvider.tsx b/src/app/modules/apps/user-management/users-list/core/QueryResponseProvider.tsx index 3f7cffe..c05ad9d 100644 --- a/src/app/modules/apps/user-management/users-list/core/QueryResponseProvider.tsx +++ b/src/app/modules/apps/user-management/users-list/core/QueryResponseProvider.tsx @@ -11,7 +11,7 @@ import { stringifyRequestQuery, WithChildren, } from '../../../../../../_digifi/helpers' -import {getStartedUsers} from './_requests' +import {getCustomerList} from './_requests' import {User} from './_models' import {useQueryRequest} from './QueryRequestProvider' @@ -32,9 +32,9 @@ const QueryResponseProvider: FC = ({children}) => { refetch, data: response, } = useQuery( - `${QUERIES.USERS_LIST}-${query}`, + `${QUERIES.CUSTOMERS_LIST}-${query}`, () => { - return getStartedUsers(query) + return getCustomerList(query) }, {cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false} ) diff --git a/src/app/modules/apps/user-management/users-list/core/_models.ts b/src/app/modules/apps/user-management/users-list/core/_models.ts index b9b06ec..0b3df3a 100644 --- a/src/app/modules/apps/user-management/users-list/core/_models.ts +++ b/src/app/modules/apps/user-management/users-list/core/_models.ts @@ -29,6 +29,7 @@ export type User = { status?: string added?: string updated?: string + bvn?: string } export type UsersQueryResponse = Response> diff --git a/src/app/modules/apps/user-management/users-list/core/_requests.ts b/src/app/modules/apps/user-management/users-list/core/_requests.ts index a585521..bb37b33 100644 --- a/src/app/modules/apps/user-management/users-list/core/_requests.ts +++ b/src/app/modules/apps/user-management/users-list/core/_requests.ts @@ -13,9 +13,9 @@ const NEW_USER_ENDPOINT = import.meta.env.VITE_APP_USER_ENDPOINT // .get(`${GET_USERS_URL}?${query}`) // .then((d: AxiosResponse) => d.data); // }; -const getStartedUsers = (query: string): Promise => { // FUNCTION TO GET USERS THAT HAVE STARTED LOAN APPLICATION +const getCustomerList = (query: string): Promise => { // FUNCTION TO GET USERS THAT HAVE STARTED LOAN APPLICATION return axios - .get(`${NEW_USER_ENDPOINT}/loan/started`) + .get(`${NEW_USER_ENDPOINT}/customers`) .then((d: AxiosResponse) => d.data); }; @@ -50,7 +50,7 @@ const deleteSelectedUsers = (userIds: Array): Promise => { }; export { - getStartedUsers, + getCustomerList, deleteUser, deleteSelectedUsers, getUserById, diff --git a/src/app/modules/apps/user-management/users-list/table/columns/AgentCell.tsx b/src/app/modules/apps/user-management/users-list/table/columns/AgentCell.tsx deleted file mode 100644 index 063ade5..0000000 --- a/src/app/modules/apps/user-management/users-list/table/columns/AgentCell.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import {FC} from 'react' - -type Props = { - agent?: string -} - -const AgentCell: FC = ({agent}) => ( - <> {agent &&
{agent}
} -) - -export {AgentCell} diff --git a/src/app/modules/apps/user-management/users-list/table/columns/Status.tsx b/src/app/modules/apps/user-management/users-list/table/columns/Status.tsx new file mode 100644 index 0000000..518667c --- /dev/null +++ b/src/app/modules/apps/user-management/users-list/table/columns/Status.tsx @@ -0,0 +1,11 @@ +import {FC} from 'react' + +type Props = { + status?: string +} + +const Status: FC = ({status}) => ( + <> {status &&
{status}
} +) + +export {Status} diff --git a/src/app/modules/apps/user-management/users-list/table/columns/_columns.tsx b/src/app/modules/apps/user-management/users-list/table/columns/_columns.tsx index 897f37a..594d918 100644 --- a/src/app/modules/apps/user-management/users-list/table/columns/_columns.tsx +++ b/src/app/modules/apps/user-management/users-list/table/columns/_columns.tsx @@ -1,7 +1,7 @@ import {Column} from 'react-table' import {UserInfoCell} from './UserInfoCell' import { PaymentMonthCell } from './UserLastLoginCell' -import {AgentCell} from './AgentCell' +import {Status} from './Status' import {UserActionsCell} from './UserActionsCell' import {UserSelectionCell} from './UserSelectionCell' import {UserCustomHeader} from './UserCustomHeader' @@ -21,22 +21,22 @@ const usersColumns: ReadonlyArray> = [ Cell: ({...props}) => , }, { - Header: (props) => , - accessor: 'loan_amount', + Header: (props) => , + accessor: 'bvn', }, + // { + // Header: (props) => ( + // + // ), + // id: 'payment_month', + // Cell: ({...props}) => , + // }, { Header: (props) => ( - + ), - id: 'payment_month', - Cell: ({...props}) => , - }, - { - Header: (props) => ( - - ), - id: 'sales_agent', - Cell: ({...props}) => , + id: 'status', + Cell: ({...props}) => , }, { Header: (props) => ( -- 2.34.1