V_VERLETZUNG umbenannt, Multi-select gefixed
This commit is contained in:
@@ -385,6 +385,31 @@ const SDSTab = ({
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
|
||||
const sendSds = () => {
|
||||
sendSdsMutation
|
||||
.mutateAsync({
|
||||
missionId: mission?.id,
|
||||
sdsMessage: {
|
||||
type: "sds-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
stationId: aircraft.Station.id,
|
||||
station: aircraft.Station,
|
||||
message: note,
|
||||
user: getPublicUser(session.data!.user, {
|
||||
ignorePrivacy: true,
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
toast.success("SDS-Nachricht gesendet");
|
||||
setIsChatOpen(false);
|
||||
setNote("");
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
{dispatcherConnected && (
|
||||
@@ -409,32 +434,16 @@ const SDSTab = ({
|
||||
value={note}
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
ref={textInputRef}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && note.trim()) {
|
||||
sendSds();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-sm btn-primary btn-outline"
|
||||
onClick={() => {
|
||||
sendSdsMutation
|
||||
.mutateAsync({
|
||||
missionId: mission?.id,
|
||||
sdsMessage: {
|
||||
type: "sds-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
stationId: aircraft.Station.id,
|
||||
station: aircraft.Station,
|
||||
message: note,
|
||||
user: getPublicUser(session.data!.user, {
|
||||
ignorePrivacy: true,
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
toast.success("SDS-Nachricht gesendet");
|
||||
setIsChatOpen(false);
|
||||
setNote("");
|
||||
});
|
||||
sendSds();
|
||||
}}
|
||||
>
|
||||
<Plus size={20} />
|
||||
|
||||
@@ -588,7 +588,34 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
|
||||
if (!session.data?.user) return null;
|
||||
const addMessage = () => {
|
||||
if (!session.data?.user) return null;
|
||||
const newMissionLog = [
|
||||
...mission.missionLog,
|
||||
{
|
||||
type: "message-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
message: note,
|
||||
user: getPublicUser(session.data?.user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as MissionMessageLog,
|
||||
];
|
||||
editMissionMutation
|
||||
.mutateAsync({
|
||||
id: mission.id,
|
||||
mission: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
missionLog: newMissionLog as any,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
setIsAddingNote(false);
|
||||
setNote("");
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
{dispatcherConnected && (
|
||||
@@ -612,36 +639,13 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
||||
value={note}
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
ref={textInputRef}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-sm btn-primary btn-outline"
|
||||
onClick={() => {
|
||||
const newMissionLog = [
|
||||
...mission.missionLog,
|
||||
{
|
||||
type: "message-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
message: note,
|
||||
user: getPublicUser(session.data?.user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as MissionMessageLog,
|
||||
];
|
||||
editMissionMutation
|
||||
.mutateAsync({
|
||||
id: mission.id,
|
||||
mission: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
missionLog: newMissionLog as any,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
setIsAddingNote(false);
|
||||
setNote("");
|
||||
});
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && note.trim()) {
|
||||
addMessage();
|
||||
}
|
||||
}}
|
||||
>
|
||||
/>
|
||||
<button className="btn btn-sm btn-primary btn-outline" onClick={() => addMessage()}>
|
||||
<Plus size={20} />
|
||||
</button>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user