V_VERLETZUNG umbenannt, Multi-select gefixed

This commit is contained in:
PxlLoewe
2025-07-04 20:29:46 -07:00
parent 432c3cbfa4
commit 075d34a01c
6 changed files with 99 additions and 54 deletions

View File

@@ -127,8 +127,10 @@ export function StationsSelect<T extends FieldValues>({
placeholder={
isMulti ? "Wähle ein oder mehrere Rettungsmittel aus" : "Wähle ein Rettungsmittel aus"
}
formatOptionLabel={(option: any) => option.component}
options={stationsOptions.map((s) => ({
label: (
label: s.label,
component: (
<div
className={cn(s.type === "vehicle" && isMulti && "tooltip tooltip-right")}
data-tip={

View File

@@ -15,6 +15,7 @@ const customStyles: StylesConfig<any, false> = {
"&:hover": {
borderColor: "color-mix(in oklab, var(--color-base-content) 20%, #0000);",
},
color: "var(--color-primary-content)",
}),
option: (provided, state) => ({
...provided,
@@ -34,12 +35,24 @@ const customStyles: StylesConfig<any, false> = {
...provided,
backgroundColor: "var(--color-base-300)",
}),
input: (provided) => ({
...provided,
color: "var(--color-primary-content)",
}),
menu: (provided) => ({
...provided,
backgroundColor: "var(--color-base-100)",
borderRadius: "0.5rem",
zIndex: 9999,
}),
menuPortal: (provided) => ({
...provided,
maxHeight: "230px",
}),
menuList: (provided) => ({
...provided,
maxHeight: "230px",
}),
};
interface SelectProps extends Omit<SelectTemplateProps, "form" | "value" | "onChange"> {

View File

@@ -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} />

View File

@@ -588,34 +588,8 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
return () => clearInterval(interval);
});
const addMessage = () => {
if (!session.data?.user) return null;
return (
<div className="p-4">
{dispatcherConnected && (
<div>
<div className="flex items-center gap-2">
{!isAddingNote ? (
<button
className="text-base-content text-base cursor-pointer"
onClick={() => setIsAddingNote(true)}
>
<span className="flex items-center gap-2">
<Plus size={18} /> Notiz hinzufügen
</span>
</button>
) : (
<div className="flex items-center gap-2 w-full">
<input
type="text"
placeholder=""
className="input input-sm text-base-content flex-1"
value={note}
onChange={(e) => setNote(e.target.value)}
ref={textInputRef}
/>
<button
className="btn btn-sm btn-primary btn-outline"
onClick={() => {
const newMissionLog = [
...mission.missionLog,
{
@@ -640,8 +614,38 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
setIsAddingNote(false);
setNote("");
});
}}
};
return (
<div className="p-4">
{dispatcherConnected && (
<div>
<div className="flex items-center gap-2">
{!isAddingNote ? (
<button
className="text-base-content text-base cursor-pointer"
onClick={() => setIsAddingNote(true)}
>
<span className="flex items-center gap-2">
<Plus size={18} /> Notiz hinzufügen
</span>
</button>
) : (
<div className="flex items-center gap-2 w-full">
<input
type="text"
placeholder=""
className="input input-sm text-base-content flex-1"
value={note}
onChange={(e) => setNote(e.target.value)}
ref={textInputRef}
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

View File

@@ -6,7 +6,7 @@ enum KEYWORD_CATEGORY {
K_KIND
M_BERGRETTUNG
P_PSYCHIATRISCH
V_VERLETZUNG
V_VERLEGUNG
W_WASSERRETTUNG
Z_SONSTIGES
}

View File

@@ -0,0 +1,17 @@
/*
Warnings:
- The values [V_VERLETZUNG] on the enum `KEYWORD_CATEGORY` will be removed. If these variants are still used in the database, this will fail.
*/
DELETE FROM "Keyword" WHERE "category" = 'V_VERLETZUNG';
-- AlterEnum
BEGIN;
CREATE TYPE "KEYWORD_CATEGORY_new" AS ENUM ('AB_ATMUNG', 'C_KREISLAUF', 'D_NEUROLOGISCH', 'E_TRAUMA_SONSTIGES', 'K_KIND', 'M_BERGRETTUNG', 'P_PSYCHIATRISCH', 'V_VERLEGUNG', 'W_WASSERRETTUNG', 'Z_SONSTIGES');
ALTER TABLE "Keyword" ALTER COLUMN "category" TYPE "KEYWORD_CATEGORY_new" USING ("category"::text::"KEYWORD_CATEGORY_new");
ALTER TYPE "KEYWORD_CATEGORY" RENAME TO "KEYWORD_CATEGORY_old";
ALTER TYPE "KEYWORD_CATEGORY_new" RENAME TO "KEYWORD_CATEGORY";
DROP TYPE "KEYWORD_CATEGORY_old";
COMMIT;