diff --git a/apps/dispatch-server/routes/mission.ts b/apps/dispatch-server/routes/mission.ts index 5c13b3fc..b5a65a97 100644 --- a/apps/dispatch-server/routes/mission.ts +++ b/apps/dispatch-server/routes/mission.ts @@ -81,6 +81,7 @@ router.put("/", async (req, res) => { router.patch("/:id", async (req, res) => { const { id } = req.params; try { + console.log("Updating mission with ID:", id, req.body); const updatedMission = await prisma.mission.update({ where: { id: Number(id) }, data: req.body, diff --git a/apps/hub/app/(app)/_components/FeaturedEvents.tsx b/apps/hub/app/(app)/_components/FeaturedEvents.tsx index b81fca3c..b3233bd5 100644 --- a/apps/hub/app/(app)/_components/FeaturedEvents.tsx +++ b/apps/hub/app/(app)/_components/FeaturedEvents.tsx @@ -1,6 +1,6 @@ import { getServerSession } from "../../api/auth/[...nextauth]/auth"; import { prisma } from "@repo/db"; -import { EventCard } from "../events/_components/item"; +import { EventCard } from "../events/_components/EventCard"; import { RocketIcon } from "lucide-react"; import { eventCompleted } from "@repo/shared-components"; diff --git a/apps/hub/app/(app)/_components/FirstPath.tsx b/apps/hub/app/(app)/_components/FirstPath.tsx index f3f8a4ac..b12301c5 100644 --- a/apps/hub/app/(app)/_components/FirstPath.tsx +++ b/apps/hub/app/(app)/_components/FirstPath.tsx @@ -6,7 +6,7 @@ import { useSession } from "next-auth/react"; import { useRef, useEffect, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { getEvents } from "../../../helper/events"; -import { EventCard } from "(app)/events/_components/item"; +import { EventCard } from "(app)/events/_components/EventCard"; const PathsOptions = ({ selected, diff --git a/apps/hub/app/(app)/_components/StatsToggle.tsx b/apps/hub/app/(app)/_components/StatsToggle.tsx index 5390d867..b844e413 100644 --- a/apps/hub/app/(app)/_components/StatsToggle.tsx +++ b/apps/hub/app/(app)/_components/StatsToggle.tsx @@ -9,7 +9,7 @@ export const StatsToggle = () => { const session = useSession(); const router = useRouter(); const searchParams = useSearchParams(); - + const user = session.data?.user; useEffect(() => { const statsPage = searchParams.get("stats") || "pilot"; if (statsPage === "dispo") { @@ -30,11 +30,7 @@ export const StatsToggle = () => { return (

- Hallo,{" "} - {session.status === "authenticated" - ? session.data?.user.firstname + " <" + session.data?.user.publicId + ">" - : ""} - {"!"} + Hallo, {user?.firstname} {" #" + user?.publicId}!

diff --git a/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx b/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx index f1c98b86..2805750c 100644 --- a/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx +++ b/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx @@ -35,7 +35,7 @@ export const AppointmentModal = ({ return ( -
+
{/* if there is a button in form, it will close the modal */} - )} -
- { Presenter: true, Participants: true, }} + leftOfSearch={ +

+ Termine +

+ } + rightOfSearch={ + event && ( + + ) + } columns={ [ { diff --git a/apps/hub/app/(app)/events/_components/item.tsx b/apps/hub/app/(app)/events/_components/EventCard.tsx similarity index 98% rename from apps/hub/app/(app)/events/_components/item.tsx rename to apps/hub/app/(app)/events/_components/EventCard.tsx index 6616ec4e..de6a56ef 100644 --- a/apps/hub/app/(app)/events/_components/item.tsx +++ b/apps/hub/app/(app)/events/_components/EventCard.tsx @@ -1,7 +1,7 @@ "use client"; import { DrawingPinFilledIcon } from "@radix-ui/react-icons"; import { Event, Participant, EventAppointment, User } from "@repo/db"; -import ModalBtn from "./modalBtn"; +import ModalBtn from "./Modal"; import MDEditor from "@uiw/react-md-editor"; import { Badge } from "@repo/shared-components"; diff --git a/apps/hub/app/(app)/events/_components/modalBtn.tsx b/apps/hub/app/(app)/events/_components/Modal.tsx similarity index 58% rename from apps/hub/app/(app)/events/_components/modalBtn.tsx rename to apps/hub/app/(app)/events/_components/Modal.tsx index f4104792..4a5f9e1d 100644 --- a/apps/hub/app/(app)/events/_components/modalBtn.tsx +++ b/apps/hub/app/(app)/events/_components/Modal.tsx @@ -4,7 +4,17 @@ import { CheckCircledIcon, EnterIcon, DrawingPinFilledIcon } from "@radix-ui/rea import { Event, EventAppointment, Participant, User } from "@repo/db"; import { cn } from "@repo/shared-components"; import { inscribeToMoodleCourse, upsertParticipant } from "../actions"; -import { Check, Clock10Icon, ExternalLink, EyeIcon, TriangleAlert } from "lucide-react"; +import { + BookCheck, + Calendar, + Check, + CirclePlay, + Clock10Icon, + ExternalLink, + EyeIcon, + Info, + TriangleAlert, +} from "lucide-react"; import { useForm } from "react-hook-form"; import { ParticipantOptionalDefaults, ParticipantOptionalDefaultsSchema } from "@repo/db/zod"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -15,6 +25,7 @@ import { eventCompleted } from "@repo/shared-components"; import MDEditor from "@uiw/react-md-editor"; import { DayPicker } from "react-day-picker"; import toast from "react-hot-toast"; +import { se } from "date-fns/locale"; interface ModalBtnProps { title: string; @@ -131,8 +142,11 @@ const ModalBtn = ({

{title}

-
-
+
+
+

+ Details +

{event.hasPresenceEvents && ( -
- {canSelectDate && ( -
- {!!dates.length && ( - <> -

Melde dich zu einem Termin an

- ({ + label: `${new Date(date.appointmentDate).toLocaleString("de-DE", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + })} - (${(date as any).Participants.length}/${event.maxParticipants})`, + value: date.id, + }))} + name="eventAppointmentId" + label={""} + placeholder="Wähle einen Termin" + className="min-w-[250px]" + /> + )} - {selectedAppointment && !participant?.appointmentCancelled && ( -
- Dein ausgewählter Termin (Deutsche Zeit) -
- -
- + {selectedAppointment && !participant?.appointmentCancelled && ( +
+ Dein ausgewählter Termin (Deutsche Zeit) +
+
+ {participant?.attended ? ( +

+ + Du hast an dem Presenztermin teilgenommen +

+ ) : ( +

+ Bitte erscheine ~5 minuten vor dem Termin im Discord +

+ )}
- Bitte erscheine pünktlich im Discord. -
- )} + )} + + {!dates.length && ( +

Aktuell sind keine Termine verfügbar

+ )} + + {!!selectedDate && + !!event.maxParticipants && + !!ownPlaceInParticipantList && + !!(ownPlaceInParticipantList > event.maxParticipants) && ( +

+ + Dieser Termin ist ausgebucht, wahrscheinlich wirst du nicht teilnehmen + können. (Listenplatz: {ownPlaceInParticipantList} , max.{" "} + {event.maxParticipants}) +

+ )} +
)} {event.finisherMoodleCourseId && ( -
- +
+

+ Moodle-Kurs +

+
+ +
)}
@@ -278,34 +288,36 @@ const ModalBtn = ({ Anmelden )} - {selectedAppointment && !participant?.appointmentCancelled && ( - - )} + ], + }); + toast.success("Termin abgesagt"); + router.refresh(); + }} + className="btn btn-error btn-outline btn-wide" + > + Termin Absagen + + )}
@@ -349,7 +361,9 @@ const MoodleCourseIndicator = ({ ); return (
-

Moodle-Kurs Benötigt

+

+ Moodle-Kurs bereit +

+

+ Wenn du nach dem Anmelden den moodle Kurs nicht siehst, warte ein paar Sekunden und lade die + Seite neu. +

); }; diff --git a/apps/hub/app/(app)/events/page.tsx b/apps/hub/app/(app)/events/page.tsx index eaa753f2..d8e2e93b 100644 --- a/apps/hub/app/(app)/events/page.tsx +++ b/apps/hub/app/(app)/events/page.tsx @@ -1,6 +1,6 @@ import { prisma } from "@repo/db"; import { getServerSession } from "../../api/auth/[...nextauth]/auth"; -import { EventCard } from "./_components/item"; +import { EventCard } from "./_components/EventCard"; import { RocketIcon } from "@radix-ui/react-icons"; const page = async () => { @@ -38,6 +38,9 @@ const page = async () => { id: true, userId: true, }, + where: { + appointmentCancelled: false, + }, orderBy: { enscriptionDate: "asc", },