From 302e4d85b66b1ab8e14c07dd3d4248c32269a528 Mon Sep 17 00:00:00 2001 From: Sianida26 Date: Sat, 27 Jan 2024 18:15:07 +0700 Subject: [PATCH] add role page --- package.json | 14 +- pnpm-lock.yaml | 313 +++++++----------- .../_components/CreateButton/CreateButton.tsx | 20 ++ .../roles/_modals/CreateModal/CreateModal.tsx | 25 ++ .../(auth)/roles/_modals/CreateModal/index.ts | 1 + .../roles/_modals/FormModal/FormModal.tsx | 131 ++++++++ .../(auth)/roles/_modals/FormModal/index.ts | 1 + .../dashboard/(auth)/roles/_modals/index.ts | 5 + .../roles/_tables/RolesTable/RolesTable.tsx | 7 +- .../roles/_tables/RolesTable/columns.tsx | 5 + src/app/dashboard/(auth)/roles/page.tsx | 43 ++- .../users/_modals/FormModal/FormModal.tsx | 9 +- src/features/auth/tools/checkPermission.ts | 4 +- src/features/auth/types/CrudPermissions.d.ts | 8 + .../roles/formSchemas/RoleFormData.ts | 19 ++ 15 files changed, 379 insertions(+), 226 deletions(-) create mode 100644 src/app/dashboard/(auth)/roles/_components/CreateButton/CreateButton.tsx create mode 100644 src/app/dashboard/(auth)/roles/_modals/CreateModal/CreateModal.tsx create mode 100644 src/app/dashboard/(auth)/roles/_modals/CreateModal/index.ts create mode 100644 src/app/dashboard/(auth)/roles/_modals/FormModal/FormModal.tsx create mode 100644 src/app/dashboard/(auth)/roles/_modals/FormModal/index.ts create mode 100644 src/app/dashboard/(auth)/roles/_modals/index.ts create mode 100644 src/features/auth/types/CrudPermissions.d.ts create mode 100644 src/features/dashboard/roles/formSchemas/RoleFormData.ts diff --git a/package.json b/package.json index afe1d90..de00b0c 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "lint": "next lint" }, "dependencies": { - "@auth/prisma-adapter": "^1.0.16", - "@mantine/core": "^7.4.2", - "@mantine/form": "^7.4.2", - "@mantine/hooks": "^7.4.2", - "@mantine/notifications": "^7.4.2", + "@auth/prisma-adapter": "^1.1.0", + "@mantine/core": "^7.5.0", + "@mantine/form": "^7.5.0", + "@mantine/hooks": "^7.5.0", + "@mantine/notifications": "^7.5.0", "@prisma/client": "5.8.1", "@tanstack/react-query": "^4.36.1", "@tanstack/react-query-devtools": "^4.36.1", @@ -24,7 +24,7 @@ "@trpc/server": "^10.45.0", "@types/bcrypt": "^5.0.2", "@types/jsonwebtoken": "^9.0.5", - "@typescript-eslint/eslint-plugin": "^6.19.0", + "@typescript-eslint/eslint-plugin": "^6.19.1", "bcrypt": "^5.1.1", "client-only": "^0.0.1", "clsx": "^2.1.0", @@ -40,7 +40,7 @@ "zod": "^3.22.4" }, "devDependencies": { - "@types/node": "^20.11.5", + "@types/node": "^20.11.7", "@types/react": "^18.2.48", "@types/react-dom": "^18.2.18", "autoprefixer": "^10.4.17", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6bdce9..91d688e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,20 +6,20 @@ settings: dependencies: '@auth/prisma-adapter': - specifier: ^1.0.16 - version: 1.0.16(@prisma/client@5.8.1) + specifier: ^1.1.0 + version: 1.1.0(@prisma/client@5.8.1) '@mantine/core': - specifier: ^7.4.2 - version: 7.4.2(@mantine/hooks@7.4.2)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0) + specifier: ^7.5.0 + version: 7.5.0(@mantine/hooks@7.5.0)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0) '@mantine/form': - specifier: ^7.4.2 - version: 7.4.2(react@18.2.0) + specifier: ^7.5.0 + version: 7.5.0(react@18.2.0) '@mantine/hooks': - specifier: ^7.4.2 - version: 7.4.2(react@18.2.0) + specifier: ^7.5.0 + version: 7.5.0(react@18.2.0) '@mantine/notifications': - specifier: ^7.4.2 - version: 7.4.2(@mantine/core@7.4.2)(@mantine/hooks@7.4.2)(react-dom@18.2.0)(react@18.2.0) + specifier: ^7.5.0 + version: 7.5.0(@mantine/core@7.5.0)(@mantine/hooks@7.5.0)(react-dom@18.2.0)(react@18.2.0) '@prisma/client': specifier: 5.8.1 version: 5.8.1(prisma@5.8.1) @@ -51,8 +51,8 @@ dependencies: specifier: ^9.0.5 version: 9.0.5 '@typescript-eslint/eslint-plugin': - specifier: ^6.19.0 - version: 6.19.0(@typescript-eslint/parser@6.19.1)(eslint@8.56.0)(typescript@5.3.3) + specifier: ^6.19.1 + version: 6.19.1(@typescript-eslint/parser@6.19.1)(eslint@8.56.0)(typescript@5.3.3) bcrypt: specifier: ^5.1.1 version: 5.1.1 @@ -67,7 +67,7 @@ dependencies: version: 9.0.2 mantine-form-zod-resolver: specifier: ^1.1.0 - version: 1.1.0(@mantine/form@7.4.2)(zod@3.22.4) + version: 1.1.0(@mantine/form@7.5.0)(zod@3.22.4) next: specifier: 14.1.0 version: 14.1.0(react-dom@18.2.0)(react@18.2.0)(sass@1.70.0) @@ -95,8 +95,8 @@ dependencies: devDependencies: '@types/node': - specifier: ^20.11.5 - version: 20.11.5 + specifier: ^20.11.7 + version: 20.11.7 '@types/react': specifier: ^18.2.48 version: 18.2.48 @@ -142,8 +142,8 @@ packages: engines: {node: '>=10'} dev: true - /@auth/core@0.22.0: - resolution: {integrity: sha512-BwngPhtcEtJPV+sfs8pGPZ+RdKnpBeXRk2K2Os10DyMfaL/Vszj2TJU6sRaS38hXzo+xycYX+83olBElqc2Ngw==} + /@auth/core@0.24.0: + resolution: {integrity: sha512-wwTyapljg4ydyvtQRXSeOaj6nBVSvPkVoXws6i+/vPfINxz4lo9UuLifPLqW7iO72/f4Ttaez0g3XA42VtKQ8A==} peerDependencies: nodemailer: ^6.8.0 peerDependenciesMeta: @@ -154,24 +154,24 @@ packages: '@types/cookie': 0.6.0 cookie: 0.6.0 jose: 5.2.0 - oauth4webapi: 2.7.0 + oauth4webapi: 2.8.1 preact: 10.11.3 preact-render-to-string: 5.2.3(preact@10.11.3) dev: false - /@auth/prisma-adapter@1.0.16(@prisma/client@5.8.1): - resolution: {integrity: sha512-i7+XCxrbv5n8Yp9r+FznvnOBG7BrjpfmXr4Fl7pL7LPgTGhDJPE10BokVf5tGTsR8SGnAp04qhBzgjTrTrmpPQ==} + /@auth/prisma-adapter@1.1.0(@prisma/client@5.8.1): + resolution: {integrity: sha512-FSHnAmdrrW7b87pKjtnSCOgEthNK9ZAdZJDfncuG3YpXr4whiDfFhqg4UXgmnn/nEXuCIAY6wL3eZIa044vIOQ==} peerDependencies: '@prisma/client': '>=2.26.0 || >=3 || >=4 || >=5' dependencies: - '@auth/core': 0.22.0 + '@auth/core': 0.24.0 '@prisma/client': 5.8.1(prisma@5.8.1) transitivePeerDependencies: - nodemailer dev: false - /@babel/runtime@7.23.8: - resolution: {integrity: sha512-Y7KbAP984rn1VGMbGqKmBLio9V7y5Je9GvU4rQPCPinCyNfUcToxIXl06d59URp/F3LwinvODxab5N/G6qggkw==} + /@babel/runtime@7.23.9: + resolution: {integrity: sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 @@ -209,26 +209,26 @@ packages: resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - /@floating-ui/core@1.5.3: - resolution: {integrity: sha512-O0WKDOo0yhJuugCx6trZQj5jVJ9yR0ystG2JaNAemYUWce+pmM6WUEFIibnWyEJKdrDxhm75NoSRME35FNaM/Q==} + /@floating-ui/core@1.6.0: + resolution: {integrity: sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g==} dependencies: '@floating-ui/utils': 0.2.1 dev: false - /@floating-ui/dom@1.5.4: - resolution: {integrity: sha512-jByEsHIY+eEdCjnTVu+E3ephzTOzkQ8hgUfGwos+bg7NlH33Zc5uO+QHz1mrQUOgIKKDD1RtS201P9NvAfq3XQ==} + /@floating-ui/dom@1.6.0: + resolution: {integrity: sha512-SZ0BEXzsaaS6THZfZJUcAobbZTD+MvfGM42bxgeg0Tnkp4/an/avqwAXiVLsFtIBZtfsx3Ymvwx0+KnnhdA/9g==} dependencies: - '@floating-ui/core': 1.5.3 + '@floating-ui/core': 1.6.0 '@floating-ui/utils': 0.2.1 dev: false - /@floating-ui/react-dom@2.0.6(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-IB8aCRFxr8nFkdYZgH+Otd9EVQPJoynxeFRGTB8voPoZMRWo8XjYuCRgpI1btvuKY69XMiLnW+ym7zoBHM90Rw==} + /@floating-ui/react-dom@2.0.7(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-B5GJxKUyPcGsvE1vua+Abvw0t6zVMyTbtG+Jk7BoI4hfc5Ahv50dstRIAn0nS0274kR9gnKwxIXyGA8EzBZJrA==} peerDependencies: react: '>=16.8.0' react-dom: '>=16.8.0' dependencies: - '@floating-ui/dom': 1.5.4 + '@floating-ui/dom': 1.6.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false @@ -239,7 +239,7 @@ packages: react: '>=16.8.0' react-dom: '>=16.8.0' dependencies: - '@floating-ui/react-dom': 2.0.6(react-dom@18.2.0)(react@18.2.0) + '@floating-ui/react-dom': 2.0.7(react-dom@18.2.0)(react@18.2.0) aria-hidden: 1.2.3 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -309,15 +309,15 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true - /@mantine/core@7.4.2(@mantine/hooks@7.4.2)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-kXmq7NjSd1AsOIzqPwQhA7SeZS9hrbARRqhRwr4LLR3NKps9hLmVto441DnpHH/D27eL9gGLSl4GRIdogjX6mg==} + /@mantine/core@7.5.0(@mantine/hooks@7.5.0)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-0Qfn4oLCs6Qrli+JK6Q325xhNblVEPSKOB4sDMUkvKYUlCt/2lsIhwUXarVBgiIV3X+rKccf0/LcEWmpn/dYuw==} peerDependencies: - '@mantine/hooks': 7.4.2 + '@mantine/hooks': 7.5.0 react: ^18.2.0 react-dom: ^18.2.0 dependencies: '@floating-ui/react': 0.24.8(react-dom@18.2.0)(react@18.2.0) - '@mantine/hooks': 7.4.2(react@18.2.0) + '@mantine/hooks': 7.5.0(react@18.2.0) clsx: 2.0.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -329,8 +329,8 @@ packages: - '@types/react' dev: false - /@mantine/form@7.4.2(react@18.2.0): - resolution: {integrity: sha512-zlacaHazqmB9NBOp3pHE8+nDlNKUnT02QbV6q4/CNitAlfqDwbB8u9tWKsSU3E0QF6s5oAzcTY+apyD/nWgfrA==} + /@mantine/form@7.5.0(react@18.2.0): + resolution: {integrity: sha512-Bp2ZYwt+oYXNUm7ySPwst5C9S44YvrdsiFXjUzjX1QaoznAWern1W0dtyF7vJ3KWOoY9+7XXx+Ou4pHTOIq/hQ==} peerDependencies: react: ^18.2.0 dependencies: @@ -339,32 +339,32 @@ packages: react: 18.2.0 dev: false - /@mantine/hooks@7.4.2(react@18.2.0): - resolution: {integrity: sha512-tNtn/SNOtSmjLQmIk4S5nsTJjV84Oj0AUYRrAN78HHw3bfWp6bdWbgYPtPEH9e6iFJfdxiX0hrLfWqROalAsbQ==} + /@mantine/hooks@7.5.0(react@18.2.0): + resolution: {integrity: sha512-KCL/RRMO+9HRIaNww3RIykifWL9XHovnANAyaCU2YUHOPyGCLSXs1UfFxsKNU71HaZ7cHwqSd7J0rR8JpVYLxw==} peerDependencies: react: ^18.2.0 dependencies: react: 18.2.0 dev: false - /@mantine/notifications@7.4.2(@mantine/core@7.4.2)(@mantine/hooks@7.4.2)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-lOIv9x+ifb2HyW3SE2UYEWzeQoKVptBR9HCB1m+KUzZiJ5pnBrujWluBzhqYghShr/wykc4Rf4L0hx39egCP9g==} + /@mantine/notifications@7.5.0(@mantine/core@7.5.0)(@mantine/hooks@7.5.0)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-43+PwX1WTTffmRjAAH/42Zk0ffXny5DMIry+WGfyNQdoN1JPL1w9eulpWhPFMUn2fm7wHyrKTRpiZdfp8ry2Ow==} peerDependencies: - '@mantine/core': 7.4.2 - '@mantine/hooks': 7.4.2 + '@mantine/core': 7.5.0 + '@mantine/hooks': 7.5.0 react: ^18.2.0 react-dom: ^18.2.0 dependencies: - '@mantine/core': 7.4.2(@mantine/hooks@7.4.2)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0) - '@mantine/hooks': 7.4.2(react@18.2.0) - '@mantine/store': 7.4.2(react@18.2.0) + '@mantine/core': 7.5.0(@mantine/hooks@7.5.0)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0) + '@mantine/hooks': 7.5.0(react@18.2.0) + '@mantine/store': 7.5.0(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-transition-group: 4.4.5(react-dom@18.2.0)(react@18.2.0) dev: false - /@mantine/store@7.4.2(react@18.2.0): - resolution: {integrity: sha512-XGGAKu3oUMmnpw8USe4La+T+oSVqsIhYKDjKPxRs5iQ9GKPtxwabAqBXEkPHA1y/txrsEaU5eJVu0ysyBbU4hQ==} + /@mantine/store@7.5.0(react@18.2.0): + resolution: {integrity: sha512-NvPS6ERKxHGnkIEY8ip/v3ySYYPQlJq6KtSSXALlJ/BdyezBTsBrkEkEgJxJcYK5H4TYr9jDjLYNL3PQy4GHxg==} peerDependencies: react: ^18.2.0 dependencies: @@ -496,7 +496,7 @@ packages: engines: {node: '>= 8'} dependencies: '@nodelib/fs.scandir': 2.1.5 - fastq: 1.16.0 + fastq: 1.17.0 /@panva/hkdf@1.1.1: resolution: {integrity: sha512-dhPeilub1NuIG0X5Kvhh9lH4iW3ZsHlnzwgwbOlgwQ2wG1IqFzsgHqmKPk3WzsdWAeaxKJxgM0+W433RmN45GA==} @@ -549,8 +549,8 @@ packages: dependencies: '@prisma/debug': 5.8.1 - /@rushstack/eslint-patch@1.7.0: - resolution: {integrity: sha512-Jh4t/593gxs0lJZ/z3NnasKlplXT2f+4y/LZYuaKZW5KAaiVFL/fThhs+17EbUd53jUVJ0QudYCBGbN/psvaqg==} + /@rushstack/eslint-patch@1.7.2: + resolution: {integrity: sha512-RbhOOTCNoCrbfkRyoXODZp75MlpiHMgbE5MEBZAnnnLyQNgrigEj4p0lzsMDyc1zVsJDLrivB58tgg3emX0eEA==} dev: true /@swc/helpers@0.5.2: @@ -671,7 +671,7 @@ packages: /@types/bcrypt@5.0.2: resolution: {integrity: sha512-6atioO8Y75fNcbmj0G7UjI9lXN2pQ/IGJ2FWT4a/btd0Lk9lQalHLKhkgKVZ3r+spnmWUKfbMi1GEe9wyHQfNQ==} dependencies: - '@types/node': 20.11.5 + '@types/node': 20.11.7 dev: false /@types/cookie@0.6.0: @@ -689,11 +689,11 @@ packages: /@types/jsonwebtoken@9.0.5: resolution: {integrity: sha512-VRLSGzik+Unrup6BsouBeHsf4d1hOEgYWTm/7Nmw1sXoN1+tRly/Gy/po3yeahnP4jfnQWWAhQAqcNfH7ngOkA==} dependencies: - '@types/node': 20.11.5 + '@types/node': 20.11.7 dev: false - /@types/node@20.11.5: - resolution: {integrity: sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==} + /@types/node@20.11.7: + resolution: {integrity: sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==} dependencies: undici-types: 5.26.5 @@ -720,8 +720,8 @@ packages: resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} dev: false - /@typescript-eslint/eslint-plugin@6.19.0(@typescript-eslint/parser@6.19.1)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==} + /@typescript-eslint/eslint-plugin@6.19.1(@typescript-eslint/parser@6.19.1)(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -733,10 +733,10 @@ packages: dependencies: '@eslint-community/regexpp': 4.10.0 '@typescript-eslint/parser': 6.19.1(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/scope-manager': 6.19.0 - '@typescript-eslint/type-utils': 6.19.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.19.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.19.0 + '@typescript-eslint/scope-manager': 6.19.1 + '@typescript-eslint/type-utils': 6.19.1(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.19.1(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.19.1 debug: 4.3.4 eslint: 8.56.0 graphemer: 1.4.0 @@ -749,27 +749,6 @@ packages: - supports-color dev: false - /@typescript-eslint/parser@6.19.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 6.19.0 - '@typescript-eslint/types': 6.19.0 - '@typescript-eslint/typescript-estree': 6.19.0(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.19.0 - debug: 4.3.4 - eslint: 8.56.0 - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/parser@6.19.1(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -790,13 +769,6 @@ packages: transitivePeerDependencies: - supports-color - /@typescript-eslint/scope-manager@6.19.0: - resolution: {integrity: sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.19.0 - '@typescript-eslint/visitor-keys': 6.19.0 - /@typescript-eslint/scope-manager@6.19.1: resolution: {integrity: sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==} engines: {node: ^16.0.0 || >=18.0.0} @@ -804,8 +776,8 @@ packages: '@typescript-eslint/types': 6.19.1 '@typescript-eslint/visitor-keys': 6.19.1 - /@typescript-eslint/type-utils@6.19.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==} + /@typescript-eslint/type-utils@6.19.1(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -814,8 +786,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.19.0(typescript@5.3.3) - '@typescript-eslint/utils': 6.19.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.3.3) + '@typescript-eslint/utils': 6.19.1(eslint@8.56.0)(typescript@5.3.3) debug: 4.3.4 eslint: 8.56.0 ts-api-utils: 1.0.3(typescript@5.3.3) @@ -824,35 +796,10 @@ packages: - supports-color dev: false - /@typescript-eslint/types@6.19.0: - resolution: {integrity: sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==} - engines: {node: ^16.0.0 || >=18.0.0} - /@typescript-eslint/types@6.19.1: resolution: {integrity: sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==} engines: {node: ^16.0.0 || >=18.0.0} - /@typescript-eslint/typescript-estree@6.19.0(typescript@5.3.3): - resolution: {integrity: sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.19.0 - '@typescript-eslint/visitor-keys': 6.19.0 - debug: 4.3.4 - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.3.3) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - /@typescript-eslint/typescript-estree@6.19.1(typescript@5.3.3): resolution: {integrity: sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==} engines: {node: ^16.0.0 || >=18.0.0} @@ -874,8 +821,8 @@ packages: transitivePeerDependencies: - supports-color - /@typescript-eslint/utils@6.19.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==} + /@typescript-eslint/utils@6.19.1(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -883,9 +830,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.6 - '@typescript-eslint/scope-manager': 6.19.0 - '@typescript-eslint/types': 6.19.0 - '@typescript-eslint/typescript-estree': 6.19.0(typescript@5.3.3) + '@typescript-eslint/scope-manager': 6.19.1 + '@typescript-eslint/types': 6.19.1 + '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.3.3) eslint: 8.56.0 semver: 7.5.4 transitivePeerDependencies: @@ -893,13 +840,6 @@ packages: - typescript dev: false - /@typescript-eslint/visitor-keys@6.19.0: - resolution: {integrity: sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.19.0 - eslint-visitor-keys: 3.4.3 - /@typescript-eslint/visitor-keys@6.19.1: resolution: {integrity: sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1099,8 +1039,8 @@ packages: peerDependencies: postcss: ^8.1.0 dependencies: - browserslist: 4.22.2 - caniuse-lite: 1.0.30001579 + browserslist: 4.22.3 + caniuse-lite: 1.0.30001580 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -1160,15 +1100,15 @@ packages: dependencies: fill-range: 7.0.1 - /browserslist@4.22.2: - resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} + /browserslist@4.22.3: + resolution: {integrity: sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001579 - electron-to-chromium: 1.4.640 + caniuse-lite: 1.0.30001580 + electron-to-chromium: 1.4.648 node-releases: 2.0.14 - update-browserslist-db: 1.0.13(browserslist@4.22.2) + update-browserslist-db: 1.0.13(browserslist@4.22.3) dev: true /buffer-equal-constant-time@1.0.1: @@ -1199,8 +1139,8 @@ packages: engines: {node: '>= 6'} dev: true - /caniuse-lite@1.0.30001579: - resolution: {integrity: sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==} + /caniuse-lite@1.0.30001580: + resolution: {integrity: sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==} /chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} @@ -1392,7 +1332,7 @@ packages: /dom-helpers@5.2.1: resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==} dependencies: - '@babel/runtime': 7.23.8 + '@babel/runtime': 7.23.9 csstype: 3.1.3 dev: false @@ -1406,8 +1346,8 @@ packages: safe-buffer: 5.2.1 dev: false - /electron-to-chromium@1.4.640: - resolution: {integrity: sha512-z/6oZ/Muqk4BaE7P69bXhUhpJbUM9ZJeka43ZwxsDshKtePns4mhBlh8bU5+yrnOnz3fhG82XLzGUXazOmsWnA==} + /electron-to-chromium@1.4.648: + resolution: {integrity: sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==} dev: true /emoji-regex@8.0.0: @@ -1532,12 +1472,12 @@ packages: optional: true dependencies: '@next/eslint-plugin-next': 14.0.4 - '@rushstack/eslint-patch': 1.7.0 - '@typescript-eslint/parser': 6.19.0(eslint@8.56.0)(typescript@5.3.3) + '@rushstack/eslint-patch': 1.7.2 + '@typescript-eslint/parser': 6.19.1(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint@8.56.0) + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) eslint-plugin-jsx-a11y: 6.8.0(eslint@8.56.0) eslint-plugin-react: 7.33.2(eslint@8.56.0) eslint-plugin-react-hooks: 4.6.0(eslint@8.56.0) @@ -1557,7 +1497,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0): + /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0): resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -1567,8 +1507,8 @@ packages: debug: 4.3.4 enhanced-resolve: 5.15.0 eslint: 8.56.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint@8.56.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) fast-glob: 3.3.2 get-tsconfig: 4.7.2 is-core-module: 2.13.1 @@ -1580,37 +1520,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0): - resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} - engines: {node: '>=4'} - peerDependencies: - '@typescript-eslint/parser': '*' - eslint: '*' - eslint-import-resolver-node: '*' - eslint-import-resolver-typescript: '*' - eslint-import-resolver-webpack: '*' - peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true - eslint: - optional: true - eslint-import-resolver-node: - optional: true - eslint-import-resolver-typescript: - optional: true - eslint-import-resolver-webpack: - optional: true - dependencies: - '@typescript-eslint/parser': 6.19.0(eslint@8.56.0)(typescript@5.3.3) - debug: 3.2.7 - eslint: 8.56.0 - eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) - transitivePeerDependencies: - - supports-color - dev: true - - /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -1635,11 +1545,12 @@ packages: debug: 3.2.7 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.56.0) transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.19.1)(eslint@8.56.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -1658,7 +1569,7 @@ packages: doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.19.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -1680,7 +1591,7 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 dependencies: - '@babel/runtime': 7.23.8 + '@babel/runtime': 7.23.9 aria-query: 5.3.0 array-includes: 3.1.7 array.prototype.flatmap: 1.3.2 @@ -1837,8 +1748,8 @@ packages: /fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - /fastq@1.16.0: - resolution: {integrity: sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==} + /fastq@1.17.0: + resolution: {integrity: sha512-zGygtijUMT7jnk3h26kUms3BkSDp4IfIKjmnqI2tvx6nuBfiF1UqOxbnLfzdv+apBy+53oaImsKtMw/xYbW+1w==} dependencies: reusify: 1.0.4 @@ -2105,8 +2016,8 @@ packages: resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} engines: {node: '>= 4'} - /immutable@4.3.4: - resolution: {integrity: sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==} + /immutable@4.3.5: + resolution: {integrity: sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==} dev: false /import-fresh@3.3.0: @@ -2495,8 +2406,8 @@ packages: dependencies: js-tokens: 4.0.0 - /lru-cache@10.1.0: - resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} + /lru-cache@10.2.0: + resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} dev: true @@ -2513,14 +2424,14 @@ packages: semver: 6.3.1 dev: false - /mantine-form-zod-resolver@1.1.0(@mantine/form@7.4.2)(zod@3.22.4): + /mantine-form-zod-resolver@1.1.0(@mantine/form@7.5.0)(zod@3.22.4): resolution: {integrity: sha512-hidTuYq6agSF5XbkcVVcr0mkGs9ki/x8OC9ldZMxGLVGja6bdl+x4k1hCNrigCG90DBoMDnu0bo3hprGBBlUZA==} engines: {node: '>=16.6.0'} peerDependencies: '@mantine/form': '>=7.0.0' zod: '>=3.0.0' dependencies: - '@mantine/form': 7.4.2(react@18.2.0) + '@mantine/form': 7.5.0(react@18.2.0) zod: 3.22.4 dev: false @@ -2621,7 +2532,7 @@ packages: '@next/env': 14.1.0 '@swc/helpers': 0.5.2 busboy: 1.6.0 - caniuse-lite: 1.0.30001579 + caniuse-lite: 1.0.30001580 graceful-fs: 4.2.11 postcss: 8.4.31 react: 18.2.0 @@ -2689,8 +2600,8 @@ packages: set-blocking: 2.0.0 dev: false - /oauth4webapi@2.7.0: - resolution: {integrity: sha512-XxmYWOSL9jO4K/ufyZL0YeqE1M+3ZNJ4gdo8C3bpuBemibFBLAlAXiVia2HCiErTzX+q+CFDlhf4o7P0HVsZ0w==} + /oauth4webapi@2.8.1: + resolution: {integrity: sha512-Jm1Z6eUumtevQWxMllSw+4diHOcFyxuc3KAXoyh4fbpHndbXRbviyrLoCn8htEdHYZM/MIOVbeWjDk86BxVF+A==} dev: false /object-assign@4.1.1: @@ -2818,7 +2729,7 @@ packages: resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} engines: {node: '>=16 || 14 >=14.17'} dependencies: - lru-cache: 10.1.0 + lru-cache: 10.2.0 minipass: 7.0.4 dev: true @@ -3087,7 +2998,7 @@ packages: peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: - '@babel/runtime': 7.23.8 + '@babel/runtime': 7.23.9 react: 18.2.0 use-composed-ref: 1.3.0(react@18.2.0) use-latest: 1.2.1(@types/react@18.2.48)(react@18.2.0) @@ -3101,7 +3012,7 @@ packages: react: '>=16.6.0' react-dom: '>=16.6.0' dependencies: - '@babel/runtime': 7.23.8 + '@babel/runtime': 7.23.9 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 @@ -3235,7 +3146,7 @@ packages: hasBin: true dependencies: chokidar: 3.5.3 - immutable: 4.3.4 + immutable: 4.3.5 source-map-js: 1.0.2 dev: false @@ -3646,13 +3557,13 @@ packages: /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - /update-browserslist-db@1.0.13(browserslist@4.22.2): + /update-browserslist-db@1.0.13(browserslist@4.22.3): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.22.2 + browserslist: 4.22.3 escalade: 3.1.1 picocolors: 1.0.0 dev: true diff --git a/src/app/dashboard/(auth)/roles/_components/CreateButton/CreateButton.tsx b/src/app/dashboard/(auth)/roles/_components/CreateButton/CreateButton.tsx new file mode 100644 index 0000000..12c67be --- /dev/null +++ b/src/app/dashboard/(auth)/roles/_components/CreateButton/CreateButton.tsx @@ -0,0 +1,20 @@ +"use client" +import { Button } from '@mantine/core' +import Link from 'next/link' +import { usePathname, useRouter } from 'next/navigation' +import React, { useState } from 'react' +import { TbPlus } from 'react-icons/tb' +import { CreateModal } from '../../_modals' + +export default function CreateButton() { + + const [isModalOpened, setModalOpened] = useState(false) + + return ( + <> + + + setModalOpened(false)} /> + + ) +} diff --git a/src/app/dashboard/(auth)/roles/_modals/CreateModal/CreateModal.tsx b/src/app/dashboard/(auth)/roles/_modals/CreateModal/CreateModal.tsx new file mode 100644 index 0000000..da59749 --- /dev/null +++ b/src/app/dashboard/(auth)/roles/_modals/CreateModal/CreateModal.tsx @@ -0,0 +1,25 @@ +import React from "react"; +import FormModal from "../FormModal"; + +interface Props { + opened: boolean + onClose?: () => void +} + +export default function CreateModal(props: Props) { + return ( + + ); +} diff --git a/src/app/dashboard/(auth)/roles/_modals/CreateModal/index.ts b/src/app/dashboard/(auth)/roles/_modals/CreateModal/index.ts new file mode 100644 index 0000000..c88ba8a --- /dev/null +++ b/src/app/dashboard/(auth)/roles/_modals/CreateModal/index.ts @@ -0,0 +1 @@ +export { default } from "./CreateModal" \ No newline at end of file diff --git a/src/app/dashboard/(auth)/roles/_modals/FormModal/FormModal.tsx b/src/app/dashboard/(auth)/roles/_modals/FormModal/FormModal.tsx new file mode 100644 index 0000000..93e2eb1 --- /dev/null +++ b/src/app/dashboard/(auth)/roles/_modals/FormModal/FormModal.tsx @@ -0,0 +1,131 @@ +"use client" +import roleFormDataSchema, { + RoleFormData, +} from "@/features/dashboard/roles/formSchemas/RoleFormData"; +import { + Flex, + Modal, + Stack, + Switch, + TextInput, + Textarea, + Button, + ScrollArea, + Checkbox, +} from "@mantine/core"; +import { useForm, zodResolver } from "@mantine/form"; +import { useRouter } from "next/navigation"; +import React, { useState } from "react"; +import { TbDeviceFloppy } from "react-icons/tb"; + +interface Props { + title: string; + readonly?: boolean; + data: RoleFormData; + opened: boolean; + onClose?: () => void +} + +export default function FormModal(props: Props) { + const router = useRouter(); + + const [isSubmitting, setSubmitting] = useState(false); + const [value, setValue] = useState("") + + const form = useForm({ + initialValues: props.data, + validate: zodResolver(roleFormDataSchema), + validateInputOnChange: false, + onValuesChange: (values) => {console.log(values)} + }); + + const closeModal = () => { + form.reset() + props.onClose ? props.onClose() : router.replace("?"); + }; + + return ( + + + {/* ID */} + {props.data.id ? ( + + ) :
} + + {/* Code */} + + + {/* Name */} + + + {/* Description */} +