Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a28d478d8 | |||
| 0d9318ddd9 | |||
| c53c37611a | |||
| f7d82c0958 |
@@ -1,18 +1,23 @@
|
||||
import clsx from 'clsx'
|
||||
import {KTIcon, toAbsoluteUrl} from '../../../helpers'
|
||||
import {HeaderNotificationsMenu, HeaderUserMenu, Search, ThemeModeSwitcher} from '../../../partials'
|
||||
import {useLayout} from '../../core'
|
||||
import clsx from 'clsx';
|
||||
import { KTIcon, toAbsoluteUrl } from '../../../helpers';
|
||||
import {
|
||||
HeaderNotificationsMenu,
|
||||
HeaderUserMenu,
|
||||
Search,
|
||||
ThemeModeSwitcher,
|
||||
} from '../../../partials';
|
||||
import { useLayout } from '../../core';
|
||||
|
||||
const itemClass = 'ms-1 ms-md-4'
|
||||
const itemClass = 'ms-1 ms-md-4';
|
||||
const btnClass =
|
||||
'btn btn-icon btn-custom btn-icon-muted btn-active-light btn-active-color-primary w-35px h-35px'
|
||||
const userAvatarClass = 'symbol-35px'
|
||||
const btnIconClass = 'fs-2'
|
||||
'btn btn-icon btn-custom btn-icon-muted btn-active-light btn-active-color-primary w-35px h-35px';
|
||||
const userAvatarClass = 'symbol-35px';
|
||||
const btnIconClass = 'fs-2';
|
||||
|
||||
const Navbar = () => {
|
||||
const {config} = useLayout()
|
||||
const { config } = useLayout();
|
||||
return (
|
||||
<div className='app-navbar flex-shrink-0'>
|
||||
<div className="app-navbar flex-shrink-0">
|
||||
{/* <div className={clsx('app-navbar-item align-items-stretch', itemClass)}>
|
||||
<Search />
|
||||
</div> */}
|
||||
@@ -43,33 +48,42 @@ const Navbar = () => {
|
||||
</div> */}
|
||||
|
||||
<div className={clsx('app-navbar-item', itemClass)}>
|
||||
<ThemeModeSwitcher toggleBtnClass={clsx('btn-active-light-primary btn-custom')} />
|
||||
<ThemeModeSwitcher
|
||||
toggleBtnClass={clsx('btn-active-light-primary btn-custom')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={clsx('app-navbar-item', itemClass)}>
|
||||
<div
|
||||
className={clsx('cursor-pointer symbol', userAvatarClass)}
|
||||
data-kt-menu-trigger="{default: 'click'}"
|
||||
data-kt-menu-attach='parent'
|
||||
data-kt-menu-placement='bottom-end'
|
||||
data-kt-menu-attach="parent"
|
||||
data-kt-menu-placement="bottom-end"
|
||||
>
|
||||
<img src={toAbsoluteUrl('media/avatars/300-3.jpg')} alt='' />
|
||||
<img
|
||||
src={toAbsoluteUrl('media/avatars/300-3.jpg')}
|
||||
alt=""
|
||||
style={{ cursor: 'auto' }}
|
||||
/>
|
||||
</div>
|
||||
<HeaderUserMenu />
|
||||
{/* <HeaderUserMenu /> */}
|
||||
</div>
|
||||
|
||||
{config.app?.header?.default?.menu?.display && (
|
||||
<div className='app-navbar-item d-lg-none ms-2 me-n3' title='Show header menu'>
|
||||
<div
|
||||
className="app-navbar-item d-lg-none ms-2 me-n3"
|
||||
title="Show header menu"
|
||||
>
|
||||
<div
|
||||
className='btn btn-icon btn-active-color-primary w-35px h-35px'
|
||||
id='kt_app_header_menu_toggle'
|
||||
className="btn btn-icon btn-active-color-primary w-35px h-35px"
|
||||
id="kt_app_header_menu_toggle"
|
||||
>
|
||||
<KTIcon iconName='text-align-left' className={btnIconClass} />
|
||||
<KTIcon iconName="text-align-left" className={btnIconClass} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export {Navbar}
|
||||
export { Navbar };
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { ID, Response } from "../../../../_digifi/helpers"
|
||||
|
||||
export type User = {
|
||||
id?: ID
|
||||
name?: string
|
||||
avatar?: string
|
||||
// email?: string
|
||||
position?: string
|
||||
role?: string
|
||||
last_login?: string
|
||||
two_steps?: boolean
|
||||
joined_day?: string
|
||||
online?: boolean
|
||||
initials?: {
|
||||
label: string
|
||||
state: string
|
||||
}
|
||||
firstname?: string,
|
||||
lastname?: string
|
||||
uid?: string
|
||||
loan_amount?: string
|
||||
payment_month?: string
|
||||
sales_agent?: string
|
||||
gender?: string | null
|
||||
marital_status?: string
|
||||
email?: string
|
||||
address?: string
|
||||
state?: string
|
||||
country?: string
|
||||
status?: string
|
||||
added?: string
|
||||
updated?: string
|
||||
}
|
||||
|
||||
export type UsersQueryResponse = Response<Array<User>>
|
||||
|
||||
export const initialUser: User = {
|
||||
avatar: 'avatars/300-6.jpg',
|
||||
position: 'Art Director',
|
||||
role: 'Administrator',
|
||||
name: '',
|
||||
email: '',
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import axios, { AxiosResponse } from "axios";
|
||||
import { ID, Response } from "../../../../_digifi/helpers"
|
||||
import { User, UsersQueryResponse } from "./_models";
|
||||
|
||||
const API_URL = import.meta.env.VITE_APP_THEME_API_URL;
|
||||
const USER_URL = `${API_URL}/user`;
|
||||
// const GET_USERS_URL = `${API_URL}/users/query`;
|
||||
|
||||
const NEW_USER_ENDPOINT = import.meta.env.VITE_APP_USER_ENDPOINT
|
||||
|
||||
// const getStartedUsers = (query: string): Promise<UsersQueryResponse> => {
|
||||
// return axios
|
||||
// .get(`${GET_USERS_URL}?${query}`)
|
||||
// .then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
// };
|
||||
const getStartedUsers = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE STARTED LOAN APPLICATION
|
||||
return axios
|
||||
.get(`${NEW_USER_ENDPOINT}/loan/started`)
|
||||
.then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
};
|
||||
|
||||
const getRejectedUsers = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE REJECTED LOAN APPLICATION
|
||||
return axios
|
||||
.get(`${NEW_USER_ENDPOINT}/loan/rejected`)
|
||||
.then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
};
|
||||
|
||||
const getPendingUsers = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE PENDING LOAN APPLICATION
|
||||
return axios
|
||||
.get(`${NEW_USER_ENDPOINT}/loan/pending`)
|
||||
.then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
};
|
||||
|
||||
const getReadyUsers = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE READY LOAN APPLICATION
|
||||
return axios
|
||||
.get(`${NEW_USER_ENDPOINT}/loan/ready`)
|
||||
.then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
};
|
||||
|
||||
const getApprovedUsers = (query: string): Promise<UsersQueryResponse> => { // FUNCTION TO GET USERS THAT HAVE APPROVED LOAN APPLICATION
|
||||
return axios
|
||||
.get(`${NEW_USER_ENDPOINT}/loan/approved`)
|
||||
.then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
};
|
||||
|
||||
const getUserById = (id: ID): Promise<User | undefined> => {
|
||||
return axios
|
||||
.get(`${USER_URL}/${id}`)
|
||||
.then((response: AxiosResponse<Response<User>>) => response.data)
|
||||
.then((response: Response<User>) => response.data);
|
||||
};
|
||||
|
||||
const createUser = (user: User): Promise<User | undefined> => {
|
||||
return axios
|
||||
.put(USER_URL, user)
|
||||
.then((response: AxiosResponse<Response<User>>) => response.data)
|
||||
.then((response: Response<User>) => response.data);
|
||||
};
|
||||
|
||||
const updateUser = (user: User): Promise<User | undefined> => {
|
||||
return axios
|
||||
.post(`${USER_URL}/${user.id}`, user)
|
||||
.then((response: AxiosResponse<Response<User>>) => response.data)
|
||||
.then((response: Response<User>) => response.data);
|
||||
};
|
||||
|
||||
const deleteUser = (userId: ID): Promise<void> => {
|
||||
return axios.delete(`${USER_URL}/${userId}`).then(() => {});
|
||||
};
|
||||
|
||||
const deleteSelectedUsers = (userIds: Array<ID>): Promise<void> => {
|
||||
const requests = userIds.map((id) => axios.delete(`${USER_URL}/${id}`));
|
||||
return axios.all(requests).then(() => {});
|
||||
};
|
||||
|
||||
export {
|
||||
getStartedUsers,
|
||||
getRejectedUsers,
|
||||
getPendingUsers,
|
||||
getReadyUsers,
|
||||
getApprovedUsers,
|
||||
deleteUser,
|
||||
deleteSelectedUsers,
|
||||
getUserById,
|
||||
createUser,
|
||||
updateUser,
|
||||
};
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
stringifyRequestQuery,
|
||||
WithChildren,
|
||||
} from '../../../../../../_digifi/helpers'
|
||||
import {getStartedUsers} from './_requests'
|
||||
import {User} from './_models'
|
||||
import {getApprovedUsers} from '../../../core/_requests'
|
||||
import {User} from '../../../core/_models'
|
||||
import {useQueryRequest} from './QueryRequestProvider'
|
||||
|
||||
const QueryResponseContext = createResponseContext<User>(initialQueryResponse)
|
||||
@@ -34,7 +34,7 @@ const QueryResponseProvider: FC<WithChildren> = ({children}) => {
|
||||
} = useQuery(
|
||||
`${QUERIES.USERS_LIST}-${query}`,
|
||||
() => {
|
||||
return getStartedUsers(query)
|
||||
return getApprovedUsers(query)
|
||||
},
|
||||
{cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false}
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import {CustomHeaderColumn} from './columns/CustomHeaderColumn'
|
||||
import {CustomRow} from './columns/CustomRow'
|
||||
import {useQueryResponseData, useQueryResponseLoading} from '../core/QueryResponseProvider'
|
||||
import {usersColumns} from './columns/_columns'
|
||||
import {User} from '../core/_models'
|
||||
import {User} from '../../../core/_models'
|
||||
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
||||
import {UsersListPagination} from '../components/pagination/UsersListPagination'
|
||||
import {KTCardBody} from '../../../../../../_digifi/helpers'
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
stringifyRequestQuery,
|
||||
WithChildren,
|
||||
} from '../../../../../../_digifi/helpers'
|
||||
import {getStartedUsers} from './_requests'
|
||||
import {User} from './_models'
|
||||
import {getPendingUsers} from '../../../core/_requests'
|
||||
import {User} from '../../../core/_models'
|
||||
import {useQueryRequest} from './QueryRequestProvider'
|
||||
|
||||
const QueryResponseContext = createResponseContext<User>(initialQueryResponse)
|
||||
@@ -34,7 +34,7 @@ const QueryResponseProvider: FC<WithChildren> = ({children}) => {
|
||||
} = useQuery(
|
||||
`${QUERIES.USERS_LIST}-${query}`,
|
||||
() => {
|
||||
return getStartedUsers(query)
|
||||
return getPendingUsers(query)
|
||||
},
|
||||
{cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false}
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import {CustomHeaderColumn} from './columns/CustomHeaderColumn'
|
||||
import {CustomRow} from './columns/CustomRow'
|
||||
import {useQueryResponseData, useQueryResponseLoading} from '../core/QueryResponseProvider'
|
||||
import {usersColumns} from './columns/_columns'
|
||||
import {User} from '../core/_models'
|
||||
import {User} from '../../../core/_models'
|
||||
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
||||
import {UsersListPagination} from '../components/pagination/UsersListPagination'
|
||||
import {KTCardBody} from '../../../../../../_digifi/helpers'
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
stringifyRequestQuery,
|
||||
WithChildren,
|
||||
} from '../../../../../../_digifi/helpers'
|
||||
import {getStartedUsers} from './_requests'
|
||||
import {User} from './_models'
|
||||
import {getReadyUsers} from '../../../core/_requests'
|
||||
import {User} from '../../../core/_models'
|
||||
import {useQueryRequest} from './QueryRequestProvider'
|
||||
|
||||
const QueryResponseContext = createResponseContext<User>(initialQueryResponse)
|
||||
@@ -34,7 +34,7 @@ const QueryResponseProvider: FC<WithChildren> = ({children}) => {
|
||||
} = useQuery(
|
||||
`${QUERIES.USERS_LIST}-${query}`,
|
||||
() => {
|
||||
return getStartedUsers(query)
|
||||
return getReadyUsers(query)
|
||||
},
|
||||
{cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false}
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import {CustomHeaderColumn} from './columns/CustomHeaderColumn'
|
||||
import {CustomRow} from './columns/CustomRow'
|
||||
import {useQueryResponseData, useQueryResponseLoading} from '../core/QueryResponseProvider'
|
||||
import {usersColumns} from './columns/_columns'
|
||||
import {User} from '../core/_models'
|
||||
import {User} from '../../../core/_models'
|
||||
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
||||
import {UsersListPagination} from '../components/pagination/UsersListPagination'
|
||||
import {KTCardBody} from '../../../../../../_digifi/helpers'
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
stringifyRequestQuery,
|
||||
WithChildren,
|
||||
} from '../../../../../../_digifi/helpers'
|
||||
import {getStartedUsers} from './_requests'
|
||||
import {User} from './_models'
|
||||
import {getRejectedUsers} from '../../../core/_requests'
|
||||
import {User} from '../../../core/_models'
|
||||
import {useQueryRequest} from './QueryRequestProvider'
|
||||
|
||||
const QueryResponseContext = createResponseContext<User>(initialQueryResponse)
|
||||
@@ -34,7 +34,7 @@ const QueryResponseProvider: FC<WithChildren> = ({children}) => {
|
||||
} = useQuery(
|
||||
`${QUERIES.USERS_LIST}-${query}`,
|
||||
() => {
|
||||
return getStartedUsers(query)
|
||||
return getRejectedUsers(query)
|
||||
},
|
||||
{cacheTime: 0, keepPreviousData: true, refetchOnWindowFocus: false}
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import {CustomHeaderColumn} from './columns/CustomHeaderColumn'
|
||||
import {CustomRow} from './columns/CustomRow'
|
||||
import {useQueryResponseData, useQueryResponseLoading} from '../core/QueryResponseProvider'
|
||||
import {usersColumns} from './columns/_columns'
|
||||
import {User} from '../core/_models'
|
||||
import {User} from '../../../core/_models'
|
||||
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
||||
import {UsersListPagination} from '../components/pagination/UsersListPagination'
|
||||
import {KTCardBody} from '../../../../../../_digifi/helpers'
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
stringifyRequestQuery,
|
||||
WithChildren,
|
||||
} from '../../../../../../_digifi/helpers'
|
||||
import {getStartedUsers} from './_requests'
|
||||
import {User} from './_models'
|
||||
import {getStartedUsers} from '../../../core/_requests'
|
||||
import {User} from '../../../core/_models'
|
||||
import {useQueryRequest} from './QueryRequestProvider'
|
||||
|
||||
const QueryResponseContext = createResponseContext<User>(initialQueryResponse)
|
||||
|
||||
@@ -4,7 +4,7 @@ import {CustomHeaderColumn} from './columns/CustomHeaderColumn'
|
||||
import {CustomRow} from './columns/CustomRow'
|
||||
import {useQueryResponseData, useQueryResponseLoading} from '../core/QueryResponseProvider'
|
||||
import {usersColumns} from './columns/_columns'
|
||||
import {User} from '../core/_models'
|
||||
import {User} from '../../../core/_models'
|
||||
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
||||
import {UsersListPagination} from '../components/pagination/UsersListPagination'
|
||||
import {KTCardBody} from '../../../../../../_digifi/helpers'
|
||||
|
||||
Reference in New Issue
Block a user