Sekundäreinsatz wird nun richtig angezeigt
This commit is contained in:
@@ -52,10 +52,31 @@ const removeClosedMissions = async () => {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ const MissionPopupContent = ({
|
||||
onClick={() => {
|
||||
setMissionFormValues({
|
||||
...mission,
|
||||
addressMissionLocation: mission.addressMissionLocation ?? undefined,
|
||||
addressMissionDestination: mission.addressMissionDestination ?? undefined,
|
||||
addressAdditionalInfo: mission.addressAdditionalInfo ?? undefined,
|
||||
state: "draft",
|
||||
hpgLocationLat: mission.hpgLocationLat ?? undefined,
|
||||
|
||||
@@ -121,7 +121,7 @@ const Einsatzdetails = ({
|
||||
hpgLocationLng: undefined,
|
||||
state: "draft",
|
||||
addressAdditionalInfo: mission.addressAdditionalInfo || undefined,
|
||||
addressMissionLocation: mission.addressAdditionalInfo || undefined,
|
||||
addressMissionDestination: mission.addressMissionDestination || undefined,
|
||||
});
|
||||
setOpen(true);
|
||||
}}
|
||||
@@ -231,7 +231,7 @@ const Einsatzdetails = ({
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
setMissionFormValues({});
|
||||
setEditingMission(false, null);
|
||||
setEditingMission(null);
|
||||
sendAlertMutation.mutate(mission.id);
|
||||
}}
|
||||
>
|
||||
@@ -248,7 +248,7 @@ const Einsatzdetails = ({
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
setMissionFormValues({});
|
||||
setEditingMission(false, null);
|
||||
setEditingMission(null);
|
||||
sendAlertMutation.mutate(mission.id);
|
||||
}}
|
||||
disabled
|
||||
@@ -295,7 +295,7 @@ const Einsatzdetails = ({
|
||||
|
||||
setOpen(false);
|
||||
setMissionFormValues({});
|
||||
setEditingMission(false, null);
|
||||
setEditingMission(null);
|
||||
await sendAlertMutation.mutateAsync(mission.id);
|
||||
}}
|
||||
>
|
||||
@@ -318,7 +318,7 @@ const Einsatzdetails = ({
|
||||
hpgLocationLng: undefined,
|
||||
state: "draft",
|
||||
addressAdditionalInfo: mission.addressAdditionalInfo || undefined,
|
||||
addressMissionLocation: mission.addressAdditionalInfo || undefined,
|
||||
addressMissionDestination: mission.addressAdditionalInfo || undefined,
|
||||
});
|
||||
setOpen(true);
|
||||
}}
|
||||
|
||||
@@ -23,6 +23,5 @@ export const selectRandomHPGMissionSzenery = (code: string) => {
|
||||
return parsedNumbers[randomI];
|
||||
})
|
||||
.join("_");
|
||||
console.log("scenery", scenery);
|
||||
return scenery;
|
||||
};
|
||||
|
||||
@@ -129,14 +129,38 @@ export const useDmeStore = create<MrtStore>(
|
||||
textRight: pageData.mission.Stations.map((s) => s.bosCallsignShort).join(","),
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textMid: `${pageData.mission.missionKeywordName}`,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
...(pageData.mission.type == "primär"
|
||||
? [
|
||||
{
|
||||
textMid: `${pageData.mission.missionKeywordName}`,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
]
|
||||
: []),
|
||||
|
||||
{ textLeft: `${pageData.mission.addressStreet}` },
|
||||
{
|
||||
textLeft: `${pageData.mission.addressZip} ${pageData.mission.addressCity}`,
|
||||
},
|
||||
{
|
||||
textMid: "Weitere Standortinformationen:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.addressAdditionalInfo || "keine Daten",
|
||||
},
|
||||
...(pageData.mission.addressMissionDestination &&
|
||||
pageData.mission.addressMissionDestination.length > 0
|
||||
? [
|
||||
{
|
||||
textMid: "Zielort:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.addressMissionDestination || "keine Daten",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
textMid: "Patienteninfos:",
|
||||
style: { fontWeight: "bold" },
|
||||
|
||||
@@ -290,9 +290,14 @@ export const MissionForm = () => {
|
||||
className="select select-primary select-bordered w-full mb-4"
|
||||
onChange={(e) => {
|
||||
form.setValue("type", e.target.value as missionType);
|
||||
form.setValue("missionKeywordName", KEYWORD_CATEGORY.AB_ATMUNG);
|
||||
form.setValue("missionKeywordAbbreviation", null as any);
|
||||
form.setValue("hpgMissionString", null);
|
||||
if (e.target.value === "sekundär") {
|
||||
form.setValue("missionKeywordName", KEYWORD_CATEGORY.Z_SONSTIGES);
|
||||
form.setValue("missionKeywordAbbreviation", "VL_S");
|
||||
form.setValue("hpgMissionString", "Verlegung:4_1_1_1-4_1");
|
||||
} else {
|
||||
form.setValue("missionKeywordAbbreviation", null as any);
|
||||
form.setValue("hpgMissionString", null);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<option value="primär">PRIMÄR</option>
|
||||
@@ -356,7 +361,6 @@ export const MissionForm = () => {
|
||||
form.setValue("hpgMissionString", e.target.value);
|
||||
const [name] = e.target.value.split(":");
|
||||
const allHpgMissionTypes = keywords?.map((k) => k.hpgMissionTypes).flat();
|
||||
console.log("Selected HPG Mission String:", name, allHpgMissionTypes);
|
||||
if (
|
||||
!form.watch("missionAdditionalInfo") ||
|
||||
allHpgMissionTypes?.find((t) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
import ModeSwitchDropdown from "_components/navbar/ModeSwitchDropdown";
|
||||
import { useSession } from "next-auth/react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { ConnectedDispatcher } from "tracker/_components/ConnectedDispatcher";
|
||||
|
||||
@@ -8,12 +9,13 @@ const Map = dynamic(() => import("../_components/map/Map"), {
|
||||
});
|
||||
|
||||
const Page = () => {
|
||||
const session = useSession();
|
||||
return (
|
||||
<>
|
||||
<Map />
|
||||
<div className="flex gap-3 absolute top-5 right-10 z-99999">
|
||||
<ConnectedDispatcher />
|
||||
<ModeSwitchDropdown className="dropdown-end" />
|
||||
{session.status === "authenticated" && <ModeSwitchDropdown className="dropdown-end" />}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@ model Mission {
|
||||
addressCity String?
|
||||
addressZip String?
|
||||
addressAdditionalInfo String? @default("")
|
||||
addressMissionLocation String? @default("")
|
||||
addressMissionDestination String? @default("")
|
||||
addressOSMways Json[] @default([])
|
||||
missionKeywordCategory String
|
||||
missionKeywordName String
|
||||
|
||||
Reference in New Issue
Block a user