added HPG VEhicles Mission, Audio settings; mission Context menu

This commit is contained in:
PxlLoewe
2025-05-24 12:46:11 -07:00
parent b2890b3ecc
commit 1ca6007ac5
28 changed files with 680 additions and 369 deletions

View File

@@ -128,6 +128,8 @@ export const ContextMenu = () => {
setMissionFormValues({
...parsed,
state: "draft",
addressLat: contextMenu.lat,
addressLng: contextMenu.lng,
addressOSMways: [closestToContext],
});

View File

@@ -46,7 +46,6 @@ const MissionPopupContent = ({
const handleTabChange = useCallback(
(tab: "home" | "details" | "patient" | "log") => {
console.log("handleTabChange", tab);
setMissionMarker({
open: [
{
@@ -284,10 +283,6 @@ const MissionMarker = ({ mission }: { mission: Mission }) => {
mission: Mission,
anchor: "topleft" | "topright" | "bottomleft" | "bottomright",
) => {
console.log(
HPGValidationRequired(mission.missionStationIds, aircrafts, mission.hpgMissionString),
);
const markerColor = needsAction
? MISSION_STATUS_COLORS["attention"]
: MISSION_STATUS_COLORS[mission.state];

View File

@@ -21,6 +21,7 @@ import {
} from "lucide-react";
import {
getPublicUser,
HpgState,
HpgValidationState,
Mission,
MissionLog,
@@ -37,6 +38,7 @@ import { getStationsAPI } from "querys/stations";
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
import { HPGValidationRequired } from "helpers/hpgValidationRequired";
import { getOsmAddress } from "querys/osm";
import { hpgStateToFMSStatus } from "helpers/hpgStateToFmsStatus";
const Einsatzdetails = ({
mission,
@@ -161,10 +163,11 @@ const Einsatzdetails = ({
<Navigation size={16} /> {mission.addressStreet}
</p>
<p className="flex items-center gap-2">
<LocateFixed size={16} />
{mission.addressZip && mission.addressCity ? (
`${mission.addressZip} ${mission.addressCity}`
) : (
<span className="italic text-gray-400">PLZ Ort nicht angegeben</span>
<span className="italic text-gray-400">PLZ / Ort nicht angegeben</span>
)}
</p>
</div>
@@ -366,8 +369,15 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
const sendAlertMutation = useMutation({
mutationKey: ["missions"],
mutationFn: ({ id, stationId }: { id: number; stationId?: number }) =>
sendMissionAPI(id, { stationId }),
mutationFn: ({
id,
stationId,
vehicleName,
}: {
id: number;
stationId?: number;
vehicleName?: "ambulance" | "police" | "firebrigade";
}) => sendMissionAPI(id, { stationId, vehicleName }),
onError: (error) => {
console.error(error);
toast.error("Fehler beim Alarmieren");
@@ -379,6 +389,25 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
const dispatcherConnected = useDispatchConnectionStore((s) => s.status) === "connected";
const HPGVehicle = ({ state, name }: { state: HpgState; name: string }) => (
<li className="flex items-center gap-2">
<span
className="font-bold text-base"
style={{
color: FMS_STATUS_TEXT_COLORS[hpgStateToFMSStatus(state)],
}}
>
{hpgStateToFMSStatus(state)}
</span>
<span className="text-base-content">
<div>
<span className="font-bold">{name}</span>
</div>
</span>
</li>
);
return (
<div className="p-4 text-base-content">
<div className="flex items-center w-full justify-between mb-2">
@@ -435,6 +464,11 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
</li>
);
})}
{mission.hpgAmbulanceState && <HPGVehicle state={mission.hpgAmbulanceState} name="RTW" />}
{mission.hpgFireEngineState && (
<HPGVehicle state={mission.hpgFireEngineState} name="Feuerwehr" />
)}
{mission.hpgPoliceState && <HPGVehicle state={mission.hpgPoliceState} name="Polizei" />}
</ul>
{dispatcherConnected && (
<div>
@@ -475,7 +509,10 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
className="btn btn-sm btn-primary btn-outline"
onClick={async () => {
if (typeof selectedStation === "string") {
toast.error("Fahrzeuge werden aktuell nicht unterstützt");
await sendAlertMutation.mutate({
id: mission.id,
vehicleName: selectedStation,
});
} else {
if (!selectedStation?.id) return;
await updateMissionMutation.mutateAsync({
@@ -520,7 +557,6 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
queryClient.invalidateQueries({ queryKey: ["missions"] });
},
});
console.log(mission.missionLog);
if (!session.data?.user) return null;
return (