added participant overview, (admin), Date input
This commit is contained in:
@@ -5,10 +5,9 @@ import {
|
||||
CalendarIcon,
|
||||
EnterIcon,
|
||||
} from "@radix-ui/react-icons";
|
||||
import { Event, EventAppointment, Participant, User } from "@repo/db";
|
||||
import { Event, EventAppointment, Participant, prisma, User } from "@repo/db";
|
||||
import { cn } from "../../../../helper/cn";
|
||||
import { inscribeToMoodleCourse, upsertParticipant } from "../actions";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { Clock10Icon, Cross } from "lucide-react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import {
|
||||
@@ -22,6 +21,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Select } from "../../../_components/ui/Select";
|
||||
import toast from "react-hot-toast";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { JsonArray } from "../../../../../../packages/database/generated/client/runtime/library";
|
||||
|
||||
interface ModalBtnProps {
|
||||
title: string;
|
||||
@@ -122,50 +122,54 @@ const ModalBtn = ({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{selectedAppointment && !participant?.appointmentCancelled && (
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<p>Dein Ausgewähler Termin</p>
|
||||
|
||||
<p>
|
||||
{new Date(
|
||||
selectedAppointment.appointmentDate,
|
||||
).toLocaleString()}
|
||||
</p>
|
||||
<button
|
||||
onClick={async () => {
|
||||
await upsertParticipant({
|
||||
eventId: event.id,
|
||||
userId: user.id,
|
||||
appointmentCancelled: true,
|
||||
statusLog: [
|
||||
...(participant?.statusLog.filter(
|
||||
(l) => l !== null,
|
||||
) || []),
|
||||
{
|
||||
data: {
|
||||
appointmentId: selectedAppointment.id,
|
||||
appointmentDate:
|
||||
selectedAppointment.appointmentDate,
|
||||
},
|
||||
event: "APPOINTMENT_CANCELLED",
|
||||
timestamp: new Date(),
|
||||
},
|
||||
],
|
||||
});
|
||||
toast.success("Termin abgesagt");
|
||||
router.refresh();
|
||||
}}
|
||||
className="btn btn-error btn-outline btn-sm"
|
||||
>
|
||||
absagen
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{!!dates.length && (
|
||||
<p className="mt-3 text-center">
|
||||
Bitte finde dich an diesem Termin in unserem Discord ein.
|
||||
{!canSelectDate && participant?.attended && (
|
||||
<p className="py-4 flex items-center gap-2 justify-center">
|
||||
<CheckCircledIcon className="text-success" />
|
||||
Du hast an dem Presenztermin teilgenommen
|
||||
</p>
|
||||
)}
|
||||
{selectedAppointment && !participant?.appointmentCancelled && (
|
||||
<>
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<p>Dein Ausgewähler Termin</p>
|
||||
|
||||
<p>
|
||||
{new Date(
|
||||
selectedAppointment.appointmentDate,
|
||||
).toLocaleString()}
|
||||
</p>
|
||||
<button
|
||||
onClick={async () => {
|
||||
await upsertParticipant({
|
||||
eventId: event.id,
|
||||
userId: participant!.userId,
|
||||
appointmentCancelled: true,
|
||||
statusLog: [
|
||||
...(participant?.statusLog as any),
|
||||
{
|
||||
data: {
|
||||
appointmentId: selectedAppointment.id,
|
||||
appointmentDate:
|
||||
selectedAppointment.appointmentDate,
|
||||
},
|
||||
event: "Termin abgesagt",
|
||||
timestamp: new Date(),
|
||||
},
|
||||
],
|
||||
});
|
||||
toast.success("Termin abgesagt");
|
||||
router.refresh();
|
||||
}}
|
||||
className="btn btn-error btn-outline btn-sm"
|
||||
>
|
||||
absagen
|
||||
</button>
|
||||
<p className="mt-3 text-center">
|
||||
Bitte finde dich an diesem Termin in unserem Discord ein.
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{event.finisherMoodleCourseId && (
|
||||
|
||||
Reference in New Issue
Block a user