removal of redundant pages
This commit is contained in:
@@ -2,7 +2,7 @@ import { useQueryClient, useMutation } from "react-query";
|
|||||||
import { QUERIES } from "../../../../../../_digifi/helpers";
|
import { QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteSelectedUsers } from "../../core/_requests";
|
import { deleteSelectedUsers } from "../../../core/_requests";
|
||||||
|
|
||||||
const UsersListGrouping = () => {
|
const UsersListGrouping = () => {
|
||||||
const { selected, clearSelected } = useListView();
|
const { selected, clearSelected } = useListView();
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
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: "",
|
|
||||||
};
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
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 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,
|
|
||||||
deleteUser,
|
|
||||||
deleteSelectedUsers,
|
|
||||||
getUserById,
|
|
||||||
createUser,
|
|
||||||
updateUser,
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {ColumnInstance} from 'react-table'
|
import {ColumnInstance} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
column: ColumnInstance<User>
|
column: ColumnInstance<User>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {Row} from 'react-table'
|
import {Row} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
row: Row<User>
|
row: Row<User>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MenuComponent } from "../../../../../../_digifi/assets/ts/components";
|
|||||||
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteUser } from "../../core/_requests";
|
import { deleteUser } from "../../../core/_requests";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: ID;
|
id: ID;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { FC, PropsWithChildren, useMemo } from "react";
|
|||||||
import { HeaderProps } from "react-table";
|
import { HeaderProps } from "react-table";
|
||||||
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
||||||
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User;
|
user: User;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {FC, PropsWithChildren} from 'react'
|
import {FC, PropsWithChildren} from 'react'
|
||||||
import {HeaderProps} from 'react-table'
|
import {HeaderProps} from 'react-table'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tableProps: PropsWithChildren<HeaderProps<User>>
|
tableProps: PropsWithChildren<HeaderProps<User>>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {UserActionsCell} from './UserActionsCell'
|
|||||||
import {UserSelectionCell} from './UserSelectionCell'
|
import {UserSelectionCell} from './UserSelectionCell'
|
||||||
import {UserCustomHeader} from './UserCustomHeader'
|
import {UserCustomHeader} from './UserCustomHeader'
|
||||||
import {UserSelectionHeader} from './UserSelectionHeader'
|
import {UserSelectionHeader} from './UserSelectionHeader'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
import { AddedCell } from './AddedCell'
|
import { AddedCell } from './AddedCell'
|
||||||
|
|
||||||
const usersColumns: ReadonlyArray<Column<User>> = [
|
const usersColumns: ReadonlyArray<Column<User>> = [
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { FC, useState } from "react";
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
||||||
import { initialUser, User } from "../core/_models";
|
import { initialUser, User } from "../../core/_models";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
||||||
import { createUser, updateUser } from "../core/_requests";
|
import { createUser, updateUser } from "../../core/_requests";
|
||||||
import { useQueryResponse } from "../core/QueryResponseProvider";
|
import { useQueryResponse } from "../core/QueryResponseProvider";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQuery } from "react-query";
|
|||||||
import { UserEditModalForm } from "./UserEditModalForm";
|
import { UserEditModalForm } from "./UserEditModalForm";
|
||||||
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { getUserById } from "../core/_requests";
|
import { getUserById } from "../../core/_requests";
|
||||||
|
|
||||||
const UserEditModalFormWrapper = () => {
|
const UserEditModalFormWrapper = () => {
|
||||||
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQueryClient, useMutation } from "react-query";
|
|||||||
import { QUERIES } from "../../../../../../_digifi/helpers";
|
import { QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteSelectedUsers } from "../../core/_requests";
|
import { deleteSelectedUsers } from "../../../core/_requests";
|
||||||
|
|
||||||
const UsersListGrouping = () => {
|
const UsersListGrouping = () => {
|
||||||
const { selected, clearSelected } = useListView();
|
const { selected, clearSelected } = useListView();
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
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: "",
|
|
||||||
};
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
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 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,
|
|
||||||
deleteUser,
|
|
||||||
deleteSelectedUsers,
|
|
||||||
getUserById,
|
|
||||||
createUser,
|
|
||||||
updateUser,
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {ColumnInstance} from 'react-table'
|
import {ColumnInstance} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
column: ColumnInstance<User>
|
column: ColumnInstance<User>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {Row} from 'react-table'
|
import {Row} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
row: Row<User>
|
row: Row<User>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import { MenuComponent } from "../../../../../../_digifi/assets/ts/components";
|
|||||||
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteUser } from "../../core/_requests";
|
import { deleteUser } from "../../../core/_requests";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: ID;
|
id: ID;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { FC, PropsWithChildren, useMemo } from "react";
|
|||||||
import { HeaderProps } from "react-table";
|
import { HeaderProps } from "react-table";
|
||||||
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
||||||
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User;
|
user: User;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {FC, PropsWithChildren} from 'react'
|
import {FC, PropsWithChildren} from 'react'
|
||||||
import {HeaderProps} from 'react-table'
|
import {HeaderProps} from 'react-table'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tableProps: PropsWithChildren<HeaderProps<User>>
|
tableProps: PropsWithChildren<HeaderProps<User>>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {UserActionsCell} from './UserActionsCell'
|
|||||||
import {UserSelectionCell} from './UserSelectionCell'
|
import {UserSelectionCell} from './UserSelectionCell'
|
||||||
import {UserCustomHeader} from './UserCustomHeader'
|
import {UserCustomHeader} from './UserCustomHeader'
|
||||||
import {UserSelectionHeader} from './UserSelectionHeader'
|
import {UserSelectionHeader} from './UserSelectionHeader'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
import { AddedCell } from './AddedCell'
|
import { AddedCell } from './AddedCell'
|
||||||
|
|
||||||
const usersColumns: ReadonlyArray<Column<User>> = [
|
const usersColumns: ReadonlyArray<Column<User>> = [
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { FC, useState } from "react";
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
||||||
import { initialUser, User } from "../core/_models";
|
import { initialUser, User } from "../../core/_models";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
||||||
import { createUser, updateUser } from "../core/_requests";
|
import { createUser, updateUser } from "../../core/_requests";
|
||||||
import { useQueryResponse } from "../core/QueryResponseProvider";
|
import { useQueryResponse } from "../core/QueryResponseProvider";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQuery } from "react-query";
|
|||||||
import { UserEditModalForm } from "./UserEditModalForm";
|
import { UserEditModalForm } from "./UserEditModalForm";
|
||||||
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { getUserById } from "../core/_requests";
|
import { getUserById } from "../../core/_requests";
|
||||||
|
|
||||||
const UserEditModalFormWrapper = () => {
|
const UserEditModalFormWrapper = () => {
|
||||||
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQueryClient, useMutation } from "react-query";
|
|||||||
import { QUERIES } from "../../../../../../_digifi/helpers";
|
import { QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteSelectedUsers } from "../../core/_requests";
|
import { deleteSelectedUsers } from "../../../core/_requests";
|
||||||
|
|
||||||
const UsersListGrouping = () => {
|
const UsersListGrouping = () => {
|
||||||
const { selected, clearSelected } = useListView();
|
const { selected, clearSelected } = useListView();
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
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: "",
|
|
||||||
};
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
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 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,
|
|
||||||
deleteUser,
|
|
||||||
deleteSelectedUsers,
|
|
||||||
getUserById,
|
|
||||||
createUser,
|
|
||||||
updateUser,
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {ColumnInstance} from 'react-table'
|
import {ColumnInstance} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
column: ColumnInstance<User>
|
column: ColumnInstance<User>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {Row} from 'react-table'
|
import {Row} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
row: Row<User>
|
row: Row<User>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MenuComponent } from "../../../../../../_digifi/assets/ts/components";
|
|||||||
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteUser } from "../../core/_requests";
|
import { deleteUser } from "../../../core/_requests";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: ID;
|
id: ID;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { FC, PropsWithChildren, useMemo } from "react";
|
|||||||
import { HeaderProps } from "react-table";
|
import { HeaderProps } from "react-table";
|
||||||
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
||||||
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User;
|
user: User;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {FC, PropsWithChildren} from 'react'
|
import {FC, PropsWithChildren} from 'react'
|
||||||
import {HeaderProps} from 'react-table'
|
import {HeaderProps} from 'react-table'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tableProps: PropsWithChildren<HeaderProps<User>>
|
tableProps: PropsWithChildren<HeaderProps<User>>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {UserActionsCell} from './UserActionsCell'
|
|||||||
import {UserSelectionCell} from './UserSelectionCell'
|
import {UserSelectionCell} from './UserSelectionCell'
|
||||||
import {UserCustomHeader} from './UserCustomHeader'
|
import {UserCustomHeader} from './UserCustomHeader'
|
||||||
import {UserSelectionHeader} from './UserSelectionHeader'
|
import {UserSelectionHeader} from './UserSelectionHeader'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
import { AddedCell } from './AddedCell'
|
import { AddedCell } from './AddedCell'
|
||||||
|
|
||||||
const usersColumns: ReadonlyArray<Column<User>> = [
|
const usersColumns: ReadonlyArray<Column<User>> = [
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { FC, useState } from "react";
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
||||||
import { initialUser, User } from "../core/_models";
|
import { initialUser, User } from "../../core/_models";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
||||||
import { createUser, updateUser } from "../core/_requests";
|
import { createUser, updateUser } from "../../core/_requests";
|
||||||
import { useQueryResponse } from "../core/QueryResponseProvider";
|
import { useQueryResponse } from "../core/QueryResponseProvider";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQuery } from "react-query";
|
|||||||
import { UserEditModalForm } from "./UserEditModalForm";
|
import { UserEditModalForm } from "./UserEditModalForm";
|
||||||
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { getUserById } from "../core/_requests";
|
import { getUserById } from "../../core/_requests";
|
||||||
|
|
||||||
const UserEditModalFormWrapper = () => {
|
const UserEditModalFormWrapper = () => {
|
||||||
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {useQueryClient, useMutation} from 'react-query'
|
|||||||
import {QUERIES} from '../../../../../../_digifi/helpers'
|
import {QUERIES} from '../../../../../../_digifi/helpers'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {useQueryResponse} from '../../core/QueryResponseProvider'
|
import {useQueryResponse} from '../../core/QueryResponseProvider'
|
||||||
import {deleteSelectedUsers} from '../../core/_requests'
|
import {deleteSelectedUsers} from '../../../core/_requests'
|
||||||
|
|
||||||
const UsersListGrouping = () => {
|
const UsersListGrouping = () => {
|
||||||
const {selected, clearSelected} = useListView()
|
const {selected, clearSelected} = useListView()
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
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: '',
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
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 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,
|
|
||||||
deleteUser,
|
|
||||||
deleteSelectedUsers,
|
|
||||||
getUserById,
|
|
||||||
createUser,
|
|
||||||
updateUser,
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {ColumnInstance} from 'react-table'
|
import {ColumnInstance} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
column: ColumnInstance<User>
|
column: ColumnInstance<User>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {Row} from 'react-table'
|
import {Row} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
row: Row<User>
|
row: Row<User>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {MenuComponent} from '../../../../../../_digifi/assets/ts/components'
|
|||||||
import {ID, KTIcon, QUERIES} from '../../../../../../_digifi/helpers'
|
import {ID, KTIcon, QUERIES} from '../../../../../../_digifi/helpers'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {useQueryResponse} from '../../core/QueryResponseProvider'
|
import {useQueryResponse} from '../../core/QueryResponseProvider'
|
||||||
import {deleteUser} from '../../core/_requests'
|
import {deleteUser} from '../../../core/_requests'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: ID
|
id: ID
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {FC, PropsWithChildren, useMemo} from 'react'
|
|||||||
import {HeaderProps} from 'react-table'
|
import {HeaderProps} from 'react-table'
|
||||||
import {initialQueryState} from '../../../../../../_digifi/helpers'
|
import {initialQueryState} from '../../../../../../_digifi/helpers'
|
||||||
import {useQueryRequest} from '../../core/QueryRequestProvider'
|
import {useQueryRequest} from '../../core/QueryRequestProvider'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string
|
className?: string
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {toAbsoluteUrl} from '../../../../../../_digifi/helpers'
|
import {toAbsoluteUrl} from '../../../../../../_digifi/helpers'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User
|
user: User
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {FC, PropsWithChildren} from 'react'
|
import {FC, PropsWithChildren} from 'react'
|
||||||
import {HeaderProps} from 'react-table'
|
import {HeaderProps} from 'react-table'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tableProps: PropsWithChildren<HeaderProps<User>>
|
tableProps: PropsWithChildren<HeaderProps<User>>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {UserActionsCell} from './UserActionsCell'
|
|||||||
import {UserSelectionCell} from './UserSelectionCell'
|
import {UserSelectionCell} from './UserSelectionCell'
|
||||||
import {UserCustomHeader} from './UserCustomHeader'
|
import {UserCustomHeader} from './UserCustomHeader'
|
||||||
import {UserSelectionHeader} from './UserSelectionHeader'
|
import {UserSelectionHeader} from './UserSelectionHeader'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
import { AddedCell } from './AddedCell'
|
import { AddedCell } from './AddedCell'
|
||||||
|
|
||||||
const usersColumns: ReadonlyArray<Column<User>> = [
|
const usersColumns: ReadonlyArray<Column<User>> = [
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import {FC, useState} from 'react'
|
|||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import {useFormik} from 'formik'
|
import {useFormik} from 'formik'
|
||||||
import {isNotEmpty, toAbsoluteUrl} from '../../../../../_digifi/helpers'
|
import {isNotEmpty, toAbsoluteUrl} from '../../../../../_digifi/helpers'
|
||||||
import {initialUser, User} from '../core/_models'
|
import {initialUser, User} from '../../core/_models'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {useListView} from '../core/ListViewProvider'
|
import {useListView} from '../core/ListViewProvider'
|
||||||
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
import {UsersListLoading} from '../components/loading/UsersListLoading'
|
||||||
import {createUser, updateUser} from '../core/_requests'
|
import {createUser, updateUser} from '../../core/_requests'
|
||||||
import {useQueryResponse} from '../core/QueryResponseProvider'
|
import {useQueryResponse} from '../core/QueryResponseProvider'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {useQuery} from 'react-query'
|
|||||||
import {UserEditModalForm} from './UserEditModalForm'
|
import {UserEditModalForm} from './UserEditModalForm'
|
||||||
import {isNotEmpty, QUERIES} from '../../../../../_digifi/helpers'
|
import {isNotEmpty, QUERIES} from '../../../../../_digifi/helpers'
|
||||||
import {useListView} from '../core/ListViewProvider'
|
import {useListView} from '../core/ListViewProvider'
|
||||||
import {getUserById} from '../core/_requests'
|
import {getUserById} from '../../core/_requests'
|
||||||
|
|
||||||
const UserEditModalFormWrapper = () => {
|
const UserEditModalFormWrapper = () => {
|
||||||
const {itemIdForUpdate, setItemIdForUpdate} = useListView()
|
const {itemIdForUpdate, setItemIdForUpdate} = useListView()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQueryClient, useMutation } from "react-query";
|
|||||||
import { QUERIES } from "../../../../../../_digifi/helpers";
|
import { QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteSelectedUsers } from "../../core/_requests";
|
import { deleteSelectedUsers } from "../../../core/_requests";
|
||||||
|
|
||||||
const UsersListGrouping = () => {
|
const UsersListGrouping = () => {
|
||||||
const { selected, clearSelected } = useListView();
|
const { selected, clearSelected } = useListView();
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
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: "",
|
|
||||||
};
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
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 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,
|
|
||||||
deleteUser,
|
|
||||||
deleteSelectedUsers,
|
|
||||||
getUserById,
|
|
||||||
createUser,
|
|
||||||
updateUser,
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {ColumnInstance} from 'react-table'
|
import {ColumnInstance} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
column: ColumnInstance<User>
|
column: ColumnInstance<User>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {FC} from 'react'
|
import {FC} from 'react'
|
||||||
import {Row} from 'react-table'
|
import {Row} from 'react-table'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
row: Row<User>
|
row: Row<User>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MenuComponent } from "../../../../../../_digifi/assets/ts/components";
|
|||||||
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
import { ID, KTIcon, QUERIES } from "../../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../../core/ListViewProvider";
|
import { useListView } from "../../core/ListViewProvider";
|
||||||
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
import { useQueryResponse } from "../../core/QueryResponseProvider";
|
||||||
import { deleteUser } from "../../core/_requests";
|
import { deleteUser } from "../../../core/_requests";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: ID;
|
id: ID;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { FC, PropsWithChildren, useMemo } from "react";
|
|||||||
import { HeaderProps } from "react-table";
|
import { HeaderProps } from "react-table";
|
||||||
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
import { initialQueryState } from "../../../../../../_digifi/helpers";
|
||||||
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
import { useQueryRequest } from "../../core/QueryRequestProvider";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
import { toAbsoluteUrl } from "../../../../../../_digifi/helpers";
|
||||||
import { User } from "../../core/_models";
|
import { User } from "../../../core/_models";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User;
|
user: User;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {FC, PropsWithChildren} from 'react'
|
import {FC, PropsWithChildren} from 'react'
|
||||||
import {HeaderProps} from 'react-table'
|
import {HeaderProps} from 'react-table'
|
||||||
import {useListView} from '../../core/ListViewProvider'
|
import {useListView} from '../../core/ListViewProvider'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tableProps: PropsWithChildren<HeaderProps<User>>
|
tableProps: PropsWithChildren<HeaderProps<User>>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {UserActionsCell} from './UserActionsCell'
|
|||||||
import {UserSelectionCell} from './UserSelectionCell'
|
import {UserSelectionCell} from './UserSelectionCell'
|
||||||
import {UserCustomHeader} from './UserCustomHeader'
|
import {UserCustomHeader} from './UserCustomHeader'
|
||||||
import {UserSelectionHeader} from './UserSelectionHeader'
|
import {UserSelectionHeader} from './UserSelectionHeader'
|
||||||
import {User} from '../../core/_models'
|
import {User} from '../../../core/_models'
|
||||||
import { AddedCell } from './AddedCell'
|
import { AddedCell } from './AddedCell'
|
||||||
|
|
||||||
const usersColumns: ReadonlyArray<Column<User>> = [
|
const usersColumns: ReadonlyArray<Column<User>> = [
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { FC, useState } from "react";
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, toAbsoluteUrl } from "../../../../../_digifi/helpers";
|
||||||
import { initialUser, User } from "../core/_models";
|
import { initialUser, User } from "../../core/_models";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
import { UsersListLoading } from "../components/loading/UsersListLoading";
|
||||||
import { createUser, updateUser } from "../core/_requests";
|
import { createUser, updateUser } from "../../core/_requests";
|
||||||
import { useQueryResponse } from "../core/QueryResponseProvider";
|
import { useQueryResponse } from "../core/QueryResponseProvider";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useQuery } from "react-query";
|
|||||||
import { UserEditModalForm } from "./UserEditModalForm";
|
import { UserEditModalForm } from "./UserEditModalForm";
|
||||||
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
|
||||||
import { useListView } from "../core/ListViewProvider";
|
import { useListView } from "../core/ListViewProvider";
|
||||||
import { getUserById } from "../core/_requests";
|
import { getUserById } from "../../core/_requests";
|
||||||
|
|
||||||
const UserEditModalFormWrapper = () => {
|
const UserEditModalFormWrapper = () => {
|
||||||
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
|
||||||
|
|||||||
Reference in New Issue
Block a user