Merge pull request #69 from VAR-Virtual-Air-Rescue/staging
Datentypen in Prod DB vorbereiten für release
4
.github/workflows/deploy-production.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Pull latest code
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ vars.STAGING_HOST }}
|
||||
host: ${{ vars.PRODUCTION_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- name: Deploy migration to Database
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ vars.STAGING_HOST }}
|
||||
host: ${{ vars.PRODUCTION_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
|
||||
1
.github/workflows/deploy-staging.yml
vendored
@@ -40,6 +40,7 @@ jobs:
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
command_timeout: 30m
|
||||
script: |
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
|
||||
1
.vscode/settings.json
vendored
@@ -2,6 +2,7 @@
|
||||
"editor.formatOnSave": true,
|
||||
"files.autoSave": "off",
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"eslint.workingDirectories": [{ "mode": "auto" }],
|
||||
"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"],
|
||||
"typescript.validate.enable": true,
|
||||
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
DISCORD_SERVER_PORT=3005
|
||||
DISCORD_GUILD_ID=1077269395019141140
|
||||
DISCORD_OAUTH_CLIENT_ID=930384053344034846
|
||||
DISCORD_OAUTH_SECRET=96aSvmIePqFTbGc54mad0QsZfDnYwhl1
|
||||
DISCORD_BOT_TOKEN=OTMwMzg0MDUzMzQ0MDM0ODQ2.G7zIy-._hE3dTbtUv6sd7nIP2PUn3d8s-2MFk0x3nYMg8
|
||||
DISCORD_OAUTH_CLIENT_ID=
|
||||
DISCORD_OAUTH_SECRET=
|
||||
DISCORD_BOT_TOKEN=
|
||||
DISCORD_REDIRECT_URL=https://hub.premiumag.de/api/discord-redirect
|
||||
NEXT_PUBLIC_DISCORD_URL=https://discord.com/oauth2/authorize?client_id=930384053344034846&response_type=code&redirect_uri=https%3A%2F%2Fhub.premiumag.de%2Fapi%2Fdiscord-redirect&scope=identify+guilds+email
|
||||
NEXT_PUBLIC_DISCORD_URL=
|
||||
@@ -3,10 +3,19 @@ import express from "express";
|
||||
import { createServer } from "http";
|
||||
import router from "routes/router";
|
||||
import cors from "cors";
|
||||
import { Server } from "socket.io";
|
||||
import { createAdapter } from "@socket.io/redis-adapter";
|
||||
import { pubClient, subClient } from "modules/redis";
|
||||
import "modules/chron";
|
||||
|
||||
const app = express();
|
||||
const server = createServer(app);
|
||||
|
||||
export const io = new Server(server, {
|
||||
adapter: createAdapter(pubClient, subClient),
|
||||
cors: {},
|
||||
});
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
app.use(router);
|
||||
|
||||
161
apps/core-server/modules/chron.ts
Normal file
@@ -0,0 +1,161 @@
|
||||
import { MissionLog, NotificationPayload, prisma } from "@repo/db";
|
||||
import { io } from "index";
|
||||
import cron from "node-cron";
|
||||
|
||||
const removeClosedMissions = async () => {
|
||||
const oldMissions = await prisma.mission.findMany({
|
||||
where: {
|
||||
state: "running",
|
||||
},
|
||||
});
|
||||
oldMissions.forEach(async (mission) => {
|
||||
const lastAlert = (mission.missionLog as unknown as MissionLog[]).find((l) => {
|
||||
return l.type === "alert-log";
|
||||
});
|
||||
|
||||
const lastAlertTime = lastAlert ? new Date(lastAlert.timeStamp) : null;
|
||||
|
||||
const aircraftsInMission = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
stationId: {
|
||||
in: mission.missionStationIds,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allConnectedAircraftsInIdleStatus = aircraftsInMission.every((a) =>
|
||||
["1", "2", "6"].includes(a.fmsStatus),
|
||||
);
|
||||
|
||||
const allStationsInMissionChangedFromStatus4to1Or8to1 = mission.missionStationIds.every(
|
||||
(stationId) => {
|
||||
const status4Log = (mission.missionLog as unknown as MissionLog[]).findIndex((l) => {
|
||||
return (
|
||||
l.type === "station-log" &&
|
||||
l.data?.stationId === stationId &&
|
||||
l.data?.newFMSstatus === "4"
|
||||
);
|
||||
});
|
||||
const status8Log = (mission.missionLog as unknown as MissionLog[]).findIndex((l) => {
|
||||
return (
|
||||
l.type === "station-log" &&
|
||||
l.data?.stationId === stationId &&
|
||||
l.data?.newFMSstatus === "8"
|
||||
);
|
||||
});
|
||||
|
||||
const status1Log = (mission.missionLog as unknown as MissionLog[]).findIndex((l) => {
|
||||
return (
|
||||
l.type === "station-log" &&
|
||||
l.data?.stationId === stationId &&
|
||||
l.data?.newFMSstatus === "1"
|
||||
);
|
||||
});
|
||||
const status6Log = (mission.missionLog as unknown as MissionLog[]).findIndex((l) => {
|
||||
return (
|
||||
l.type === "station-log" &&
|
||||
l.data?.stationId === stationId &&
|
||||
l.data?.newFMSstatus === "6"
|
||||
);
|
||||
});
|
||||
return (
|
||||
(status4Log !== -1 || status8Log !== -1) &&
|
||||
(status1Log !== -1 || status6Log !== -1) &&
|
||||
(status4Log < status1Log ||
|
||||
status8Log < status1Log ||
|
||||
status8Log < status6Log ||
|
||||
status1Log < status6Log)
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
const missionHastManualReactivation = (mission.missionLog as unknown as MissionLog[]).some(
|
||||
(l) => l.type === "reopened-log",
|
||||
);
|
||||
console.log({
|
||||
missionId: mission.publicId,
|
||||
allConnectedAircraftsInIdleStatus,
|
||||
lastAlertTime,
|
||||
allStationsInMissionChangedFromStatus4to1Or8to1,
|
||||
missionHastManualReactivation,
|
||||
});
|
||||
if (
|
||||
!allConnectedAircraftsInIdleStatus // If some aircrafts are still active, do not close the mission
|
||||
)
|
||||
return;
|
||||
|
||||
const now = new Date();
|
||||
if (!lastAlertTime) return;
|
||||
|
||||
// Case 1: Forgotten Mission, last alert more than 3 Hours ago
|
||||
// Case 2: All stations in mission changed from status 4 to 1 or from status 8 to 1
|
||||
if (
|
||||
!(
|
||||
now.getTime() - lastAlertTime.getTime() > 1000 * 60 * 180 ||
|
||||
allStationsInMissionChangedFromStatus4to1Or8to1
|
||||
) ||
|
||||
missionHastManualReactivation
|
||||
)
|
||||
return;
|
||||
|
||||
const log: MissionLog = {
|
||||
type: "completed-log",
|
||||
auto: true,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {},
|
||||
};
|
||||
|
||||
const updatedMission = await prisma.mission.update({
|
||||
where: {
|
||||
id: mission.id,
|
||||
},
|
||||
data: {
|
||||
state: "finished",
|
||||
missionLog: {
|
||||
push: log as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
io.to("dispatchers").emit("new-mission", { updatedMission });
|
||||
io.to("dispatchers").emit("notification", {
|
||||
type: "mission-auto-close",
|
||||
status: "chron",
|
||||
message: `Einsatz ${updatedMission.publicId} wurde aufgrund ${allStationsInMissionChangedFromStatus4to1Or8to1 ? "des Freimeldens aller Stationen" : "von Inaktivität"} geschlossen.`,
|
||||
data: {
|
||||
missionId: updatedMission.id,
|
||||
publicMissionId: updatedMission.publicId,
|
||||
},
|
||||
} as NotificationPayload);
|
||||
console.log(`Mission ${mission.id} closed due to inactivity.`);
|
||||
});
|
||||
};
|
||||
|
||||
const removeConnectedAircrafts = async () => {
|
||||
const connectedAircrafts = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
logoutTime: null,
|
||||
},
|
||||
});
|
||||
|
||||
connectedAircrafts.forEach(async (aircraft) => {
|
||||
const lastUpdate = new Date(aircraft.lastHeartbeat);
|
||||
const now = new Date();
|
||||
if (now.getTime() - lastUpdate.getTime() > 12 * 60 * 60 * 1000) {
|
||||
await prisma.connectedAircraft.update({
|
||||
where: { id: aircraft.id },
|
||||
data: { logoutTime: now },
|
||||
});
|
||||
|
||||
console.log(`Aircraft ${aircraft.id} disconnected due to inactivity.`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
cron.schedule("*/1 * * * *", async () => {
|
||||
try {
|
||||
await removeClosedMissions();
|
||||
await removeConnectedAircrafts();
|
||||
} catch (error) {
|
||||
console.error("Error on cron job:", error);
|
||||
}
|
||||
});
|
||||
13
apps/core-server/modules/redis.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createClient, RedisClientType } from "redis";
|
||||
|
||||
export const pubClient: RedisClientType = createClient({
|
||||
url: `redis://${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
|
||||
});
|
||||
export const subClient: RedisClientType = pubClient.duplicate();
|
||||
|
||||
Promise.all([pubClient.connect(), subClient.connect()]).then(() => {
|
||||
console.log("Redis connected");
|
||||
});
|
||||
|
||||
pubClient.on("error", (err: unknown) => console.log("Redis Client Error", err));
|
||||
subClient.on("error", (err: unknown) => console.log("Redis Client Error", err));
|
||||
@@ -20,6 +20,7 @@
|
||||
"typescript": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@socket.io/redis-adapter": "^8.3.0",
|
||||
"axios": "^1.9.0",
|
||||
"cors": "^2.8.5",
|
||||
"cron": "^4.3.1",
|
||||
@@ -30,6 +31,8 @@
|
||||
"nodemon": "^3.1.10",
|
||||
"prom-client": "^15.1.3",
|
||||
"react": "^19.1.0",
|
||||
"redis": "^5.1.1",
|
||||
"socket.io": "^4.8.1",
|
||||
"tsx": "^4.19.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { handleConnectDesktop } from "socket-events/connect-desktop";
|
||||
import cookieParser from "cookie-parser";
|
||||
import cors from "cors";
|
||||
import { authMiddleware } from "modules/expressMiddleware";
|
||||
import "modules/chron";
|
||||
|
||||
const app = express();
|
||||
const server = createServer(app);
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
import { MissionLog, prisma } from "@repo/db";
|
||||
import cron from "node-cron";
|
||||
|
||||
const removeClosedMissions = async () => {
|
||||
const oldMissions = await prisma.mission.findMany({
|
||||
where: {
|
||||
state: "running",
|
||||
},
|
||||
});
|
||||
oldMissions.forEach(async (mission) => {
|
||||
const lastAlert = (mission.missionLog as unknown as MissionLog[]).find((l) => {
|
||||
return l.type === "alert-log";
|
||||
});
|
||||
const lastAlertTime = lastAlert ? new Date(lastAlert.timeStamp) : null;
|
||||
|
||||
const aircraftsInMission = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
stationId: {
|
||||
in: mission.missionStationIds,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (
|
||||
!aircraftsInMission ||
|
||||
!aircraftsInMission.some((a) => ["1", "2", "6"].includes(a.fmsStatus))
|
||||
)
|
||||
return;
|
||||
|
||||
const now = new Date();
|
||||
if (!lastAlertTime) return;
|
||||
// change State to closed if last alert was more than 180 minutes ago
|
||||
if (now.getTime() - lastAlertTime.getTime() < 30 * 60 * 1000) return;
|
||||
const log: MissionLog = {
|
||||
type: "completed-log",
|
||||
auto: true,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {},
|
||||
};
|
||||
|
||||
await prisma.mission.update({
|
||||
where: {
|
||||
id: mission.id,
|
||||
},
|
||||
data: {
|
||||
state: "finished",
|
||||
missionLog: {
|
||||
push: log as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(`Mission ${mission.id} closed due to inactivity.`);
|
||||
});
|
||||
};
|
||||
const removeConnectedAircrafts = async () => {
|
||||
const connectedAircrafts = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
logoutTime: null,
|
||||
},
|
||||
});
|
||||
|
||||
connectedAircrafts.forEach(async (aircraft) => {
|
||||
const lastUpdate = new Date(aircraft.lastHeartbeat);
|
||||
const now = new Date();
|
||||
if (now.getTime() - lastUpdate.getTime() > 12 * 60 * 60 * 1000) {
|
||||
await prisma.connectedAircraft.update({
|
||||
where: { id: aircraft.id },
|
||||
data: { logoutTime: now },
|
||||
});
|
||||
|
||||
console.log(`Aircraft ${aircraft.id} disconnected due to inactivity.`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
cron.schedule("*/5 * * * *", async () => {
|
||||
try {
|
||||
await removeClosedMissions();
|
||||
await removeConnectedAircrafts();
|
||||
} catch (error) {
|
||||
console.error("Error removing closed missions:", error);
|
||||
}
|
||||
});
|
||||
@@ -7,12 +7,6 @@ export const subClient: RedisClientType = pubClient.duplicate();
|
||||
|
||||
Promise.all([pubClient.connect(), subClient.connect()]).then(() => {
|
||||
console.log("Redis connected");
|
||||
pubClient.keys("dispatchers*").then((keys) => {
|
||||
if (!keys) return;
|
||||
keys.forEach(async (key) => {
|
||||
await pubClient.json.del(key);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
pubClient.on("error", (err) => console.log("Redis Client Error", err));
|
||||
|
||||
@@ -86,7 +86,7 @@ router.patch("/:id", async (req, res) => {
|
||||
where: { id: Number(id) },
|
||||
data: req.body,
|
||||
});
|
||||
io.to("dispatchers").emit("update-mission", updatedMission);
|
||||
io.to("dispatchers").emit("update-mission", { updatedMission });
|
||||
res.json(updatedMission);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -51,7 +51,9 @@ export const handleConnectDispatch =
|
||||
data: {
|
||||
publicUser: getPublicUser(user) as any,
|
||||
esimatedLogoutTime:
|
||||
logoffHours && logoffMinutes ? getNextDateWithTime(logoffHours, logoffMinutes) : null,
|
||||
logoffHours !== undefined && logoffMinutes !== undefined
|
||||
? getNextDateWithTime(logoffHours, logoffMinutes)
|
||||
: null,
|
||||
lastHeartbeat: new Date().toISOString(),
|
||||
userId: user.id,
|
||||
zone: selectedZone,
|
||||
|
||||
@@ -79,7 +79,9 @@ export const handleConnectPilot =
|
||||
data: {
|
||||
publicUser: getPublicUser(user) as any,
|
||||
esimatedLogoutTime:
|
||||
logoffHours && logoffMinutes ? getNextDateWithTime(logoffHours, logoffMinutes) : null,
|
||||
logoffHours !== undefined && logoffMinutes !== undefined
|
||||
? getNextDateWithTime(logoffHours, logoffMinutes)
|
||||
: null,
|
||||
userId: userId,
|
||||
stationId: parseInt(stationId),
|
||||
lastHeartbeat: debug ? nowPlus2h.toISOString() : undefined,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { HpgState } from "@repo/db";
|
||||
import { cn } from "@repo/shared-components";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
@@ -6,7 +7,6 @@ import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { getStationsAPI } from "_querys/stations";
|
||||
import { Ambulance, FireExtinguisher, Radio, Siren } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { FieldValues } from "react-hook-form";
|
||||
|
||||
type MissionStationsSelectProps = {
|
||||
selectedStations?: number[];
|
||||
@@ -54,7 +54,6 @@ export function StationsSelect({
|
||||
...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED || undefined ? ["FW"] : []),
|
||||
...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED || undefined ? ["POL"] : []),
|
||||
]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedStations, vehicleStates]);
|
||||
|
||||
// Helper to check if a station is a vehicle and its state is NOT_REQUESTED
|
||||
@@ -108,8 +107,27 @@ export function StationsSelect({
|
||||
menuPlacement={menuPlacement}
|
||||
isMulti={isMulti}
|
||||
onChange={(v) => {
|
||||
console.log("Selected values:", v);
|
||||
setValue(v);
|
||||
if (!isMulti) return onChange?.(v);
|
||||
if (!isMulti) {
|
||||
const singleValue = v as string;
|
||||
const isVehicle = ["RTW", "FW", "POL"].includes(singleValue);
|
||||
|
||||
const hpgAmbulanceState =
|
||||
singleValue === "RTW" ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
|
||||
const hpgFireEngineState =
|
||||
singleValue === "FW" ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
|
||||
const hpgPoliceState =
|
||||
singleValue === "POL" ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
|
||||
|
||||
onChange?.({
|
||||
selectedStationIds: isVehicle ? [] : [Number(singleValue)],
|
||||
hpgAmbulanceState,
|
||||
hpgFireEngineState,
|
||||
hpgPoliceState,
|
||||
});
|
||||
return;
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Audio } from "../../../../_components/Audio/Audio";
|
||||
import { ExitIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
|
||||
import Link from "next/link";
|
||||
import { Settings } from "_components/navbar/Settings";
|
||||
import ModeSwitchDropdown from "_components/navbar/ModeSwitchDropdown";
|
||||
import AdminPanel from "_components/navbar/AdminPanel";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { WarningAlert } from "_components/navbar/PageAlert";
|
||||
import { Radar } from "lucide-react";
|
||||
|
||||
export default async function Navbar() {
|
||||
const session = await getServerSession();
|
||||
@@ -14,7 +14,7 @@ export default async function Navbar() {
|
||||
return (
|
||||
<div className="navbar bg-base-100 shadow-sm flex gap-5 justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<ModeSwitchDropdown />
|
||||
<p className="normal-case text-xl font-semibold">VAR Leitstelle V2</p>
|
||||
{session?.user.permissions.includes("ADMIN_KICK") && <AdminPanel />}
|
||||
</div>
|
||||
<WarningAlert />
|
||||
@@ -27,6 +27,11 @@ export default async function Navbar() {
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Settings />
|
||||
<Link href={"/tracker"} target="_blank" rel="noopener noreferrer">
|
||||
<button className="btn btn-ghost">
|
||||
<Radar size={19} /> Tracker
|
||||
</button>
|
||||
</Link>
|
||||
<Link
|
||||
href={process.env.NEXT_PUBLIC_HUB_URL || "#!"}
|
||||
target="_blank"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
"use client";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useDispatchConnectionStore } from "../../../../../_store/dispatch/connectionStore";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { Prisma } from "@repo/db";
|
||||
import { changeDispatcherAPI } from "_querys/dispatcher";
|
||||
import { getNextDateWithTime } from "@repo/shared-components";
|
||||
import { Button, getNextDateWithTime } from "@repo/shared-components";
|
||||
|
||||
export const ConnectionBtn = () => {
|
||||
const modalRef = useRef<HTMLDialogElement>(null);
|
||||
@@ -19,38 +19,8 @@ export const ConnectionBtn = () => {
|
||||
mutationFn: ({ id, data }: { id: number; data: Prisma.ConnectedDispatcherUpdateInput }) =>
|
||||
changeDispatcherAPI(id, data),
|
||||
});
|
||||
const [logoffDebounce, setLogoffDebounce] = useState<NodeJS.Timeout | null>(null);
|
||||
const session = useSession();
|
||||
const uid = session.data?.user?.id;
|
||||
if (!uid) return null;
|
||||
|
||||
// useEffect für die Logoff-Zeit
|
||||
const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || [];
|
||||
|
||||
useEffect(() => {
|
||||
if (!logoffHours || !logoffMinutes) return;
|
||||
if (logoffDebounce) clearTimeout(logoffDebounce);
|
||||
|
||||
const timeout = setTimeout(async () => {
|
||||
if (!logoffHours || !logoffMinutes || !connection.connectedDispatcher) return;
|
||||
await changeDispatcherMutation.mutateAsync({
|
||||
id: connection.connectedDispatcher?.id,
|
||||
data: {
|
||||
esimatedLogoutTime:
|
||||
logoffHours && logoffMinutes ? getNextDateWithTime(logoffHours, logoffMinutes) : null,
|
||||
},
|
||||
});
|
||||
toast.success("Änderung gespeichert!");
|
||||
modalRef.current?.close();
|
||||
}, 2000);
|
||||
|
||||
setLogoffDebounce(timeout);
|
||||
|
||||
// Cleanup function
|
||||
return () => {
|
||||
if (logoffDebounce) clearTimeout(logoffDebounce);
|
||||
};
|
||||
}, [form.logoffTime, connection.connectedDispatcher]);
|
||||
|
||||
useEffect(() => {
|
||||
// Disconnect the socket when the component unmounts
|
||||
@@ -59,6 +29,7 @@ export const ConnectionBtn = () => {
|
||||
};
|
||||
}, [connection.disconnect]);
|
||||
|
||||
if (!uid) return null;
|
||||
return (
|
||||
<div className="rounded-box bg-base-200 flex justify-center items-center gap-2 p-1">
|
||||
{connection.message.length > 0 && (
|
||||
@@ -122,6 +93,27 @@ export const ConnectionBtn = () => {
|
||||
<form method="dialog" className="w-full flex justify-between">
|
||||
<button className="btn btn-soft">Zurück</button>
|
||||
{connection.status == "connected" ? (
|
||||
<>
|
||||
<Button
|
||||
className="btn"
|
||||
onClick={async () => {
|
||||
if (!connection.connectedDispatcher?.id) return;
|
||||
const [logoffHours, logoffMinutes] =
|
||||
form.logoffTime?.split(":").map(Number) || [];
|
||||
await changeDispatcherMutation.mutateAsync({
|
||||
id: connection.connectedDispatcher?.id,
|
||||
data: {
|
||||
esimatedLogoutTime:
|
||||
logoffHours !== undefined && logoffMinutes !== undefined
|
||||
? getNextDateWithTime(logoffHours, logoffMinutes)
|
||||
: null,
|
||||
},
|
||||
});
|
||||
modalRef.current?.close();
|
||||
}}
|
||||
>
|
||||
Logoff-Zeit speichern
|
||||
</Button>
|
||||
<button
|
||||
className="btn btn-soft btn-error"
|
||||
type="submit"
|
||||
@@ -132,6 +124,7 @@ export const ConnectionBtn = () => {
|
||||
>
|
||||
Verbindung Trennen
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<button
|
||||
type="submit"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
"use client";
|
||||
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 { BellRing, BookmarkPlus } from "lucide-react";
|
||||
import { KEYWORD_CATEGORY, Mission, missionType, Prisma } from "@repo/db";
|
||||
import {
|
||||
JsonValueType,
|
||||
@@ -306,7 +307,9 @@ export const MissionForm = () => {
|
||||
<option disabled value="please_select">
|
||||
Einsatz Kategorie auswählen...
|
||||
</option>
|
||||
{Object.keys(KEYWORD_CATEGORY).map((use) => (
|
||||
{Object.keys(KEYWORD_CATEGORY)
|
||||
.filter((k) => !k.startsWith("V_"))
|
||||
.map((use) => (
|
||||
<option key={use} value={use}>
|
||||
{use}
|
||||
</option>
|
||||
|
||||
@@ -26,7 +26,14 @@ export const Pannel = () => {
|
||||
setOpen(false);
|
||||
}
|
||||
}
|
||||
}, [missions, setMissionFormValues, setEditingMission, setOpen, missionFormValues]);
|
||||
}, [
|
||||
missions,
|
||||
setMissionFormValues,
|
||||
setEditingMission,
|
||||
setOpen,
|
||||
missionFormValues,
|
||||
editingMissionId,
|
||||
]);
|
||||
|
||||
return (
|
||||
<div className={cn("flex-1 max-w-[600px] z-9999999")}>
|
||||
|
||||
@@ -16,7 +16,13 @@ export default async function RootLayout({
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session?.user.permissions.includes("DISPO"))
|
||||
return <Error title="Zugriff verweigert" statusCode={403} />;
|
||||
return (
|
||||
<Error
|
||||
title=" Fehlende Berechtigung"
|
||||
description="Du hast nicht die erforderlichen Berechtigungen, dich als Disponent anzumelden. Du kannst im HUB Kurse abschließen um die Berechtigung zu erhalten."
|
||||
statusCode={403}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
"use client";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getUserAPI } from "_querys/user";
|
||||
import { useAudioStore } from "_store/audioStore";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
import { useDmeStore } from "_store/pilot/dmeStore";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
export const useSounds = () => {
|
||||
const session = useSession();
|
||||
const { data: user } = useQuery({
|
||||
queryKey: ["user", session.data?.user.id],
|
||||
queryFn: () => getUserAPI(session.data!.user.id),
|
||||
});
|
||||
|
||||
const dmeVolume = useAudioStore((state) => state.settings.dmeVolume);
|
||||
const { page, setPage } = useDmeStore((state) => state);
|
||||
const mission = usePilotConnectionStore((state) => state.activeMission);
|
||||
|
||||
@@ -25,14 +18,14 @@ export const useSounds = () => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (user?.settingsDmeVolume) {
|
||||
if (dmeVolume) {
|
||||
if (newMissionSound.current) {
|
||||
newMissionSound.current.volume = user.settingsDmeVolume;
|
||||
newMissionSound.current.volume = dmeVolume;
|
||||
}
|
||||
} else if (newMissionSound.current) {
|
||||
newMissionSound.current.volume = 0.8; // Default volume
|
||||
}
|
||||
}, [user?.settingsDmeVolume]);
|
||||
}, [dmeVolume]);
|
||||
|
||||
useEffect(() => {
|
||||
const timeouts: NodeJS.Timeout[] = [];
|
||||
@@ -40,7 +33,6 @@ export const useSounds = () => {
|
||||
if (page === "new-mission" && newMissionSound.current) {
|
||||
console.log("new-mission", mission);
|
||||
newMissionSound.current.currentTime = 0;
|
||||
newMissionSound.current.volume = 0.3;
|
||||
newMissionSound.current.play();
|
||||
if (mission) {
|
||||
timeouts.push(setTimeout(() => setPage({ page: "mission", mission }), 500));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ConnectedAircraft, Prisma } from "@repo/db";
|
||||
import { Prisma } from "@repo/db";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
import { useMrtStore } from "_store/pilot/MrtStore";
|
||||
import { pilotSocket } from "(app)/pilot/socket";
|
||||
@@ -21,7 +21,7 @@ export const useButtons = () => {
|
||||
}) => editConnectedAircraftAPI(aircraftId, data),
|
||||
});
|
||||
|
||||
const { page, setPage } = useMrtStore((state) => state);
|
||||
const { setPage } = useMrtStore((state) => state);
|
||||
|
||||
const handleButton =
|
||||
(button: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0" | "home") => () => {
|
||||
|
||||
@@ -3,13 +3,15 @@ import { Audio } from "_components/Audio/Audio";
|
||||
import { ExitIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
|
||||
import Link from "next/link";
|
||||
import { Settings } from "_components/navbar/Settings";
|
||||
import ModeSwitchDropdown from "_components/navbar/ModeSwitchDropdown";
|
||||
import { WarningAlert } from "_components/navbar/PageAlert";
|
||||
import { Radar } from "lucide-react";
|
||||
|
||||
export default function Navbar() {
|
||||
return (
|
||||
<div className="navbar bg-base-100 shadow-sm flex gap-5 justify-between">
|
||||
<ModeSwitchDropdown />
|
||||
<div className="flex items-center gap-2">
|
||||
<p className="normal-case text-xl font-semibold">VAR Operations Center</p>
|
||||
</div>
|
||||
<WarningAlert />
|
||||
<div className="flex items-center gap-5">
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -20,6 +22,11 @@ export default function Navbar() {
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Settings />
|
||||
<Link href={"/tracker"} target="_blank" rel="noopener noreferrer">
|
||||
<button className="btn btn-ghost">
|
||||
<Radar size={19} /> Tracker
|
||||
</button>
|
||||
</Link>
|
||||
<Link
|
||||
href={process.env.NEXT_PUBLIC_HUB_URL || "#!"}
|
||||
target="_blank"
|
||||
|
||||
@@ -4,12 +4,10 @@ import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { getStationsAPI } from "_querys/stations";
|
||||
import toast from "react-hot-toast";
|
||||
import { editConnectedAircraftAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { Prisma } from "@repo/db";
|
||||
import { getNextDateWithTime } from "@repo/shared-components";
|
||||
import { Button, getNextDateWithTime } from "@repo/shared-components";
|
||||
import { Select } from "_components/Select";
|
||||
import { components } from "react-select";
|
||||
import { Radio } from "lucide-react";
|
||||
|
||||
export const ConnectionBtn = () => {
|
||||
@@ -24,7 +22,6 @@ export const ConnectionBtn = () => {
|
||||
selectedStationId: null,
|
||||
debugPosition: false,
|
||||
});
|
||||
const [logoffDebounce, setLogoffDebounce] = useState<NodeJS.Timeout | null>(null);
|
||||
|
||||
const { data: stations } = useQuery({
|
||||
queryKey: ["stations"],
|
||||
@@ -54,41 +51,14 @@ export const ConnectionBtn = () => {
|
||||
return () => {
|
||||
connection.disconnect();
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [connection.disconnect]);
|
||||
|
||||
const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || [];
|
||||
|
||||
const { data: connectedAircrafts } = useQuery({
|
||||
queryKey: ["aircrafts"],
|
||||
queryFn: () => getConnectedAircraftsAPI(),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!logoffHours || !logoffMinutes || !connection.connectedAircraft) return;
|
||||
|
||||
if (logoffDebounce) clearTimeout(logoffDebounce);
|
||||
|
||||
const timeout = setTimeout(async () => {
|
||||
if (!connection.connectedAircraft?.id) return;
|
||||
await aircraftMutation.mutateAsync({
|
||||
sessionId: connection.connectedAircraft.id,
|
||||
change: {
|
||||
esimatedLogoutTime:
|
||||
logoffHours && logoffMinutes ? getNextDateWithTime(logoffHours, logoffMinutes) : null,
|
||||
},
|
||||
});
|
||||
modalRef.current?.close();
|
||||
toast.success("Änderung gespeichert!");
|
||||
}, 2000);
|
||||
|
||||
setLogoffDebounce(timeout);
|
||||
|
||||
// Cleanup function to clear timeout
|
||||
return () => {
|
||||
if (logoffDebounce) clearTimeout(logoffDebounce);
|
||||
};
|
||||
}, [logoffHours, logoffMinutes, connection.connectedAircraft]);
|
||||
|
||||
const session = useSession();
|
||||
const uid = session.data?.user?.id;
|
||||
if (!uid) return null;
|
||||
@@ -143,7 +113,9 @@ export const ConnectionBtn = () => {
|
||||
})
|
||||
}
|
||||
value={form.selectedStationId ?? ""}
|
||||
formatOptionLabel={(option: any) => option.component}
|
||||
formatOptionLabel={(option: unknown) =>
|
||||
(option as { component: React.ReactNode }).component
|
||||
}
|
||||
options={
|
||||
stations?.map((station) => ({
|
||||
value: station.id.toString(),
|
||||
@@ -184,7 +156,8 @@ export const ConnectionBtn = () => {
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
{session.data?.user.permissions.includes("ADMIN_STATION") && (
|
||||
{session.data?.user.permissions.includes("ADMIN_STATION") &&
|
||||
connection.status === "disconnected" && (
|
||||
<fieldset className="fieldset bg-base-100 border-base-300 rounded-box w-full border p-4">
|
||||
<legend className="fieldset-legend">Debug-optionen</legend>
|
||||
<label className="label">
|
||||
@@ -202,27 +175,52 @@ export const ConnectionBtn = () => {
|
||||
<form method="dialog" className="w-full flex justify-between">
|
||||
<button className="btn btn-soft">Zurück</button>
|
||||
{connection.status == "connected" ? (
|
||||
<>
|
||||
<Button
|
||||
className="btn"
|
||||
onClick={async () => {
|
||||
if (!connection.connectedAircraft) return;
|
||||
const [logoffHours, logoffMinutes] =
|
||||
form.logoffTime?.split(":").map(Number) || [];
|
||||
|
||||
console.log(logoffHours, logoffMinutes, form.logoffTime);
|
||||
await aircraftMutation.mutateAsync({
|
||||
sessionId: connection.connectedAircraft.id,
|
||||
change: {
|
||||
esimatedLogoutTime:
|
||||
logoffHours !== undefined && logoffMinutes !== undefined
|
||||
? getNextDateWithTime(logoffHours, logoffMinutes)
|
||||
: null,
|
||||
},
|
||||
});
|
||||
modalRef.current?.close();
|
||||
}}
|
||||
>
|
||||
Logoff-Zeit speichern
|
||||
</Button>
|
||||
<button
|
||||
className="btn btn-soft btn-error"
|
||||
type="submit"
|
||||
onSubmit={() => false}
|
||||
onClick={() => {
|
||||
connection.disconnect();
|
||||
modalRef.current?.close();
|
||||
}}
|
||||
>
|
||||
Verbindung Trennen
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<button
|
||||
<Button
|
||||
type="submit"
|
||||
onSubmit={() => false}
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
const selectedStation = stations?.find(
|
||||
(station) =>
|
||||
station.id === parseInt(form.selectedStationId?.toString() || ""),
|
||||
);
|
||||
if (selectedStation) {
|
||||
connection.connect(
|
||||
await connection.connect(
|
||||
uid,
|
||||
form.selectedStationId?.toString() || "",
|
||||
form.logoffTime || "",
|
||||
@@ -231,11 +229,12 @@ export const ConnectionBtn = () => {
|
||||
form.debugPosition,
|
||||
);
|
||||
}
|
||||
modalRef.current?.close();
|
||||
}}
|
||||
className="btn btn-soft btn-info"
|
||||
>
|
||||
{connection.status == "disconnected" ? "Verbinden" : connection.status}
|
||||
</button>
|
||||
</Button>
|
||||
)}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,13 @@ export default async function RootLayout({
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session?.user.permissions.includes("PILOT"))
|
||||
return <Error title="Zugriff verweigert" statusCode={403} />;
|
||||
return (
|
||||
<Error
|
||||
title=" Fehlende Berechtigung"
|
||||
description="Du hast nicht die erforderlichen Berechtigungen, dich als Pilot anzumelden. Du kannst in HUB Kurse abschließen um die Berechtigung zu erhalten."
|
||||
statusCode={403}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -8,9 +8,10 @@ import dynamic from "next/dynamic";
|
||||
import { ConnectedDispatcher } from "tracker/_components/ConnectedDispatcher";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
import { getAircraftsAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { checkSimulatorConnected } from "@repo/shared-components";
|
||||
import { SimConnectionAlert } from "(app)/pilot/_components/SimConnectionAlert";
|
||||
import { SettingsBoard } from "_components/left/SettingsBoard";
|
||||
|
||||
const Map = dynamic(() => import("_components/map/Map"), {
|
||||
ssr: false,
|
||||
@@ -18,15 +19,14 @@ const Map = dynamic(() => import("_components/map/Map"), {
|
||||
|
||||
const PilotPage = () => {
|
||||
const { connectedAircraft, status } = usePilotConnectionStore((state) => state);
|
||||
const { data: ownAircraftArray = [] } = useQuery({
|
||||
queryKey: ["own-aircraft", connectedAircraft?.id],
|
||||
queryFn: () =>
|
||||
getAircraftsAPI({
|
||||
id: connectedAircraft?.id,
|
||||
}),
|
||||
refetchInterval: 10000,
|
||||
// Query will be cached anyway, due to this, displayed Markers are in sync with own Aircraft connection-warning
|
||||
const { data: aircrafts } = useQuery({
|
||||
queryKey: ["aircrafts"],
|
||||
queryFn: () => getConnectedAircraftsAPI(),
|
||||
refetchInterval: 10_000,
|
||||
});
|
||||
const ownAircraft = ownAircraftArray[0];
|
||||
|
||||
const ownAircraft = aircrafts?.find((aircraft) => aircraft.id === connectedAircraft?.id);
|
||||
const simulatorConnected = ownAircraft ? checkSimulatorConnected(ownAircraft) : false;
|
||||
return (
|
||||
<div className="relative flex-1 flex transition-all duration-500 ease w-full h-screen overflow-hidden">
|
||||
@@ -40,6 +40,11 @@ const PilotPage = () => {
|
||||
</div>
|
||||
<div className="flex w-2/3 h-full">
|
||||
<div className="relative flex flex-1 h-full">
|
||||
<div className="absolute left-0 top-19/20 transform -translate-y-1/2 pl-4 z-999999">
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<SettingsBoard />
|
||||
</div>
|
||||
</div>
|
||||
<Map />
|
||||
<div className="absolute top-5 right-10 z-99999 space-y-2">
|
||||
{!simulatorConnected && status === "connected" && (
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { NextPage } from "next";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
const AuthLayout: NextPage<
|
||||
Readonly<{
|
||||
|
||||
@@ -14,7 +14,7 @@ export const Login = () => {
|
||||
if (status === "authenticated") {
|
||||
navigate.push("/");
|
||||
}
|
||||
}, [session, navigate]);
|
||||
}, [session, navigate, status]);
|
||||
|
||||
useEffect(() => {
|
||||
const signInWithCode = async () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { useDebounce } from "_helpers/useDebounce";
|
||||
import { useDebounce } from "@repo/shared-components";
|
||||
import { useAudioStore } from "_store/audioStore";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
@@ -112,5 +112,6 @@ export const useSounds = ({
|
||||
callToLong.current!.pause();
|
||||
};
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isTransmitting]);
|
||||
};
|
||||
|
||||
@@ -11,10 +11,10 @@ export const CustomErrorBoundary = ({ children }: { children?: React.ReactNode }
|
||||
let errorTest;
|
||||
let errorCode = 500;
|
||||
if ("statusCode" in error) {
|
||||
errorCode = (error as any).statusCode;
|
||||
errorCode = error.statusCode;
|
||||
}
|
||||
if ("message" in error || error instanceof Error) {
|
||||
errorTest = (error as any).message;
|
||||
errorTest = error.message;
|
||||
} else if (typeof error === "string") {
|
||||
errorTest = error;
|
||||
} else {
|
||||
|
||||
@@ -47,27 +47,28 @@ export default function MicrophoneLevel({ deviceId, volumeInput }: MicrophoneLev
|
||||
};
|
||||
}, [deviceId, volumeInput]);
|
||||
|
||||
const barWidth = Math.max((volumeLevel / 70) * 100 - 35, 0);
|
||||
const barWidth = Math.min((volumeLevel / 140) * 100, 100);
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div className="relative w-full bg-base-300 h-5 rounded">
|
||||
<div
|
||||
className={cn("bg-primary h-full rounded", barWidth > 100 && "bg-red-400")}
|
||||
className={cn("bg-primary h-full rounded", barWidth == 100 && "bg-red-400")}
|
||||
style={{
|
||||
width: `${barWidth > 100 ? 100 : barWidth}%`,
|
||||
width: `${barWidth}%`,
|
||||
transition: "width 0.2s",
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className="absolute top-0 left-[60%] w-[20%] h-full bg-green-500 opacity-40 rounded"
|
||||
className="absolute top-0 left-[60%] w-[30%] h-full bg-green-500 opacity-40 rounded"
|
||||
style={{
|
||||
transform: "translateX(-50%)",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-gray-500 text-sm">
|
||||
Lautstärke sollte beim Sprechen in dem Grünen bereich bleiben
|
||||
Lautstärke sollte beim Sprechen in dem Grünen bereich bleiben. Beachte das scharfe Laute
|
||||
(z.B. "S" oder "Z") die Anzeige verfälschen können.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
"use client";
|
||||
|
||||
import { toast } from "react-hot-toast";
|
||||
import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
import { dispatchSocket } from "(app)/dispatch/socket";
|
||||
import { Mission, NotificationPayload } from "@repo/db";
|
||||
import { NotificationPayload } from "@repo/db";
|
||||
import { HPGnotificationToast } from "_components/customToasts/HPGnotification";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
import { AdminMessageToast } from "_components/customToasts/AdminMessage";
|
||||
import { pilotSocket } from "(app)/pilot/socket";
|
||||
import { QUICK_RESPONSE, StatusToast } from "_components/customToasts/StationStatusToast";
|
||||
import { MissionAutoCloseToast } from "_components/customToasts/MissionAutoClose";
|
||||
|
||||
export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
const mapStore = useMapStore((s) => s);
|
||||
@@ -30,7 +31,7 @@ export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
}),
|
||||
);
|
||||
useEffect(() => {
|
||||
const invalidateMission = (mission: Mission) => {
|
||||
const invalidateMission = () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["missions"],
|
||||
});
|
||||
@@ -79,6 +80,14 @@ export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
duration: 60000,
|
||||
});
|
||||
break;
|
||||
case "mission-auto-close":
|
||||
toast.custom(
|
||||
(t) => <MissionAutoCloseToast event={notification} t={t} mapStore={mapStore} />,
|
||||
{
|
||||
duration: 60000,
|
||||
},
|
||||
);
|
||||
break;
|
||||
default:
|
||||
toast("unbekanntes Notification-Event");
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
"use client";
|
||||
import { FieldValues, Path } from "react-hook-form";
|
||||
import SelectTemplate, { Props as SelectTemplateProps, StylesConfig } from "react-select";
|
||||
import { cn } from "@repo/shared-components";
|
||||
import dynamic from "next/dynamic";
|
||||
@@ -99,7 +99,7 @@ const SelectCom = ({
|
||||
);
|
||||
};
|
||||
|
||||
const SelectWrapper = <T extends FieldValues>(props: SelectProps) => <SelectCom {...props} />;
|
||||
const SelectWrapper = (props: SelectProps) => <SelectCom {...props} />;
|
||||
|
||||
export const Select = dynamic(() => Promise.resolve(SelectWrapper), {
|
||||
ssr: false,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NotificationPayload, ValidationFailed, ValidationSuccess } from "@repo/db";
|
||||
import { ValidationFailed, ValidationSuccess } from "@repo/db";
|
||||
import { BaseNotification } from "_components/customToasts/BaseNotification";
|
||||
import { MapStore, useMapStore } from "_store/mapStore";
|
||||
import { MapStore } from "_store/mapStore";
|
||||
import { Check, Cross } from "lucide-react";
|
||||
import toast, { Toast } from "react-hot-toast";
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
import { getPublicUser, MissionAutoClose, Prisma } from "@repo/db";
|
||||
import { JsonValueType } from "@repo/db/zod";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { BaseNotification } from "_components/customToasts/BaseNotification";
|
||||
import { editMissionAPI } from "_querys/missions";
|
||||
import { MapStore } from "_store/mapStore";
|
||||
import { Clock, X } from "lucide-react";
|
||||
import { useSession } from "next-auth/react";
|
||||
import toast, { Toast } from "react-hot-toast";
|
||||
|
||||
export const MissionAutoCloseToast = ({
|
||||
event,
|
||||
t,
|
||||
mapStore,
|
||||
}: {
|
||||
event: MissionAutoClose;
|
||||
t: Toast;
|
||||
mapStore: MapStore;
|
||||
}) => {
|
||||
const { data: session } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const editMissionMutation = useMutation({
|
||||
mutationFn: ({ id, mission }: { id: number; mission: Partial<Prisma.MissionUpdateInput> }) =>
|
||||
editMissionAPI(id, mission),
|
||||
mutationKey: ["missions"],
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["missions"],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<BaseNotification icon={<Clock />} className="flex flex-row">
|
||||
<div className="flex-1">
|
||||
<h1 className="text-warning font-bold">Inaktiver Einsatz wurde automatisch geschlossen</h1>
|
||||
<p>{event.message}</p>
|
||||
</div>
|
||||
<div className="ml-11">
|
||||
<button
|
||||
className="btn"
|
||||
onClick={async () => {
|
||||
if (!session?.user) return;
|
||||
const mission = await editMissionMutation.mutateAsync({
|
||||
id: event.data.missionId,
|
||||
mission: {
|
||||
state: "running",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "reopened-log",
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
user: getPublicUser(session?.user, {
|
||||
ignorePrivacy: true,
|
||||
}) as unknown as JsonValueType,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
mapStore.setMap({
|
||||
zoom: 14,
|
||||
center: {
|
||||
lat: mission.addressLat,
|
||||
lng: mission.addressLng,
|
||||
},
|
||||
});
|
||||
mapStore.setOpenMissionMarker({
|
||||
open: [
|
||||
{
|
||||
id: mission.id,
|
||||
tab: "home",
|
||||
},
|
||||
],
|
||||
close: [],
|
||||
});
|
||||
toast.dismiss(t.id);
|
||||
}}
|
||||
>
|
||||
schließen widerrufen
|
||||
</button>
|
||||
<button className="btn btn-ghost btn-sm" onClick={() => toast.remove(t.id)}>
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</BaseNotification>
|
||||
);
|
||||
};
|
||||
@@ -5,7 +5,6 @@ import { FMS_STATUS_COLORS } from "_helpers/fmsStatusColors";
|
||||
import { editConnectedAircraftAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { getStationsAPI } from "_querys/stations";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
import { cpSync } from "fs";
|
||||
import { X } from "lucide-react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Toast, toast } from "react-hot-toast";
|
||||
@@ -67,7 +66,7 @@ export const StatusToast = ({ event, t }: { event: StationStatus; t: Toast }) =>
|
||||
} else if (event.status == connectedAircraft?.fmsStatus && !aircraftDataAcurate) {
|
||||
setAircraftDataAccurate(true);
|
||||
}
|
||||
}, [connectedAircraft, station]);
|
||||
}, [aircraftDataAcurate, connectedAircraft, event.status, t.id]);
|
||||
|
||||
useEffect(() => {
|
||||
let soundRef: React.RefObject<HTMLAudioElement | null> | null = null;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { asPublicUser } from "@repo/db";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getConnectedDispatcherAPI } from "_querys/dispatcher";
|
||||
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||
|
||||
export const Chat = () => {
|
||||
const {
|
||||
@@ -26,6 +27,7 @@ export const Chat = () => {
|
||||
const session = useSession();
|
||||
const [addTabValue, setAddTabValue] = useState<string>("default");
|
||||
const [message, setMessage] = useState<string>("");
|
||||
const dispatcherConnected = useDispatchConnectionStore((state) => state.status === "connected");
|
||||
|
||||
const { data: dispatcher } = useQuery({
|
||||
queryKey: ["dispatcher"],
|
||||
@@ -36,21 +38,24 @@ export const Chat = () => {
|
||||
queryKey: ["aircrafts"],
|
||||
queryFn: () => getConnectedAircraftsAPI(),
|
||||
refetchInterval: 10000,
|
||||
enabled: dispatcherConnected,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!session.data?.user.id) return;
|
||||
setOwnId(session.data?.user.id);
|
||||
}, [session.data?.user.id]);
|
||||
}, [session.data?.user.id, setOwnId]);
|
||||
|
||||
const filteredDispatcher = dispatcher?.filter((d) => d.userId !== session.data?.user.id);
|
||||
const filteredAircrafts = aircrafts?.filter((a) => a.userId !== session.data?.user.id);
|
||||
const filteredAircrafts = aircrafts?.filter(
|
||||
(a) => a.userId !== session.data?.user.id && dispatcherConnected,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={cn("dropdown dropdown-right dropdown-center", chatOpen && "dropdown-open")}>
|
||||
<div className="indicator">
|
||||
{Object.values(chats).some((c) => c.notification) && (
|
||||
<span className="indicator-item status status-info"></span>
|
||||
<span className="indicator-item status status-info animate-ping"></span>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-soft btn-sm btn-primary"
|
||||
@@ -118,7 +123,7 @@ export const Chat = () => {
|
||||
const dispatcherUser = dispatcher?.find((d) => d.userId === addTabValue);
|
||||
const user = aircraftUser || dispatcherUser;
|
||||
if (!user) return;
|
||||
let role = "Station" in user ? user.Station.bosCallsignShort : user.zone;
|
||||
const role = "Station" in user ? user.Station.bosCallsignShort : user.zone;
|
||||
addChat(addTabValue, `${asPublicUser(user.publicUser).fullName} (${role})`);
|
||||
setSelectedChat(addTabValue);
|
||||
}}
|
||||
@@ -134,7 +139,13 @@ export const Chat = () => {
|
||||
<Fragment key={userId}>
|
||||
<a
|
||||
className={cn("indicator tab", selectedChat === userId && "tab-active")}
|
||||
onClick={() => setSelectedChat(userId)}
|
||||
onClick={() => {
|
||||
if (selectedChat === userId) {
|
||||
setSelectedChat(null);
|
||||
return;
|
||||
}
|
||||
setSelectedChat(userId);
|
||||
}}
|
||||
>
|
||||
{chat.name}
|
||||
{chat.notification && <span className="indicator-item status status-info" />}
|
||||
|
||||
104
apps/dispatch/app/_components/left/SettingsBoard.tsx
Normal file
@@ -0,0 +1,104 @@
|
||||
"use client";
|
||||
import { useLeftMenuStore } from "_store/leftMenuStore";
|
||||
import { cn } from "@repo/shared-components";
|
||||
import { SettingsIcon } from "lucide-react";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
|
||||
export const SettingsBoard = () => {
|
||||
const { setSituationTabOpen, situationTabOpen } = useLeftMenuStore();
|
||||
const { followOwnAircraft, showOtherAircrafts, showOtherMissions, setMapOptions } =
|
||||
usePilotConnectionStore();
|
||||
const cross = (
|
||||
<svg
|
||||
aria-label="disabled"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="4"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<path d="M18 6 6 18" />
|
||||
<path d="m6 6 12 12" />
|
||||
</svg>
|
||||
);
|
||||
const check = (
|
||||
<svg aria-label="enabled" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<g
|
||||
strokeLinejoin="round"
|
||||
strokeLinecap="round"
|
||||
strokeWidth="4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path d="M20 6 9 17l-5-5"></path>
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={cn("dropdown dropdown-top", situationTabOpen && "dropdown-open")}>
|
||||
<div className="indicator">
|
||||
<button
|
||||
className="btn btn-soft btn-sm btn-info"
|
||||
onClick={() => {
|
||||
setSituationTabOpen(!situationTabOpen);
|
||||
}}
|
||||
>
|
||||
<SettingsIcon size={18} />
|
||||
</button>
|
||||
</div>
|
||||
{situationTabOpen && (
|
||||
<div
|
||||
tabIndex={0}
|
||||
className="dropdown-content card bg-base-200 shadow-md z-[1100] ml-2 border-1 border-info min-w-[300px] max-h-[300px]"
|
||||
>
|
||||
<div className="card-body flex flex-row gap-4">
|
||||
<div className="flex flex-col w-full h-full gap-2">
|
||||
<h2 className="inline-flex items-center gap-2 text-lg font-bold mb-2">
|
||||
<SettingsIcon size={18} /> Map Einstellungen
|
||||
</h2>
|
||||
<div className="flex items-center gap-2">
|
||||
<label className="toggle text-base-content">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={followOwnAircraft}
|
||||
onChange={(e) => setMapOptions({ followOwnAircraft: e.target.checked })}
|
||||
/>
|
||||
{cross}
|
||||
{check}
|
||||
</label>
|
||||
Folge mir selbst
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<label className="toggle text-base-content">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={showOtherAircrafts}
|
||||
onChange={(e) => setMapOptions({ showOtherAircrafts: e.target.checked })}
|
||||
/>
|
||||
{cross}
|
||||
{check}
|
||||
</label>
|
||||
Zeige andere Piloten
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<label className="toggle text-base-content">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={showOtherMissions}
|
||||
onChange={(e) => setMapOptions({ showOtherMissions: e.target.checked })}
|
||||
/>
|
||||
{cross}
|
||||
{check}
|
||||
</label>
|
||||
Zeige andere Einsätze
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -4,7 +4,7 @@ import { cn } from "@repo/shared-components";
|
||||
import { ListCollapse, Plane } from "lucide-react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getMissionsAPI } from "_querys/missions";
|
||||
import { Station } from "@repo/db";
|
||||
import { Mission, Station } from "@repo/db";
|
||||
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
@@ -20,7 +20,13 @@ export const SituationBoard = () => {
|
||||
const { data: missions } = useQuery({
|
||||
queryKey: ["missions", "missions-on-stations"],
|
||||
queryFn: () =>
|
||||
getMissionsAPI(
|
||||
getMissionsAPI<
|
||||
Mission & {
|
||||
MissionsOnStations: (Station & {
|
||||
Station: Station;
|
||||
})[];
|
||||
}
|
||||
>(
|
||||
{
|
||||
state: {
|
||||
not: "finished",
|
||||
@@ -64,7 +70,7 @@ export const SituationBoard = () => {
|
||||
{situationTabOpen && (
|
||||
<div
|
||||
tabIndex={0}
|
||||
className="dropdown-content card bg-base-200 shadow-md z-[1100] ml-2 border-1 border-info"
|
||||
className="dropdown-content card bg-base-200 shadow-md z-[1100] ml-2 border-1 border-info min-w-[900px] max-h-[300px]"
|
||||
>
|
||||
<div className="card-body flex flex-row gap-4">
|
||||
<div className="flex-1">
|
||||
@@ -84,7 +90,7 @@ export const SituationBoard = () => {
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<div className="overflow-x-auto overflow-y-auto max-h-[170px] select-none">
|
||||
<table className="table table-xs">
|
||||
{/* head */}
|
||||
<thead>
|
||||
@@ -100,6 +106,10 @@ export const SituationBoard = () => {
|
||||
(mission) =>
|
||||
(dispatcherConnected || mission.state !== "draft") && (
|
||||
<tr
|
||||
className={cn(
|
||||
"cursor-pointer",
|
||||
mission.state === "draft" && "missionListItem",
|
||||
)}
|
||||
onDoubleClick={() => {
|
||||
setOpenMissionMarker({
|
||||
open: [
|
||||
@@ -119,14 +129,13 @@ export const SituationBoard = () => {
|
||||
});
|
||||
}}
|
||||
key={mission.id}
|
||||
className={cn(mission.state === "draft" && "missionListItem")}
|
||||
>
|
||||
<td>{mission.publicId}</td>
|
||||
<td>{mission.publicId.replace("ENr.: ", "")}</td>
|
||||
<td>{mission.missionKeywordAbbreviation}</td>
|
||||
<td>{mission.addressCity}</td>
|
||||
<td>
|
||||
{(mission as any).MissionsOnStations?.map(
|
||||
(mos: { Station: Station }) => mos.Station?.bosCallsignShort,
|
||||
{mission.MissionsOnStations?.map(
|
||||
(mos) => mos.Station?.bosCallsignShort,
|
||||
).join(", ")}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -141,7 +150,7 @@ export const SituationBoard = () => {
|
||||
<h2 className="inline-flex items-center gap-2 text-lg font-bold mb-2">
|
||||
<Plane /> Stationen
|
||||
</h2>
|
||||
<div className="overflow-x-auto">
|
||||
<div className="overflow-x-auto overflow-y-auto max-h-[200px] select-none">
|
||||
<table className="table table-xs">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -153,6 +162,7 @@ export const SituationBoard = () => {
|
||||
<tbody>
|
||||
{connectedAircrafts?.map((station) => (
|
||||
<tr
|
||||
className="cursor-pointer"
|
||||
key={station.id}
|
||||
onDoubleClick={() => {
|
||||
setOpenAircraftMarker({
|
||||
|
||||
@@ -16,6 +16,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { getConnectedAircraftPositionLogAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { getMissionsAPI } from "_querys/missions";
|
||||
import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
|
||||
const AircraftPopupContent = ({
|
||||
aircraft,
|
||||
@@ -169,7 +170,7 @@ const AircraftPopupContent = ({
|
||||
onClick={() => handleTabChange("aircraft")}
|
||||
>
|
||||
<span className="text-white text-base font-medium truncate">
|
||||
{aircraft.Station.bosCallsign.length > 20
|
||||
{aircraft.Station.bosCallsign.length > 16
|
||||
? aircraft.Station.bosCallsignShort
|
||||
: aircraft.Station.bosCallsign}
|
||||
</span>
|
||||
@@ -262,7 +263,7 @@ const AircraftMarker = ({ aircraft }: { aircraft: ConnectedAircraft & { Station:
|
||||
return () => {
|
||||
marker?.off("click", handleClick);
|
||||
};
|
||||
}, [aircraft.id, openAircraftMarker, setOpenAircraftMarker, markerRef.current]);
|
||||
}, [aircraft.id, openAircraftMarker, setOpenAircraftMarker]);
|
||||
|
||||
const [anchor, setAnchor] = useState<"topleft" | "topright" | "bottomleft" | "bottomright">(
|
||||
"topleft",
|
||||
@@ -396,10 +397,42 @@ export const AircraftLayer = () => {
|
||||
queryFn: () => getConnectedAircraftsAPI(),
|
||||
refetchInterval: 10_000,
|
||||
});
|
||||
const { setMap } = useMapStore((state) => state);
|
||||
const map = useMap();
|
||||
const {
|
||||
connectedAircraft,
|
||||
status: pilotConnectionStatus,
|
||||
showOtherAircrafts,
|
||||
followOwnAircraft,
|
||||
} = usePilotConnectionStore((state) => state);
|
||||
|
||||
const filteredAircrafts = useMemo(() => {
|
||||
if (!aircrafts) return [];
|
||||
return aircrafts.filter((aircraft) => {
|
||||
if (pilotConnectionStatus === "connected" && !showOtherAircrafts) {
|
||||
return connectedAircraft?.stationId === aircraft.stationId;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}, [aircrafts, pilotConnectionStatus, connectedAircraft, showOtherAircrafts]);
|
||||
|
||||
const ownAircraft = useMemo(() => {
|
||||
return aircrafts?.find((aircraft) => aircraft.id === connectedAircraft?.id);
|
||||
}, [aircrafts, connectedAircraft]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pilotConnectionStatus === "connected" && followOwnAircraft && ownAircraft) {
|
||||
if (!ownAircraft.posLat || !ownAircraft.posLng) return;
|
||||
setMap({
|
||||
center: [ownAircraft.posLat, ownAircraft.posLng],
|
||||
zoom: map.getZoom(),
|
||||
});
|
||||
}
|
||||
}, [pilotConnectionStatus, followOwnAircraft, ownAircraft, setMap, map]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{aircrafts?.map((aircraft) => {
|
||||
{filteredAircrafts?.map((aircraft) => {
|
||||
return <AircraftMarker key={aircraft.id} aircraft={aircraft} />;
|
||||
})}
|
||||
</>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
import { usePannelStore } from "_store/pannelStore";
|
||||
import { Control, Icon, LatLngExpression } from "leaflet";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Control, divIcon, Icon, LatLngExpression } from "leaflet";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
LayerGroup,
|
||||
LayersControl,
|
||||
@@ -15,16 +14,17 @@ import {
|
||||
Marker,
|
||||
Tooltip,
|
||||
} from "react-leaflet";
|
||||
// @ts-ignore
|
||||
// @ts-expect-error geojson hat keine Typen
|
||||
import type { FeatureCollection, Geometry } from "geojson";
|
||||
import L from "leaflet";
|
||||
import LEITSTELLENBERECHE from "./_geojson/Leitstellen.json";
|
||||
import WINDFARMS from "./_geojson/Windfarms.json";
|
||||
import { createCustomMarker } from "_components/map/_components/createCustomMarker";
|
||||
import { Station } from "@repo/db";
|
||||
import { Heliport, Station } from "@repo/db";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getStationsAPI } from "_querys/stations";
|
||||
import "./darkMapStyles.css";
|
||||
import { getHeliportsAPI } from "_querys/heliports";
|
||||
|
||||
const RadioAreaLayer = () => {
|
||||
const getColor = (randint: number) => {
|
||||
@@ -68,6 +68,199 @@ const RadioAreaLayer = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const HeliportsLayer = () => {
|
||||
const { data: heliports } = useQuery({
|
||||
queryKey: ["heliports"],
|
||||
queryFn: () => getHeliportsAPI(),
|
||||
});
|
||||
const [heliportsWithIcon, setHeliportsWithIcon] = useState<(Heliport & { icon?: string })[]>([]);
|
||||
const map = useMap();
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
const [boxContent, setBoxContent] = useState<React.ReactNode>(null);
|
||||
// Übergangslösung
|
||||
const formatDate = (date: Date): string => {
|
||||
const year = date.getFullYear().toString().slice(-2); // Letzte 2 Stellen des Jahres
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, "0"); // Monat (mit führender Null, falls notwendig)
|
||||
const day = date.getDate().toString().padStart(2, "0"); // Tag (mit führender Null, falls notwendig)
|
||||
return `${year}${month}${day}`;
|
||||
};
|
||||
const replaceWithYesterdayDate = (url: string): string => {
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 2); // Einen Tag zurücksetzen
|
||||
const formattedDate = formatDate(yesterday);
|
||||
|
||||
return url.replace(/\.at\/lo\/\d{6}/, `.at/lo/${formattedDate}`);
|
||||
};
|
||||
|
||||
const resetSelection = () => {
|
||||
setBoxContent(null);
|
||||
};
|
||||
|
||||
useMapEvent("click", () => {
|
||||
resetSelection();
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const handleZoom = () => {
|
||||
setIsVisible(map.getZoom() > 8);
|
||||
};
|
||||
|
||||
handleZoom();
|
||||
|
||||
map.on("zoomend", handleZoom);
|
||||
|
||||
const fetchIcons = async () => {
|
||||
if (!heliports) return;
|
||||
const urls = await Promise.all(
|
||||
heliports.map(async (heliport) => {
|
||||
return createCustomMarker(heliport.type);
|
||||
}),
|
||||
);
|
||||
setHeliportsWithIcon(
|
||||
heliports.map((heliport, index) => ({ ...heliport, icon: urls[index] })),
|
||||
);
|
||||
};
|
||||
|
||||
const filterVisibleHeliports = () => {
|
||||
const bounds = map.getBounds();
|
||||
if (!heliports?.length) return;
|
||||
// Filtere die Heliports, die innerhalb der Kartenansicht liegen
|
||||
const visibleHeliports = heliports.filter((heliport) => {
|
||||
const coordinates: LatLngExpression = [heliport.lat, heliport.lng];
|
||||
return bounds.contains(coordinates); // Überprüft, ob der Heliport innerhalb der aktuellen Bounds liegt
|
||||
});
|
||||
|
||||
setHeliportsWithIcon(visibleHeliports);
|
||||
};
|
||||
|
||||
if (heliports?.length) {
|
||||
fetchIcons();
|
||||
filterVisibleHeliports();
|
||||
}
|
||||
|
||||
handleZoom();
|
||||
|
||||
map.on("zoomend", handleZoom);
|
||||
map.on("moveend", filterVisibleHeliports);
|
||||
|
||||
return () => {
|
||||
map.off("zoomend", handleZoom);
|
||||
map.off("moveend", filterVisibleHeliports);
|
||||
};
|
||||
}, [map, heliports]);
|
||||
|
||||
const createCustomIcon = (heliportType: string) => {
|
||||
if (heliportType === "POI") {
|
||||
return divIcon({
|
||||
className: "custom-marker no-pointer", // CSS-Klasse für Styling
|
||||
html: '<div style="width: 15px; height: 15px; border-radius: 50%; background-color: white; border: 2px solid #7f7f7f; display: flex; align-items: center; justify-content: center;"><span style="font-size: 12px; color: #7f7f7f;">H</span></div>',
|
||||
iconSize: [15, 15], // Größe des Icons
|
||||
iconAnchor: [7.5, 15], // Ankerpunkt des Icons
|
||||
});
|
||||
}
|
||||
|
||||
// Heliport Typ: H-Icon
|
||||
if (heliportType === "HELIPAD") {
|
||||
return divIcon({
|
||||
className: "custom-marker no-pointer", // CSS-Klasse für Styling
|
||||
html: '<div style="width: 15px; height: 15px; background-color: white; border: 2px solid #7f7f7f; display: flex; align-items: center; justify-content: center;"><span style="font-size: 12px; color: #7f7f7f;">H</span></div>',
|
||||
iconSize: [15, 15], // Größe des Icons (15x15 px Viereck)
|
||||
iconAnchor: [7.5, 15], // Ankerpunkt des Icons
|
||||
});
|
||||
}
|
||||
|
||||
// Mountain Typ: Kreis mit "M"
|
||||
if (heliportType === "MOUNTAIN") {
|
||||
return divIcon({
|
||||
className: "custom-marker no-pointer",
|
||||
html: '<div style="width: 15px; height: 15px; border-radius: 50%; background-color: white; border: 2px solid #7f7f7f; display: flex; align-items: center; justify-content: center;"><span style="font-size: 12px; color: #7f7f7f;">M</span></div>',
|
||||
iconSize: [15, 15], // Größe des Icons
|
||||
iconAnchor: [7.5, 15], // Ankerpunkt des Icons
|
||||
});
|
||||
}
|
||||
|
||||
// Falls kein Typ übereinstimmt, standardmäßig das POI-Icon mit Fragezeichen verwenden
|
||||
return divIcon({
|
||||
className: "custom-marker no-pointer",
|
||||
html: '<div style="width: 15px; height: 15px; border-radius: 50%; background-color: white; border: 2px solid #7f7f7f; display: flex; align-items: center; justify-content: center;"><span style="font-size: 12px; color: #7f7f7f;">?</span></div>',
|
||||
iconSize: [15, 15],
|
||||
iconAnchor: [7.5, 15],
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<FeatureGroup attribution="">
|
||||
{isVisible &&
|
||||
heliportsWithIcon.map((heliport) => {
|
||||
const coordinates: LatLngExpression = [heliport.lat, heliport.lng];
|
||||
const designatorLabel = heliport.designator.charAt(0).toUpperCase();
|
||||
const heliportType = heliport.type;
|
||||
return (
|
||||
<Marker
|
||||
key={heliport.id}
|
||||
position={coordinates}
|
||||
icon={createCustomIcon(heliportType)}
|
||||
eventHandlers={{
|
||||
mouseover: (e) => {
|
||||
const tooltipContent = `${heliport.siteNameSub26} (${heliport.designator})`;
|
||||
e.target
|
||||
.bindTooltip(tooltipContent, {
|
||||
direction: "top",
|
||||
offset: [4, -15],
|
||||
})
|
||||
.openTooltip();
|
||||
},
|
||||
mouseout: (e) => {
|
||||
e.target.closeTooltip();
|
||||
},
|
||||
click: () => {
|
||||
setBoxContent(
|
||||
<div>
|
||||
<h4>{heliport.siteNameSub26}</h4>
|
||||
<p>
|
||||
<strong>Designator:</strong> {heliport.designator}
|
||||
</p>
|
||||
{heliport.info?.startsWith("http") ? (
|
||||
<p>
|
||||
<a
|
||||
href={replaceWithYesterdayDate(heliport.info)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{heliport.info}
|
||||
</a>
|
||||
</p>
|
||||
) : (
|
||||
<p>{heliport.info}</p>
|
||||
)}
|
||||
<p>
|
||||
{heliport.lat} °N, {heliport.lng} °E
|
||||
</p>
|
||||
</div>,
|
||||
);
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Tooltip direction="top" sticky>
|
||||
<div style={{ textAlign: "center" }}>
|
||||
<strong>{heliport.designator}</strong>
|
||||
<small style={{ fontWeight: "bold", fontSize: "0.7em" }}>
|
||||
{` (${designatorLabel})`}
|
||||
</small>
|
||||
<br />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</Marker>
|
||||
);
|
||||
})}
|
||||
</FeatureGroup>
|
||||
|
||||
{boxContent && <div className="modal-box">{boxContent}</div>}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const StationsLayer = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const { data: stations } = useQuery({
|
||||
queryKey: ["stations"],
|
||||
@@ -197,7 +390,7 @@ const StationsLayer = ({ attribution }: { attribution: Control.Attribution }) =>
|
||||
);
|
||||
};
|
||||
|
||||
const EsriSatellite = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const EsriSatellite = () => {
|
||||
const accessToken = process.env.NEXT_PUBLIC_ESRI_ACCESS;
|
||||
return (
|
||||
<>
|
||||
@@ -221,8 +414,7 @@ const StrassentexteEsri = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const OpenAIP = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const accessToken = process.env.NEXT_PUBLIC_OPENAIP_ACCESS;
|
||||
const OpenAIP = () => {
|
||||
const ref = useRef<L.TileLayer | null>(null);
|
||||
|
||||
return (
|
||||
@@ -241,7 +433,7 @@ const OpenAIP = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const NiederschlagOverlay = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const NiederschlagOverlay = () => {
|
||||
const tileLayerRef = useRef<L.TileLayer.WMS | null>(null);
|
||||
|
||||
return (
|
||||
@@ -262,6 +454,25 @@ const NiederschlagOverlay = ({ attribution }: { attribution: Control.Attribution
|
||||
);
|
||||
};
|
||||
|
||||
const SlopesOverlay = () => {
|
||||
const tileLayerRef = useRef<L.TileLayer.WMS | null>(null);
|
||||
|
||||
return (
|
||||
<WMSTileLayer
|
||||
ref={tileLayerRef}
|
||||
eventHandlers={{
|
||||
add: () => {
|
||||
tileLayerRef.current?.bringToFront();
|
||||
},
|
||||
}}
|
||||
attribution="Opensnowmap.org (CC-BY-SA)"
|
||||
url="http://tiles.opensnowmap.org/pistes/{z}/{x}/{y}.png?"
|
||||
transparent
|
||||
zIndex={1000}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const WindfarmOutlineLayer = () => {
|
||||
const map = useMap();
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
@@ -306,12 +517,12 @@ const WindfarmOutlineLayer = () => {
|
||||
export const BaseMaps = () => {
|
||||
const map = useMap();
|
||||
return (
|
||||
<LayersControl position="topleft">
|
||||
<LayersControl position="bottomright">
|
||||
<LayersControl.Overlay name={"Leitstellenbereiche"}>
|
||||
<RadioAreaLayer />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name={"Niederschlag"}>
|
||||
<NiederschlagOverlay attribution={map.attributionControl} />
|
||||
<NiederschlagOverlay />
|
||||
</LayersControl.Overlay>
|
||||
|
||||
<LayersControl.Overlay name={"Windkraftanlagen offshore"}>
|
||||
@@ -321,8 +532,14 @@ export const BaseMaps = () => {
|
||||
<LayersControl.Overlay name={"LRZs"}>
|
||||
<StationsLayer attribution={map.attributionControl} />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name={"Heliports"}>
|
||||
<HeliportsLayer />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name={"OpenAIP"}>
|
||||
<OpenAIP attribution={map.attributionControl} />
|
||||
<OpenAIP />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name={"Skigebiete"}>
|
||||
<SlopesOverlay />
|
||||
</LayersControl.Overlay>
|
||||
|
||||
<LayersControl.BaseLayer name="OpenStreetMap Dark" checked>
|
||||
@@ -348,7 +565,7 @@ export const BaseMaps = () => {
|
||||
</LayersControl.BaseLayer>
|
||||
<LayersControl.BaseLayer name="ESRI Satellite">
|
||||
<LayerGroup>
|
||||
<EsriSatellite attribution={map.attributionControl} />
|
||||
<EsriSatellite />
|
||||
<StrassentexteEsri />
|
||||
</LayerGroup>
|
||||
</LayersControl.BaseLayer>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { OSMWay, Prisma } from "@repo/db";
|
||||
import { OSMWay } from "@repo/db";
|
||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
import { usePannelStore } from "_store/pannelStore";
|
||||
@@ -8,8 +8,6 @@ import { getOsmAddress } from "_querys/osm";
|
||||
import { useEffect, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { Popup, useMap } from "react-leaflet";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { editMissionAPI } from "_querys/missions";
|
||||
import { findClosestPolygon } from "_helpers/findClosestPolygon";
|
||||
|
||||
export const ContextMenu = () => {
|
||||
@@ -22,8 +20,9 @@ export const ContextMenu = () => {
|
||||
setSearchPopup,
|
||||
toggleSearchElementSelection,
|
||||
} = useMapStore();
|
||||
const { missionFormValues, setMissionFormValues, setOpen, isOpen, editingMissionId } =
|
||||
usePannelStore((state) => state);
|
||||
const { missionFormValues, setMissionFormValues, setOpen, isOpen } = usePannelStore(
|
||||
(state) => state,
|
||||
);
|
||||
const [showRulerOptions, setShowRulerOptions] = useState(false);
|
||||
const [rulerHover, setRulerHover] = useState(false);
|
||||
const [rulerOptionsHover, setRulerOptionsHover] = useState(false);
|
||||
|
||||
@@ -17,6 +17,7 @@ import { getMissionsAPI } from "_querys/missions";
|
||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||
import { HPGValidationRequired } from "_helpers/hpgValidationRequired";
|
||||
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
|
||||
export const MISSION_STATUS_COLORS: Record<MissionState | "attention", string> = {
|
||||
draft: "#0092b8",
|
||||
@@ -72,7 +73,7 @@ const MissionPopupContent = ({
|
||||
default:
|
||||
return <span className="text-gray-100">Error</span>;
|
||||
}
|
||||
}, [currentTab, mission]);
|
||||
}, [currentTab, hpgNeedsAttention, mission]);
|
||||
|
||||
const setOpenMissionMarker = useMapStore((state) => state.setOpenMissionMarker);
|
||||
const { anchor } = useSmartPopup();
|
||||
@@ -350,6 +351,10 @@ const MissionMarker = ({ mission }: { mission: Mission }) => {
|
||||
editingMissionId,
|
||||
mission.addressLat,
|
||||
mission.addressLng,
|
||||
mission.hpgLocationLat,
|
||||
mission.hpgLocationLng,
|
||||
mission.hpgValidationState,
|
||||
mission.id,
|
||||
missionFormValues?.addressLat,
|
||||
missionFormValues?.addressLng,
|
||||
]);
|
||||
@@ -392,6 +397,11 @@ const MissionMarker = ({ mission }: { mission: Mission }) => {
|
||||
export const MissionLayer = () => {
|
||||
const dispatchState = useDispatchConnectionStore((s) => s);
|
||||
const dispatcherConnected = dispatchState.status === "connected";
|
||||
const {
|
||||
status: pilotConnectionStatus,
|
||||
showOtherMissions,
|
||||
selectedStation,
|
||||
} = usePilotConnectionStore((state) => state);
|
||||
|
||||
const { data: missions = [] } = useQuery({
|
||||
queryKey: ["missions"],
|
||||
@@ -406,9 +416,18 @@ export const MissionLayer = () => {
|
||||
return missions.filter((m: Mission) => {
|
||||
if (m.state === "draft" && !dispatcherConnected) return false;
|
||||
if (dispatchState.hideDraftMissions && m.state === "draft") return false;
|
||||
if (pilotConnectionStatus === "connected" && !showOtherMissions)
|
||||
return m.missionStationIds.includes(selectedStation!.id);
|
||||
return true;
|
||||
});
|
||||
}, [missions, dispatcherConnected, dispatchState.hideDraftMissions]);
|
||||
}, [
|
||||
missions,
|
||||
dispatcherConnected,
|
||||
dispatchState.hideDraftMissions,
|
||||
pilotConnectionStatus,
|
||||
showOtherMissions,
|
||||
selectedStation,
|
||||
]);
|
||||
|
||||
// IDEA: Add Marker to Map Layer / LayerGroup
|
||||
return (
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useEffect } from "react";
|
||||
|
||||
export const SearchElements = () => {
|
||||
const { searchElements, openMissionMarker, setSearchElements } = useMapStore();
|
||||
const { isOpen: pannelOpen, editingMissionId } = usePannelStore((state) => state);
|
||||
const { isOpen: pannelOpen } = usePannelStore((state) => state);
|
||||
const { data: missions } = useQuery({
|
||||
queryKey: ["missions"],
|
||||
queryFn: () =>
|
||||
@@ -42,7 +42,7 @@ export const SearchElements = () => {
|
||||
);
|
||||
setSearchElements(elements.filter((e) => !!e));
|
||||
}
|
||||
}, [openMissionMarker, pannelOpen, missions]);
|
||||
}, [openMissionMarker, pannelOpen, missions, setSearchElements]);
|
||||
|
||||
const SearchElement = ({ element }: { element: OSMWay }) => {
|
||||
const { toggleSearchElementSelection } = useMapStore();
|
||||
|
||||
@@ -250,7 +250,7 @@ const StationTab = ({ aircraft }: { aircraft: ConnectedAircraft & { Station: Sta
|
||||
const lstName = useMemo(() => {
|
||||
if (!aircraft.posLng || !aircraft.posLat) return station.bosRadioArea;
|
||||
return findLeitstelleForPosition(aircraft.posLng, aircraft.posLat);
|
||||
}, [aircraft.posLng, aircraft.posLat]);
|
||||
}, [aircraft.posLng, aircraft.posLat, station.bosRadioArea]);
|
||||
|
||||
return (
|
||||
<div className="p-4 text-base-content">
|
||||
|
||||
@@ -11,6 +11,7 @@ import { getMissionsAPI } from "_querys/missions";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMap } from "react-leaflet";
|
||||
import { HPGValidationRequired } from "_helpers/hpgValidationRequired";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
|
||||
const PopupContent = ({
|
||||
aircrafts,
|
||||
@@ -136,6 +137,7 @@ const PopupContent = ({
|
||||
export const MarkerCluster = () => {
|
||||
const map = useMap();
|
||||
const dispatchState = useDispatchConnectionStore((s) => s);
|
||||
const pilotState = usePilotConnectionStore((s) => s);
|
||||
const dispatcherConnected = dispatchState.status === "connected";
|
||||
const { data: aircrafts } = useQuery({
|
||||
queryKey: ["aircrafts"],
|
||||
@@ -155,9 +157,36 @@ export const MarkerCluster = () => {
|
||||
return missions.filter((m: Mission) => {
|
||||
if (m.state === "draft" && !dispatcherConnected) return false;
|
||||
if (dispatchState.hideDraftMissions && m.state === "draft") return false;
|
||||
if (
|
||||
pilotState.status === "connected" &&
|
||||
!pilotState.showOtherMissions &&
|
||||
pilotState.selectedStation
|
||||
)
|
||||
return m.missionStationIds.includes(pilotState.selectedStation.id);
|
||||
return true;
|
||||
});
|
||||
}, [missions, dispatcherConnected, dispatchState.hideDraftMissions]);
|
||||
}, [
|
||||
missions,
|
||||
dispatcherConnected,
|
||||
dispatchState.hideDraftMissions,
|
||||
pilotState.selectedStation,
|
||||
pilotState.showOtherMissions,
|
||||
pilotState.status,
|
||||
]);
|
||||
|
||||
const filteredAircrafts = useMemo(() => {
|
||||
return aircrafts?.filter((a: ConnectedAircraft) => {
|
||||
if (pilotState.status === "connected" && !pilotState.showOtherAircrafts) {
|
||||
return a.stationId === pilotState.connectedAircraft?.stationId;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}, [
|
||||
aircrafts,
|
||||
pilotState.status,
|
||||
pilotState.showOtherAircrafts,
|
||||
pilotState.connectedAircraft?.stationId,
|
||||
]);
|
||||
|
||||
// Track zoom level in state
|
||||
const [zoom, setZoom] = useState(() => map.getZoom());
|
||||
@@ -178,7 +207,7 @@ export const MarkerCluster = () => {
|
||||
lat: number;
|
||||
lng: number;
|
||||
}[] = [];
|
||||
aircrafts?.forEach((aircraft) => {
|
||||
filteredAircrafts?.forEach((aircraft) => {
|
||||
const lat = aircraft.posLat!;
|
||||
const lng = aircraft.posLng!;
|
||||
|
||||
@@ -255,7 +284,7 @@ export const MarkerCluster = () => {
|
||||
});
|
||||
|
||||
return clusterWithAvgPos;
|
||||
}, [aircrafts, filteredMissions, zoom]);
|
||||
}, [filteredAircrafts, filteredMissions, zoom]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
SmartphoneNfc,
|
||||
CheckCheck,
|
||||
Cross,
|
||||
Radio,
|
||||
Route,
|
||||
} from "lucide-react";
|
||||
import {
|
||||
@@ -26,12 +25,9 @@ import {
|
||||
HpgState,
|
||||
HpgValidationState,
|
||||
Mission,
|
||||
MissionAlertLog,
|
||||
MissionCompletedLog,
|
||||
MissionLog,
|
||||
MissionMessageLog,
|
||||
Prisma,
|
||||
Station,
|
||||
} from "@repo/db";
|
||||
import { usePannelStore } from "_store/pannelStore";
|
||||
import { useSession } from "next-auth/react";
|
||||
@@ -143,13 +139,16 @@ const Einsatzdetails = ({
|
||||
state: "finished",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "completed-log",
|
||||
toJSON: () => ({
|
||||
type: "message-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
user: getPublicUser(session.data?.user, { ignorePrivacy: true }),
|
||||
message: "Einsatz abgeschlossen",
|
||||
user: getPublicUser(session.data.user, { ignorePrivacy: true }),
|
||||
},
|
||||
}),
|
||||
},
|
||||
} as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -371,9 +370,17 @@ const Patientdetails = ({ mission }: { mission: Mission }) => {
|
||||
|
||||
const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
||||
const queryClient = useQueryClient();
|
||||
const [selectedStation, setSelectedStation] = useState<number | "RTW" | "POL" | "FW" | null>(
|
||||
null,
|
||||
);
|
||||
const [selectedStation, setSelectedStation] = useState<{
|
||||
selectedStationId: number | undefined;
|
||||
hpgAmbulanceState: HpgState;
|
||||
hpgFireEngineState: HpgState;
|
||||
hpgPoliceState: HpgState;
|
||||
}>({
|
||||
selectedStationId: undefined,
|
||||
hpgAmbulanceState: HpgState.NOT_REQUESTED,
|
||||
hpgFireEngineState: HpgState.NOT_REQUESTED,
|
||||
hpgPoliceState: HpgState.NOT_REQUESTED,
|
||||
});
|
||||
const { data: connectedAircrafts } = useQuery({
|
||||
queryKey: ["aircrafts"],
|
||||
queryFn: () => getConnectedAircraftsAPI(),
|
||||
@@ -408,11 +415,6 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
||||
refetchMissionStationIds();
|
||||
}, [mission.missionStationIds, refetchMissionStationIds]);
|
||||
|
||||
const { data: allStations } = useQuery({
|
||||
queryKey: ["stations"],
|
||||
queryFn: () => getStationsAPI(),
|
||||
});
|
||||
|
||||
const sendAlertMutation = useMutation({
|
||||
mutationKey: ["missions"],
|
||||
mutationFn: ({
|
||||
@@ -527,8 +529,14 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
||||
menuPlacement="top"
|
||||
className="min-w-[320px] flex-1"
|
||||
isMulti={false}
|
||||
onChange={(v: any) => {
|
||||
setSelectedStation(v);
|
||||
onChange={(v) => {
|
||||
console.log("Selected station:", v);
|
||||
setSelectedStation({
|
||||
selectedStationId: v?.selectedStationIds[0],
|
||||
hpgAmbulanceState: mission.hpgAmbulanceState || HpgState.NOT_REQUESTED,
|
||||
hpgFireEngineState: mission.hpgFireEngineState || HpgState.NOT_REQUESTED,
|
||||
hpgPoliceState: mission.hpgPoliceState || HpgState.NOT_REQUESTED,
|
||||
});
|
||||
}}
|
||||
selectedStations={mission.missionStationIds}
|
||||
filterSelected
|
||||
@@ -541,24 +549,39 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
||||
<button
|
||||
className="btn btn-sm btn-primary btn-outline"
|
||||
onClick={async () => {
|
||||
if (typeof selectedStation === "string") {
|
||||
if (
|
||||
selectedStation.hpgAmbulanceState !== "NOT_REQUESTED" ||
|
||||
selectedStation.hpgFireEngineState !== "NOT_REQUESTED" ||
|
||||
selectedStation.hpgPoliceState !== "NOT_REQUESTED"
|
||||
) {
|
||||
// Determine which vehicle type is selected
|
||||
let vehicleName: "RTW" | "POL" | "FW" | undefined;
|
||||
if (selectedStation.hpgAmbulanceState !== "NOT_REQUESTED") {
|
||||
vehicleName = "RTW";
|
||||
} else if (selectedStation.hpgPoliceState !== "NOT_REQUESTED") {
|
||||
vehicleName = "POL";
|
||||
} else if (selectedStation.hpgFireEngineState !== "NOT_REQUESTED") {
|
||||
vehicleName = "FW";
|
||||
}
|
||||
|
||||
await sendAlertMutation.mutate({
|
||||
id: mission.id,
|
||||
vehicleName: selectedStation,
|
||||
vehicleName: vehicleName,
|
||||
});
|
||||
} else {
|
||||
if (!selectedStation) return;
|
||||
if (typeof selectedStation.selectedStationId !== "number") return;
|
||||
|
||||
await updateMissionMutation.mutateAsync({
|
||||
id: mission.id,
|
||||
missionEdit: {
|
||||
missionStationIds: {
|
||||
push: selectedStation,
|
||||
push: selectedStation.selectedStationId,
|
||||
},
|
||||
},
|
||||
});
|
||||
await sendAlertMutation.mutate({
|
||||
id: mission.id,
|
||||
stationId: selectedStation,
|
||||
stationId: selectedStation.selectedStationId,
|
||||
});
|
||||
}
|
||||
}}
|
||||
@@ -740,8 +763,13 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
<span className="text-base-content">{entry.data.message}</span>
|
||||
</li>
|
||||
);
|
||||
if (entry.type === "alert-log") {
|
||||
const alertReceiver = entry.auto
|
||||
if (
|
||||
entry.type === "alert-log" ||
|
||||
entry.type === "completed-log" ||
|
||||
entry.type === "reopened-log"
|
||||
) {
|
||||
const alertReceiver =
|
||||
entry.auto || entry.type !== "alert-log"
|
||||
? null
|
||||
: entry.data.station?.bosCallsignShort || entry.data.vehicle;
|
||||
return (
|
||||
@@ -760,8 +788,8 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
>
|
||||
{!entry.auto && (
|
||||
<>
|
||||
{entry.data.user.firstname?.[0]?.toUpperCase() ?? "?"}
|
||||
{entry.data.user.lastname?.[0]?.toUpperCase() ?? "?"}
|
||||
{entry.data.user?.firstname?.[0]?.toUpperCase() ?? "?"}
|
||||
{entry.data.user?.lastname?.[0]?.toUpperCase() ?? "?"}
|
||||
</>
|
||||
)}
|
||||
{entry.auto && "AUTO"}
|
||||
@@ -786,7 +814,15 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
{entry.type === "alert-log" && (
|
||||
<span className="text-base-content">Einsatz alarmiert</span>
|
||||
)}
|
||||
{entry.type === "completed-log" && (
|
||||
<span className="text-base-content">Einsatz abgeschlossen</span>
|
||||
)}
|
||||
{entry.type === "reopened-log" && (
|
||||
<span className="text-base-content">Einsatz wiedereröffnet</span>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
"use client";
|
||||
import { PublicUser } from "@repo/db";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { cn, PenaltyDropdown } from "@repo/shared-components";
|
||||
import { PenaltyDropdown } from "@repo/shared-components";
|
||||
import { getConnectedAircraftsAPI, kickAircraftAPI } from "_querys/aircrafts";
|
||||
import { getConnectedDispatcherAPI, kickDispatcherAPI } from "_querys/dispatcher";
|
||||
import { getLivekitRooms, kickLivekitParticipant } from "_querys/livekit";
|
||||
import { ParticipantInfo } from "livekit-server-sdk";
|
||||
import {
|
||||
Eye,
|
||||
LockKeyhole,
|
||||
Plane,
|
||||
RedoDot,
|
||||
@@ -17,7 +16,7 @@ import {
|
||||
UserCheck,
|
||||
Workflow,
|
||||
} from "lucide-react";
|
||||
import { ReactNode, useRef, useState } from "react";
|
||||
import { useRef } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default function AdminPanel() {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function ModeSwitchDropdown({ className }: { className?: string }
|
||||
{session.data?.user.permissions?.includes("PILOT") && (
|
||||
<li>
|
||||
<Link href={"/pilot"}>
|
||||
<Plane size={22} /> Pilot
|
||||
<Plane size={22} /> Operations Center
|
||||
</Link>
|
||||
</li>
|
||||
)}
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
"use client";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { GearIcon } from "@radix-ui/react-icons";
|
||||
import { SettingsIcon, Volume2 } from "lucide-react";
|
||||
import { Bell, SettingsIcon, Volume2 } from "lucide-react";
|
||||
import MicVolumeBar from "_components/MicVolumeIndication";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { editUserAPI, getUserAPI } from "_querys/user";
|
||||
import { Prisma } from "@repo/db";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useAudioStore } from "_store/audioStore";
|
||||
import toast from "react-hot-toast";
|
||||
import Link from "next/link";
|
||||
|
||||
export const SettingsBtn = () => {
|
||||
const session = useSession();
|
||||
|
||||
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
|
||||
const { data: user } = useQuery({
|
||||
queryKey: ["user", session.data?.user.id],
|
||||
queryFn: () => getUserAPI(session.data!.user.id),
|
||||
@@ -30,33 +32,54 @@ export const SettingsBtn = () => {
|
||||
|
||||
const modalRef = useRef<HTMLDialogElement>(null);
|
||||
|
||||
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
|
||||
const [selectedDevice, setSelectedDevice] = useState<string | null>(
|
||||
user?.settingsMicDevice || null,
|
||||
);
|
||||
const [showIndication, setShowIndication] = useState<boolean>(false);
|
||||
const [micVol, setMicVol] = useState<number>(1);
|
||||
const [funkVolume, setFunkVol] = useState<number>(0.8);
|
||||
const [dmeVolume, setDmeVol] = useState<number>(0.8);
|
||||
|
||||
const setMic = useAudioStore((state) => state.setMic);
|
||||
const [settings, setSettings] = useState({
|
||||
micDeviceId: user?.settingsMicDevice || null,
|
||||
micVolume: user?.settingsMicVolume || 1,
|
||||
radioVolume: user?.settingsRadioVolume || 0.8,
|
||||
dmeVolume: user?.settingsDmeVolume || 0.8,
|
||||
pilotNtfyRoom: user?.settingsNtfyRoom || "",
|
||||
});
|
||||
|
||||
const { setSettings: setAudioSettings } = useAudioStore((state) => state);
|
||||
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
setSelectedDevice(user.settingsMicDevice);
|
||||
setMic(user.settingsMicDevice, user.settingsMicVolume || 1);
|
||||
setMicVol(user.settingsMicVolume || 1);
|
||||
setFunkVol(user.settingsRadioVolume || 0.8);
|
||||
setDmeVol(user.settingsDmeVolume || 0.8);
|
||||
}
|
||||
}, [user, setMic]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof navigator !== "undefined" && navigator.mediaDevices?.enumerateDevices) {
|
||||
navigator.mediaDevices.enumerateDevices().then((devices) => {
|
||||
setInputDevices(devices.filter((d) => d.kind === "audioinput"));
|
||||
setAudioSettings({
|
||||
micDeviceId: user.settingsMicDevice,
|
||||
micVolume: user.settingsMicVolume || 1,
|
||||
radioVolume: user.settingsRadioVolume || 0.8,
|
||||
dmeVolume: user.settingsDmeVolume || 0.8,
|
||||
});
|
||||
setSettings({
|
||||
micDeviceId: user.settingsMicDevice,
|
||||
micVolume: user.settingsMicVolume || 1,
|
||||
radioVolume: user.settingsRadioVolume || 0.8,
|
||||
dmeVolume: user.settingsDmeVolume || 0.8,
|
||||
pilotNtfyRoom: user.settingsNtfyRoom || "",
|
||||
});
|
||||
}
|
||||
}, [user, setSettings, setAudioSettings]);
|
||||
|
||||
const setSettingsPartial = (newSettings: Partial<typeof settings>) => {
|
||||
setSettings((prev) => ({
|
||||
...prev,
|
||||
...newSettings,
|
||||
}));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const setDevices = async () => {
|
||||
if (typeof navigator !== "undefined" && navigator.mediaDevices?.enumerateDevices) {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ video: false, audio: true });
|
||||
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||
setInputDevices(devices.filter((d) => d.kind === "audioinput"));
|
||||
stream.getTracks().forEach((track) => track.stop());
|
||||
}
|
||||
};
|
||||
|
||||
setDevices();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -82,9 +105,9 @@ export const SettingsBtn = () => {
|
||||
<span>Eingabegerät</span>
|
||||
<select
|
||||
className="input w-full"
|
||||
value={selectedDevice ? selectedDevice : ""}
|
||||
value={settings.micDeviceId ? settings.micDeviceId : ""}
|
||||
onChange={(e) => {
|
||||
setSelectedDevice(e.target.value);
|
||||
setSettingsPartial({ micDeviceId: e.target.value });
|
||||
setShowIndication(true);
|
||||
}}
|
||||
>
|
||||
@@ -110,10 +133,10 @@ export const SettingsBtn = () => {
|
||||
step={0.01}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setMicVol(value);
|
||||
setSettingsPartial({ micVolume: value });
|
||||
setShowIndication(true);
|
||||
}}
|
||||
value={micVol}
|
||||
value={settings.micVolume}
|
||||
className="range range-xs range-accent w-full"
|
||||
/>
|
||||
<div className="flex justify-between px-2.5 mt-2 text-xs">
|
||||
@@ -125,7 +148,10 @@ export const SettingsBtn = () => {
|
||||
</div>
|
||||
</div>
|
||||
{showIndication && (
|
||||
<MicVolumeBar deviceId={selectedDevice ? selectedDevice : ""} volumeInput={micVol} />
|
||||
<MicVolumeBar
|
||||
deviceId={settings.micDeviceId ? settings.micDeviceId : ""}
|
||||
volumeInput={settings.micVolume}
|
||||
/>
|
||||
)}
|
||||
<div className="divider w-full" />
|
||||
</div>
|
||||
@@ -139,10 +165,11 @@ export const SettingsBtn = () => {
|
||||
max={1}
|
||||
step={0.01}
|
||||
onChange={(e) => {
|
||||
console.log("Radio Volume", e.target.value);
|
||||
const value = parseFloat(e.target.value);
|
||||
setFunkVol(value);
|
||||
setSettingsPartial({ radioVolume: value });
|
||||
}}
|
||||
value={funkVolume}
|
||||
value={settings.radioVolume}
|
||||
className="range range-xs range-primary w-full"
|
||||
/>
|
||||
<div className="flex justify-between px-2.5 mt-2 text-xs">
|
||||
@@ -153,9 +180,7 @@ export const SettingsBtn = () => {
|
||||
<span>100%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-center w-full">
|
||||
<div className="divider w-1/2" />
|
||||
</div>
|
||||
|
||||
<p className="flex items-center gap-2 text-base mb-2">
|
||||
<Volume2 size={20} /> Melder Lautstärke
|
||||
</p>
|
||||
@@ -167,12 +192,12 @@ export const SettingsBtn = () => {
|
||||
step={0.01}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setDmeVol(value);
|
||||
setSettingsPartial({ dmeVolume: value });
|
||||
if (!testSoundRef.current) return;
|
||||
testSoundRef.current.volume = value;
|
||||
testSoundRef.current.play();
|
||||
}}
|
||||
value={dmeVolume}
|
||||
value={settings.dmeVolume}
|
||||
className="range range-xs range-primary w-full"
|
||||
/>
|
||||
<div className="flex justify-between px-2.5 mt-2 text-xs">
|
||||
@@ -183,6 +208,34 @@ export const SettingsBtn = () => {
|
||||
<span>100%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-center w-full">
|
||||
<div className="divider w-full" />
|
||||
</div>
|
||||
<div className="w-full">
|
||||
<label className="floating-label w-full">
|
||||
<span className="text-lg flex items-center gap-2">
|
||||
<Bell /> NTFY room
|
||||
</span>
|
||||
<input
|
||||
placeholder="Erhalte eine Benachrichtigung auf dein Handy über NTFY"
|
||||
className="input input-bordered w-full"
|
||||
value={settings.pilotNtfyRoom}
|
||||
onChange={(e) => setSettingsPartial({ pilotNtfyRoom: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<p className="label mt-2 w-full">
|
||||
<Link
|
||||
href="https://docs.virtualairrescue.com/docs/Leitstelle/App-Alarmierung#download"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="link link-hover link-primary"
|
||||
>
|
||||
Hier
|
||||
</Link>
|
||||
findest du mehr Informationen!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between modal-action">
|
||||
<button
|
||||
@@ -205,13 +258,19 @@ export const SettingsBtn = () => {
|
||||
await editUserMutation.mutateAsync({
|
||||
id: session.data!.user.id,
|
||||
user: {
|
||||
settingsMicDevice: selectedDevice,
|
||||
settingsMicVolume: micVol,
|
||||
settingsRadioVolume: funkVolume,
|
||||
settingsDmeVolume: dmeVolume,
|
||||
settingsMicDevice: settings.micDeviceId,
|
||||
settingsMicVolume: settings.micVolume,
|
||||
settingsRadioVolume: settings.radioVolume,
|
||||
settingsDmeVolume: settings.dmeVolume,
|
||||
settingsNtfyRoom: settings.pilotNtfyRoom,
|
||||
},
|
||||
});
|
||||
setMic(selectedDevice, micVol);
|
||||
setAudioSettings({
|
||||
micDeviceId: settings.micDeviceId,
|
||||
micVolume: settings.micVolume,
|
||||
radioVolume: settings.radioVolume,
|
||||
dmeVolume: settings.dmeVolume,
|
||||
});
|
||||
modalRef.current?.close();
|
||||
toast.success("Einstellungen gespeichert");
|
||||
}}
|
||||
@@ -224,7 +283,6 @@ export const SettingsBtn = () => {
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const Settings = () => {
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
export const fmsStatusDescription: { [key: string]: string } = {
|
||||
NaN: "Keine Daten",
|
||||
"0": "Prio. Sprechwunsch",
|
||||
"1": "Frei auf Funk",
|
||||
"2": "Einsatzbereit am LRZ",
|
||||
"3": "Auf dem Weg",
|
||||
"4": "Am Einsatzort",
|
||||
"1": "Einsatzbereit über Funk",
|
||||
"2": "Einsatzbereit auf Wache",
|
||||
"3": "Einsatzübernahme",
|
||||
"4": "Einsatzort an",
|
||||
"5": "Sprechwunsch",
|
||||
"6": "Nicht einsatzbereit",
|
||||
"7": "Patient aufgenommen",
|
||||
"8": "Am Transportziel",
|
||||
"7": "Einsatzgebunden",
|
||||
"8": "Bedingt verfügbar",
|
||||
"9": "Fremdanmeldung",
|
||||
E: "Indent/Abbruch/Einsatzbefehl abgebrochen",
|
||||
C: "Anmelden zur Übernahme des Einsatzes",
|
||||
@@ -17,7 +17,7 @@ export const fmsStatusDescription: { [key: string]: string } = {
|
||||
J: "Sprechaufforderung",
|
||||
L: "Lagebericht abgeben",
|
||||
P: "Einsatz mit Polizei/Pause machen",
|
||||
U: "Ungültiger Status",
|
||||
U: "Ungültige Statusfolge",
|
||||
c: "Status korrigieren",
|
||||
d: "Transportziel angeben",
|
||||
h: "Zielklinik verständigt",
|
||||
|
||||
@@ -36,6 +36,7 @@ export function findClosestPolygon(
|
||||
const polygon = toPolygonFeature(way.nodes);
|
||||
if (!polygon) continue;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const center = centroid(polygon as any).geometry.coordinates; // [lon, lat]
|
||||
|
||||
const newDistance = distance([referencePoint.lon, referencePoint.lat], center);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { point, multiPolygon, booleanPointInPolygon, booleanIntersects, polygon } from "@turf/turf";
|
||||
import { point, booleanPointInPolygon, polygon } from "@turf/turf";
|
||||
import leitstellenGeoJSON from "../_components/map/_geojson/Leitstellen.json"; // Pfad anpassen
|
||||
|
||||
export function findLeitstelleForPosition(lat: number, lng: number) {
|
||||
const heliPoint = point([lat, lng]);
|
||||
|
||||
for (const feature of (leitstellenGeoJSON as any).features) {
|
||||
for (const feature of (leitstellenGeoJSON as GeoJSON.FeatureCollection).features) {
|
||||
const geom = feature.geometry;
|
||||
|
||||
if (geom.type === "Polygon") {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { useAudioStore } from "_store/audioStore";
|
||||
import {
|
||||
LocalParticipant,
|
||||
LocalTrackPublication,
|
||||
Participant,
|
||||
RemoteParticipant,
|
||||
RemoteTrack,
|
||||
RemoteTrackPublication,
|
||||
@@ -17,32 +15,33 @@ export const handleTrackSubscribed = (
|
||||
if (!track.isMuted) {
|
||||
useAudioStore.getState().addSpeakingParticipant(participant);
|
||||
}
|
||||
track.on("unmuted", () => {
|
||||
useAudioStore.getState().addSpeakingParticipant(participant);
|
||||
});
|
||||
track.on("muted", () => {
|
||||
useAudioStore.getState().removeSpeakingParticipant(participant);
|
||||
});
|
||||
|
||||
if (track.kind === Track.Kind.Video || track.kind === Track.Kind.Audio) {
|
||||
// attach it to a new HTMLVideoElement or HTMLAudioElement
|
||||
const element = track.attach();
|
||||
element.play();
|
||||
|
||||
track.on("unmuted", () => {
|
||||
useAudioStore.getState().addSpeakingParticipant(participant);
|
||||
console.log(useAudioStore.getState().settings.radioVolume);
|
||||
element.volume = useAudioStore.getState().settings.radioVolume;
|
||||
});
|
||||
track.on("unmuted", () => {
|
||||
useAudioStore.getState().addSpeakingParticipant(participant);
|
||||
});
|
||||
}
|
||||
|
||||
track.on("muted", () => {
|
||||
useAudioStore.getState().removeSpeakingParticipant(participant);
|
||||
});
|
||||
};
|
||||
|
||||
export const handleTrackUnsubscribed = (
|
||||
track: RemoteTrack,
|
||||
publication: RemoteTrackPublication,
|
||||
participant: RemoteParticipant,
|
||||
) => {
|
||||
export const handleTrackUnsubscribed = (track: RemoteTrack) => {
|
||||
// remove tracks from all attached elements
|
||||
track.detach();
|
||||
};
|
||||
|
||||
export const handleLocalTrackUnpublished = (
|
||||
publication: LocalTrackPublication,
|
||||
participant: LocalParticipant,
|
||||
) => {
|
||||
export const handleLocalTrackUnpublished = (publication: LocalTrackPublication) => {
|
||||
// when local tracks are ended, update UI to remove them from rendering
|
||||
publication.track?.detach();
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ConnectedAircraft, PositionLog, Prisma, PublicUser, Station } from "@repo/db";
|
||||
import { ConnectedAircraft, PositionLog, Prisma, Station } from "@repo/db";
|
||||
import axios from "axios";
|
||||
import { serverApi } from "_helpers/axios";
|
||||
import { checkSimulatorConnected } from "@repo/shared-components";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ConnectedAircraft, ConnectedDispatcher, Prisma } from "@repo/db";
|
||||
import { ConnectedDispatcher, Prisma } from "@repo/db";
|
||||
import { serverApi } from "_helpers/axios";
|
||||
import axios from "axios";
|
||||
|
||||
|
||||
14
apps/dispatch/app/_querys/heliports.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Heliport, Prisma } from "@repo/db";
|
||||
import axios from "axios";
|
||||
|
||||
export const getHeliportsAPI = async (filter?: Prisma.HeliportWhereInput) => {
|
||||
const res = await axios.get<Heliport[]>("/api/heliports", {
|
||||
params: {
|
||||
filter: JSON.stringify(filter),
|
||||
},
|
||||
});
|
||||
if (res.status !== 200) {
|
||||
throw new Error("Failed to fetch heliports");
|
||||
}
|
||||
return res.data;
|
||||
};
|
||||
@@ -2,12 +2,12 @@ import { Mission, MissionSdsLog, Prisma } from "@repo/db";
|
||||
import axios from "axios";
|
||||
import { serverApi } from "_helpers/axios";
|
||||
|
||||
export const getMissionsAPI = async (
|
||||
export const getMissionsAPI = async <T = Mission>(
|
||||
filter?: Prisma.MissionWhereInput,
|
||||
include?: Prisma.MissionInclude,
|
||||
orderBy?: Prisma.MissionOrderByWithRelationInput,
|
||||
) => {
|
||||
const res = await axios.get<Mission[]>("/api/missions", {
|
||||
): Promise<T[]> => {
|
||||
const res = await axios.get<T[]>("/api/missions", {
|
||||
params: {
|
||||
filter: JSON.stringify(filter),
|
||||
include: JSON.stringify(include),
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { raw } from "../../../../packages/database/generated/client/runtime/library";
|
||||
|
||||
export const getOsmAddress = async (lat: number, lng: number) => {
|
||||
const address = await fetch(
|
||||
`https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lng}&format=json`,
|
||||
|
||||
@@ -5,18 +5,31 @@ import {
|
||||
handleTrackSubscribed,
|
||||
handleTrackUnsubscribed,
|
||||
} from "_helpers/liveKitEventHandler";
|
||||
import { ConnectionQuality, Participant, Room, RoomEvent, RpcInvocationData } from "livekit-client";
|
||||
import {
|
||||
ConnectionQuality,
|
||||
LocalTrackPublication,
|
||||
Participant,
|
||||
Room,
|
||||
RoomEvent,
|
||||
RpcInvocationData,
|
||||
Track,
|
||||
} from "livekit-client";
|
||||
import { pilotSocket } from "(app)/pilot/socket";
|
||||
import { create } from "zustand";
|
||||
import axios from "axios";
|
||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||
import { changeDispatcherAPI } from "_querys/dispatcher";
|
||||
import { getRadioStream } from "_helpers/radioEffect";
|
||||
|
||||
let interval: NodeJS.Timeout;
|
||||
|
||||
type TalkState = {
|
||||
settings: {
|
||||
micDeviceId: string | null;
|
||||
micVolume: number;
|
||||
radioVolume: number;
|
||||
dmeVolume: number;
|
||||
};
|
||||
isTalking: boolean;
|
||||
transmitBlocked: boolean;
|
||||
removeMessage: () => void;
|
||||
@@ -25,13 +38,14 @@ type TalkState = {
|
||||
connectionQuality: ConnectionQuality;
|
||||
remoteParticipants: number;
|
||||
toggleTalking: () => void;
|
||||
setMic: (micDeviceId: string | null, volume: number) => void;
|
||||
setSettings: (settings: Partial<TalkState["settings"]>) => void;
|
||||
connect: (roomName: string, role: string) => void;
|
||||
disconnect: () => void;
|
||||
speakingParticipants: Participant[];
|
||||
addSpeakingParticipant: (participant: Participant) => void;
|
||||
removeSpeakingParticipant: (speakingParticipants: Participant) => void;
|
||||
room: Room | null;
|
||||
localRadioTrack: LocalTrackPublication | undefined;
|
||||
};
|
||||
const getToken = async (roomName: string) => {
|
||||
const response = await axios.get(`/api/livekit-token?roomName=${roomName}`);
|
||||
@@ -41,11 +55,17 @@ const getToken = async (roomName: string) => {
|
||||
|
||||
export const useAudioStore = create<TalkState>((set, get) => ({
|
||||
isTalking: false,
|
||||
localRadioTrack: undefined,
|
||||
transmitBlocked: false,
|
||||
message: null,
|
||||
micDeviceId: null,
|
||||
speakingParticipants: [],
|
||||
micVolume: 1,
|
||||
settings: {
|
||||
micDeviceId: null,
|
||||
micVolume: 1,
|
||||
radioVolume: 0.8,
|
||||
dmeVolume: 0.8,
|
||||
},
|
||||
state: "disconnected" as const,
|
||||
remoteParticipants: 0,
|
||||
connectionQuality: ConnectionQuality.Unknown,
|
||||
@@ -65,7 +85,7 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
||||
const newSpeaktingParticipants = get().speakingParticipants.filter(
|
||||
(p) => !(p.identity === participant.identity),
|
||||
);
|
||||
set((state) => ({
|
||||
set(() => ({
|
||||
speakingParticipants: newSpeaktingParticipants,
|
||||
}));
|
||||
if (newSpeaktingParticipants.length === 0 && get().transmitBlocked) {
|
||||
@@ -73,12 +93,30 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
||||
set({ transmitBlocked: false, message: null, isTalking: true });
|
||||
}
|
||||
},
|
||||
setMic: (micDeviceId, micVolume) => {
|
||||
set({ micDeviceId, micVolume });
|
||||
setSettings: (newSettings) => {
|
||||
const oldSettings = get().settings;
|
||||
set((s) => ({
|
||||
settings: {
|
||||
...s.settings,
|
||||
...newSettings,
|
||||
},
|
||||
}));
|
||||
if (
|
||||
get().state === "connected" &&
|
||||
(oldSettings.micDeviceId !== newSettings.micDeviceId ||
|
||||
oldSettings.micVolume !== newSettings.micVolume)
|
||||
) {
|
||||
const { room, disconnect, connect } = get();
|
||||
const role = room?.localParticipant.attributes.role;
|
||||
console.log(role);
|
||||
if (room?.name || role) {
|
||||
disconnect();
|
||||
connect(room?.name || "", role || "user");
|
||||
}
|
||||
}
|
||||
},
|
||||
toggleTalking: () => {
|
||||
const { room, isTalking, micDeviceId, micVolume, speakingParticipants, transmitBlocked } =
|
||||
get();
|
||||
const { room, isTalking, speakingParticipants, transmitBlocked } = get();
|
||||
if (!room) return;
|
||||
|
||||
if (speakingParticipants.length > 0 && !isTalking && !transmitBlocked) {
|
||||
@@ -95,10 +133,7 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Todo: use micVolume
|
||||
room.localParticipant.setMicrophoneEnabled(!isTalking, {
|
||||
deviceId: micDeviceId ?? undefined,
|
||||
});
|
||||
room.localParticipant.setMicrophoneEnabled(!isTalking);
|
||||
|
||||
set((state) => ({ isTalking: !state.isTalking, transmitBlocked: false }));
|
||||
},
|
||||
@@ -132,6 +167,27 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
||||
});
|
||||
}
|
||||
|
||||
const inputStream = await navigator.mediaDevices.getUserMedia({
|
||||
audio: {
|
||||
deviceId: get().settings.micDeviceId ?? undefined,
|
||||
noiseSuppression: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Funk-Effekt anwenden
|
||||
const radioStream = getRadioStream(inputStream, get().settings.micVolume);
|
||||
if (!radioStream) throw new Error("Konnte Funkstream nicht erzeugen");
|
||||
|
||||
const [track] = radioStream.getAudioTracks();
|
||||
if (!track) throw new Error("Konnte Audio-Track nicht erzeugen");
|
||||
|
||||
const publishedTrack = await room.localParticipant.publishTrack(track, {
|
||||
name: "radio-audio",
|
||||
source: Track.Source.Microphone,
|
||||
});
|
||||
await publishedTrack.mute();
|
||||
set({ localRadioTrack: publishedTrack });
|
||||
|
||||
set({ state: "connected", room, message: null });
|
||||
})
|
||||
.on(RoomEvent.Disconnected, () => {
|
||||
@@ -187,7 +243,7 @@ interface PTTData {
|
||||
}
|
||||
|
||||
const handlePTT = (data: PTTData) => {
|
||||
const { shouldTransmit, source } = data;
|
||||
const { shouldTransmit } = data;
|
||||
const { room, speakingParticipants } = useAudioStore.getState();
|
||||
if (!room) return;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface MapStore {
|
||||
lat: number;
|
||||
lng: number;
|
||||
} | null;
|
||||
|
||||
map: {
|
||||
center: L.LatLngExpression;
|
||||
zoom: number;
|
||||
|
||||
@@ -27,6 +27,14 @@ interface ConnectionStore {
|
||||
debug?: boolean,
|
||||
) => Promise<void>;
|
||||
disconnect: () => void;
|
||||
followOwnAircraft: boolean;
|
||||
showOtherAircrafts: boolean;
|
||||
showOtherMissions: boolean;
|
||||
setMapOptions: (options: {
|
||||
followOwnAircraft?: boolean;
|
||||
showOtherAircrafts?: boolean;
|
||||
showOtherMissions?: boolean;
|
||||
}) => void;
|
||||
}
|
||||
|
||||
export const usePilotConnectionStore = create<ConnectionStore>((set) => ({
|
||||
@@ -37,7 +45,15 @@ export const usePilotConnectionStore = create<ConnectionStore>((set) => ({
|
||||
connectedAircraft: null,
|
||||
activeMission: null,
|
||||
debug: false,
|
||||
|
||||
followOwnAircraft: false,
|
||||
showOtherAircrafts: false,
|
||||
showOtherMissions: false,
|
||||
setMapOptions(options) {
|
||||
set((state) => ({
|
||||
...state,
|
||||
...options,
|
||||
}));
|
||||
},
|
||||
connect: async (uid, stationId, logoffTime, station, user, debug) =>
|
||||
new Promise((resolve) => {
|
||||
set({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { prisma, Prisma } from "@repo/db";
|
||||
import { prisma } from "@repo/db";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: NextRequest): Promise<NextResponse> {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { AuthOptions, getServerSession as getNextAuthServerSession } from "next-auth";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import Credentials from "next-auth/providers/credentials";
|
||||
import { prisma, PrismaClient } from "@repo/db";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export const options: AuthOptions = {
|
||||
providers: [
|
||||
@@ -9,7 +10,7 @@ export const options: AuthOptions = {
|
||||
credentials: {
|
||||
code: { label: "code", type: "code" },
|
||||
},
|
||||
async authorize(credentials, req) {
|
||||
async authorize(credentials) {
|
||||
try {
|
||||
if (!credentials) throw new Error("No credentials provided");
|
||||
const code = await prisma.oAuthToken.findFirstOrThrow({
|
||||
@@ -60,7 +61,7 @@ export const options: AuthOptions = {
|
||||
|
||||
adapter: PrismaAdapter(prisma as any),
|
||||
callbacks: {
|
||||
jwt: async ({ token, user, ...rest }) => {
|
||||
jwt: async ({ token, user }) => {
|
||||
if (user && "firstname" in user) {
|
||||
return {
|
||||
...token,
|
||||
@@ -69,7 +70,7 @@ export const options: AuthOptions = {
|
||||
}
|
||||
return token;
|
||||
},
|
||||
session: async ({ session, user, token }) => {
|
||||
session: async ({ session, token }) => {
|
||||
const dbUser = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: token?.sub,
|
||||
|
||||
22
apps/dispatch/app/api/heliports/route.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export async function GET(req: NextRequest): Promise<NextResponse> {
|
||||
const { searchParams } = new URL(req.url);
|
||||
const id = searchParams.get("id");
|
||||
const filter = searchParams.get("filter");
|
||||
|
||||
try {
|
||||
const data = await prisma.heliport.findMany({
|
||||
where: {
|
||||
id: id ? Number(id) : undefined,
|
||||
...(filter ? JSON.parse(filter) : {}),
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(data, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ error: "Failed to fetch heliport" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,10 @@ import { RoomManager } from "_helpers/LivekitRoomManager";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { NextRequest } from "next/server";
|
||||
|
||||
export const GET = async (request: NextRequest) => {
|
||||
export const GET = async () => {
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session) return Response.json({ message: "Unauthorized" }, { status: 401 });
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
},
|
||||
});
|
||||
|
||||
const rooms = await RoomManager.listRooms();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { ROOMS } from "_data/livekitRooms";
|
||||
import { AccessToken } from "livekit-server-sdk";
|
||||
import { NextRequest } from "next/server";
|
||||
import { getPublicUser, prisma } from "@repo/db";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PositionLog, Prisma, prisma, User } from "@repo/db";
|
||||
import { PositionLog, prisma, User } from "@repo/db";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { verify } from "jsonwebtoken";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { nextJsConfig } from "@repo/eslint-config/next-js";
|
||||
import nextJsConfig from "@repo/eslint-config/next-js";
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
export default nextJsConfig;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@hookform/resolvers": "^5.1.1",
|
||||
"@livekit/components-react": "^2.9.12",
|
||||
"@livekit/components-styles": "^1.1.6",
|
||||
@@ -34,6 +35,7 @@
|
||||
"clsx": "^2.1.1",
|
||||
"daisyui": "^5.0.43",
|
||||
"date-fns": "^4.1.0",
|
||||
"eslint-config-next": "^15.3.4",
|
||||
"geojson": "^0.5.0",
|
||||
"i": "^0.3.7",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
|
||||
1
apps/dispatch/types/next-auth.d.ts
vendored
@@ -1,4 +1,3 @@
|
||||
import NextAuth from "next-auth";
|
||||
import { User as IUser } from "@repo/db";
|
||||
|
||||
declare module "next-auth" {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
node_modules
|
||||
dist
|
||||
18
apps/docs/.gitignore
vendored
@@ -1,18 +0,0 @@
|
||||
/coverage
|
||||
/src/client/shared.ts
|
||||
/src/node/shared.ts
|
||||
*.log
|
||||
*.tgz
|
||||
.DS_Store
|
||||
.idea
|
||||
.temp
|
||||
.vite_opt_cache
|
||||
.vscode
|
||||
dist
|
||||
cache
|
||||
temp
|
||||
examples-temp
|
||||
node_modules
|
||||
pnpm-global
|
||||
TODOs.md
|
||||
*.timestamp-*.mjs
|
||||
@@ -1,198 +0,0 @@
|
||||
import { defineConfig } from "vitepress";
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
title: "VAR Knowledgebase",
|
||||
description: "How To's und mehr zu Virtual Air Rescue",
|
||||
srcDir: "src",
|
||||
themeConfig: {
|
||||
logo: "/var_logo.png",
|
||||
search: {
|
||||
provider: "local",
|
||||
},
|
||||
lastUpdated: {
|
||||
text: "Letzte Änderung",
|
||||
formatOptions: {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
},
|
||||
},
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
nav: [
|
||||
{ text: "Startseite", link: "/" },
|
||||
{
|
||||
text: "How-To's",
|
||||
items: [
|
||||
{ text: "Wie werde ich Pilot?", link: "/pilotenbereich/how-to-pilot" },
|
||||
{ text: "Wie werde ich Disponent?", link: "/disponentenbereich/how-to-disponent" },
|
||||
{
|
||||
text: "Wie verbinde ich meinen Discord Account?",
|
||||
link: "/allgemein/var-systeme/hub/how-to-discord",
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "FAQ", link: "/faq" },
|
||||
],
|
||||
|
||||
footer: {
|
||||
message:
|
||||
"<a href='https://virtualairrescue.com/impressum/'>Impressum</a> | <a href='https://virtualairrescue.com/datenschutz/'>Datenschutzerklärung</a>",
|
||||
},
|
||||
|
||||
sidebar: [
|
||||
{
|
||||
text: "Pilotenbereich",
|
||||
items: [
|
||||
{ text: "How-To Pilot", link: "/pilotenbereich/how-to-pilot" },
|
||||
{
|
||||
text: "HPG H145",
|
||||
collapsed: false,
|
||||
items: [
|
||||
{ text: "Allgemeine Informationen", link: "/pilotenbereich/hpg-h145/info" },
|
||||
{ text: "Start-Up", link: "/pilotenbereich/hpg-h145/Start-Up" },
|
||||
{ text: "Powering Down", link: "/pilotenbereich/hpg-h145/Powering-Down" },
|
||||
{
|
||||
text: "R&E Integration",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "Voraussetzungen",
|
||||
link: "/pilotenbereich/hpg-h145/r-e-integration/Voraussetzungen",
|
||||
},
|
||||
{
|
||||
text: "Einrichtung",
|
||||
link: "/pilotenbereich/hpg-h145/r-e-integration/Einrichtung",
|
||||
},
|
||||
{
|
||||
text: "Fehlerbehebung",
|
||||
link: "/pilotenbereich/hpg-h145/r-e-integration/Fehlerbehebung",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "EC135 Bedienung", link: "/pilotenbereich/ec-135" },
|
||||
{ text: "Hubschrauber Steuerorgane", link: "/pilotenbereich/Steuerorgane" },
|
||||
{ text: "Luftraumstruktur", link: "/pilotenbereich/Luftraumstruktur" },
|
||||
{ text: "Meteorologie", link: "/pilotenbereich/Meteorologie" },
|
||||
{ text: "Navigation", link: "/pilotenbereich/Navigation" },
|
||||
{ text: "Standardplatzrunde", link: "/pilotenbereich/Standardplatzrunde" },
|
||||
{ text: "Reichweite / Endurance", link: "/pilotenbereich/Endurance" },
|
||||
{ text: "Hubschraubertypen", link: "/pilotenbereich/Hubschraubertypen" },
|
||||
{
|
||||
text: "Luftrettung",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Außenlandung", link: "/pilotenbereich/luftrettung/aussenlandung" },
|
||||
{ text: "Landeplätze- und Stellen", link: "/pilotenbereich/luftrettung/landeplatz" },
|
||||
{
|
||||
text: "Crew",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "HEMS-TC", link: "/pilotenbereich/luftrettung/crew/hems-tc" },
|
||||
{ text: "Notarzt", link: "/pilotenbereich/luftrettung/crew/notarzt" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Militärfliegerei (SAR)",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Einführung", link: "/pilotenbereich/luftrettung/military/Einführung" },
|
||||
{ text: "SOP", link: "/pilotenbereich/luftrettung/military/SOP" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "Mobile App-Alarmierung", link: "/pilotenbereich/app-alarmierung" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Disponentenbereich",
|
||||
items: [
|
||||
{ text: "How-To Disponent", link: "/disponentenbereich/how-to-disponent" },
|
||||
{ text: "Disposition", link: "/disponentenbereich/disposition" },
|
||||
{ text: "Stichworte", link: "/disponentenbereich/Stichworte" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Allgemein",
|
||||
items: [
|
||||
{
|
||||
text: "VAR Systeme",
|
||||
collapsed: false,
|
||||
items: [
|
||||
{ text: "Änderungen in der V2", link: "/allgemein/var-systeme/v2-changes" },
|
||||
{
|
||||
text: "HUB",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "How-To Discord", link: "/allgemein/var-systeme/hub/how-to-discord" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Leitstelle",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Piloten", link: "/allgemein/var-systeme/leitstelle/pilot" },
|
||||
{ text: "Disponenten", link: "/allgemein/var-systeme/leitstelle/disponent" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
text: "BOS Funk",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Grundlagen", link: "/allgemein/bos-funk/Grundlagen" },
|
||||
{ text: "Funkverkehr", link: "/allgemein/bos-funk/Funkverkehr" },
|
||||
{ text: "OPTA", link: "/allgemein/bos-funk/OPTA" },
|
||||
{ text: "Status", link: "/allgemein/bos-funk/Status" },
|
||||
{ text: "Funkbeispiel", link: "/allgemein/bos-funk/Funkbeispiel" },
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
text: "VATSIM",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Registrierung", link: "/allgemein/vatsim/registrierung" },
|
||||
{ text: "Prefile", link: "/allgemein/vatsim/prefile" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
items: [
|
||||
{ text: "Impressum", link: "https://virtualairrescue.com/impressum/" },
|
||||
{ text: "Datenschutzerklärung", link: "https://virtualairrescue.com/datenschutz/" },
|
||||
{ text: "Mitwirken", link: "/" },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
socialLinks: [{ icon: "github", link: "https://github.com/VAR-Virtual-Air-Rescue/docs" }],
|
||||
|
||||
docFooter: {
|
||||
prev: "Vorherige Seite",
|
||||
next: "Nächste Seite",
|
||||
},
|
||||
|
||||
outline: {
|
||||
label: "Inhalt",
|
||||
},
|
||||
},
|
||||
markdown: {
|
||||
theme: {
|
||||
light: "catppuccin-latte",
|
||||
dark: "catppuccin-mocha",
|
||||
},
|
||||
image: {
|
||||
lazyLoading: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
.VPHero .image-src {
|
||||
max-width: 50%;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import DefaultTheme from "vitepress/theme";
|
||||
import "@catppuccin/vitepress/theme/mocha/lavender.css";
|
||||
import "./custom.css";
|
||||
|
||||
export default DefaultTheme;
|
||||
@@ -1,32 +0,0 @@
|
||||
# --- Build stage ---
|
||||
FROM node:24-alpine3.21 AS builder
|
||||
# Consider using the latest patch version for security updates
|
||||
RUN apk update && apk upgrade
|
||||
|
||||
# Install pnpm
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Set workdir
|
||||
WORKDIR /app
|
||||
|
||||
# Copy project files
|
||||
COPY ./apps/docs .
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install
|
||||
|
||||
# Build VitePress site
|
||||
RUN pnpm build
|
||||
|
||||
# --- Serve stage ---
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built site to nginx public folder
|
||||
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "docs",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"dev": "vitepress dev --port 3006",
|
||||
"docs:dev": "vitepress dev --port 3006",
|
||||
"build": "vitepress build",
|
||||
"docs:preview": "vitepress preview"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"packageManager": "pnpm@10.11.1",
|
||||
"devDependencies": {
|
||||
"vitepress": "^1.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@catppuccin/vitepress": "^0.1.2"
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
# Funkbeispiel
|
||||
|
||||
## Primäreinsatz
|
||||
|
||||
Zur Orientierung haben wir hier ein Funkbeispiel für einen Primäreinsatz erstellt, welches alle wichtigen Einsatzabschnitte abdeckt und einen Realeinsatz so gut wie möglich abbilden soll.
|
||||
|
||||
::: warning 10:00 Uhr ➜ Die Leistelle alarmiert das Rettungsmittel
|
||||
Innerhalb der nächsten drei Minuten sendet das Luftrettungsmittel Status 3 zur Leitstelle, um <b>wortlos</b> die Einsatzübernahme zu quittieren.
|
||||
:::
|
||||
|
||||
::: warning CHX 69 ➜ 10:02 Uhr ➜ Status 3
|
||||
:::
|
||||
|
||||
Der kommende Einsatzabschnitt kann theoretisch komplett ohne Kommunikation verlaufen, hier hat die Leitstelle aber noch einige Informationen für den Hubschrauber.
|
||||
|
||||
::: info Leitstelle ➜ 10:05 Uhr
|
||||
<strong>"Christoph 69 von Leitstelle VAR, kommen."</strong>
|
||||
|
||||
<p>Die Leitstelle baut das Gespräch mit dem Luftrettungsmittel auf.</p>
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 10:05 Uhr
|
||||
<strong>"Hier Christoph 69, kommen."</strong>
|
||||
:::
|
||||
|
||||
::: info Leitstelle ➜ 10:05 Uhr
|
||||
<strong>
|
||||
"Einsatz in der VAR-Straße 187 ist eine Nachforderung vom RTW, Patient
|
||||
bewusstlos, kommen."
|
||||
</strong>
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 10:06 Uhr
|
||||
<strong>"Einsatz als Nachforderung vom RTW, verstanden, kommen."</strong>
|
||||
:::
|
||||
|
||||
::: info Leitstelle ➜ 10:06 Uhr
|
||||
<strong>"Richtig verstanden, Ende."</strong>
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 10:11 Uhr ➜ Status 4
|
||||
:::
|
||||
|
||||
Der Hubschrauber ist am Einsatzort eingetroffen und das ärztliche Personal versorgt den Patienten.
|
||||
|
||||
Nach der Versorgung verständigt sich der Notarzt mit dem aufnehmenden Klinikum und meldet den Patienten an.
|
||||
Das Luftrettungsmittel verlegt den Patienten im kommenden Einsatzabschnitt. Um der Leitstelle diese Information in Hinblick auf dessen Verfügbarkeit mitzuteilen, versucht die Besatzung ein Gespräch mittels Status 5 - dem klassischen Sprechwunsch - aufzubauen.
|
||||
|
||||
::: warning CHX69 ➜ 10:35 Uhr ➜ Status 5
|
||||
:::
|
||||
|
||||
Entweder, die Leistelle schickt den FMS-Status J, die Sprechaufforderung:
|
||||
|
||||
:::info Leitstelle ➜ 10:36 Uhr ➜ Status J
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 10:36 Uhr
|
||||
<strong>
|
||||
"Hier Christoph 69, Patient aufgenommen, wir fliegen ins Capitol-Klinikum
|
||||
Finsdorf."
|
||||
</strong>
|
||||
:::
|
||||
|
||||
oder die Leitstelle baut den Ruf verbal auf:
|
||||
|
||||
:::info Leitstelle ➜ 10:36 Uhr
|
||||
<strong>"Christoph 69 von Leitstelle VAR, kommen."</strong>
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 10:36 Uhr
|
||||
<strong>
|
||||
"Hier Christoph 69, Patient aufgenommen, wir fliegen ins Capitol-Klinikum
|
||||
Finsdorf, kommen."
|
||||
</strong>
|
||||
:::
|
||||
|
||||
:::info Leitstelle ➜ 10:36 Uhr
|
||||
<strong>"Verstanden, Ende."</strong>
|
||||
|
||||
<p>
|
||||
Die Leistelle kann als übergeordneter Gesprächsteilnehmer den Ruf - wie in
|
||||
diesem Fall - auch vorzeitig beenden.
|
||||
</p>
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 10:37 Uhr ➜ Status 7
|
||||
:::
|
||||
|
||||
Der Hubschrauber macht sich auf den Weg nach Finsdorf. Dort angekommen setzt er den Status 8.
|
||||
|
||||
**Eine Kommunikation mit der Leitstelle in der Zwischenzeit ist in der Regel nicht erforderlich.**
|
||||
|
||||
Am Zielort angekommen teilt die Besatzung der Leitstelle mittels Status 8 mit, dass der Patient zum einen in das Klinikum verbracht wurde und das Luftrettungsmittel zum anderen auf Nachfrage bedingt für einen kommenden Einsatz abkömmlich ist.
|
||||
|
||||
::: warning CHX69 ➜ 10:49 Uhr ➜ Status 8
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 11:05 Uhr ➜ Status 1
|
||||
Der Hubschrauber ist wieder einsatzbereit und fliegt zurück zum
|
||||
Luftrettungszentrum.
|
||||
:::
|
||||
|
||||
::: warning CHX69 ➜ 11:18 Uhr ➜ Status 2
|
||||
:::
|
||||
|
||||
Ab hier geht es dann wieder [von vorne los.](#primareinsatz)
|
||||
@@ -1,168 +0,0 @@
|
||||
# Funkverkehr
|
||||
|
||||
Damit im Einsatzfunk keine Misverständnisse entstehen, gibt es im BOS-Funk eine gewissen "Funkdisziplin" . Neben bestimmten Betriebswörtern ist die korrekte und deutliche Aussprache, das Vermeiden von Floskeln oder ungeläufigen Abkürzungen und vieles mehr sehr wichtig.
|
||||
Im folgenden Artikel ist alles dazu zusammengefasst.
|
||||
|
||||
Achtet unbedingt auf unsere [Dos und Don'ts](#dos-and-donts) am Ende dieses Artikels.
|
||||
|
||||
## Die Basics
|
||||
|
||||
Ein Funkspruch sollte immer so kurz wie möglich und nur so lang wie nötig sein.
|
||||
Um lange Denkpausen wärhend des Funkspruchs zu verhindern, kann man sich an den einfachen Merkspruch **Denken, Drücken, Sprechen** halten. In jeder anderen Reihenfolge entstehen keine guten Funksprüche.
|
||||
|
||||
:::danger Zu vermeiden ist das Nutzen von:
|
||||
|
||||
- Eigennamen (sofern nicht wichtig)
|
||||
- Höflichkeitsformen ("Danke", "Bitte", etc.)
|
||||
- ungeläufigen Abkürzungen
|
||||
:::
|
||||
|
||||
:::tip Unbedingt genutzt werden sollte:
|
||||
|
||||
- die Anrede mit "Sie"
|
||||
- die unverwechselbare Aussprache von Zahlen (einzeln und "zwo" statt "zwei")
|
||||
- ggf. die [deutsche postalische Buchstabiertafel](https://de.wikipedia.org/wiki/Buchstabiertafel#Deutscher_Sprachraum) ("A wie Anton", "B wie Berta" etc.)
|
||||
:::
|
||||
|
||||
Natürlich ist im alltäglichen Gebrauch eine starke Abweichung zu erkennen - aber nur wer weiß, wie's richtig geht, kann sich eine Abweichung erlauben. Gerade in [DMO](/allgemein/bos-funk/Grundlagen)-Rufgruppen ist ein "Standardfunkverkehr" nur selten gewährleistet. Bei größeren Einsatzlagen wird eine korrekte und unmisverständliche Kommunikation jedoch wichtig.
|
||||
|
||||
## Gesprächsaufbau
|
||||
|
||||
Der **Gesprächspartner** (dessen OPTA) wird zuerst gerufen, dann folgen das Bindewort "<b>von</b>" (nicht "für"!), die <b>eigene OPTA</b> und die Sprechaufforderung "<b>kommen</b>".
|
||||
|
||||
::: tip CHX69 ➜
|
||||
<strong>"Leitstelle VAR von Christoph 69 - kommen"</strong>
|
||||
:::
|
||||
|
||||
Auch kann ein kommender Gesprächsinhalt als Vorbereitung angefügt werden.
|
||||
|
||||
::: tip CHX69 ➜
|
||||
<strong>"Leitstelle VAR von Christoph 69 - mit Nachforderung - kommen"</strong>
|
||||
:::
|
||||
|
||||
Das Drücken des [Status](/allgemein/bos-funk/Status) 5 kommt einem wortlosen Gesprächsaufbau gleich.
|
||||
|
||||
## Antwort auf einen Gesprächsaufbau
|
||||
|
||||
Die Antwort auf einen Gesprächsaufbau beginnt immer mit dem Wort "**Hier**", gefolgt von der **eigenen OPTA** und der Sprechaufforderung "**kommen**".
|
||||
|
||||
::: info Leitstelle ➜
|
||||
<strong>"Hier Leitstelle VAR - kommen"</strong>
|
||||
:::
|
||||
|
||||
Die Formulierungen "Hört", "Hört Sie" und ähnliche sind in der Realität nicht erwünscht.
|
||||
|
||||
Auf einen Sprechwunsch antwortet man folgendermaßen
|
||||
|
||||
::: info Leitstelle ➜
|
||||
<strong>"Chistoph 69 - hier Leitstelle VAR - kommen."</strong>
|
||||
:::
|
||||
|
||||
Hier ist es auch nicht unüblich, dass von der Leistelle nur die OPTA des rufenden Teilnehmers genannt wird.
|
||||
|
||||
:::info
|
||||
Einige Leitstellen führen als Namen nicht das Wort "Leitstelle" sondern "Florian". "Florian Berlin" als Rettungsleitstelle in Berlin wird also nicht "Leitstelle Florian Berlin", sondern "Florian Berlin" gerufen.
|
||||
:::
|
||||
|
||||
## Führen eines Gesprächs
|
||||
|
||||
Nach den vorherigen beiden Schritten beginnt das eigentliche Funkgespräch. Jede Nachricht wird mit dem Betriebswort "**kommen**" beendet, beide OPTA (also die eigene und die des Gesprächspartners) werden nicht mehr genannt.
|
||||
|
||||
::: tip CHX 69 ➜
|
||||
<strong>"Starten in 2</strong>
|
||||
<i> ("zwo") </i>
|
||||
<strong>Minuten - kommen"</strong>
|
||||
:::
|
||||
|
||||
Sofern die Information aufgenommen wurde, ist diese vom Empfänger mit "**Verstanden**" und der Sprechaufforderung zu bestätigen.
|
||||
|
||||
::: info Leitstelle ➜
|
||||
<strong>"Verstanden - kommen"</strong>
|
||||
:::
|
||||
|
||||
Komplexe Informationen sollten immer wiederholt werden.
|
||||
Beispiele hierfür sind:
|
||||
|
||||
- Koordinaten
|
||||
- Anzahlen
|
||||
- Zeiten
|
||||
|
||||
## Beenden eines Gesprächs
|
||||
|
||||
Ist der Informationsaustausch beendet, muss auch das Gespräch beendet werden.
|
||||
|
||||
::: tip CHX 69 ➜
|
||||
<strong>"Vertanden - Ende"</strong>
|
||||
:::
|
||||
|
||||
Standardgemäß beendet **immer** der eröffnende Gesprächspartner das Gespräch.
|
||||
Wird das Gespräch über einen [Sprechwunsch](Status) eröffnet, gilt dieser als Gesprächsaufbau.
|
||||
|
||||
Außerhalb dieser Regel kann die Leitstelle ein Gespräch jederzeit beenden.
|
||||
|
||||
## Betriebswörter
|
||||
|
||||
| **Verwendung** | **Betriebsworte** |
|
||||
| -------------------------------------------------------------------------- | ------------------------------------ |
|
||||
| Berichtigung eines Sprech- oder Textfehlers | Ich berichtige |
|
||||
| Ankündigung einer Wiederholung | Ich wiederhole |
|
||||
| Aufforderung, eine Meldung zu wiederholen | Wiederholen Sie |
|
||||
| Aufforderung, eine Meldung eingegrenzt zu wiederholen | Wiederholen Sie ab / bis / von...bis |
|
||||
| Ankündigung, dass ein Wort buchstabiert wird | Ich buchstabiere |
|
||||
| Aufforderung, ein Wort zu buchstabieren | Buchstabieren Sie |
|
||||
| Ankündigung einer Frage | Frage |
|
||||
| Aufforderung zum Warten | Warten |
|
||||
| Nicht aufnahmebereiter Gesprächspartner ruft zurück, sofern aufnahmebereit | Ich rufe wieder |
|
||||
|
||||
## Dos and Don'ts
|
||||
|
||||
#### Unklarer Rufaufbau
|
||||
|
||||
> **Don't:** "Christoph 69 für Leitstelle VAR, kommen"
|
||||
|
||||
Abgesehen davon, dass "für" ein kompliziertes Wort in diesem Zusammenhang ist, ist vielen nicht bewusst, welche Station in diesem Anruf zuerst und welche danach gerufen wird.
|
||||
In diesem Beispiel würde die Leistelle also den Christoph 69 rufen.
|
||||
Besser in dieser Situation: **"von"**. Ein unmissverständliches Betriebswort, welches eindeutig beschreibt, welche Station **von** welcher gerufen wird.
|
||||
|
||||
> **Do:** "Christoph 69 von Leistelle VAR, kommen"
|
||||
|
||||
#### Erst Gedrückt, dann Gesprochen
|
||||
|
||||
> **Don't:** "Ähm, Christoph Ähm 69, wir ähm, fliegen jetzt in - Moment - die Uniklinik in - Moment - Erfurt mit Ankunft in ähm 5 Minuten, kommen"
|
||||
|
||||
Beachtet die ricthige Reihenfolge von "Denken, Drücken, Sprechen"!
|
||||
|
||||
> **Do:** "Christoph 69, Transportziel Uniklinik mit Ankunft in 5 Minuten, kommen"
|
||||
|
||||
#### Falscher Status/Notrufmissbrauch
|
||||
|
||||
> **Don't:** Status 0 senden, um mitzuteilen, dass sich der Start um eine Minute verzögert.
|
||||
|
||||
Der dringende Sprechwunsch ist dazu da, um den eigenen Sprechwunsch vor anderen Sprechwünschen zu priorisieren.
|
||||
Missbraucht weder den priorisierten Sprechwunsch, noch den Notruf.
|
||||
|
||||
> **Do:** Status sinnig verwenden und vorher klären, ob die Information wirklich wichtig genug ist, um sie in einem Sprechwunsch mitzuteilen.
|
||||
|
||||
#### Flugfunk mit BOS-Funk verwechseln
|
||||
|
||||
> **Don't:** "Copy", "Understood", "Wilco"
|
||||
|
||||
Bedarf wohl keiner weiteren Erklärung.
|
||||
|
||||
> **Do:** "Verstanden"
|
||||
|
||||
#### Den Sprechwunsch meiden
|
||||
|
||||
> **Don't:** "Leitstelle von Christoph 69, kommen."
|
||||
|
||||
Der Sprechwunsch-Status 5 ist _in der Regel_ vor einem verbalen Gesprächsaufbau zu verwenden.
|
||||
|
||||
> **Do:** Status 5 drücken und auf ein "J" oder einen Gesprächsaufbau durch die Leistelle warten.
|
||||
|
||||
#### Landemeldungen
|
||||
|
||||
> **Don't:** "Christoph 69 zur Landung an der Einsatzstelle."
|
||||
|
||||
Eine Landemeldung interessiert die Leitstelle in den seltensten Fällen.
|
||||
|
||||
> **Do:** Nach der Landung Status 4 drücken.
|
||||
@@ -1,63 +0,0 @@
|
||||
# BOS-Funk Grundlagen
|
||||
|
||||
Die Kommunikation zwischen Pilot und Flugverkehrskontrolle beschränkt sich auf die fliegerischen Informationen; die Koordination der Einsätze erflogt jedoch über eine weitere Instanz: Die Leitstelle.
|
||||
Die ist die Koordinatorin aller Einsätze in einem definierten Gebiet und sorgt dort für die effektive Bereitstellung von Rettungsmitteln.
|
||||
|
||||
Deren Kommunikation läuft größtenteils über Funk ab, der sich jedoch maßgeblich vom Pilotenfunk unterscheidet - dem BOS-Funk.
|
||||
|
||||
**BOS** steht für "Behörden und Organistationen mit Sicherheitsaufgaben", dazu zählen Feuerwehr, Rettungsdienst (inkl. Luftrettung), Polizei, aber auch das Technische Hilfswerk THW und viele andere.
|
||||
Während in Deutschland lange der analoge UKW BOS-Funk verbreitet war, befasst sich dieser Artikel vorerst mit dem nach und nach einheitlichen digitalen TETRA-BOS Funk.
|
||||
|
||||
Für den BOS-Funk in Deutschland verantwortlich ist die in 2007 gegründete [**Bundesanstalt für den Digitalfunk der Behörden und Organisationen mit Sicherheitsaufgaben**](https://www.bdbos.bund.de/DE/Home/home_node.html) - kurz BDBOS.
|
||||
Sie gibt an, dass bereits 99,2 % der Fläche Deutschlands einsatzbereit für den Digitalfunk sind.
|
||||
|
||||
## Funktion
|
||||
|
||||
Digitalfunkgeräte der BOS in Deutschland werden mit einer sogenannten BSI-Sicherheitskarte ausgestattet. Sie ist ähnlich einer SIM-Karte und berechtigt das Funkgerät zum Zugriff auf das bereitgestellte Digitalfunknetz.
|
||||
Diese Karte wird nur an berechtigte Teilnehmer ausgegeben und schützt somit vor einem (im Analogfunk verbreiteten) Abhören von Funkgesprächen.
|
||||
|
||||
Der Funkverkehr findet im Kontrast zu "Frequenzen" im Luftverkehr oder "Kanälen" im Analogfunk in sogenannten "Rufgruppen" statt und wird digital abhörsicher verschlüsselt.
|
||||
|
||||
## Betriebsarten
|
||||
|
||||
Im TETRA-BOS Funk gibt es zwei sogenannte Betriebsarten - sie geben im groben an, wie das Empfänger-Endgerät erreicht wird.
|
||||
|
||||
### DMO Betrieb
|
||||
|
||||
**DMO** steht für **D**irect **M**ode **O**peration, also den _Direktbetrieb_. Vereinfacht gesehen kommuniziert ein Funkgerät mit anderen Endgeräten in der Umgebung, wobei sich Sender und Empfänger in einem bestimmten Radius befinden müssen - die Verbindung wird direkt (**direct**) zwischen den Funkgeräten aufgebaut.
|
||||
Dadurch ist der DMO-Betrieb anfällig für bestimmte Störfaktoren wie abschirmende Metalle, Gebäude, Berge und Täler etc.
|
||||
Er ist außerdem **reichweitenbegrenzt**.
|
||||
So kann es passieren, dass man Teilnehmer in der aktuellen Rufgruppe auf Funksprüche antworten hören kann, welche man aufgrund der eigenen Reichweite selbst nicht hören konnte.
|
||||
|
||||

|
||||
|
||||
Im Beispiel kann Funkgerät 2 an beide anderen Funkgeräte senden und Nachrichten von ihnen Empfangen. 1 und 3 können zwar auf beide Wege mit Funkgerät 2 kommunizieren, jedoch nicht miteinander, da die Entfernung zwischen ihnen zu groß ist.
|
||||
|
||||
:::tip Eselsbrücke
|
||||
**DMO** ist der **D**orf**mo**dus - kurze Reichweite, aber für eine lokale Einsatzkoordination komplett ausreichend.
|
||||
:::
|
||||
|
||||
### TMO Betrieb
|
||||
|
||||
**TMO** steht für **T**runked **M**ode **O**peration, den sogenannten _Netzbetrieb_.
|
||||
Hier wird eine Verbindung zwischen dem Funkgerät und einer der deutschlandweit verteilten TETRA-Antennen hergestellt, welche den Funkspruch innerhalb der Rufgruppe an weitere Antennen und final an die entsprechenden Empfänger "zustellt". So ist der TMO Betrieb weitesgehend reichweitenunbegrenzt, aber immer noch Abhängig von bekannten Störfaktoren und der TETRA-Netzabdeckung.
|
||||
Ein Beispiel hier ist der klassische Leistellenfunk. Vor allem in großen Funkverkehrsbereichen ist die DMO-Reichweite selbst bei optimalen Bedingungen nicht ausreichend, um alle Teilnehmer zuverlässig zu erreichen.
|
||||
In einer TMO Leitstellen-Rufgruppe wird die Reichweite erhöht und alle Teilnehmer im Funkverkehrsbereich können Gespräche mithöhren und an ihnen teilnehmen.
|
||||
|
||||

|
||||
|
||||
Im Beispiel können alle drei Funkgeräte untereinander über eine erhöhte Reichweite kommunizieren. Dabei können auch mehrere TETRA-Masten zwischengeschaltet oder ein Direktruf zwischen zwei einzelnen Funkgeräten aufgebaut werden.
|
||||
|
||||
## Sonstiges
|
||||
|
||||
Mit Handfunkgeräten können auch sogenannte "Repeater" realisiert werden. Gesonderte Geräte werden taktisch platziert und wiederholen (engl. "to repeat") das Signal innerhalb einer DMO-Rufgruppe, um die Reichweite zu erhöhen oder innerhalb von Objekten eine bessere Abdeckung zu gewähleisten.
|
||||
|
||||
Auch ist ein sogenannter "Gateway-Betrieb" möglich. Ein Handfunkgerät kommuniziert im DMO mit einem Fahrzeugfunkgerät, welches auf eine TMO-Rufgruppe eingestellt ist und den DMO- zu einem TMO-Ruf macht.
|
||||
|
||||
Notrufe, die von einem Funkgerät ausgelöst wurden, haben in der Rufgruppe immer eine Sprechpriorität und unterbrechen bis zur Auflösung des Notrufs und nach einer bestimmten Zeit jeglichen anderen Funkverkehr.
|
||||
|
||||
## Besondere Rufgruppen
|
||||
|
||||
Um einen geordneten Einsatz- und Leitstellenfunk gewährleisten zu können, gibt es diverse Rufgruppen im DMO- und TMO-Betrieb. Diese sind meist spezifisch auf eine BOS ausgelegt, so gibt es etwa TMO- und DMO-Rufgruppen für den Rettungsdienst, die Feuerwehr oder die Polizei. Da die BSI-Sicherheitskarte bzw. der zuständige Administrator den Zugriff auf die jeweiligen Rufgruppen ggf. untersagt, existieren sogenannte **TBZ**-Rufgruppen. Sie dienen der **t**echnisch-**b**etrieblichen-**Z**usammenarbeit und kommen zum Einsatz, wenn bspw. ein Hubschrauber in Absprache mit der örtlichen Feuerwehr einen Landeplatz ausfindig macht, oder z.B. mit DLRG, Polizei, Feuerwehr vermisste Personen in Gewässern sucht.
|
||||
|
||||
Außerdem verfügen die meisten Leitstellen über gesonderte und standardisierte Fremdrufgruppen, über die Fahrzeuge aus fremden Funkverkehrsbereichen Erstkontakt mit der jeweiligen Leistelle aufnehmen kann.
|
||||
@@ -1,88 +0,0 @@
|
||||
# OPTA
|
||||
|
||||
Die OPTA, oder lang: Die **Op**erativ-**T**ktische **A**dresse sorgt bei korrekter Nutzung für eine verwechslungsfreie Zuordnung von Funksprüchen zu genau einem Fahrzeug. Sie wird oft auch als "Funkkenner" bezeichnet, ist für jedes BOS-Fahrzeug einzigartig und setzt sich aus sechs Bestandteilen zusammen.
|
||||
|
||||
:::danger Achtung
|
||||
Wie so vieles im föderalistisch organisiertem Rettungsdienst unterscheiden sich OPTA von Bundesland zu Bundesland oder sogar von Landkreis zu Landkreis; hier wird eins der geläufigsten OPTA-Schemen erläutert. Gegebenenfalls wird der Artikel erweitert.
|
||||
:::
|
||||
|
||||
OPTA tangieren die Regelluftrettung direkt nur marginal, da Rettungshubschrauber die bundeseinheitliche OPTA **Christoph XX** tragen, wobei **XX** meist die standortspezifische Kennzahl des Hubschraubers ist.
|
||||
|
||||
Um ein gewisses Grundverständnis von den Vorgängen im BOS-Funk zu erlangen, kann es dennoch hilfreich sein, sich mit dem Konzept OPTA vertraut zu machen.
|
||||
|
||||
## Aufgbau einer OPTA
|
||||
|
||||
Ein gutes Beispiel hierfür ist der [NEH Kessin](https://www.rth.info/stationen.db/station.php?id=90).
|
||||
Dessen OPTA ist
|
||||
|
||||
| **Kennwort** | **Funkverkehrskreis** | **Gemeindekennzahl** | **Teilkennzahl 1** | **Teilkennzahl 2** | **Teilkennzahl 3** |
|
||||
| :----------: | :-------------------: | :------------------: | :----------------: | :----------------: | :----------------: |
|
||||
| Rettung | Landkreis Rostock | 029 | 01 | 82 | 01 |
|
||||
|
||||
#### Organisationskennwort
|
||||
|
||||
Das vorangestellte Kennwort lässt auf die zugeordnete Hilfsorganisation schließen.
|
||||
**Rettung** steht immer für private Hilfsorganisationen; hier die Ambulanz Millich.
|
||||
|
||||
#### Funkverkehrskreis
|
||||
|
||||
Das folgende Kennwort wird zur Identifikation eines Fahrzeugs außerhalb des eigenen Funkverkehrsbereichs genutzt.
|
||||
Innerhalb dieses Bereichs wird es nicht mit genannt.
|
||||
|
||||
#### Gemeindekennzahl
|
||||
|
||||
Sie gibt den Herkunftsort des Fahrzeugs an. Im Beispiel steht "029" im Landkreis Rostock für die Gemeinde Dummerstorf.
|
||||
|
||||
#### TKZ 1 - Standortkennzahl
|
||||
|
||||
Aufsteigende Zahl zur Unterscheidung mehrerer Standorte derselben Gemeindekennzahl.
|
||||
|
||||
#### TKZ 2 - Typkennzahl
|
||||
|
||||
Gibt die Art des Fahrzeugs an. 82 steht im Beispiel für NEF bzw. NEH
|
||||
|
||||
#### TKZ 3 - Fahrzeugkennzahl
|
||||
|
||||
Unterscheidet mehrere Fahrzeuge desselben Typs.
|
||||
|
||||
:::info
|
||||
Eine "0" wird in der OPTA nicht mitgesprochen.
|
||||
:::
|
||||
|
||||
## Übersichten wichtiger Teile einer OPTA
|
||||
|
||||
### Organisationskennworte
|
||||
|
||||
| **Organistaion** | **Kennwort** |
|
||||
| :-------------------------------: | :----------: |
|
||||
| Feuerwehr | Florian |
|
||||
| Deutsches Rotes Kreuz | Rotkreuz |
|
||||
| Johanniter-Unfall-Hilfe | Akkon |
|
||||
| Malteser Hilfsdienst | Johannes |
|
||||
| Arbeiter-Samariter-Bund | Sama |
|
||||
| DLRG | Pelikan |
|
||||
| DGzRS | Triton |
|
||||
| Katastrophenschutz | Kater |
|
||||
| Kommunale/Private Rettungsdienste | Rettung |
|
||||
| THW | Heros |
|
||||
| Rettungshubschrauber | Christoph |
|
||||
|
||||
### Typenkennzahlen (des Rettungsdienstes)
|
||||
|
||||
| **Fahrzeug** | **TKZ** |
|
||||
| :------------------------------: | :-----: |
|
||||
| NAW oder ITW | 81 |
|
||||
| NEF | 82 |
|
||||
| RTW oder MZF | 83 |
|
||||
| NKTW, teilweise auch RTH | 84 |
|
||||
| KTW | 85 |
|
||||
| KatS RTW (nicht ständig besetzt) | 86 |
|
||||
| KatS KTW | 87 |
|
||||
|
||||
:::info
|
||||
Diese TKZ unterscheiden sich und sind in Hessen und Bayern teilweise anders zugeordnet.
|
||||
:::
|
||||
|
||||
## ISSI
|
||||
|
||||
Die **I**ndividual **S**hort **S**ubscriber **I**dentity ist eine einzigartige siebenstellige Nummer, die ein TETRA-Endgerät eindeutig kennzeichnet. Einige BOS-Fahrzeuge schreiben teilweise die ISSI des Fahrzeugfunkgerätes auf ihr Dach, da durch sie ein direktes Gespräch mit dem jeweiligen Funkgerät aufgebaut werden kann.
|
||||
@@ -1,53 +0,0 @@
|
||||
# Status
|
||||
|
||||
Der _Status_ eines Rettungsmittels wurde lange per FMS ("Funkmeldesystem") übertragen. Seit der Einführung des Digitalfunks weicht das sogenannte "tonfrequente Übertragungssystem" zum Senden von Statusmeldungen dem SDS (**S**hort **D**ata **S**ervice). Dieses System im Digitalfunk kann ähnliche Funktionen wie das alte FMS im Analogfunk abdecken. Es dient dem Austausch von Kurznachrichten, ähnlich einer SMS.
|
||||
|
||||
SDS ermöglicht die Übertragung von End-To-End verschlüsselten Alarmierungen, GPS-Positionsdaten oder Textnachrichten. Grundlegend besteht eine Statusnachricht aus einer fünfstelligen Zahl, für die in den TETRA-Endgeräten ein Statustext hinterlegt ist.
|
||||
|
||||
Darüber kann auch das Senden von den bekannten zahlengebundenen Statusmeldungen realisiert werden.
|
||||
|
||||
Der Vorteil dieser Statusnummern ist die deutliche Reduktion des Funkverkehrs innerhalb einer Leitstellenrufgruppe.
|
||||
|
||||
## Statusmeldungen
|
||||
|
||||
| **Status** | **Bedeutung** | **Details** |
|
||||
| :--------: | :------------------------: | :------------------------------------------------------------------------------------------------ |
|
||||
| 0 | Priorisierter Sprechwunsch | Das Einsatzmittel möchte vor allen anderen Kontakt mit der Leitstelle aufnehmen. |
|
||||
| 1 | Einsatzbereit über Funk | Das Einsatzmittel kann nach Rücksprache und abhängig vom Standort alarmiert werden. |
|
||||
| 2 | Einsatzbereit am Standort | Das Einsatzmittel kann am Heimatstandort alarmiert werden. |
|
||||
| 3 | Einsatz übernommen | Das Einsatzmittel hat den Auftrag angenommen und befindet sich auf Anfahrt. |
|
||||
| 4 | Ankunft am Einsatzort | Das Einsatzmittel ist mit der Abarbeitung vor Ort beschäftigt und nur bedingt erreichbar. |
|
||||
| 5 | Sprechwunsch | Das Einsatzmittel möchte Kontakt mit der Leitstelle aufnehmen. |
|
||||
| 6 | Nicht einsatzbereit | Das Einsatzmittel kann nicht alarmiert werden. |
|
||||
| 7 | Patient aufgenommen | Das Einsatzmittel hat einen Patienten aufgenommen und kann nicht alarmiert werden. |
|
||||
| 8 | Ankunft am Zielort | Das Einsatzmittel kann mit einer längeren Reaktionszeit nach Rücksprache alarmiert werden. |
|
||||
| 9 | Fahrzeuganmeldung | Das Einsatzmittel meldet sich im Funkverkehrsbereich an. Bei der VAR: Meldung nach dem Einloggen. |
|
||||
|
||||
## Statusanweisungen
|
||||
|
||||
| **Status** | **Bedeutung** | **Details** |
|
||||
| :--------: | :-------------------------------: | :---------------------------------------------------------------------------------------------- |
|
||||
| E | Einsatzabbruch | Das Einsatzmittel wird vom Einsatzabgezogen und quittiert mit `2` oder `1`. |
|
||||
| C | Einsatzübernahme melden | Dem Disponenten muss mit `3` die Übernahme des Einsatzes quittiert werden. |
|
||||
| F | Kommen Sie über Draht | Das Einsatzmittel muss sich telefonisch (per Discord) beim Disponenten melden. |
|
||||
| H | Fahren Sie Wache an | Keine Nutzung in der VAR |
|
||||
| J | Sprechaufforderung (nach `5`/`0`) | Nicht-mündliche Aufforderung, mit dem Sprechen zu beginnen. |
|
||||
| L | Geben Sie Lagemeldung | Die Leitstelle fordert eine Lagemeldung vom Rettungsmittel an. |
|
||||
| P | Einsatz mit Polizei/Pause nehmen | Keine Nutzung in der VAR |
|
||||
| U | Unerlaubte Statusfolge | Keine Nutzung in der VAR |
|
||||
| c | Status korrigieren | Das Einsatzmittel hat einen offensichtlich falschen Status gesetzt und muss diesen korrigieren. |
|
||||
| d | Transportziel durchgeben | Die Leitstelle erfragt das Transportziel des Rettungsmittels. |
|
||||
| h | Zielklinik verständigt | Die Leitstelle hat die Zielklinik verständigt und positive Rückmeldung erhalten. |
|
||||
| o | Warten, alle Abfrageplätze belegt | Das Rettungsmittel muss auf die Sprechaufforderung warten. |
|
||||
| u | Verstanden | Die Leitstelle hat die Informationen aufgenommen und verstanden. |
|
||||
|
||||
:::info Status 5
|
||||
In vielen Leitstellen kann ein Gespräch nur über das Senden des Status 5 initiiert werden, da der Disponent den Funk innerhalb seiner Rufgruppe nicht ständig mithört. Auch bei uns wird der Sprechwunsch mittels Status 5 von vielen Disponenten erwartet und immer vor mündlichen Sprechwünschen priorisiert.
|
||||
:::
|
||||
|
||||
:::info Status 9
|
||||
Die vergangenen Monate haben gezeigt, dass die Implementierung eines Status 9 sinnvoll ist. In Realität ist das in vielen Leitstellenbereichen die Anmeldung in einer fremden Rufgruppe (analog zu Status 5).
|
||||
VAR-intern kann der Status 9 dann genutzt werden, wenn man sich eingeloggt hat und dem Disponenten diesen Umstand mitteilen möchte. Die Reaktion darauf wird dann `u` sein. Somit wird die Rufgruppe frei von
|
||||
"Funksprechproben" oder versteckten Hinweisen auf die Einsatzbereitschaft eines Einsatzmittels gehalten. Solltet ihr eure Audio-Einstellungen überprüfen wollen, tut das bitte in den Einstellungen selbst. Das indirekte Betteln nach schnellen Einsätzen mit wiederholtem Drücken von Status 9
|
||||
ist nicht erwünscht und wird entsprechend geahndet. Sollte das Rettungsmittel durch Witterung und Zeit nur beschränkt bzw. unter Auflagen alarmierbar sein, ist das nach wie vor mit Status 5 mitzuteilen.
|
||||
:::
|
||||
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 82 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M80.3 44C69.8 69.9 64 98.2 64 128s5.8 58.1 16.3 84c6.6 16.4-1.3 35-17.7 41.7s-35-1.3-41.7-17.7C7.4 202.6 0 166.1 0 128S7.4 53.4 20.9 20C27.6 3.6 46.2-4.3 62.6 2.3S86.9 27.6 80.3 44zM555.1 20C568.6 53.4 576 89.9 576 128s-7.4 74.6-20.9 108c-6.6 16.4-25.3 24.3-41.7 17.7S489.1 228.4 495.7 212c10.5-25.9 16.3-54.2 16.3-84s-5.8-58.1-16.3-84C489.1 27.6 497 9 513.4 2.3s35 1.3 41.7 17.7zM352 128c0 23.7-12.9 44.4-32 55.4V480c0 17.7-14.3 32-32 32s-32-14.3-32-32V183.4c-19.1-11.1-32-31.7-32-55.4c0-35.3 28.7-64 64-64s64 28.7 64 64zM170.6 76.8C163.8 92.4 160 109.7 160 128s3.8 35.6 10.6 51.2c7.1 16.2-.3 35.1-16.5 42.1s-35.1-.3-42.1-16.5c-10.3-23.6-16-49.6-16-76.8s5.7-53.2 16-76.8c7.1-16.2 25.9-23.6 42.1-16.5s23.6 25.9 16.5 42.1zM464 51.2c10.3 23.6 16 49.6 16 76.8s-5.7 53.2-16 76.8c-7.1 16.2-25.9 23.6-42.1 16.5s-23.6-25.9-16.5-42.1c6.8-15.6 10.6-32.9 10.6-51.2s-3.8-35.6-10.6-51.2c-7.1-16.2 .3-35.1 16.5-42.1s35.1 .3 42.1 16.5z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M128 32c0-17.7 14.3-32 32-32H544c17.7 0 32 14.3 32 32s-14.3 32-32 32H384v64h32c88.4 0 160 71.6 160 160v64c0 17.7-14.3 32-32 32H384 320c-20.1 0-39.1-9.5-51.2-25.6l-71.4-95.2c-3.5-4.7-8.3-8.3-13.7-10.5L47.2 198.1c-9.5-3.8-16.7-12-19.2-22L5 83.9C2.4 73.8 10.1 64 20.5 64H48c10.1 0 19.6 4.7 25.6 12.8L112 128H320V64H160c-17.7 0-32-14.3-32-32zM384 320H512V288c0-53-43-96-96-96H384V320zM630.6 425.4c12.5 12.5 12.5 32.8 0 45.3l-3.9 3.9c-24 24-56.6 37.5-90.5 37.5H256c-17.7 0-32-14.3-32-32s14.3-32 32-32H536.2c17 0 33.3-6.7 45.3-18.7l3.9-3.9c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
|
||||
|
Before Width: | Height: | Size: 809 B |
@@ -1,5 +0,0 @@
|
||||
# How-To Discord verbinden
|
||||
|
||||
Besuche hierfür das HUB und [navigiere zu den Einstellungen](https://hub.premiumag.de/settings). Dort findest du oben rechts einen Button "Mit Discord Verbinden".
|
||||
|
||||
Klicke diesen an und melde dich im Anschluss mit deinen Discord Nutzerdaten an.
|
||||
|
Before Width: | Height: | Size: 572 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 230 KiB |
@@ -1,54 +0,0 @@
|
||||
# Disponenten
|
||||
|
||||
Auf dieser Seite beziehen wir uns auf [die /dispatch Seite](https://lst.premiumag.de/dispatch) des Leitstellensystems.
|
||||
|
||||
Während du als Leitstelle aktiv bist, muss diese Seite immer geöffnet bleiben, da hierüber die gesamte Kommunikation passiert.
|
||||
|
||||
## Einsatzalarmierung
|
||||
|
||||
Mit einem Rechtsklick auf die Karte kannst du an der jweiligen Position einen neuen Einsatz starten.
|
||||
|
||||

|
||||
|
||||
Die anderen Buttons sind zum Suchen Nach Gebäuden an der jeweiligen Position sowie um die Koordinaten in die Zwischenablage zu kopieren.
|
||||
|
||||

|
||||
|
||||
Jetzt wird der Ort auf der Karte zentriert, es werden einige Gebäude im näheren Umkreis markiert und auf der rechten Seite öffnet sich die Einsatzmaske. Die Maske wird wie gewohnt ausgefüllt.
|
||||
|
||||
Die hervorgehobenen Gebäude sind entweder Blau oder Orange markiert. Orange Gebäude sind die für den Einsatz ausgewählten Gebäude. Durch anklicken eines blauen Gebäudes wird dieses zum Einsatz hinzugefügt und vice versa.
|
||||
|
||||
Durch Rechtsklick -> Lupe wird die Gebäudemarkierung zurückgesetzt und an der neuen Position neu gestartet.
|
||||
|
||||

|
||||
|
||||
Der Einsatz kann nun direkt alarmiert werden oder nur vorbereitet abgespeichert werden.
|
||||
|
||||

|
||||
|
||||
Wir haben diesen Einsatz aus Demonstrationszwecken vorerst nur vorbereitet.
|
||||
Vorbereitete Einsätze erscheinen in Hellblau und können nur von angemeldeten Disponenten gesehen werden, aktive Einsätze erscheinen in Dunkelblau für alle sichtbar.
|
||||
|
||||
Auf der Startseite sehen wir kurze Infos zu Adresse und Stichwort sowie die Möglichkeit den Einsatz zu Alarmieren oder zu löschen.
|
||||
|
||||
Der zweite Tab zeigt Patienten sowie Einsatzinformationen, der dritte bietet eine Schnittstelle zum Nachalarmieren.
|
||||
|
||||
Der Orangene Stift bietet die Möglichkeit, den Einsatz noch zu bearbeiten, diese Option ist nur für vorbereitete Einsätze verfügbar.
|
||||
|
||||
Im letzten Tab haben wir einen Einsatzlog mit Zeitstempeln der Statusmeldungen sowie Notizen von Disponeten zu einem Einsatz zeigt.
|
||||
|
||||
Über das kleine Icon oben rechts lässt sich das Einsatz Popup wieder schließen.
|
||||
|
||||
## Nach der Alarmierung
|
||||
|
||||

|
||||
|
||||
Nun sind die Alarmierungsoptionen verschwunden, stattdessen können wir mit den 2 Buttons oben rechts entweder den Einsatz "kopieren" und daraus einen neuen Erstellen oder ihn abschließen.
|
||||
|
||||
Auf der Seite der Nachalarmierung gibt es nun einen Button an der gleichen Position um die Alarmierung erneut zu schicken.
|
||||
|
||||
## Sonstiges
|
||||
|
||||

|
||||
|
||||
Am linken Seitenrand gibt es einen Chat, die Möglichkeit jemanden zu reporten sowie eine Liste aller Einsätze und aktiver Stationen.
|
||||
@@ -1,25 +0,0 @@
|
||||
# Piloten
|
||||
|
||||
Auf dieser Seite beziehen wir uns auf [die /pilot Seite](https://lst.premiumag.de/pilot) des Leitstellensystems.
|
||||
|
||||
Während du auf VAR fliegst, muss diese Seite, neben dem Desktop Client, immer geöffnet bleiben, da hierüber die gesamte Kommunikation passiert.
|
||||
|
||||
## MRT
|
||||
|
||||
Das Mobile Radio Terminal - kurz MRT - ist die Schnittstelle zwischen Fahrzeug und der Leistelle, hierüber gibst funkst und gibst du Statusmeldungen an die Leistelle weiter und seit unserer V2 erhälst du nun auch SDS Nachrichten auf dem MRT.
|
||||
|
||||

|
||||
|
||||
Simuliert sind die Tasten 0-9 sowie der vom Display aus obere rechte knopf zum bestätigen einer SDS Nachricht.
|
||||
|
||||
Auf dem Display steht jeweils dein Callsign wenn du verbunden bist.
|
||||
|
||||
## DME
|
||||
|
||||
Der Digitalfunkmeldeempfänger ist ein kleines Gerät, was immer bei dem jeweiligen Crewmitglied bleibt. Hierüber bekommt das Crewmitglied seine Alarmierung mit Ton und Text. Angezeigt wird eine kurze Einsatzbeschreibung und die Einsatzsortschaft.
|
||||
|
||||

|
||||
|
||||
Simuliert sind die obere linke Taste, um auf den Hauptbildschirm zurück zu kehren nach einer Alarmierung, sowie der obere rechte runde Knopf (hier nur von der Seite zu sehen), um den Einsatz zu quittieren und den Piepton zu stoppen.
|
||||
|
||||
Auf dem Display stehen das jeweilige Callsign sowie der eigene Name. Im Einsatzfall steht die Alarmierung auf dem Display.
|
||||