E Nr, Karte Zentrieren, Statin-select
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user