diff --git a/web/components/dashboard/FahrerAuswaehler.tsx b/web/components/dashboard/FahrerAuswaehler.tsx
new file mode 100644
index 0000000..0e04679
--- /dev/null
+++ b/web/components/dashboard/FahrerAuswaehler.tsx
@@ -0,0 +1,44 @@
+"use client";
+
+import { useState } from "react";
+import { Card } from "@/components/ui/Card";
+import { Button } from "@/components/ui/Button";
+import { FIELD_CLASSES } from "@/components/ui/FormField";
+
+export function FahrerAuswaehler({
+ fahrerListe,
+ onBestaetigen,
+ onAbbrechen,
+}: {
+ fahrerListe: { id: string; name: string }[];
+ onBestaetigen: (fahrerId: string) => void;
+ onAbbrechen: () => void;
+}) {
+ const [ausgewaehlt, setAusgewaehlt] = useState("");
+
+ return (
+
+
+ Fahrer auswählen
+
+
+
+
+
+
+
+ );
+}
diff --git a/web/components/dashboard/KanbanBoard.tsx b/web/components/dashboard/KanbanBoard.tsx
index b89a33e..c9f1d2f 100644
--- a/web/components/dashboard/KanbanBoard.tsx
+++ b/web/components/dashboard/KanbanBoard.tsx
@@ -15,10 +15,11 @@ import type { AuftragStatus } from "@/lib/auftraege/queries";
import type { KanbanAuftrag, KanbanSpalten } from "@/lib/dashboard/queries";
import type { Role } from "@/lib/auth/roles";
import { istDragErlaubt } from "@/lib/dashboard/kanban-permissions";
-import { uebernehmenVomBoard, stornierenVomBoard } from "@/app/dashboard/actions";
+import { uebernehmenVomBoard, stornierenVomBoard, zuweisenAnFahrer } from "@/app/dashboard/actions";
import { Card } from "@/components/ui/Card";
import { StatusBadge } from "@/components/ui/StatusBadge";
import { Alert } from "@/components/ui/Alert";
+import { FahrerAuswaehler } from "./FahrerAuswaehler";
const SPALTEN_REIHENFOLGE: AuftragStatus[] = ["offen", "zugewiesen", "unterwegs", "abgeschlossen", "storniert"];
@@ -84,6 +85,7 @@ export type ZuweisenDialogState = { auftragId: string; quelle: AuftragStatus } |
export function KanbanBoard({
initialSpalten,
+ fahrerListe,
rolle,
}: {
initialSpalten: KanbanSpalten;
@@ -136,6 +138,19 @@ export function KanbanBoard({
}
}
+ async function bestaetigeZuweisung(fahrerId: string) {
+ if (!zuweisenDialog) return;
+ const { auftragId, quelle } = zuweisenDialog;
+ setZuweisenDialog(null);
+ verschiebeKarteLokal(auftragId, quelle, "zugewiesen");
+
+ const ergebnis = await zuweisenAnFahrer(auftragId, fahrerId);
+ if (!ergebnis.success) {
+ macheRueckgaengig(auftragId, quelle, "zugewiesen");
+ setFehler(ergebnis.error);
+ }
+ }
+
return (
{fehler && (
@@ -150,7 +165,13 @@ export function KanbanBoard({
))}
- {/* Fahrer-Auswaehler-Dialog fuer zuweisenDialog wird in Task 6 ergaenzt. */}
+ {zuweisenDialog && (
+ setZuweisenDialog(null)}
+ />
+ )}
);
}