From 92aba03affba9b1afbf8a2f9eeb0bfd6133e7e00 Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Fri, 27 Jun 2025 15:58:57 -0700 Subject: [PATCH] =?UTF-8?q?Kicks=20ben=C3=B6tigen=20nun=20immer=20eine=20B?= =?UTF-8?q?egr=C3=BCndung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/_components/navbar/AdminPanel.tsx | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/apps/dispatch/app/_components/navbar/AdminPanel.tsx b/apps/dispatch/app/_components/navbar/AdminPanel.tsx index d5109957..f13649b3 100644 --- a/apps/dispatch/app/_components/navbar/AdminPanel.tsx +++ b/apps/dispatch/app/_components/navbar/AdminPanel.tsx @@ -154,9 +154,11 @@ export default function AdminPanel() { btnClassName="btn-warning" btnTip="Die Verbindung zur Leitstelle wird für diesesn Nutzer unterbrochen" Icon={} - onClick={({ reason }) => - kickPilotMutation.mutate({ id: p.id, reason }) - } + onClick={({ reason }) => { + if (!reason.length) + return toast.error("Bitte gib einen Grund für die Strafe an."); + kickPilotMutation.mutate({ id: p.id, reason }); + }} /> } onClick={({ reason, until }) => { + if (!reason.length) + return toast.error("Bitte gib einen Grund für die Strafe an."); if (!until) { toast.error( "Bitte wähle ein Datum aus. Ein permanenter Bann ist nur vom HUB aus möglich.", @@ -225,9 +229,22 @@ export default function AdminPanel() { btnTip="Dadurch wird sich der Pilot nicht mehr mit dem VAR verbinden können." showDatePicker Icon={} - onClick={({ reason, until }) => - kickDispatchMutation.mutate({ id: d.id, reason, bann: true, until }) - } + onClick={({ reason, until }) => { + if (!reason.length) + return toast.error("Bitte gib einen Grund für die Strafe an."); + if (!until) { + toast.error( + "Bitte wähle ein Datum aus. Ein permanenter Bann ist nur vom HUB aus möglich.", + ); + return; + } + kickDispatchMutation.mutate({ + id: d.id, + reason, + bann: true, + until, + }); + }} />