some Fixes, see #45
This commit is contained in:
@@ -296,6 +296,7 @@ export const MissionForm = () => {
|
|||||||
<option value="primär">PRIMÄR</option>
|
<option value="primär">PRIMÄR</option>
|
||||||
<option value="sekundär">SEKUNDÄR</option>
|
<option value="sekundär">SEKUNDÄR</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
{form.watch("type") === "primär" && (
|
{form.watch("type") === "primär" && (
|
||||||
<>
|
<>
|
||||||
<select
|
<select
|
||||||
@@ -321,6 +322,8 @@ export const MissionForm = () => {
|
|||||||
{form.formState.errors.missionKeywordCategory && (
|
{form.formState.errors.missionKeywordCategory && (
|
||||||
<p className="text-error text-sm mb-4">Bitte wähle eine Kategorie aus.</p>
|
<p className="text-error text-sm mb-4">Bitte wähle eine Kategorie aus.</p>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<select
|
<select
|
||||||
{...form.register("missionKeywordAbbreviation")}
|
{...form.register("missionKeywordAbbreviation")}
|
||||||
className="select select-primary select-bordered w-full mb-4"
|
className="select select-primary select-bordered w-full mb-4"
|
||||||
@@ -387,8 +390,7 @@ export const MissionForm = () => {
|
|||||||
<p className="text-sm text-warning">Szenario wird vor Alarmierung HPG-Validiert.</p>
|
<p className="text-sm text-warning">Szenario wird vor Alarmierung HPG-Validiert.</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<textarea
|
<textarea
|
||||||
{...form.register("missionAdditionalInfo")}
|
{...form.register("missionAdditionalInfo")}
|
||||||
placeholder="Einsatzinformationen"
|
placeholder="Einsatzinformationen"
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ import { useEffect, useRef, useState } from "react";
|
|||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { getStationsAPI } from "_querys/stations";
|
import { getStationsAPI } from "_querys/stations";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { editConnectedAircraftAPI } from "_querys/aircrafts";
|
import { editConnectedAircraftAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||||
import { Prisma } from "@repo/db";
|
import { Prisma } from "@repo/db";
|
||||||
import { debug } from "console";
|
|
||||||
import { getNextDateWithTime } from "@repo/shared-components";
|
import { getNextDateWithTime } from "@repo/shared-components";
|
||||||
|
import { Select } from "_components/Select";
|
||||||
|
import { components } from "react-select";
|
||||||
|
import { Radio } from "lucide-react";
|
||||||
|
|
||||||
export const ConnectionBtn = () => {
|
export const ConnectionBtn = () => {
|
||||||
const modalRef = useRef<HTMLDialogElement>(null);
|
const modalRef = useRef<HTMLDialogElement>(null);
|
||||||
@@ -56,6 +58,11 @@ export const ConnectionBtn = () => {
|
|||||||
|
|
||||||
const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || [];
|
const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || [];
|
||||||
|
|
||||||
|
const { data: connectedAircrafts } = useQuery({
|
||||||
|
queryKey: ["aircrafts"],
|
||||||
|
queryFn: () => getConnectedAircraftsAPI(),
|
||||||
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!logoffHours || !logoffMinutes || !connection.connectedAircraft) return;
|
if (!logoffHours || !logoffMinutes || !connection.connectedAircraft) return;
|
||||||
|
|
||||||
@@ -126,27 +133,35 @@ export const ConnectionBtn = () => {
|
|||||||
<h3 className="text-lg font-bold mb-5">Als Pilot anmelden</h3>
|
<h3 className="text-lg font-bold mb-5">Als Pilot anmelden</h3>
|
||||||
)}
|
)}
|
||||||
{connection.status !== "connected" && (
|
{connection.status !== "connected" && (
|
||||||
<fieldset className="fieldset w-full">
|
<div className="w-full">
|
||||||
<label className="floating-label w-full text-base">
|
<Select
|
||||||
<span>Station</span>
|
placeholder="Wähle eine Station"
|
||||||
<select
|
onChange={(v) =>
|
||||||
onChange={(e) =>
|
|
||||||
setForm({
|
setForm({
|
||||||
...form,
|
...form,
|
||||||
selectedStationId: parseInt(e.target.value),
|
selectedStationId: parseInt(v),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
value={form.selectedStationId ?? ""}
|
value={form.selectedStationId ?? ""}
|
||||||
className="input w-full"
|
formatOptionLabel={(option: any) => option.component}
|
||||||
>
|
options={
|
||||||
{stations?.map((station) => (
|
stations?.map((station) => ({
|
||||||
<option key={station.id} value={station.id}>
|
value: station.id.toString(),
|
||||||
|
label: station.bosCallsign,
|
||||||
|
component: (
|
||||||
|
<div>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
{connectedAircrafts?.find((a) => a.stationId == station.id) && (
|
||||||
|
<Radio className="text-warning" size={15} />
|
||||||
|
)}
|
||||||
{station.bosCallsign}
|
{station.bosCallsign}
|
||||||
</option>
|
</span>
|
||||||
))}
|
</div>
|
||||||
</select>
|
),
|
||||||
</label>
|
})) ?? []
|
||||||
</fieldset>
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
<fieldset className="fieldset w-full mt-2">
|
<fieldset className="fieldset w-full mt-2">
|
||||||
<label className="floating-label w-full text-base">
|
<label className="floating-label w-full text-base">
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ const AircraftMarker = ({ aircraft }: { aircraft: ConnectedAircraft & { Station:
|
|||||||
id: aircraft.id,
|
id: aircraft.id,
|
||||||
}),
|
}),
|
||||||
refetchInterval: 10000,
|
refetchInterval: 10000,
|
||||||
|
enabled: openAircraftMarker.some((m) => m.id === aircraft.id),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
CheckCheck,
|
CheckCheck,
|
||||||
Cross,
|
Cross,
|
||||||
Radio,
|
Radio,
|
||||||
|
Route,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
getPublicUser,
|
getPublicUser,
|
||||||
@@ -190,6 +191,16 @@ const Einsatzdetails = ({
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{mission.type == "sekundär" && (
|
||||||
|
<>
|
||||||
|
<div className="divider mt-0 mb-0" />
|
||||||
|
<div className="text-sm font-semibold">
|
||||||
|
<p className="flex items-center gap-2">
|
||||||
|
<Route size={16} /> {mission.addressMissionDestination}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{mission.state === "draft" && (
|
{mission.state === "draft" && (
|
||||||
<div>
|
<div>
|
||||||
<div className="divider mt-0 mb-0" />
|
<div className="divider mt-0 mb-0" />
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export const getOsmAddress = async (lat: number, lng: number) => {
|
|||||||
road?: string;
|
road?: string;
|
||||||
state?: string;
|
state?: string;
|
||||||
city?: string;
|
city?: string;
|
||||||
|
village?: string;
|
||||||
town?: string;
|
town?: string;
|
||||||
};
|
};
|
||||||
display_name?: string;
|
display_name?: string;
|
||||||
@@ -43,7 +44,7 @@ export const getOsmAddress = async (lat: number, lng: number) => {
|
|||||||
return {
|
return {
|
||||||
raw: data,
|
raw: data,
|
||||||
parsed: {
|
parsed: {
|
||||||
addressCity: data.address?.city || data.address?.town || "",
|
addressCity: data.address?.city || data.address?.town || data.address?.village || "",
|
||||||
addressStreet,
|
addressStreet,
|
||||||
addressZip: data.address?.postcode || "",
|
addressZip: data.address?.postcode || "",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ export async function GET(request: NextRequest): Promise<NextResponse> {
|
|||||||
gte: new Date(Date.now() - 2 * 60 * 60 * 1000), // Last 2 hours
|
gte: new Date(Date.now() - 2 * 60 * 60 * 1000), // Last 2 hours
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
orderBy: {
|
||||||
|
timestamp: "desc",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return NextResponse.json(positionLog, {
|
return NextResponse.json(positionLog, {
|
||||||
|
|||||||
@@ -177,9 +177,13 @@ export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormPro
|
|||||||
type="button"
|
type="button"
|
||||||
className="btn btn-sm btn-outline"
|
className="btn btn-sm btn-outline"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
form.setValue("permissions", ["LOGIN_NEXTCLOUD", "PILOT", "DISPO", "AUDIO"], {
|
form.setValue(
|
||||||
|
"permissions",
|
||||||
|
["LOGIN_NEXTCLOUD", "PILOT", "DISPO", "AUDIO", "ADMIN_EVENT"],
|
||||||
|
{
|
||||||
shouldDirty: true,
|
shouldDirty: true,
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
onSubmit={() => false}
|
onSubmit={() => false}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export function PaginatedTable<TData>({
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSearchTerm(e.target.value);
|
setSearchTerm(e.target.value);
|
||||||
handleSearchChange(e.target.value);
|
handleSearchChange(e.target.value);
|
||||||
|
setPage(0); // Reset to first page on search
|
||||||
}}
|
}}
|
||||||
className="input input-bordered w-full max-w-xs justify-end"
|
className="input input-bordered w-full max-w-xs justify-end"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -17,16 +17,33 @@ export const PenaltyDropdown = ({
|
|||||||
btnTip?: string;
|
btnTip?: string;
|
||||||
Icon: ReactNode;
|
Icon: ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
|
const [open, setOpen] = useState(true);
|
||||||
const [reason, setReason] = useState("");
|
const [reason, setReason] = useState("");
|
||||||
const [until, setUntil] = useState<string>("default");
|
const [until, setUntil] = useState<string>("default");
|
||||||
return (
|
return (
|
||||||
<details className="dropdown dropdown-left dropdown-center">
|
<div className="dropdown dropdown-open">
|
||||||
<summary className={cn("btn btn-xs btn-square btn-soft", btnClassName)}>{Icon}</summary>
|
<div tabIndex={0} role="button"></div>
|
||||||
|
<div className="indicator">
|
||||||
|
<button
|
||||||
|
className={cn("btn btn-xs btn-square btn-soft cursor-pointer", btnClassName)}
|
||||||
|
onClick={() => setOpen(!open)}
|
||||||
|
>
|
||||||
|
{Icon}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{open && (
|
||||||
<div
|
<div
|
||||||
className="dropdown-content bg-base-100 rounded-box z-1 p-4 shadow-sm space-y-4 shadow-md"
|
className="dropdown-content bg-base-100 rounded-box z-1 p-4 shadow-sm space-y-4 shadow-md"
|
||||||
style={{ minWidth: "500px", right: "40px" }}
|
style={{ minWidth: "500px", right: "40px" }}
|
||||||
>
|
>
|
||||||
<h2 className="text-xl font-blod text-center">{btnName}</h2>
|
<button
|
||||||
|
className="absolute top-2 right-2 btn btn-xs btn-circle btn-ghost"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span className="text-xl leading-none">×</span>
|
||||||
|
</button>
|
||||||
|
<h2 className="text-xl font-bold text-center">{btnName}</h2>
|
||||||
<textarea
|
<textarea
|
||||||
value={reason}
|
value={reason}
|
||||||
onChange={(e) => setReason(e.target.value)}
|
onChange={(e) => setReason(e.target.value)}
|
||||||
@@ -107,6 +124,15 @@ export const PenaltyDropdown = ({
|
|||||||
{Icon} {btnName}
|
{Icon} {btnName}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<details className={"dropdown dropdown-left dropdown-center dropdown-open"}>
|
||||||
|
<summary
|
||||||
|
className={cn("btn btn-xs btn-square btn-soft", btnClassName)}
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
></summary>
|
||||||
</details>
|
</details>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user