added logbook
This commit is contained in:
@@ -24,6 +24,8 @@ import {
|
||||
HpgState,
|
||||
HpgValidationState,
|
||||
Mission,
|
||||
MissionAlertLog,
|
||||
MissionCompletedLog,
|
||||
MissionLog,
|
||||
MissionMessageLog,
|
||||
Prisma,
|
||||
@@ -47,6 +49,7 @@ const Einsatzdetails = ({
|
||||
mission: Mission;
|
||||
hpgNeedsAttention?: boolean;
|
||||
}) => {
|
||||
const session = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const deleteMissionMutation = useMutation({
|
||||
mutationKey: ["missions"],
|
||||
@@ -127,10 +130,21 @@ const Einsatzdetails = ({
|
||||
<button
|
||||
className="btn btn-xs btn-warning flex items-center gap-2"
|
||||
onClick={() => {
|
||||
if (!session.data) return;
|
||||
editMissionMutation.mutate({
|
||||
id: mission.id,
|
||||
mission: {
|
||||
state: "finished",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "completed-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
user: getPublicUser(session.data?.user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
}}
|
||||
@@ -593,7 +607,7 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
message: note,
|
||||
user: getPublicUser(session.data?.user),
|
||||
user: getPublicUser(session.data?.user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as MissionMessageLog,
|
||||
];
|
||||
@@ -694,7 +708,49 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
<span className="text-base-content">{entry.data.message}</span>
|
||||
</li>
|
||||
);
|
||||
if (entry.type === "alert-log") {
|
||||
const alertReceiver = entry.data.station?.bosCallsignShort || entry.data.vehicle;
|
||||
return (
|
||||
<li key={index} className="flex items-center gap-2">
|
||||
<span className="text-base-content">
|
||||
{new Date(entry.timeStamp).toLocaleTimeString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})}
|
||||
</span>
|
||||
<span
|
||||
className="font-bold text-base flex items-center gap-0.5"
|
||||
style={{
|
||||
color: FMS_STATUS_TEXT_COLORS[6],
|
||||
}}
|
||||
>
|
||||
{entry.data.user.firstname?.[0]?.toUpperCase() ?? "?"}
|
||||
{entry.data.user.lastname?.[0]?.toUpperCase() ?? "?"}
|
||||
{alertReceiver && (
|
||||
<>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
strokeWidth="2"
|
||||
stroke="currentColor"
|
||||
className="size-4"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
{alertReceiver}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
<span className="text-base-content">Einsatz alarmiert</span>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user