From 8084ef72c43818c0413b205c9b3e23a4d84b8d5f Mon Sep 17 00:00:00 2001 From: nocnico Date: Mon, 21 Apr 2025 20:22:33 +0200 Subject: [PATCH] =?UTF-8?q?Weitere=20Felder=20zur=20Einsatzmaske=20hinzuge?= =?UTF-8?q?f=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_components/pannel/MissionForm.tsx | 74 +++++++++++++------ 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx b/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx index b26851dd..2b1be5bf 100644 --- a/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx +++ b/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx @@ -4,7 +4,6 @@ import { useForm, Controller } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { MissionSchema } from "@repo/db/zod"; -import { Mission } from "@repo/db/zod"; import { Trash2 } from "lucide-react"; import { Select } from "_components/Select"; @@ -31,6 +30,9 @@ const missionFormSchema = MissionSchema.pick({ type MissionFormValues = z.infer; const dummyRettungsmittel = [ + "RTW", + "Feuerwehr", + "Polizei", "Christoph 31", "Christoph 100", "Christoph Berlin", @@ -41,6 +43,15 @@ export const MissionForm: React.FC = () => { const [missionCategory, setMissionCategory] = useState<"PRIMÄR" | "SEKUNDÄR">( "PRIMÄR", ); + const [missionKeyword, setMissionKeyword] = useState< + "AB_ATMUNG" | "C_BLUTUNG" + >("AB_ATMUNG"); + const [missionType, setMissionType] = useState<"typ1" | "typ2" | "typ3">( + "typ1", + ); + const [selectedRettungsmittel, setSelectedRettungsmittel] = useState< + { label: string; value: string }[] + >([]); const form = useForm({ resolver: zodResolver(missionFormSchema), defaultValues: { @@ -49,10 +60,12 @@ export const MissionForm: React.FC = () => { missionCategory: "PRIMÄR", }, }); - const { control, register, handleSubmit, watch } = form; const onSubmit = (data: MissionFormValues) => { - console.log(data); + console.log({ + ...data, + rettungsmittel: selectedRettungsmittel.map((item) => item.value), + }); }; return ( @@ -110,20 +123,15 @@ export const MissionForm: React.FC = () => { {/* Rettungsmittel Section */}

Rettungsmittel

- ( - - + className="select select-primary select-bordered w-full mb-4" + onChange={(e) => + setMissionKeyword(e.target.value as "AB_ATMUNG" | "C_BLUTUNG") + } + > + + + +