Remove Event-Appointment
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { AppointmentForm } from "(app)/admin/event/_components/AppointmentForm";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export default async function Page({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string; appointmentId: string }>;
|
||||
}) {
|
||||
const { id: eventId, appointmentId } = await params;
|
||||
|
||||
const event = await prisma.event.findUnique({
|
||||
where: { id: parseInt(eventId) },
|
||||
});
|
||||
|
||||
if (!event) return <div>Event nicht gefunden</div>;
|
||||
|
||||
let appointment = null;
|
||||
if (appointmentId !== "new") {
|
||||
appointment = await prisma.eventAppointment.findUnique({
|
||||
where: { id: parseInt(appointmentId) },
|
||||
include: {
|
||||
Presenter: true,
|
||||
Participants: {
|
||||
include: { User: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!appointment) return <div>Termin nicht gefunden</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<AppointmentForm event={event} initialAppointment={appointment} appointmentId={appointmentId} />
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { prisma } from "@repo/db";
|
||||
import { ParticipantForm } from "../../../_components/ParticipantForm";
|
||||
import { Error } from "_components/Error";
|
||||
import Link from "next/link";
|
||||
import { PersonIcon } from "@radix-ui/react-icons";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
|
||||
export default async function Page({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string; participantId: string }>;
|
||||
}) {
|
||||
const { id: eventId, participantId } = await params;
|
||||
|
||||
const event = await prisma.event.findUnique({
|
||||
where: { id: parseInt(eventId) },
|
||||
});
|
||||
|
||||
const participant = await prisma.participant.findUnique({
|
||||
where: { id: parseInt(participantId) },
|
||||
});
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: participant?.userId },
|
||||
});
|
||||
|
||||
if (!event) return <div>Event nicht gefunden</div>;
|
||||
|
||||
if (!participant || !user) {
|
||||
return <Error title="Teilnehmer nicht gefunden" statusCode={404} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="my-3">
|
||||
<div className="text-left">
|
||||
<Link href={`/admin/event/${event.id}`} className="link-hover l-0 text-gray-500">
|
||||
<ArrowLeft className="mb-1 mr-1 inline h-4 w-4" />
|
||||
Zurück zum Event
|
||||
</Link>
|
||||
</div>
|
||||
<p className="text-left text-2xl font-semibold">
|
||||
<PersonIcon className="mr-2 inline h-5 w-5" /> Event-übersicht für{" "}
|
||||
{`${user.firstname} ${user.lastname} #${user.publicId}`}
|
||||
</p>
|
||||
</div>
|
||||
<ParticipantForm event={event} user={user} participant={participant} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user