fixed extimatedLoggoff time
This commit is contained in:
@@ -31,9 +31,9 @@ export const ConnectionBtn = () => {
|
||||
|
||||
if (!uid) return null;
|
||||
return (
|
||||
<div className="rounded-box bg-base-200 flex justify-center items-center gap-2 p-1">
|
||||
<div className="rounded-box bg-base-200 flex items-center justify-center gap-2 p-1">
|
||||
{connection.message.length > 0 && (
|
||||
<span className="mx-2 text-error">{connection.message}</span>
|
||||
<span className="text-error mx-2">{connection.message}</span>
|
||||
)}
|
||||
|
||||
{connection.status == "connected" ? (
|
||||
@@ -63,11 +63,11 @@ export const ConnectionBtn = () => {
|
||||
<dialog ref={modalRef} className="modal">
|
||||
<div className="modal-box flex flex-col items-center justify-center">
|
||||
{connection.status == "connected" ? (
|
||||
<h3 className="text-lg font-bold mb-5">
|
||||
<h3 className="mb-5 text-lg font-bold">
|
||||
Verbunden als <span className="text-info"><{connection.selectedZone}></span>
|
||||
</h3>
|
||||
) : (
|
||||
<h3 className="text-lg font-bold mb-5">Als Disponent anmelden</h3>
|
||||
<h3 className="mb-5 text-lg font-bold">Als Disponent anmelden</h3>
|
||||
)}
|
||||
<fieldset className="fieldset w-full">
|
||||
<label className="floating-label w-full text-base">
|
||||
@@ -89,8 +89,8 @@ export const ConnectionBtn = () => {
|
||||
<p className="fieldset-label">Du kannst diese Zeit später noch anpassen.</p>
|
||||
)}
|
||||
</fieldset>
|
||||
<div className="modal-action flex justify-between w-full">
|
||||
<form method="dialog" className="w-full flex justify-between">
|
||||
<div className="modal-action flex w-full justify-between">
|
||||
<form method="dialog" className="flex w-full justify-between">
|
||||
<button className="btn btn-soft">Zurück</button>
|
||||
{connection.status == "connected" ? (
|
||||
<>
|
||||
@@ -130,7 +130,15 @@ export const ConnectionBtn = () => {
|
||||
type="submit"
|
||||
onSubmit={() => false}
|
||||
onClick={() => {
|
||||
connection.connect(uid, form.selectedZone, form.logoffTime);
|
||||
const [logoffHours, logoffMinutes] =
|
||||
form.logoffTime?.split(":").map(Number) || [];
|
||||
connection.connect(
|
||||
uid,
|
||||
form.selectedZone,
|
||||
form.logoffTime && logoffHours !== undefined && logoffMinutes !== undefined
|
||||
? getNextDateWithTime(logoffHours, logoffMinutes).toISOString()
|
||||
: "",
|
||||
);
|
||||
}}
|
||||
className="btn btn-soft btn-info"
|
||||
>
|
||||
|
||||
@@ -63,9 +63,9 @@ export const ConnectionBtn = () => {
|
||||
const uid = session.data?.user?.id;
|
||||
if (!uid) return null;
|
||||
return (
|
||||
<div className="rounded-box bg-base-200 flex justify-center items-center gap-2 p-1">
|
||||
<div className="rounded-box bg-base-200 flex items-center justify-center gap-2 p-1">
|
||||
{connection.message.length > 0 && (
|
||||
<span className="mx-2 text-error">{connection.message}</span>
|
||||
<span className="text-error mx-2">{connection.message}</span>
|
||||
)}
|
||||
|
||||
{connection.status == "connected" ? (
|
||||
@@ -95,12 +95,12 @@ export const ConnectionBtn = () => {
|
||||
<dialog ref={modalRef} className="modal">
|
||||
<div className="modal-box flex flex-col items-center justify-center">
|
||||
{connection.status == "connected" ? (
|
||||
<h3 className="text-lg font-bold mb-5">
|
||||
<h3 className="mb-5 text-lg font-bold">
|
||||
Verbunden als{" "}
|
||||
<span className="text-info"><{connection.selectedStation?.bosCallsign}></span>
|
||||
</h3>
|
||||
) : (
|
||||
<h3 className="text-lg font-bold mb-5">Als Pilot anmelden</h3>
|
||||
<h3 className="mb-5 text-lg font-bold">Als Pilot anmelden</h3>
|
||||
)}
|
||||
{connection.status !== "connected" && (
|
||||
<div className="w-full">
|
||||
@@ -135,7 +135,7 @@ export const ConnectionBtn = () => {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<fieldset className="fieldset w-full mt-2">
|
||||
<fieldset className="fieldset mt-2 w-full">
|
||||
<label className="floating-label w-full text-base">
|
||||
<span>Logoff Zeit (LCL)</span>
|
||||
<input
|
||||
@@ -171,8 +171,8 @@ export const ConnectionBtn = () => {
|
||||
</label>
|
||||
</fieldset>
|
||||
)}
|
||||
<div className="modal-action flex justify-between w-full">
|
||||
<form method="dialog" className="w-full flex justify-between">
|
||||
<div className="modal-action flex w-full justify-between">
|
||||
<form method="dialog" className="flex w-full justify-between">
|
||||
<button className="btn btn-soft">Zurück</button>
|
||||
{connection.status == "connected" ? (
|
||||
<>
|
||||
@@ -220,10 +220,15 @@ export const ConnectionBtn = () => {
|
||||
station.id === parseInt(form.selectedStationId?.toString() || ""),
|
||||
);
|
||||
if (selectedStation) {
|
||||
const [logoffHours, logoffMinutes] =
|
||||
form.logoffTime?.split(":").map(Number) || [];
|
||||
|
||||
await connection.connect(
|
||||
uid,
|
||||
form.selectedStationId?.toString() || "",
|
||||
form.logoffTime || "",
|
||||
form.logoffTime && logoffHours !== undefined && logoffMinutes !== undefined
|
||||
? getNextDateWithTime(logoffHours, logoffMinutes).toISOString()
|
||||
: "",
|
||||
selectedStation,
|
||||
session.data!.user,
|
||||
form.debugPosition,
|
||||
|
||||
Reference in New Issue
Block a user