Pfadauswahl hinzugefügt

This commit is contained in:
PxlLoewe
2025-06-25 21:06:03 -07:00
parent 7ad75bff63
commit 2bd8a455c8
14 changed files with 253 additions and 90 deletions

View File

@@ -5,7 +5,7 @@ import ModalBtn from "./modalBtn";
import MDEditor from "@uiw/react-md-editor";
import { Badge } from "../../../_components/Badge/Badge";
export const KursItem = ({
export const EventCard = ({
user,
event,
selectedAppointments,
@@ -13,8 +13,8 @@ export const KursItem = ({
}: {
user: User;
event: Event & {
appointments: EventAppointment[];
participants: Participant[];
Appointments: EventAppointment[];
Participants: Participant[];
};
selectedAppointments: EventAppointment[];
appointments: EventAppointment[];
@@ -28,8 +28,8 @@ export const KursItem = ({
{event.type === "COURSE" && (
<span className="badge badge-info badge-outline">Zusatzqualifikation</span>
)}
{event.type === "OBLIGATED_COURSE" && (
<span className="badge badge-secondary badge-outline">Verpflichtend</span>
{event.type === "EVENT" && (
<span className="badge badge-secondary badge-outline">Event</span>
)}
</div>
<div className="grid grid-cols-6 gap-4">
@@ -75,7 +75,7 @@ export const KursItem = ({
event={event}
title={event.name}
dates={appointments}
participant={event.participants[0]}
participant={event.Participants[0]}
modalId={`${event.name}_modal.${event.id}`}
/>
</div>

View File

@@ -92,7 +92,7 @@ const ModalBtn = ({
<button
className={cn(
"btn btn-outline btn-info btn-wide",
event.type === "OBLIGATED_COURSE" && "btn-secondary",
event.type === "COURSE" && "btn-secondary",
eventCompleted(event, participant) && "btn-success",
)}
onClick={openModal}
@@ -219,7 +219,7 @@ const ModalBtn = ({
<button
className={cn(
"btn btn-info btn-outline btn-wide",
event.type === "OBLIGATED_COURSE" && "btn-secondary",
event.type === "COURSE" && "btn-secondary",
)}
onClick={async () => {
const data = selectAppointmentForm.getValues();

View File

@@ -1,6 +1,6 @@
import { prisma } from "@repo/db";
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
import { KursItem } from "./_components/item";
import { EventCard } from "./_components/item";
import { RocketIcon } from "@radix-ui/react-icons";
const page = async () => {
@@ -11,14 +11,14 @@ const page = async () => {
const events = await prisma.event.findMany({
include: {
appointments: {
Appointments: {
where: {
appointmentDate: {
gte: new Date(),
},
},
},
participants: {
Participants: {
where: {
userId: user.id,
},
@@ -69,7 +69,7 @@ const page = async () => {
{events.map((event) => {
return (
<KursItem
<EventCard
appointments={appointments}
selectedAppointments={userAppointments}
user={user}