E Nr, Karte Zentrieren, Statin-select

This commit is contained in:
PxlLoewe
2025-07-08 19:23:49 -07:00
parent e9c63605ce
commit 30a4f6488f
5 changed files with 17 additions and 19 deletions

View File

@@ -50,9 +50,9 @@ export function StationsSelect({
useEffect(() => {
setValue([
...(selectedStations || []).map((id) => String(id)),
...(vehicleStates.hpgAmbulanceState !== HpgState.NOT_REQUESTED ? ["RTW"] : []),
...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED ? ["FW"] : []),
...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED ? ["POL"] : []),
...(vehicleStates.hpgAmbulanceState !== HpgState.NOT_REQUESTED || undefined ? ["RTW"] : []),
...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED || undefined ? ["FW"] : []),
...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED || undefined ? ["POL"] : []),
]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedStations, vehicleStates]);
@@ -110,18 +110,9 @@ export function StationsSelect({
onChange={(v) => {
setValue(v);
if (!isMulti) return onChange?.(v);
const hpgAmbulanceState =
vehicleStates.hpgAmbulanceState === "NOT_REQUESTED" && v.includes("RTW")
? HpgState.DISPATCHED
: vehicleStates.hpgAmbulanceState;
const hpgFireEngineState =
vehicleStates.hpgFireEngineState === "NOT_REQUESTED" && v.includes("FW")
? HpgState.DISPATCHED
: vehicleStates.hpgFireEngineState;
const hpgPoliceState =
vehicleStates.hpgPoliceState === "NOT_REQUESTED" && v.includes("POL")
? HpgState.DISPATCHED
: vehicleStates.hpgPoliceState;
const hpgAmbulanceState = v.includes("RTW") ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
const hpgFireEngineState = v.includes("FW") ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
const hpgPoliceState = v.includes("POL") ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
onChange?.({
selectedStationIds: v

View File

@@ -3,7 +3,6 @@ import React, { useEffect } from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { BellRing, BookmarkPlus, Radio } from "lucide-react";
import { Select } from "_components/Select";
import { KEYWORD_CATEGORY, Mission, missionType, Prisma } from "@repo/db";
import {
JsonValueType,
@@ -254,6 +253,7 @@ export const MissionForm = () => {
isMulti
selectedStations={form.watch("missionStationIds")}
onChange={(v) => {
console.log("Selected stations:", v);
form.setValue("missionStationIds", v.selectedStationIds);
form.setValue("hpgAmbulanceState", v.hpgAmbulanceState);
form.setValue("hpgFireEngineState", v.hpgFireEngineState);

View File

@@ -71,7 +71,7 @@ const AircraftPopupContent = ({
}
}, [currentTab, aircraft, mission]);
const setOpenAircraftMarker = useMapStore((state) => state.setOpenAircraftMarker);
const { setOpenAircraftMarker, setMap } = useMapStore((state) => state);
const { anchor } = useSmartPopup();
return (
<>
@@ -133,7 +133,13 @@ const AircraftPopupContent = ({
style={{
backgroundColor: `${FMS_STATUS_COLORS[aircraft.fmsStatus]}`,
}}
/* onClick={() => handleTabChange("fms")} */
onClick={() => {
if (!aircraft.posLat || !aircraft.posLng) return;
setMap({
center: [aircraft.posLat, aircraft.posLng],
zoom: 14,
});
}}
>
<ChevronsRightLeft className="text-sm" />
</div>

View File

@@ -442,6 +442,7 @@ const SDSTab = ({
<button
className="btn btn-sm btn-primary btn-outline"
onClick={() => {
if (!note.trim()) return;
sendSds();
}}
>