Fixed mission form
This commit is contained in:
@@ -121,7 +121,7 @@ export const ContextMenu = () => {
|
||||
|
||||
const nodeWay: [number, number][] = [];
|
||||
|
||||
closestToContext.nodes.map((node: { lat: number; lon: number }) =>
|
||||
closestToContext.nodes?.foreach((node: { lat: number; lon: number }) =>
|
||||
nodeWay.push([node.lat, node.lon]),
|
||||
);
|
||||
|
||||
|
||||
@@ -88,9 +88,9 @@ export const MissionForm = () => {
|
||||
createdUserId: session.data?.user.id,
|
||||
type: "primär",
|
||||
addressOSMways: [],
|
||||
missionKeywordAbbreviation: "",
|
||||
missionKeywordCategory: "",
|
||||
missionKeywordName: "",
|
||||
missionKeywordAbbreviation: null as any,
|
||||
missionKeywordCategory: null as any,
|
||||
missionKeywordName: null as any,
|
||||
hpgFireEngineState: null,
|
||||
hpgAmbulanceState: null,
|
||||
hpgPoliceState: null,
|
||||
@@ -108,6 +108,8 @@ export const MissionForm = () => {
|
||||
});
|
||||
const { missionFormValues, setOpen } = usePannelStore((state) => state);
|
||||
|
||||
console.log("MissionForm rendered", form.formState.errors);
|
||||
|
||||
const validationRequired = HPGValidationRequired(
|
||||
form.watch("missionStationIds"),
|
||||
aircrafts,
|
||||
@@ -164,6 +166,7 @@ export const MissionForm = () => {
|
||||
id: Number(editingMissionId),
|
||||
mission: {
|
||||
...(mission as unknown as Prisma.MissionCreateInput),
|
||||
state: undefined, // state should not be updated
|
||||
missionAdditionalInfo:
|
||||
!mission.missionAdditionalInfo.length && hpgSzenario
|
||||
? `HPG-Szenario: ${hpgSzenario}`
|
||||
@@ -261,8 +264,8 @@ export const MissionForm = () => {
|
||||
className="select select-primary select-bordered w-full mb-4"
|
||||
onChange={(e) => {
|
||||
form.setValue("type", e.target.value as missionType);
|
||||
form.setValue("missionKeywordName", null);
|
||||
form.setValue("missionKeywordAbbreviation", null);
|
||||
form.setValue("missionKeywordName", KEYWORD_CATEGORY.AB_ATMUNG);
|
||||
form.setValue("missionKeywordAbbreviation", "");
|
||||
form.setValue("hpgMissionString", null);
|
||||
}}
|
||||
>
|
||||
@@ -275,9 +278,15 @@ export const MissionForm = () => {
|
||||
{...form.register("missionKeywordCategory")}
|
||||
className="select select-primary select-bordered w-full mb-4"
|
||||
onChange={(e) => {
|
||||
const firstKeyword = keywords?.find(
|
||||
(k) => k.category === form.watch("missionKeywordCategory"),
|
||||
);
|
||||
form.setValue("missionKeywordCategory", e.target.value as string);
|
||||
form.setValue("missionKeywordName", null);
|
||||
form.setValue("missionKeywordAbbreviation", "");
|
||||
form.setValue("missionKeywordName", firstKeyword?.name || (null as any));
|
||||
form.setValue(
|
||||
"missionKeywordAbbreviation",
|
||||
firstKeyword?.abreviation || (null as any),
|
||||
);
|
||||
form.setValue("hpgMissionString", "");
|
||||
}}
|
||||
defaultValue=""
|
||||
@@ -296,8 +305,8 @@ export const MissionForm = () => {
|
||||
className="select select-primary select-bordered w-full mb-4"
|
||||
onChange={(e) => {
|
||||
const keyword = keywords?.find((k) => k.abreviation === e.target.value);
|
||||
form.setValue("missionKeywordName", keyword?.name || null);
|
||||
form.setValue("missionKeywordAbbreviation", keyword?.abreviation || null);
|
||||
form.setValue("missionKeywordName", keyword?.name || (null as any));
|
||||
form.setValue("missionKeywordAbbreviation", keyword?.abreviation || (null as any));
|
||||
form.setValue("hpgMissionString", "default");
|
||||
}}
|
||||
defaultValue="default"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import React from "react";
|
||||
|
||||
export const EmailFooter = () => {
|
||||
return (
|
||||
<td style={{ textAlign: "center", paddingTop: "20px" }}>
|
||||
|
||||
@@ -66,12 +66,7 @@ export const PasswortReset = () => {
|
||||
<path d="M2.5 3A1.5 1.5 0 0 0 1 4.5v.793c.026.009.051.02.076.032L7.674 8.51c.206.1.446.1.652 0l6.598-3.185A.755.755 0 0 1 15 5.293V4.5A1.5 1.5 0 0 0 13.5 3h-11Z" />
|
||||
<path d="M15 6.954 8.978 9.86a2.25 2.25 0 0 1-1.956 0L1 6.954V11.5A1.5 1.5 0 0 0 2.5 13h11a1.5 1.5 0 0 0 1.5-1.5V6.954Z" />
|
||||
</svg>
|
||||
<input
|
||||
type="text"
|
||||
className="grow"
|
||||
{...form.register("email")}
|
||||
placeholder="Email"
|
||||
/>
|
||||
<input type="text" className="grow" {...form.register("email")} placeholder="Email" />
|
||||
</label>
|
||||
<p className="text-error">
|
||||
{typeof form.formState.errors.email?.message === "string"
|
||||
@@ -80,15 +75,11 @@ export const PasswortReset = () => {
|
||||
</p>
|
||||
<span className="text-sm font-medium flex justify-end">
|
||||
<Link href="/passwort-reset" className="link link-accent link-hover ">
|
||||
Passwort vergessen?
|
||||
neues Passwort anfordern
|
||||
</Link>
|
||||
</span>
|
||||
<div className="card-actions mt-6">
|
||||
<Button
|
||||
disabled={isLoading}
|
||||
isLoading={isLoading}
|
||||
className="btn btn-primary btn-block"
|
||||
>
|
||||
<Button disabled={isLoading} isLoading={isLoading} className="btn btn-primary btn-block">
|
||||
Login
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -8,12 +8,12 @@ model Mission {
|
||||
addressStreet String?
|
||||
addressCity String?
|
||||
addressZip String?
|
||||
addressAdditionalInfo String?
|
||||
addressMissionLocation String?
|
||||
addressAdditionalInfo String? @default("")
|
||||
addressMissionLocation String? @default("")
|
||||
addressOSMways Json[] @default([])
|
||||
missionKeywordCategory String?
|
||||
missionKeywordName String?
|
||||
missionKeywordAbbreviation String?
|
||||
missionKeywordCategory String
|
||||
missionKeywordName String
|
||||
missionKeywordAbbreviation String
|
||||
missionPatientInfo String
|
||||
missionAdditionalInfo String
|
||||
missionStationIds Int[] @default([])
|
||||
|
||||
Reference in New Issue
Block a user