Edit draft mission update, nachalarmieren

This commit is contained in:
Nicolas
2025-04-28 10:19:51 +02:00
parent 64fcab59af
commit c00b64d666
4 changed files with 38 additions and 14 deletions

View File

@@ -17,7 +17,6 @@ import {
Cross, Cross,
House, House,
Minimize2, Minimize2,
Route,
SmartphoneNfc, SmartphoneNfc,
PencilLine, PencilLine,
} from "lucide-react"; } from "lucide-react";
@@ -33,12 +32,13 @@ import Einsatzdetails, {
Rettungsmittel, Rettungsmittel,
} from "./_components/MissionMarkerTabs"; } from "./_components/MissionMarkerTabs";
export const MISSION_STATUS_COLORS: Record<MissionState, string> = { export const MISSION_STATUS_COLORS: Record<MissionState | "attention", string> =
draft: "#0092b8", {
running: "#155dfc", draft: "#0092b8",
finished: "#155dfc", running: "#155dfc",
attention: "rgb(186,105,0)", finished: "#155dfc",
}; attention: "rgb(186,105,0)",
};
export const MISSION_STATUS_TEXT_COLORS: Record<MissionState, string> = { export const MISSION_STATUS_TEXT_COLORS: Record<MissionState, string> = {
draft: "#00d3f2", draft: "#00d3f2",
@@ -183,8 +183,10 @@ const MissionPopupContent = ({ mission }: { mission: Mission }) => {
setMissionFormValues({ setMissionFormValues({
...mission, ...mission,
state: "draft", state: "draft",
hpgLocationLat: mission.hpgLocationLat ?? undefined,
hpgLocationLng: mission.hpgLocationLng ?? undefined,
}); });
setEditingMission(true, mission.id); setEditingMission(true, String(mission.id));
setOpen(true); setOpen(true);
}} }}
> >

View File

@@ -1,6 +1,9 @@
"use client"; "use client";
import React, { useState } from "react"; import React, { useState } from "react";
import { FMS_STATUS_TEXT_COLORS } from "../AircraftMarker"; import { FMS_STATUS_TEXT_COLORS } from "../AircraftMarker";
/* import { Select } from "_components/Select";
import { Station } from "@repo/db";
import { getStations } from "dispatch/_components/pannel/action"; */
import { import {
Ban, Ban,
BellRing, BellRing,
@@ -114,7 +117,13 @@ const Patientdetails = ({ mission }: { mission: Mission }) => {
); );
}; };
const Rettungsmittel = () => { const Rettungsmittel = ({ mission }: { mission: Mission }) => {
/* const [stations, setStations] = useState<Station[]>([]);
useEffect(() => {
getStations().then((data) => {
setStations(data);
});
}, []); */
// Mockup data // Mockup data
const mockupData = [ const mockupData = [
{ bosCallsign: "Christoph 31", FMSstatus: 2, min: 6 }, { bosCallsign: "Christoph 31", FMSstatus: 2, min: 6 },
@@ -150,6 +159,20 @@ const Rettungsmittel = () => {
</li> </li>
))} ))}
</ul> </ul>
<div className="divider mt-0 mb-0" />
<div className="flex items-center gap-2">
{/* TODO: make it a small multiselect */}
<select className="select select-sm select-primary select-bordered flex-1">
<option value="1">Feuerwehr</option>
<option value="2">RTW</option>
<option value="3">Polizei</option>
</select>
<button className="btn btn-sm btn-primary btn-outline">
<span className="text-base-content flex items-center gap-2">
<BellRing size={16} /> Nachalarmieren
</span>
</button>
</div>
</div> </div>
); );
}; };
@@ -255,8 +278,8 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
color: FMS_STATUS_TEXT_COLORS[6], color: FMS_STATUS_TEXT_COLORS[6],
}} }}
> >
{entry.data.user.firstname[0].toUpperCase()} {entry.data.user.firstname?.[0]?.toUpperCase() ?? "?"}
{entry.data.user.lastname[0].toUpperCase()} {entry.data.user.lastname?.[0]?.toUpperCase() ?? "?"}
</span> </span>
<span className="text-base-content">{entry.data.message}</span> <span className="text-base-content">{entry.data.message}</span>
</li> </li>

View File

@@ -300,7 +300,7 @@ export const MissionForm = () => {
onClick={form.handleSubmit( onClick={form.handleSubmit(
async (mission: MissionOptionalDefaults) => { async (mission: MissionOptionalDefaults) => {
try { try {
deleteMission(editingMissionId); deleteMission(Number(editingMissionId));
const newMission = await createMission(mission); const newMission = await createMission(mission);
toast.success( toast.success(
`Einsatz ${newMission.id} erfolgreich aktualisiert`, `Einsatz ${newMission.id} erfolgreich aktualisiert`,

View File

@@ -5,8 +5,7 @@ import { Rss, Trash2Icon } from "lucide-react";
export const Pannel = () => { export const Pannel = () => {
const { setOpen, setMissionFormValues } = usePannelStore(); const { setOpen, setMissionFormValues } = usePannelStore();
const { isEditingMission, editingMissionId, setEditingMission } = const { isEditingMission, setEditingMission } = usePannelStore();
usePannelStore();
return ( return (
<div className={cn("flex-1 max-w-[600px] z-9999999")}> <div className={cn("flex-1 max-w-[600px] z-9999999")}>