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