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

@@ -63,7 +63,7 @@ router.put("/", async (req, res) => {
const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based
const day = String(date.getDate()).padStart(2, "0"); const day = String(date.getDate()).padStart(2, "0");
const publicId = `__${year}${month}${day}${missionsTodayCount ? missionsTodayCount + 1 : 1}`; const publicId = `ENr.: ${year}${month}${day}${missionsTodayCount ? missionsTodayCount + 1 : 1}`;
const newMission = await prisma.mission.create({ const newMission = await prisma.mission.create({
data: { data: {
...req.body, ...req.body,

View File

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

View File

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

View File

@@ -71,7 +71,7 @@ const AircraftPopupContent = ({
} }
}, [currentTab, aircraft, mission]); }, [currentTab, aircraft, mission]);
const setOpenAircraftMarker = useMapStore((state) => state.setOpenAircraftMarker); const { setOpenAircraftMarker, setMap } = useMapStore((state) => state);
const { anchor } = useSmartPopup(); const { anchor } = useSmartPopup();
return ( return (
<> <>
@@ -133,7 +133,13 @@ const AircraftPopupContent = ({
style={{ style={{
backgroundColor: `${FMS_STATUS_COLORS[aircraft.fmsStatus]}`, 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" /> <ChevronsRightLeft className="text-sm" />
</div> </div>

View File

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