diff --git a/web/app/standorte/page.tsx b/web/app/standorte/page.tsx
new file mode 100644
index 0000000..673ee67
--- /dev/null
+++ b/web/app/standorte/page.tsx
@@ -0,0 +1,21 @@
+import { redirect } from "next/navigation";
+import { loadProfile } from "@/lib/auth/profile";
+import { kannStammdatenPflegen } from "@/lib/auth/roles";
+import { listOrte } from "@/lib/auftraege/queries";
+import { StandorteTabelle } from "@/components/standorte/StandorteTabelle";
+
+export default async function StandortePage() {
+ const profileResult = await loadProfile();
+ if (profileResult.status !== "ok" || !kannStammdatenPflegen(profileResult.profile.role)) {
+ redirect(`/auftraege?error=${encodeURIComponent("Nur Disponent/Admin duerfen Stammdaten pflegen.")}`);
+ }
+
+ const orte = await listOrte();
+
+ return (
+
+
Standorte
+
+
+ );
+}
diff --git a/web/components/standorte/NeuerStandort.tsx b/web/components/standorte/NeuerStandort.tsx
new file mode 100644
index 0000000..718f309
--- /dev/null
+++ b/web/components/standorte/NeuerStandort.tsx
@@ -0,0 +1,84 @@
+"use client";
+
+import { useState, useTransition } from "react";
+import { useRouter } from "next/navigation";
+import { createOrt } from "@/app/standorte/actions";
+import { Card } from "@/components/ui/Card";
+import { Button } from "@/components/ui/Button";
+import { Alert } from "@/components/ui/Alert";
+import { FormField, FIELD_CLASSES } from "@/components/ui/FormField";
+
+export function NeuerStandort() {
+ const router = useRouter();
+ const [offen, setOffen] = useState(false);
+ const [fehler, setFehler] = useState(null);
+ const [isPending, startTransition] = useTransition();
+
+ function handleSubmit(formData: FormData) {
+ startTransition(async () => {
+ const ergebnis = await createOrt(formData);
+ if (!ergebnis.success) {
+ setFehler(ergebnis.error);
+ return;
+ }
+ setFehler(null);
+ setOffen(false);
+ router.refresh();
+ });
+ }
+
+ if (!offen) {
+ return (
+
+
+
+ );
+ }
+
+ return (
+
+
+
+ );
+}
diff --git a/web/components/standorte/StandortZeile.tsx b/web/components/standorte/StandortZeile.tsx
new file mode 100644
index 0000000..b5b5010
--- /dev/null
+++ b/web/components/standorte/StandortZeile.tsx
@@ -0,0 +1,106 @@
+"use client";
+
+import { useState, useTransition } from "react";
+import { useRouter } from "next/navigation";
+import type { Ort } from "@/lib/auftraege/queries";
+import { updateOrt } from "@/app/standorte/actions";
+import { Card } from "@/components/ui/Card";
+import { Button } from "@/components/ui/Button";
+import { Alert } from "@/components/ui/Alert";
+import { FormField, FIELD_CLASSES } from "@/components/ui/FormField";
+
+export function StandortZeile({ ort }: { ort: Ort }) {
+ const router = useRouter();
+ const [bearbeiten, setBearbeiten] = useState(false);
+ const [fehler, setFehler] = useState(null);
+ const [isPending, startTransition] = useTransition();
+
+ function handleSubmit(formData: FormData) {
+ startTransition(async () => {
+ const ergebnis = await updateOrt(ort.id, formData);
+ if (!ergebnis.success) {
+ setFehler(ergebnis.error);
+ return;
+ }
+ setFehler(null);
+ setBearbeiten(false);
+ router.refresh();
+ });
+ }
+
+ if (!bearbeiten) {
+ return (
+
+
+
Adresse
+
{ort.adresse}
+
+
+
Ansprechpartner
+
{ort.ansprechpartner}
+
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+ );
+}
diff --git a/web/components/standorte/StandorteTabelle.tsx b/web/components/standorte/StandorteTabelle.tsx
new file mode 100644
index 0000000..31e89ae
--- /dev/null
+++ b/web/components/standorte/StandorteTabelle.tsx
@@ -0,0 +1,26 @@
+import type { Ort } from "@/lib/auftraege/queries";
+import { StandortZeile } from "./StandortZeile";
+import { NeuerStandort } from "./NeuerStandort";
+
+export function StandorteTabelle({ orte }: { orte: Ort[] }) {
+ return (
+
+
+
Adresse
+
Ansprechpartner
+
+ Aktionen
+
+
+
+ {orte.map((ort) => (
+
+ ))}
+
+
+
+ );
+}