diff --git a/apps/hub/app/(app)/admin/event/[id]/participant/[participantId]/page.tsx b/apps/hub/app/(app)/admin/event/[id]/participant/[participantId]/page.tsx index e7bd207d..0fadd17e 100644 --- a/apps/hub/app/(app)/admin/event/[id]/participant/[participantId]/page.tsx +++ b/apps/hub/app/(app)/admin/event/[id]/participant/[participantId]/page.tsx @@ -11,6 +11,7 @@ export default async function Page({ params: Promise<{ id: string; participantId: string }>; }) { const { id: eventId, participantId } = await params; + console.log(eventId, participantId); const event = await prisma.event.findUnique({ where: { id: parseInt(eventId) }, @@ -20,11 +21,15 @@ export default async function Page({ where: { id: parseInt(participantId) }, }); + if (!participant) { + return ; + } + const user = await prisma.user.findUnique({ where: { id: participant?.userId }, }); - if (!event) return
Event nicht gefunden
; + if (!event) return ; if (!participant || !user) { return ; diff --git a/apps/hub/app/(app)/admin/event/_components/Form.tsx b/apps/hub/app/(app)/admin/event/_components/Form.tsx index 65bc5e54..55a43f34 100644 --- a/apps/hub/app/(app)/admin/event/_components/Form.tsx +++ b/apps/hub/app/(app)/admin/event/_components/Form.tsx @@ -1,8 +1,8 @@ "use client"; import { zodResolver } from "@hookform/resolvers/zod"; -import { BADGES, Event, EVENT_TYPE, PERMISSION } from "@repo/db"; +import { BADGES, Event, EVENT_TYPE, Participant, PERMISSION, Prisma } from "@repo/db"; import { EventOptionalDefaults, EventOptionalDefaultsSchema } from "@repo/db/zod"; -import { Bot, FileText } from "lucide-react"; +import { Bot, FileText, UserIcon } from "lucide-react"; import { redirect } from "next/navigation"; import "react-datepicker/dist/react-datepicker.css"; import { useForm } from "react-hook-form"; @@ -13,6 +13,10 @@ import { Select } from "../../../../_components/ui/Select"; import { Switch } from "../../../../_components/ui/Switch"; import { deleteEvent, upsertEvent } from "../action"; import toast from "react-hot-toast"; +import { PaginatedTable } from "_components/PaginatedTable"; +import Link from "next/link"; +import { ColumnDef } from "@tanstack/react-table"; +import { User } from "next-auth"; export const Form = ({ event }: { event?: Event }) => { const form = useForm({ @@ -21,7 +25,6 @@ export const Form = ({ event }: { event?: Event }) => { ? { ...event, discordRoleId: event.discordRoleId ?? undefined, - maxParticipants: event.maxParticipants ?? undefined, finisherMoodleCourseId: event.finisherMoodleCourseId ?? undefined, } : undefined, @@ -103,19 +106,115 @@ export const Form = ({ event }: { event?: Event }) => { label="Discord Rolle für eingeschriebene Teilnehmer" className="input-sm" /> -
+
+
+ { + + Teilnehmer + + } + prismaModel={"participant"} + showSearch + getFilter={(searchTerm) => + ({ + AND: [{ eventId: event?.id }], + OR: [ + { + User: { + OR: [ + { firstname: { contains: searchTerm, mode: "insensitive" } }, + { lastname: { contains: searchTerm, mode: "insensitive" } }, + { publicId: { contains: searchTerm, mode: "insensitive" } }, + ], + }, + }, + ], + }) as Prisma.ParticipantWhereInput + } + include={{ + User: true, + }} + supressQuery={!event} + columns={ + [ + { + header: "Vorname", + accessorKey: "User.firstname", + cell: ({ row }) => { + return ( + + {row.original.User.firstname} + + ); + }, + }, + { + header: "Nachname", + accessorKey: "User.lastname", + cell: ({ row }) => { + return ( + + {row.original.User.lastname} + + ); + }, + }, + { + header: "VAR-Nummer", + accessorKey: "User.publicId", + cell: ({ row }) => { + return ( + + {row.original.User.publicId} + + ); + }, + }, + { + header: "Moodle Kurs abgeschlossen", + accessorKey: "finisherMoodleCurseCompleted", + }, + { + header: "Aktionen", + cell: ({ row }) => { + return ( + + + + ); + }, + }, + ] as ColumnDef[] + } + /> + } +
+
diff --git a/package.json b/package.json index da08da6d..a7352403 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "node": ">=18", "pnpm": ">=10" }, - "packageManager": "pnpm@10.28.0", + "packageManager": "pnpm@10.28.2", "workspaces": [ "apps/*", "packages/*" diff --git a/packages/database/package.json b/packages/database/package.json index c197f985..a7eb3e99 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -25,6 +25,7 @@ "zod-prisma-types": "^3.2.4" }, "devDependencies": { + "@types/node": "^25.1.0", "prisma": "^6.12.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9a37750f..14d8004b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -130,7 +130,7 @@ importers: version: 0.5.8(@types/dom-mediacapture-transform@0.1.11)(livekit-client@2.15.3(@types/dom-mediacapture-record@1.0.22)) '@next-auth/prisma-adapter': specifier: ^1.0.7 - version: 1.0.7(@prisma/client@6.12.0(prisma@6.12.0(typescript@5.8.3))(typescript@5.8.3))(next-auth@4.24.13(next@16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)) + version: 1.0.7(@prisma/client@6.12.0(prisma@6.12.0(typescript@5.8.3))(typescript@5.8.3))(next-auth@4.24.13(next@16.1.1(@babel/core@7.27.7)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)) '@radix-ui/react-icons': specifier: ^1.3.2 version: 1.3.2(react@19.1.0) @@ -211,10 +211,10 @@ importers: version: 0.525.0(react@19.1.0) next: specifier: '>=15.4.9' - version: 16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + version: 16.1.1(@babel/core@7.27.7)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) next-auth: specifier: '>=4.24.12' - version: 4.24.13(next@16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + version: 4.24.13(next@16.1.1(@babel/core@7.27.7)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) npm: specifier: ^11.4.2 version: 11.4.2 @@ -588,6 +588,9 @@ importers: specifier: ^3.2.4 version: 3.2.4(@prisma/client@6.12.0(prisma@6.12.0(typescript@5.9.3))(typescript@5.9.3))(prisma@6.12.0(typescript@5.9.3)) devDependencies: + '@types/node': + specifier: ^25.1.0 + version: 25.1.0 prisma: specifier: ^6.12.0 version: 6.12.0(typescript@5.9.3) @@ -2161,6 +2164,9 @@ packages: '@types/node@22.15.34': resolution: {integrity: sha512-8Y6E5WUupYy1Dd0II32BsWAx5MWdcnRd8L84Oys3veg1YrYtNtzgO4CFhiBg6MDSjk7Ay36HYOnU7/tuOzIzcw==} + '@types/node@25.1.0': + resolution: {integrity: sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==} + '@types/nodemailer@6.4.17': resolution: {integrity: sha512-I9CCaIp6DTldEg7vyUTZi8+9Vo0hi1/T8gv3C89yk1rSAAzoKQ8H8ki/jBYJSFoH/BisgLP8tkZMlQ91CIquww==} @@ -5290,6 +5296,9 @@ packages: undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici-types@7.16.0: + resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} + undici@6.21.3: resolution: {integrity: sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==} engines: {node: '>=18.17'} @@ -5603,7 +5612,7 @@ snapshots: '@babel/parser': 7.27.7 '@babel/template': 7.27.2 '@babel/types': 7.27.7 - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -5852,7 +5861,7 @@ snapshots: '@eslint/eslintrc@3.3.1': dependencies: ajv: 6.12.6 - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) espree: 10.4.0 globals: 14.0.0 ignore: 5.3.2 @@ -6091,11 +6100,6 @@ snapshots: '@prisma/client': 6.12.0(prisma@6.12.0(typescript@5.8.3))(typescript@5.8.3) next-auth: 4.24.13(next@16.1.1(@babel/core@7.27.7)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) - '@next-auth/prisma-adapter@1.0.7(@prisma/client@6.12.0(prisma@6.12.0(typescript@5.8.3))(typescript@5.8.3))(next-auth@4.24.13(next@16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))': - dependencies: - '@prisma/client': 6.12.0(prisma@6.12.0(typescript@5.8.3))(typescript@5.8.3) - next-auth: 4.24.13(next@16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) - '@next/env@16.1.1': {} '@next/eslint-plugin-next@15.4.2': @@ -7678,9 +7682,13 @@ snapshots: dependencies: undici-types: 6.21.0 + '@types/node@25.1.0': + dependencies: + undici-types: 7.16.0 + '@types/nodemailer@6.4.17': dependencies: - '@types/node': 22.15.29 + '@types/node': 22.15.34 '@types/parse-json@4.0.2': {} @@ -7749,7 +7757,7 @@ snapshots: '@typescript-eslint/types': 8.37.0 '@typescript-eslint/typescript-estree': 8.37.0(typescript@5.8.3) '@typescript-eslint/visitor-keys': 8.37.0 - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) eslint: 9.31.0(jiti@2.4.2) typescript: 5.8.3 transitivePeerDependencies: @@ -7759,7 +7767,7 @@ snapshots: dependencies: '@typescript-eslint/tsconfig-utils': 8.37.0(typescript@5.8.3) '@typescript-eslint/types': 8.37.0 - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) typescript: 5.8.3 transitivePeerDependencies: - supports-color @@ -7778,7 +7786,7 @@ snapshots: '@typescript-eslint/types': 8.37.0 '@typescript-eslint/typescript-estree': 8.37.0(typescript@5.8.3) '@typescript-eslint/utils': 8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3) - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) eslint: 9.31.0(jiti@2.4.2) ts-api-utils: 2.1.0(typescript@5.8.3) typescript: 5.8.3 @@ -7793,7 +7801,7 @@ snapshots: '@typescript-eslint/tsconfig-utils': 8.37.0(typescript@5.8.3) '@typescript-eslint/types': 8.37.0 '@typescript-eslint/visitor-keys': 8.37.0 - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 @@ -8424,10 +8432,6 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.4.1: - dependencies: - ms: 2.1.3 - debug@4.4.1(supports-color@5.5.0): dependencies: ms: 2.1.3 @@ -8770,7 +8774,7 @@ snapshots: eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@9.31.0(jiti@2.4.2)): dependencies: '@nolyfill/is-core-module': 1.0.39 - debug: 4.4.1 + debug: 4.4.1(supports-color@5.5.0) eslint: 9.31.0(jiti@2.4.2) get-tsconfig: 4.10.1 is-bun-module: 2.0.0 @@ -10223,23 +10227,6 @@ snapshots: optionalDependencies: nodemailer: 7.0.11 - next-auth@4.24.13(next@16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@7.0.11)(react-dom@19.1.0(react@19.1.0))(react@19.1.0): - dependencies: - '@babel/runtime': 7.27.6 - '@panva/hkdf': 1.2.1 - cookie: 0.7.2 - jose: 4.15.9 - next: 16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) - oauth: 0.9.15 - openid-client: 5.7.1 - preact: 10.28.2 - preact-render-to-string: 5.2.6(preact@10.28.2) - react: 19.1.0 - react-dom: 19.1.0(react@19.1.0) - uuid: 8.3.2 - optionalDependencies: - nodemailer: 7.0.11 - next-remove-imports@1.0.12(webpack@5.99.9): dependencies: '@babel/core': 7.27.7 @@ -10275,32 +10262,6 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@16.1.1(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0): - dependencies: - '@next/env': 16.1.1 - '@swc/helpers': 0.5.15 - baseline-browser-mapping: 2.9.14 - caniuse-lite: 1.0.30001726 - postcss: 8.4.31 - react: 19.1.0 - react-dom: 19.1.0(react@19.1.0) - styled-jsx: 5.1.6(react@19.1.0) - optionalDependencies: - '@next/swc-darwin-arm64': 16.1.1 - '@next/swc-darwin-x64': 16.1.1 - '@next/swc-linux-arm64-gnu': 16.1.1 - '@next/swc-linux-arm64-musl': 16.1.1 - '@next/swc-linux-x64-gnu': 16.1.1 - '@next/swc-linux-x64-musl': 16.1.1 - '@next/swc-win32-arm64-msvc': 16.1.1 - '@next/swc-win32-x64-msvc': 16.1.1 - '@opentelemetry/api': 1.9.0 - '@playwright/test': 1.52.0 - sharp: 0.34.5 - transitivePeerDependencies: - - '@babel/core' - - babel-plugin-macros - node-cron@4.2.1: {} node-releases@2.0.19: {} @@ -11238,11 +11199,6 @@ snapshots: optionalDependencies: '@babel/core': 7.27.7 - styled-jsx@5.1.6(react@19.1.0): - dependencies: - client-only: 0.0.1 - react: 19.1.0 - stylis@4.2.0: {} supports-color@5.5.0: @@ -11463,6 +11419,8 @@ snapshots: undici-types@6.21.0: {} + undici-types@7.16.0: {} + undici@6.21.3: {} unified@11.0.5: