Added user modal table contents
This commit is contained in:
parent
5eabc9c6de
commit
fae864dbf5
|
|
@ -29,7 +29,7 @@
|
||||||
"@types/node": "^20.14.2",
|
"@types/node": "^20.14.2",
|
||||||
"drizzle-kit": "^0.21.4",
|
"drizzle-kit": "^0.21.4",
|
||||||
"pg": "^8.12.0",
|
"pg": "^8.12.0",
|
||||||
"tsx": "^4.13.2",
|
"tsx": "^4.15.1",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^5.4.5"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
"@mantine/hooks": "^7.10.1",
|
"@mantine/hooks": "^7.10.1",
|
||||||
"@mantine/notifications": "^7.10.1",
|
"@mantine/notifications": "^7.10.1",
|
||||||
"@tanstack/react-query": "^5.40.1",
|
"@tanstack/react-query": "^5.40.1",
|
||||||
"@tanstack/react-router": "^1.35.3",
|
"@tanstack/react-router": "^1.35.5",
|
||||||
"@tanstack/react-table": "^8.17.3",
|
"@tanstack/react-table": "^8.17.3",
|
||||||
"backend": "workspace:*",
|
"backend": "workspace:*",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
|
@ -27,14 +27,14 @@
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tanstack/eslint-plugin-query": "^5.35.6",
|
"@tanstack/eslint-plugin-query": "^5.43.1",
|
||||||
"@tanstack/router-devtools": "^1.35.3",
|
"@tanstack/router-devtools": "^1.35.5",
|
||||||
"@tanstack/router-vite-plugin": "^1.34.8",
|
"@tanstack/router-vite-plugin": "^1.35.4",
|
||||||
"@types/node": "^20.14.2",
|
"@types/node": "^20.14.2",
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
||||||
"@typescript-eslint/parser": "^7.12.0",
|
"@typescript-eslint/parser": "^7.13.0",
|
||||||
"@vitejs/plugin-react-swc": "^3.7.0",
|
"@vitejs/plugin-react-swc": "^3.7.0",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.19",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,12 @@ import { userQueryOptions } from "@/modules/usersManagement/queries/userQueries"
|
||||||
import PageTemplate from "@/components/PageTemplate";
|
import PageTemplate from "@/components/PageTemplate";
|
||||||
import { createLazyFileRoute } from "@tanstack/react-router";
|
import { createLazyFileRoute } from "@tanstack/react-router";
|
||||||
import UserFormModal from "@/modules/usersManagement/modals/UserFormModal";
|
import UserFormModal from "@/modules/usersManagement/modals/UserFormModal";
|
||||||
import { createColumnHelper } from "@tanstack/react-table";
|
|
||||||
import ExtractQueryDataType from "@/types/ExtractQueryDataType";
|
import ExtractQueryDataType from "@/types/ExtractQueryDataType";
|
||||||
|
import { createColumnHelper } from "@tanstack/react-table";
|
||||||
|
import { Badge, Flex } from "@mantine/core";
|
||||||
|
import createActionButtons from "@/utils/createActionButton";
|
||||||
|
import { TbEye, TbPencil, TbTrash } from "react-icons/tb";
|
||||||
|
import UserDeleteModal from "@/modules/usersManagement/modals/UserDeleteModal";
|
||||||
|
|
||||||
export const Route = createLazyFileRoute("/_dashboardLayout/users/")({
|
export const Route = createLazyFileRoute("/_dashboardLayout/users/")({
|
||||||
component: UsersPage,
|
component: UsersPage,
|
||||||
|
|
@ -18,21 +22,62 @@ export default function UsersPage() {
|
||||||
<PageTemplate
|
<PageTemplate
|
||||||
title="Users"
|
title="Users"
|
||||||
queryOptions={userQueryOptions}
|
queryOptions={userQueryOptions}
|
||||||
modals={[<UserFormModal />]}
|
modals={[<UserFormModal />, <UserDeleteModal />]}
|
||||||
columnDefs={[
|
columnDefs={[
|
||||||
columnHelper.display({
|
columnHelper.display({
|
||||||
id: "sequence",
|
|
||||||
header: "#",
|
header: "#",
|
||||||
cell: (props) => props.row.index + 1,
|
cell: (props) => props.row.index + 1,
|
||||||
size: 1,
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
columnHelper.accessor("email", {
|
columnHelper.display({
|
||||||
header: "Email",
|
header: "Name",
|
||||||
|
cell: (props) => props.row.original.name,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
columnHelper.accessor("email", {
|
columnHelper.display({
|
||||||
header: "Email",
|
header: "Username",
|
||||||
|
cell: (props) => props.row.original.username,
|
||||||
|
}),
|
||||||
|
|
||||||
|
columnHelper.display({
|
||||||
|
header: "Status",
|
||||||
|
cell: (props) =>
|
||||||
|
props.row.original.isEnabled ? (
|
||||||
|
<Badge color="green">Active</Badge>
|
||||||
|
) : (
|
||||||
|
<Badge color="red">Inactive</Badge>
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
|
||||||
|
columnHelper.display({
|
||||||
|
header: "Actions",
|
||||||
|
cell: (props) => (
|
||||||
|
<Flex gap="xs">
|
||||||
|
{createActionButtons([
|
||||||
|
{
|
||||||
|
label: "Detail",
|
||||||
|
permission: true,
|
||||||
|
action: `?detail=${props.row.original.id}`,
|
||||||
|
color: "green",
|
||||||
|
icon: <TbEye />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Edit",
|
||||||
|
permission: true,
|
||||||
|
action: `?edit=${props.row.original.id}`,
|
||||||
|
color: "orange",
|
||||||
|
icon: <TbPencil />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Delete",
|
||||||
|
permission: true,
|
||||||
|
action: `?delete=${props.row.original.id}`,
|
||||||
|
color: "red",
|
||||||
|
icon: <TbTrash />,
|
||||||
|
},
|
||||||
|
])}
|
||||||
|
</Flex>
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
639
pnpm-lock.yaml
639
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user