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="sekundär">SEKUNDÄR</option>
|
||||
</select>
|
||||
|
||||
{form.watch("type") === "primär" && (
|
||||
<>
|
||||
<select
|
||||
@@ -321,6 +322,8 @@ export const MissionForm = () => {
|
||||
{form.formState.errors.missionKeywordCategory && (
|
||||
<p className="text-error text-sm mb-4">Bitte wähle eine Kategorie aus.</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<select
|
||||
{...form.register("missionKeywordAbbreviation")}
|
||||
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>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<textarea
|
||||
{...form.register("missionAdditionalInfo")}
|
||||
placeholder="Einsatzinformationen"
|
||||
|
||||
@@ -5,10 +5,12 @@ import { useEffect, useRef, useState } from "react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { getStationsAPI } from "_querys/stations";
|
||||
import toast from "react-hot-toast";
|
||||
import { editConnectedAircraftAPI } from "_querys/aircrafts";
|
||||
import { editConnectedAircraftAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { Prisma } from "@repo/db";
|
||||
import { debug } from "console";
|
||||
import { getNextDateWithTime } from "@repo/shared-components";
|
||||
import { Select } from "_components/Select";
|
||||
import { components } from "react-select";
|
||||
import { Radio } from "lucide-react";
|
||||
|
||||
export const ConnectionBtn = () => {
|
||||
const modalRef = useRef<HTMLDialogElement>(null);
|
||||
@@ -56,6 +58,11 @@ export const ConnectionBtn = () => {
|
||||
|
||||
const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || [];
|
||||
|
||||
const { data: connectedAircrafts } = useQuery({
|
||||
queryKey: ["aircrafts"],
|
||||
queryFn: () => getConnectedAircraftsAPI(),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
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>
|
||||
)}
|
||||
{connection.status !== "connected" && (
|
||||
<fieldset className="fieldset w-full">
|
||||
<label className="floating-label w-full text-base">
|
||||
<span>Station</span>
|
||||
<select
|
||||
onChange={(e) =>
|
||||
<div className="w-full">
|
||||
<Select
|
||||
placeholder="Wähle eine Station"
|
||||
onChange={(v) =>
|
||||
setForm({
|
||||
...form,
|
||||
selectedStationId: parseInt(e.target.value),
|
||||
selectedStationId: parseInt(v),
|
||||
})
|
||||
}
|
||||
value={form.selectedStationId ?? ""}
|
||||
className="input w-full"
|
||||
>
|
||||
{stations?.map((station) => (
|
||||
<option key={station.id} value={station.id}>
|
||||
formatOptionLabel={(option: any) => option.component}
|
||||
options={
|
||||
stations?.map((station) => ({
|
||||
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}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</fieldset>
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
})) ?? []
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<fieldset className="fieldset w-full mt-2">
|
||||
<label className="floating-label w-full text-base">
|
||||
|
||||
@@ -223,6 +223,7 @@ const AircraftMarker = ({ aircraft }: { aircraft: ConnectedAircraft & { Station:
|
||||
id: aircraft.id,
|
||||
}),
|
||||
refetchInterval: 10000,
|
||||
enabled: openAircraftMarker.some((m) => m.id === aircraft.id),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
CheckCheck,
|
||||
Cross,
|
||||
Radio,
|
||||
Route,
|
||||
} from "lucide-react";
|
||||
import {
|
||||
getPublicUser,
|
||||
@@ -190,6 +191,16 @@ const Einsatzdetails = ({
|
||||
)}
|
||||
</p>
|
||||
</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" && (
|
||||
<div>
|
||||
<div className="divider mt-0 mb-0" />
|
||||
|
||||
@@ -16,6 +16,7 @@ export const getOsmAddress = async (lat: number, lng: number) => {
|
||||
road?: string;
|
||||
state?: string;
|
||||
city?: string;
|
||||
village?: string;
|
||||
town?: string;
|
||||
};
|
||||
display_name?: string;
|
||||
@@ -43,7 +44,7 @@ export const getOsmAddress = async (lat: number, lng: number) => {
|
||||
return {
|
||||
raw: data,
|
||||
parsed: {
|
||||
addressCity: data.address?.city || data.address?.town || "",
|
||||
addressCity: data.address?.city || data.address?.town || data.address?.village || "",
|
||||
addressStreet,
|
||||
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
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
timestamp: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(positionLog, {
|
||||
|
||||
@@ -177,9 +177,13 @@ export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormPro
|
||||
type="button"
|
||||
className="btn btn-sm btn-outline"
|
||||
onClick={() =>
|
||||
form.setValue("permissions", ["LOGIN_NEXTCLOUD", "PILOT", "DISPO", "AUDIO"], {
|
||||
form.setValue(
|
||||
"permissions",
|
||||
["LOGIN_NEXTCLOUD", "PILOT", "DISPO", "AUDIO", "ADMIN_EVENT"],
|
||||
{
|
||||
shouldDirty: true,
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
onSubmit={() => false}
|
||||
>
|
||||
|
||||
@@ -112,6 +112,7 @@ export function PaginatedTable<TData>({
|
||||
onChange={(e) => {
|
||||
setSearchTerm(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"
|
||||
/>
|
||||
|
||||
@@ -17,16 +17,33 @@ export const PenaltyDropdown = ({
|
||||
btnTip?: string;
|
||||
Icon: ReactNode;
|
||||
}) => {
|
||||
const [open, setOpen] = useState(true);
|
||||
const [reason, setReason] = useState("");
|
||||
const [until, setUntil] = useState<string>("default");
|
||||
return (
|
||||
<details className="dropdown dropdown-left dropdown-center">
|
||||
<summary className={cn("btn btn-xs btn-square btn-soft", btnClassName)}>{Icon}</summary>
|
||||
<div className="dropdown dropdown-open">
|
||||
<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
|
||||
className="dropdown-content bg-base-100 rounded-box z-1 p-4 shadow-sm space-y-4 shadow-md"
|
||||
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
|
||||
value={reason}
|
||||
onChange={(e) => setReason(e.target.value)}
|
||||
@@ -107,6 +124,15 @@ export const PenaltyDropdown = ({
|
||||
{Icon} {btnName}
|
||||
</button>
|
||||
</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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user