Formatting
This commit is contained in:
@@ -192,7 +192,8 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes batteryPulse {
|
@keyframes batteryPulse {
|
||||||
0%, 100% {
|
0%,
|
||||||
|
100% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
@@ -201,10 +202,12 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes batteryBlink {
|
@keyframes batteryBlink {
|
||||||
0%, 50% {
|
0%,
|
||||||
|
50% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
51%, 100% {
|
51%,
|
||||||
|
100% {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="index.css" />
|
<link rel="stylesheet" href="index.css" />
|
||||||
<link rel="icon" type="image/x-icon" href="/pictures/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="/pictures/favicon.ico" />
|
||||||
|
|
||||||
<title>NinjaCross Timer</title>
|
<title>NinjaCross Timer</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Batterie-Banner -->
|
<!-- Batterie-Banner -->
|
||||||
@@ -27,9 +26,17 @@
|
|||||||
<a href="/settings" class="settings-btn">⚙️</a>
|
<a href="/settings" class="settings-btn">⚙️</a>
|
||||||
|
|
||||||
<div class="heartbeat-indicators">
|
<div class="heartbeat-indicators">
|
||||||
<div class="heartbeat-indicator" id="heartbeat1" data-label="Start1"></div>
|
<div
|
||||||
|
class="heartbeat-indicator"
|
||||||
|
id="heartbeat1"
|
||||||
|
data-label="Start1"
|
||||||
|
></div>
|
||||||
<div class="heartbeat-indicator" id="heartbeat2" data-label="Stop1"></div>
|
<div class="heartbeat-indicator" id="heartbeat2" data-label="Stop1"></div>
|
||||||
<div class="heartbeat-indicator" id="heartbeat3" data-label="Start2"></div>
|
<div
|
||||||
|
class="heartbeat-indicator"
|
||||||
|
id="heartbeat3"
|
||||||
|
data-label="Start2"
|
||||||
|
></div>
|
||||||
<div class="heartbeat-indicator" id="heartbeat4" data-label="Stop2"></div>
|
<div class="heartbeat-indicator" id="heartbeat4" data-label="Stop2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -47,14 +54,14 @@
|
|||||||
|
|
||||||
<div class="timer-container">
|
<div class="timer-container">
|
||||||
<div class="lane">
|
<div class="lane">
|
||||||
<div id="name1" class="swimmer-name" style="display: none;"></div>
|
<div id="name1" class="swimmer-name" style="display: none"></div>
|
||||||
<h2>🏊♀️ Bahn 1</h2>
|
<h2>🏊♀️ Bahn 1</h2>
|
||||||
<div id="time1" class="time-display">00.00</div>
|
<div id="time1" class="time-display">00.00</div>
|
||||||
<div id="status1" class="status ready">Bereit</div>
|
<div id="status1" class="status ready">Bereit</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="lane">
|
<div class="lane">
|
||||||
<div id="name2" class="swimmer-name" style="display: none;"></div>
|
<div id="name2" class="swimmer-name" style="display: none"></div>
|
||||||
<h2>🏊♂️ Bahn 2</h2>
|
<h2>🏊♂️ Bahn 2</h2>
|
||||||
<div id="time2" class="time-display">00.00</div>
|
<div id="time2" class="time-display">00.00</div>
|
||||||
<div id="status2" class="status ready">Bereit</div>
|
<div id="status2" class="status ready">Bereit</div>
|
||||||
@@ -102,8 +109,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Set all heartbeats to red initially
|
// Set all heartbeats to red initially
|
||||||
["heartbeat1", "heartbeat2", "heartbeat3", "heartbeat4"].forEach(id => {
|
["heartbeat1", "heartbeat2", "heartbeat3", "heartbeat4"].forEach((id) => {
|
||||||
document.getElementById(id).classList.remove('active');
|
document.getElementById(id).classList.remove("active");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle WebSocket events
|
// Handle WebSocket events
|
||||||
@@ -136,15 +143,21 @@
|
|||||||
|
|
||||||
if (indicatorId) {
|
if (indicatorId) {
|
||||||
heartbeatTimeouts[data.button] = Date.now();
|
heartbeatTimeouts[data.button] = Date.now();
|
||||||
document.getElementById(indicatorId).classList.add('active');
|
document.getElementById(indicatorId).classList.add("active");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Namen-Handling
|
// Namen-Handling
|
||||||
if ((data.firstname == "" || data.lastname == "") && data.lane == "start1") {
|
if (
|
||||||
|
(data.firstname == "" || data.lastname == "") &&
|
||||||
|
data.lane == "start1"
|
||||||
|
) {
|
||||||
name1 = "";
|
name1 = "";
|
||||||
}
|
}
|
||||||
if ((data.firstname == "" || data.lastname == "") && data.lane == "start2") {
|
if (
|
||||||
|
(data.firstname == "" || data.lastname == "") &&
|
||||||
|
data.lane == "start2"
|
||||||
|
) {
|
||||||
name2 = "";
|
name2 = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +197,7 @@
|
|||||||
lowBatteryDevices.add({
|
lowBatteryDevices.add({
|
||||||
button: data.button,
|
button: data.button,
|
||||||
mac: data.mac,
|
mac: data.mac,
|
||||||
battery: batteryLevel
|
battery: batteryLevel,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +206,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Gerät aus niedrige Batterie Liste entfernen
|
// Gerät aus niedrige Batterie Liste entfernen
|
||||||
lowBatteryDevices.forEach(device => {
|
lowBatteryDevices.forEach((device) => {
|
||||||
if (device.button === data.button && device.mac === data.mac) {
|
if (device.button === data.button && device.mac === data.mac) {
|
||||||
lowBatteryDevices.delete(device);
|
lowBatteryDevices.delete(device);
|
||||||
}
|
}
|
||||||
@@ -217,11 +230,11 @@
|
|||||||
lowBatteryDevices.clear();
|
lowBatteryDevices.clear();
|
||||||
|
|
||||||
if (data.devices && data.devices.length > 0) {
|
if (data.devices && data.devices.length > 0) {
|
||||||
data.devices.forEach(device => {
|
data.devices.forEach((device) => {
|
||||||
lowBatteryDevices.add({
|
lowBatteryDevices.add({
|
||||||
button: device.button,
|
button: device.button,
|
||||||
mac: device.mac,
|
mac: device.mac,
|
||||||
battery: device.battery || 0
|
battery: device.battery || 0,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -235,27 +248,29 @@
|
|||||||
|
|
||||||
// Batterie-Banner anzeigen
|
// Batterie-Banner anzeigen
|
||||||
function showBatteryBanner() {
|
function showBatteryBanner() {
|
||||||
const banner = document.getElementById('battery-banner');
|
const banner = document.getElementById("battery-banner");
|
||||||
const deviceList = document.getElementById('low-battery-list');
|
const deviceList = document.getElementById("low-battery-list");
|
||||||
|
|
||||||
// Geräteliste erstellen
|
// Geräteliste erstellen
|
||||||
const deviceNames = Array.from(lowBatteryDevices).map(device => {
|
const deviceNames = Array.from(lowBatteryDevices)
|
||||||
|
.map((device) => {
|
||||||
const buttonName = getButtonDisplayName(device.button);
|
const buttonName = getButtonDisplayName(device.button);
|
||||||
return `${buttonName} (${device.battery}%)`;
|
return `${buttonName} (${device.battery}%)`;
|
||||||
}).join(', ');
|
})
|
||||||
|
.join(", ");
|
||||||
|
|
||||||
deviceList.textContent = deviceNames;
|
deviceList.textContent = deviceNames;
|
||||||
|
|
||||||
// Banner anzeigen
|
// Banner anzeigen
|
||||||
banner.classList.add('show');
|
banner.classList.add("show");
|
||||||
document.body.classList.add('content-shifted');
|
document.body.classList.add("content-shifted");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Batterie-Banner verstecken
|
// Batterie-Banner verstecken
|
||||||
function hideBatteryBanner() {
|
function hideBatteryBanner() {
|
||||||
const banner = document.getElementById('battery-banner');
|
const banner = document.getElementById("battery-banner");
|
||||||
banner.classList.remove('show');
|
banner.classList.remove("show");
|
||||||
document.body.classList.remove('content-shifted');
|
document.body.classList.remove("content-shifted");
|
||||||
batteryBannerDismissed = false;
|
batteryBannerDismissed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,11 +283,16 @@
|
|||||||
// Button-Namen für Anzeige
|
// Button-Namen für Anzeige
|
||||||
function getButtonDisplayName(button) {
|
function getButtonDisplayName(button) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 'start1': return 'Start Bahn 1';
|
case "start1":
|
||||||
case 'stop1': return 'Stop Bahn 1';
|
return "Start Bahn 1";
|
||||||
case 'start2': return 'Start Bahn 2';
|
case "stop1":
|
||||||
case 'stop2': return 'Stop Bahn 2';
|
return "Stop Bahn 1";
|
||||||
default: return button;
|
case "start2":
|
||||||
|
return "Start Bahn 2";
|
||||||
|
case "stop2":
|
||||||
|
return "Stop Bahn 2";
|
||||||
|
default:
|
||||||
|
return button;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,7 +360,8 @@
|
|||||||
// Lernmodus
|
// Lernmodus
|
||||||
const learningDisplay = document.getElementById("learning-display");
|
const learningDisplay = document.getElementById("learning-display");
|
||||||
if (learningMode) {
|
if (learningMode) {
|
||||||
document.getElementById("learning-button").textContent = learningButton;
|
document.getElementById("learning-button").textContent =
|
||||||
|
learningButton;
|
||||||
learningDisplay.style.display = "block";
|
learningDisplay.style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
learningDisplay.style.display = "none";
|
learningDisplay.style.display = "none";
|
||||||
@@ -363,7 +384,7 @@
|
|||||||
updateDisplay();
|
updateDisplay();
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
console.error("Fehler beim Laden der Daten:", error)
|
console.error("Fehler beim Laden der Daten:", error),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +404,7 @@
|
|||||||
{ button: "stop2", id: "heartbeat4" },
|
{ button: "stop2", id: "heartbeat4" },
|
||||||
].forEach(({ button, id }) => {
|
].forEach(({ button, id }) => {
|
||||||
if (now - heartbeatTimeouts[button] > 10000) {
|
if (now - heartbeatTimeouts[button] > 10000) {
|
||||||
document.getElementById(id).classList.remove('active');
|
document.getElementById(id).classList.remove("active");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -174,9 +174,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
0% { transform: scale(1); }
|
0% {
|
||||||
50% { transform: scale(1.05); }
|
transform: scale(1);
|
||||||
100% { transform: scale(1); }
|
}
|
||||||
|
50% {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
@@ -201,7 +207,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.date-input-group input[type="date"]::-webkit-calendar-picker-indicator {
|
.date-input-group input[type="date"]::-webkit-calendar-picker-indicator {
|
||||||
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23667eea" viewBox="0 0 16 16"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg>') no-repeat;
|
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23667eea" viewBox="0 0 16 16"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg>')
|
||||||
|
no-repeat;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|||||||
289
data/rfid.html
289
data/rfid.html
@@ -1,19 +1,40 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="rfid.css" />
|
<link rel="stylesheet" href="rfid.css" />
|
||||||
<link rel="icon" type="image/x-icon" href="/pictures/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="/pictures/favicon.ico" />
|
||||||
|
|
||||||
<title>RFID Daten Eingabe</title>
|
<title>RFID Daten Eingabe</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
<div
|
||||||
<button onclick="window.location.href='/settings'" class="back-btn" style="background: #6c757d; color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 5px;">
|
style="
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
onclick="window.location.href='/settings'"
|
||||||
|
class="back-btn"
|
||||||
|
style="
|
||||||
|
background: #6c757d;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
"
|
||||||
|
>
|
||||||
← Zurück zu Einstellungen
|
← Zurück zu Einstellungen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -21,16 +42,28 @@
|
|||||||
<p>Erfassen Sie RFID-Tag Informationen</p>
|
<p>Erfassen Sie RFID-Tag Informationen</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="successMessage" class="success-message" style="display: none;">
|
<div id="successMessage" class="success-message" style="display: none">
|
||||||
✅ Daten erfolgreich gespeichert!
|
✅ Daten erfolgreich gespeichert!
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="rfidForm">
|
<form id="rfidForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="uid">RFID UID <span class="required">*</span></label>
|
<label for="uid">RFID UID <span class="required">*</span></label>
|
||||||
<div style="display: flex; gap: 10px; align-items: stretch;">
|
<div style="display: flex; gap: 10px; align-items: stretch">
|
||||||
<input type="text" id="uid" name="uid" placeholder="z.B. A1:B2:C3:D4" required style="flex: 1;">
|
<input
|
||||||
<button type="button" id="readUidBtn" class="read-uid-btn" onclick="readRFIDUID()">
|
type="text"
|
||||||
|
id="uid"
|
||||||
|
name="uid"
|
||||||
|
placeholder="z.B. A1:B2:C3:D4"
|
||||||
|
required
|
||||||
|
style="flex: 1"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
id="readUidBtn"
|
||||||
|
class="read-uid-btn"
|
||||||
|
onclick="readRFIDUID()"
|
||||||
|
>
|
||||||
📡 Read Chip
|
📡 Read Chip
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,28 +71,53 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="vorname">Vorname <span class="required">*</span></label>
|
<label for="vorname">Vorname <span class="required">*</span></label>
|
||||||
<input type="text" id="vorname" name="vorname" placeholder="Vorname eingeben" required>
|
<input
|
||||||
|
type="text"
|
||||||
|
id="vorname"
|
||||||
|
name="vorname"
|
||||||
|
placeholder="Vorname eingeben"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="nachname">Nachname <span class="required">*</span></label>
|
<label for="nachname">Nachname <span class="required">*</span></label>
|
||||||
<input type="text" id="nachname" name="nachname" placeholder="Nachname eingeben" required>
|
<input
|
||||||
|
type="text"
|
||||||
|
id="nachname"
|
||||||
|
name="nachname"
|
||||||
|
placeholder="Nachname eingeben"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="geburtsdatum">Geburtsdatum <span class="required">*</span></label>
|
<label for="geburtsdatum"
|
||||||
|
>Geburtsdatum <span class="required">*</span></label
|
||||||
|
>
|
||||||
<div class="date-input-group">
|
<div class="date-input-group">
|
||||||
<input type="date" id="geburtsdatum" name="geburtsdatum" required max="">
|
<input
|
||||||
<div id="ageDisplay" class="age-display" style="display: none;"></div>
|
type="date"
|
||||||
|
id="geburtsdatum"
|
||||||
|
name="geburtsdatum"
|
||||||
|
required
|
||||||
|
max=""
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
id="ageDisplay"
|
||||||
|
class="age-display"
|
||||||
|
style="display: none"
|
||||||
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-container">
|
<div class="btn-container">
|
||||||
<button type="submit" class="btn btn-primary">💾 Speichern</button>
|
<button type="submit" class="btn btn-primary">💾 Speichern</button>
|
||||||
<button type="button" class="btn btn-secondary" onclick="clearForm()">🗑️ Zurücksetzen</button>
|
<button type="button" class="btn btn-secondary" onclick="clearForm()">
|
||||||
|
🗑️ Zurücksetzen
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -70,9 +128,9 @@
|
|||||||
var APIKey;
|
var APIKey;
|
||||||
|
|
||||||
// Maximales Datum auf heute setzen
|
// Maximales Datum auf heute setzen
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const today = new Date().toISOString().split('T')[0];
|
const today = new Date().toISOString().split("T")[0];
|
||||||
document.getElementById('geburtsdatum').setAttribute('max', today);
|
document.getElementById("geburtsdatum").setAttribute("max", today);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Alter berechnen und anzeigen
|
// Alter berechnen und anzeigen
|
||||||
@@ -82,7 +140,10 @@
|
|||||||
let age = today.getFullYear() - birth.getFullYear();
|
let age = today.getFullYear() - birth.getFullYear();
|
||||||
const monthDiff = today.getMonth() - birth.getMonth();
|
const monthDiff = today.getMonth() - birth.getMonth();
|
||||||
|
|
||||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
|
if (
|
||||||
|
monthDiff < 0 ||
|
||||||
|
(monthDiff === 0 && today.getDate() < birth.getDate())
|
||||||
|
) {
|
||||||
age--;
|
age--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,52 +151,60 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Geburtsdatum Change Event
|
// Geburtsdatum Change Event
|
||||||
document.getElementById('geburtsdatum').addEventListener('change', function(e) {
|
document
|
||||||
|
.getElementById("geburtsdatum")
|
||||||
|
.addEventListener("change", function (e) {
|
||||||
const birthDate = e.target.value;
|
const birthDate = e.target.value;
|
||||||
const ageDisplay = document.getElementById('ageDisplay');
|
const ageDisplay = document.getElementById("ageDisplay");
|
||||||
|
|
||||||
if (birthDate) {
|
if (birthDate) {
|
||||||
const age = calculateAge(birthDate);
|
const age = calculateAge(birthDate);
|
||||||
if (age >= 0 && age <= 150) {
|
if (age >= 0 && age <= 150) {
|
||||||
ageDisplay.textContent = `${age} Jahre`;
|
ageDisplay.textContent = `${age} Jahre`;
|
||||||
ageDisplay.style.display = 'block';
|
ageDisplay.style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
ageDisplay.style.display = 'none';
|
ageDisplay.style.display = "none";
|
||||||
if (age < 0) {
|
if (age < 0) {
|
||||||
showErrorMessage('Das Geburtsdatum kann nicht in der Zukunft liegen!');
|
showErrorMessage(
|
||||||
e.target.value = '';
|
"Das Geburtsdatum kann nicht in der Zukunft liegen!",
|
||||||
|
);
|
||||||
|
e.target.value = "";
|
||||||
} else {
|
} else {
|
||||||
showErrorMessage('Bitte überprüfen Sie das Geburtsdatum!');
|
showErrorMessage("Bitte überprüfen Sie das Geburtsdatum!");
|
||||||
e.target.value = '';
|
e.target.value = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ageDisplay.style.display = 'none';
|
ageDisplay.style.display = "none";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Form Submit Handler
|
// Form Submit Handler
|
||||||
document.getElementById('rfidForm').addEventListener('submit', async function(e) {
|
document
|
||||||
|
.getElementById("rfidForm")
|
||||||
|
.addEventListener("submit", async function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (isLoading) return;
|
if (isLoading) return;
|
||||||
|
|
||||||
// Daten aus dem Formular holen
|
// Daten aus dem Formular holen
|
||||||
const uid = document.getElementById('uid').value.trim();
|
const uid = document.getElementById("uid").value.trim();
|
||||||
const vorname = document.getElementById('vorname').value.trim();
|
const vorname = document.getElementById("vorname").value.trim();
|
||||||
const nachname = document.getElementById('nachname').value.trim();
|
const nachname = document.getElementById("nachname").value.trim();
|
||||||
const geburtsdatum = document.getElementById('geburtsdatum').value;
|
const geburtsdatum = document.getElementById("geburtsdatum").value;
|
||||||
|
|
||||||
// Validierung
|
// Validierung
|
||||||
if (!uid || !vorname || !nachname || !geburtsdatum) {
|
if (!uid || !vorname || !nachname || !geburtsdatum) {
|
||||||
showErrorMessage('Bitte füllen Sie alle Pflichtfelder aus!');
|
showErrorMessage("Bitte füllen Sie alle Pflichtfelder aus!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alter berechnen
|
// Alter berechnen
|
||||||
const alter = calculateAge(geburtsdatum);
|
const alter = calculateAge(geburtsdatum);
|
||||||
if (alter < 0) {
|
if (alter < 0) {
|
||||||
showErrorMessage('Das Geburtsdatum kann nicht in der Zukunft liegen!');
|
showErrorMessage(
|
||||||
|
"Das Geburtsdatum kann nicht in der Zukunft liegen!",
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,61 +214,64 @@
|
|||||||
try {
|
try {
|
||||||
// API Aufruf zum Erstellen des Benutzers
|
// API Aufruf zum Erstellen des Benutzers
|
||||||
const response = await fetch(`/api/users/insert`, {
|
const response = await fetch(`/api/users/insert`, {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
uid: uid,
|
uid: uid,
|
||||||
vorname: vorname,
|
vorname: vorname,
|
||||||
nachname: nachname,
|
nachname: nachname,
|
||||||
geburtsdatum: geburtsdatum,
|
geburtsdatum: geburtsdatum,
|
||||||
alter: alter // Berechnetes Alter wird mit gesendet
|
alter: alter, // Berechnetes Alter wird mit gesendet
|
||||||
})
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
// Erfolg anzeigen
|
// Erfolg anzeigen
|
||||||
showSuccessMessage('Benutzer erfolgreich gespeichert!');
|
showSuccessMessage("Benutzer erfolgreich gespeichert!");
|
||||||
|
|
||||||
// Formular zurücksetzen
|
// Formular zurücksetzen
|
||||||
clearForm();
|
clearForm();
|
||||||
|
|
||||||
// UID Feld fokussieren für nächsten Eintrag
|
// UID Feld fokussieren für nächsten Eintrag
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.getElementById('uid').focus();
|
document.getElementById("uid").focus();
|
||||||
}, 100);
|
}, 100);
|
||||||
} else {
|
} else {
|
||||||
// Fehler anzeigen
|
// Fehler anzeigen
|
||||||
showErrorMessage(result.error || 'Fehler beim Speichern der Daten');
|
showErrorMessage(
|
||||||
|
result.error || "Fehler beim Speichern der Daten",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Fehler beim Speichern:', error);
|
console.error("Fehler beim Speichern:", error);
|
||||||
showErrorMessage('Verbindungsfehler zum Server. Bitte versuchen Sie es später erneut.');
|
showErrorMessage(
|
||||||
|
"Verbindungsfehler zum Server. Bitte versuchen Sie es später erneut.",
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingState(false);
|
setLoadingState(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function showSuccessMessage(message = 'Daten erfolgreich gespeichert!') {
|
function showSuccessMessage(message = "Daten erfolgreich gespeichert!") {
|
||||||
const successMsg = document.getElementById('successMessage');
|
const successMsg = document.getElementById("successMessage");
|
||||||
successMsg.textContent = `✅ ${message}`;
|
successMsg.textContent = `✅ ${message}`;
|
||||||
successMsg.style.display = 'block';
|
successMsg.style.display = "block";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
successMsg.style.display = 'none';
|
successMsg.style.display = "none";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showErrorMessage(message) {
|
function showErrorMessage(message) {
|
||||||
// Fehlermeldung dynamisch erstellen
|
// Fehlermeldung dynamisch erstellen
|
||||||
let errorDiv = document.getElementById('errorMessage');
|
let errorDiv = document.getElementById("errorMessage");
|
||||||
if (!errorDiv) {
|
if (!errorDiv) {
|
||||||
errorDiv = document.createElement('div');
|
errorDiv = document.createElement("div");
|
||||||
errorDiv.id = 'errorMessage';
|
errorDiv.id = "errorMessage";
|
||||||
errorDiv.className = 'error-message';
|
errorDiv.className = "error-message";
|
||||||
errorDiv.style.cssText = `
|
errorDiv.style.cssText = `
|
||||||
background: #f8d7da;
|
background: #f8d7da;
|
||||||
color: #721c24;
|
color: #721c24;
|
||||||
@@ -210,144 +282,150 @@
|
|||||||
animation: fadeIn 0.3s ease-out;
|
animation: fadeIn 0.3s ease-out;
|
||||||
display: none;
|
display: none;
|
||||||
`;
|
`;
|
||||||
document.querySelector('.container').insertBefore(errorDiv, document.getElementById('rfidForm'));
|
document
|
||||||
|
.querySelector(".container")
|
||||||
|
.insertBefore(errorDiv, document.getElementById("rfidForm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
errorDiv.textContent = `❌ ${message}`;
|
errorDiv.textContent = `❌ ${message}`;
|
||||||
errorDiv.style.display = 'block';
|
errorDiv.style.display = "block";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
errorDiv.style.display = 'none';
|
errorDiv.style.display = "none";
|
||||||
}, 10000);
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLoadingState(loading) {
|
function setLoadingState(loading) {
|
||||||
isLoading = loading;
|
isLoading = loading;
|
||||||
const submitBtn = document.querySelector('.btn-primary');
|
const submitBtn = document.querySelector(".btn-primary");
|
||||||
const form = document.getElementById('rfidForm');
|
const form = document.getElementById("rfidForm");
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
submitBtn.textContent = '⏳ Speichern...';
|
submitBtn.textContent = "⏳ Speichern...";
|
||||||
submitBtn.disabled = true;
|
submitBtn.disabled = true;
|
||||||
form.style.opacity = '0.7';
|
form.style.opacity = "0.7";
|
||||||
} else {
|
} else {
|
||||||
submitBtn.textContent = '💾 Speichern';
|
submitBtn.textContent = "💾 Speichern";
|
||||||
submitBtn.disabled = false;
|
submitBtn.disabled = false;
|
||||||
form.style.opacity = '1';
|
form.style.opacity = "1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearForm() {
|
function clearForm() {
|
||||||
document.getElementById('rfidForm').reset();
|
document.getElementById("rfidForm").reset();
|
||||||
document.getElementById('ageDisplay').style.display = 'none';
|
document.getElementById("ageDisplay").style.display = "none";
|
||||||
document.getElementById('uid').focus();
|
document.getElementById("uid").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Beim Laden der Seite
|
// Beim Laden der Seite
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener("load", function () {
|
||||||
document.getElementById('uid').focus();
|
document.getElementById("uid").focus();
|
||||||
checkServerStatus();
|
checkServerStatus();
|
||||||
loadLicence();
|
loadLicence();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enter-Taste in UID Feld zum nächsten Feld springen
|
// Enter-Taste in UID Feld zum nächsten Feld springen
|
||||||
document.getElementById('uid').addEventListener('keydown', function(e) {
|
document.getElementById("uid").addEventListener("keydown", function (e) {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === "Enter") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.getElementById('vorname').focus();
|
document.getElementById("vorname").focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Automatische UID Formatierung
|
// Automatische UID Formatierung
|
||||||
document.getElementById('uid').addEventListener('input', function(e) {
|
document.getElementById("uid").addEventListener("input", function (e) {
|
||||||
let value = e.target.value.toUpperCase();
|
let value = e.target.value.toUpperCase();
|
||||||
// Entfernen aller nicht-hexadezimalen Zeichen außer Doppelpunkt
|
// Entfernen aller nicht-hexadezimalen Zeichen außer Doppelpunkt
|
||||||
value = value.replace(/[^0-9A-F:]/g, '');
|
value = value.replace(/[^0-9A-F:]/g, "");
|
||||||
e.target.value = value;
|
e.target.value = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
// RFID UID lesen
|
// RFID UID lesen
|
||||||
async function readRFIDUID() {
|
async function readRFIDUID() {
|
||||||
const readBtn = document.getElementById('readUidBtn');
|
const readBtn = document.getElementById("readUidBtn");
|
||||||
const uidInput = document.getElementById('uid');
|
const uidInput = document.getElementById("uid");
|
||||||
|
|
||||||
// Button Status ändern
|
// Button Status ändern
|
||||||
readBtn.disabled = true;
|
readBtn.disabled = true;
|
||||||
readBtn.className = 'read-uid-btn reading';
|
readBtn.className = "read-uid-btn reading";
|
||||||
readBtn.innerHTML = '📡 Lese UID...';
|
readBtn.innerHTML = "📡 Lese UID...";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// API Aufruf zum RFID Reader
|
// API Aufruf zum RFID Reader
|
||||||
const response = await fetch(`/api/rfid/read`, {
|
const response = await fetch(`/api/rfid/read`, {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success && result.uid) {
|
if (result.success && result.uid) {
|
||||||
// UID in das Eingabefeld setzen
|
// UID in das Eingabefeld setzen
|
||||||
uidInput.value = result.uid.match(/.{1,2}/g).join(':').toUpperCase();
|
uidInput.value = result.uid
|
||||||
|
.match(/.{1,2}/g)
|
||||||
|
.join(":")
|
||||||
|
.toUpperCase();
|
||||||
uidInput.focus();
|
uidInput.focus();
|
||||||
|
|
||||||
// Visuelles Feedback
|
// Visuelles Feedback
|
||||||
uidInput.style.borderColor = '#28a745';
|
uidInput.style.borderColor = "#28a745";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uidInput.style.borderColor = '#e1e5e9';
|
uidInput.style.borderColor = "#e1e5e9";
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
showSuccessMessage('UID erfolgreich gelesen!');
|
showSuccessMessage("UID erfolgreich gelesen!");
|
||||||
|
|
||||||
// Automatisch zum nächsten Feld springen
|
// Automatisch zum nächsten Feld springen
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.getElementById('vorname').focus();
|
document.getElementById("vorname").focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Fehler beim Lesen
|
// Fehler beim Lesen
|
||||||
const errorMsg = result.error || 'Keine UID gefunden';
|
const errorMsg = result.error || "Keine UID gefunden";
|
||||||
showErrorMessage(`RFID Fehler: ${errorMsg}`);
|
showErrorMessage(`RFID Fehler: ${errorMsg}`);
|
||||||
|
|
||||||
// UID Feld rot markieren
|
// UID Feld rot markieren
|
||||||
uidInput.style.borderColor = '#dc3545';
|
uidInput.style.borderColor = "#dc3545";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uidInput.style.borderColor = '#e1e5e9';
|
uidInput.style.borderColor = "#e1e5e9";
|
||||||
}, 10000);
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Fehler beim Lesen der UID:', error);
|
console.error("Fehler beim Lesen der UID:", error);
|
||||||
showErrorMessage('Verbindungsfehler zum RFID Reader. Bitte prüfen Sie die Verbindung.');
|
showErrorMessage(
|
||||||
|
"Verbindungsfehler zum RFID Reader. Bitte prüfen Sie die Verbindung.",
|
||||||
|
);
|
||||||
|
|
||||||
// UID Feld rot markieren
|
// UID Feld rot markieren
|
||||||
uidInput.style.borderColor = '#dc3545';
|
uidInput.style.borderColor = "#dc3545";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uidInput.style.borderColor = '#e1e5e9';
|
uidInput.style.borderColor = "#e1e5e9";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
// Button Status zurücksetzen
|
// Button Status zurücksetzen
|
||||||
readBtn.disabled = false;
|
readBtn.disabled = false;
|
||||||
readBtn.className = 'read-uid-btn';
|
readBtn.className = "read-uid-btn";
|
||||||
readBtn.innerHTML = '📡 Read Chip';
|
readBtn.innerHTML = "📡 Read Chip";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkServerStatus() {
|
async function checkServerStatus() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/health');
|
const response = await fetch("/api/health");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
if (!data.status || data.status !== 'connected') {
|
if (!data.status || data.status !== "connected") {
|
||||||
showErrorMessage('Server nicht verbunden. Einige Funktionen könnten eingeschränkt sein.');
|
showErrorMessage(
|
||||||
|
"Server nicht verbunden. Einige Funktionen könnten eingeschränkt sein.",
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Server Status Check fehlgeschlagen:', error);
|
console.error("Server Status Check fehlgeschlagen:", error);
|
||||||
showErrorMessage('Verbindung zum Server nicht möglich.');
|
showErrorMessage("Verbindung zum Server nicht möglich.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,10 +435,9 @@
|
|||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
APIKey = data.licence || "";
|
APIKey = data.licence || "";
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
showMessage("Fehler beim Laden der Lizenz", "error")
|
showMessage("Fehler beim Laden der Lizenz", "error"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<!-- Meta Tags -->
|
<!-- Meta Tags -->
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="icon" type="image/x-icon" href="/pictures/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="/pictures/favicon.ico" />
|
||||||
|
|
||||||
<!-- Stylesheets -->
|
<!-- Stylesheets -->
|
||||||
<link rel="stylesheet" href="settings.css" />
|
<link rel="stylesheet" href="settings.css" />
|
||||||
@@ -143,8 +143,14 @@
|
|||||||
<!-- WiFi Configuration Section -->
|
<!-- WiFi Configuration Section -->
|
||||||
<div class="section" id="wifiSection">
|
<div class="section" id="wifiSection">
|
||||||
<h2>📡 WLAN-Konfiguration</h2>
|
<h2>📡 WLAN-Konfiguration</h2>
|
||||||
<div id="wifiRestrictionNotice" class="restriction-notice" style="display: none;">
|
<div
|
||||||
🔒 WLAN-Konfiguration ist nur mit Lizenz Level 3 oder höher verfügbar. Aktuelle Lizenz: Level <span id="currentLicenseLevel">0</span>
|
id="wifiRestrictionNotice"
|
||||||
|
class="restriction-notice"
|
||||||
|
style="display: none"
|
||||||
|
>
|
||||||
|
🔒 WLAN-Konfiguration ist nur mit Lizenz Level 3 oder höher
|
||||||
|
verfügbar. Aktuelle Lizenz: Level
|
||||||
|
<span id="currentLicenseLevel">0</span>
|
||||||
</div>
|
</div>
|
||||||
<form id="wifiForm">
|
<form id="wifiForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -176,8 +182,14 @@
|
|||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>📍 Standort</h2>
|
<h2>📍 Standort</h2>
|
||||||
<div id="locationRestrictionNotice" class="restriction-notice" style="display: none;">
|
<div
|
||||||
🔒 Standort-Konfiguration ist nur mit Lizenz Level 3 oder höher verfügbar. Aktuelle Lizenz: Level <span id="currentLocationLicenseLevel">0</span>
|
id="locationRestrictionNotice"
|
||||||
|
class="restriction-notice"
|
||||||
|
style="display: none"
|
||||||
|
>
|
||||||
|
🔒 Standort-Konfiguration ist nur mit Lizenz Level 3 oder höher
|
||||||
|
verfügbar. Aktuelle Lizenz: Level
|
||||||
|
<span id="currentLocationLicenseLevel">0</span>
|
||||||
</div>
|
</div>
|
||||||
<form id="locationForm">
|
<form id="locationForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -187,7 +199,11 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<button type="submit" id="locationSubmitBtn" class="btn btn-primary">
|
<button
|
||||||
|
type="submit"
|
||||||
|
id="locationSubmitBtn"
|
||||||
|
class="btn btn-primary"
|
||||||
|
>
|
||||||
💾 Standort speichern
|
💾 Standort speichern
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -197,8 +213,13 @@
|
|||||||
<!-- OTA Update Section -->
|
<!-- OTA Update Section -->
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>🔄 OTA Update</h2>
|
<h2>🔄 OTA Update</h2>
|
||||||
<div id="otaRestrictionNotice" class="restriction-notice" style="display: none;">
|
<div
|
||||||
🔒 OTA Updates sind nur mit Lizenz Level 2 oder höher verfügbar. Aktuelle Lizenz: Level <span id="currentLicenseLevel">0</span>
|
id="otaRestrictionNotice"
|
||||||
|
class="restriction-notice"
|
||||||
|
style="display: none"
|
||||||
|
>
|
||||||
|
🔒 OTA Updates sind nur mit Lizenz Level 2 oder höher verfügbar.
|
||||||
|
Aktuelle Lizenz: Level <span id="currentLicenseLevel">0</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<button
|
<button
|
||||||
@@ -235,7 +256,9 @@
|
|||||||
<div>Kanal: <span id="channel">Laden...</span></div>
|
<div>Kanal: <span id="channel">Laden...</span></div>
|
||||||
<div>MAC-Adresse: <span id="macAddress">Laden...</span></div>
|
<div>MAC-Adresse: <span id="macAddress">Laden...</span></div>
|
||||||
<div>Freier Speicher: <span id="freeMemory">Laden...</span></div>
|
<div>Freier Speicher: <span id="freeMemory">Laden...</span></div>
|
||||||
<div>Verbundene Buttons: <span id="connectedButtons">Laden...</span></div>
|
<div>
|
||||||
|
Verbundene Buttons: <span id="connectedButtons">Laden...</span>
|
||||||
|
</div>
|
||||||
<div>Lizenz gültig: <span id="isLicenceValid">Laden...</span></div>
|
<div>Lizenz gültig: <span id="isLicenceValid">Laden...</span></div>
|
||||||
<div>Lizenz Level: <span id="licenceLevel">Laden...</span></div>
|
<div>Lizenz Level: <span id="licenceLevel">Laden...</span></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -247,7 +270,12 @@
|
|||||||
<form id="licenceForm">
|
<form id="licenceForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="licencekey">Lizensschlüssel:</label>
|
<label for="licencekey">Lizensschlüssel:</label>
|
||||||
<input type="password" id="licencekey" name="licence" value="Key" />
|
<input
|
||||||
|
type="password"
|
||||||
|
id="licencekey"
|
||||||
|
name="licence"
|
||||||
|
value="Key"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
@@ -297,9 +325,8 @@
|
|||||||
minute: "2-digit",
|
minute: "2-digit",
|
||||||
second: "2-digit",
|
second: "2-digit",
|
||||||
});
|
});
|
||||||
document.getElementById(
|
document.getElementById("currentTime").textContent =
|
||||||
"currentTime"
|
`System Zeit: ${timeString}`;
|
||||||
).textContent = `System Zeit: ${timeString}`;
|
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("currentTime").textContent =
|
document.getElementById("currentTime").textContent =
|
||||||
"Aktuelle Zeit: Fehler beim Laden";
|
"Aktuelle Zeit: Fehler beim Laden";
|
||||||
@@ -329,7 +356,7 @@
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(
|
console.log(
|
||||||
"Zeit konnte nicht geladen werden, verwende Browser-Zeit"
|
"Zeit konnte nicht geladen werden, verwende Browser-Zeit",
|
||||||
);
|
);
|
||||||
syncWithBrowserTime();
|
syncWithBrowserTime();
|
||||||
});
|
});
|
||||||
@@ -374,12 +401,13 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
showMessage("Verbindungsfehler beim Setzen der Zeit", "error")
|
showMessage("Verbindungsfehler beim Setzen der Zeit", "error"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zeit setzen
|
// Zeit setzen
|
||||||
document.getElementById("timeForm")
|
document
|
||||||
|
.getElementById("timeForm")
|
||||||
.addEventListener("submit", function (e) {
|
.addEventListener("submit", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -410,11 +438,13 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
showMessage("Verbindungsfehler beim Setzen der Zeit", "error")
|
showMessage("Verbindungsfehler beim Setzen der Zeit", "error"),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("licenceForm").addEventListener("submit", function(e) {
|
document
|
||||||
|
.getElementById("licenceForm")
|
||||||
|
.addEventListener("submit", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
saveLicence();
|
saveLicence();
|
||||||
});
|
});
|
||||||
@@ -429,7 +459,7 @@
|
|||||||
data.maxTimeDisplay || 20;
|
data.maxTimeDisplay || 20;
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
showMessage("Fehler beim Laden der Einstellungen", "error")
|
showMessage("Fehler beim Laden der Einstellungen", "error"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +485,7 @@
|
|||||||
|
|
||||||
// Check license level and update OTA button accordingly
|
// Check license level and update OTA button accordingly
|
||||||
updateOTAButtonAccess(data.tier || 0);
|
updateOTAButtonAccess(data.tier || 0);
|
||||||
updateWifiButtonAccess(data.tier || 0)
|
updateWifiButtonAccess(data.tier || 0);
|
||||||
updateLocationAccess(data.tier || 0);
|
updateLocationAccess(data.tier || 0);
|
||||||
})
|
})
|
||||||
.catch((error) => console.log("Info konnte nicht geladen werden"));
|
.catch((error) => console.log("Info konnte nicht geladen werden"));
|
||||||
@@ -469,7 +499,7 @@
|
|||||||
loadLocations();
|
loadLocations();
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
showMessage("Fehler beim Laden der Lizenz", "error")
|
showMessage("Fehler beim Laden der Lizenz", "error"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,19 +530,24 @@
|
|||||||
// WLAN-Einstellungen laden
|
// WLAN-Einstellungen laden
|
||||||
function loadWifiSettings() {
|
function loadWifiSettings() {
|
||||||
fetch("/api/get-wifi")
|
fetch("/api/get-wifi")
|
||||||
.then(response => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => {
|
.then((data) => {
|
||||||
document.getElementById("wifi-ssid").value = data.ssid || "";
|
document.getElementById("wifi-ssid").value = data.ssid || "";
|
||||||
document.getElementById("wifi-password").value = data.password || "";
|
document.getElementById("wifi-password").value =
|
||||||
|
data.password || "";
|
||||||
})
|
})
|
||||||
.catch(error => showMessage("Fehler beim Laden der WLAN-Einstellungen", "error"));
|
.catch((error) =>
|
||||||
|
showMessage("Fehler beim Laden der WLAN-Einstellungen", "error"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WLAN-Einstellungen beim Laden der Seite abrufen
|
// WLAN-Einstellungen beim Laden der Seite abrufen
|
||||||
window.addEventListener('load', loadWifiSettings);
|
window.addEventListener("load", loadWifiSettings);
|
||||||
|
|
||||||
// WLAN-Formular Handler
|
// WLAN-Formular Handler
|
||||||
document.getElementById("wifiForm").addEventListener("submit", function(e) {
|
document
|
||||||
|
.getElementById("wifiForm")
|
||||||
|
.addEventListener("submit", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const ssid = document.getElementById("wifi-ssid").value;
|
const ssid = document.getElementById("wifi-ssid").value;
|
||||||
@@ -522,7 +557,11 @@
|
|||||||
showMessage("Bitte WLAN-Namen eingeben", "error");
|
showMessage("Bitte WLAN-Namen eingeben", "error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!confirm("Der Server wird nach dem setzten neu gestartet. Fortsetzten?")) {
|
if (
|
||||||
|
!confirm(
|
||||||
|
"Der Server wird nach dem setzten neu gestartet. Fortsetzten?",
|
||||||
|
)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,23 +572,32 @@
|
|||||||
},
|
},
|
||||||
body: `ssid=${encodeURIComponent(ssid)}&password=${encodeURIComponent(password)}`,
|
body: `ssid=${encodeURIComponent(ssid)}&password=${encodeURIComponent(password)}`,
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => {
|
.then((data) => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
showMessage("WLAN-Einstellungen erfolgreich gespeichert!", "success");
|
showMessage(
|
||||||
|
"WLAN-Einstellungen erfolgreich gespeichert!",
|
||||||
|
"success",
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
showMessage(data.error || "Fehler beim Speichern der WLAN-Einstellungen", "error");
|
showMessage(
|
||||||
|
data.error || "Fehler beim Speichern der WLAN-Einstellungen",
|
||||||
|
"error",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => showMessage("Verbindungsfehler", "error"));
|
.catch((error) => showMessage("Verbindungsfehler", "error"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Update OTA button access based on license level
|
// Update OTA button access based on license level
|
||||||
function updateOTAButtonAccess(licenseLevel) {
|
function updateOTAButtonAccess(licenseLevel) {
|
||||||
const otaButton = document.getElementById("otaUpdateBtn");
|
const otaButton = document.getElementById("otaUpdateBtn");
|
||||||
const otarestrictionNotice = document.getElementById("otaRestrictionNotice");
|
const otarestrictionNotice = document.getElementById(
|
||||||
const otacurrentLevelSpan = document.getElementById("currentLicenseLevel");
|
"otaRestrictionNotice",
|
||||||
|
);
|
||||||
|
const otacurrentLevelSpan = document.getElementById(
|
||||||
|
"currentLicenseLevel",
|
||||||
|
);
|
||||||
|
|
||||||
const level = parseInt(licenseLevel) || 0;
|
const level = parseInt(licenseLevel) || 0;
|
||||||
|
|
||||||
@@ -571,24 +619,33 @@
|
|||||||
function updateButtons() {
|
function updateButtons() {
|
||||||
if (confirm("Update Buttons?")) {
|
if (confirm("Update Buttons?")) {
|
||||||
fetch("/api/updateButtons", {
|
fetch("/api/updateButtons", {
|
||||||
method: "GET"
|
method: "GET",
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
showMessage("Buttons führen das Update erfolgreich aus!", "success");
|
showMessage(
|
||||||
|
"Buttons führen das Update erfolgreich aus!",
|
||||||
|
"success",
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
showMessage("Fehler beim Senden der MQTT Message", "error");
|
showMessage("Fehler beim Senden der MQTT Message", "error");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => showMessage("Verbindungsfehler beim MQTT Publish", "error"));
|
.catch((error) =>
|
||||||
|
showMessage("Verbindungsfehler beim MQTT Publish", "error"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateWifiButtonAccess(licenseLevel) {
|
function updateWifiButtonAccess(licenseLevel) {
|
||||||
const wifiSubmitBtn = document.getElementById("wifiSubmitBtn");
|
const wifiSubmitBtn = document.getElementById("wifiSubmitBtn");
|
||||||
const wifiForm = document.getElementById("wifiForm");
|
const wifiForm = document.getElementById("wifiForm");
|
||||||
const wifiRestrictionNotice = document.getElementById("wifiRestrictionNotice");
|
const wifiRestrictionNotice = document.getElementById(
|
||||||
const wifiCurrentLevelSpan = document.getElementById("currentLicenseLevel");
|
"wifiRestrictionNotice",
|
||||||
|
);
|
||||||
|
const wifiCurrentLevelSpan = document.getElementById(
|
||||||
|
"currentLicenseLevel",
|
||||||
|
);
|
||||||
|
|
||||||
const level = parseInt(licenseLevel) || 0;
|
const level = parseInt(licenseLevel) || 0;
|
||||||
|
|
||||||
@@ -596,7 +653,7 @@
|
|||||||
// License level 3 or higher - enable form
|
// License level 3 or higher - enable form
|
||||||
wifiSubmitBtn.classList.remove("btn-disabled");
|
wifiSubmitBtn.classList.remove("btn-disabled");
|
||||||
wifiSubmitBtn.disabled = false;
|
wifiSubmitBtn.disabled = false;
|
||||||
wifiForm.querySelectorAll('input').forEach(input => {
|
wifiForm.querySelectorAll("input").forEach((input) => {
|
||||||
input.disabled = false;
|
input.disabled = false;
|
||||||
});
|
});
|
||||||
wifiRestrictionNotice.style.display = "none";
|
wifiRestrictionNotice.style.display = "none";
|
||||||
@@ -604,7 +661,7 @@
|
|||||||
// License level below 3 - disable form
|
// License level below 3 - disable form
|
||||||
wifiSubmitBtn.classList.add("btn-disabled");
|
wifiSubmitBtn.classList.add("btn-disabled");
|
||||||
wifiSubmitBtn.disabled = true;
|
wifiSubmitBtn.disabled = true;
|
||||||
wifiForm.querySelectorAll('input').forEach(input => {
|
wifiForm.querySelectorAll("input").forEach((input) => {
|
||||||
input.disabled = true;
|
input.disabled = true;
|
||||||
});
|
});
|
||||||
wifiRestrictionNotice.style.display = "block";
|
wifiRestrictionNotice.style.display = "block";
|
||||||
@@ -616,24 +673,35 @@
|
|||||||
function performOTAUpdate() {
|
function performOTAUpdate() {
|
||||||
const otaButton = document.getElementById("otaUpdateBtn");
|
const otaButton = document.getElementById("otaUpdateBtn");
|
||||||
|
|
||||||
if (otaButton.disabled || otaButton.classList.contains("btn-disabled")) {
|
if (
|
||||||
showMessage("OTA Update erfordert Lizenz Level 2 oder höher", "error");
|
otaButton.disabled ||
|
||||||
|
otaButton.classList.contains("btn-disabled")
|
||||||
|
) {
|
||||||
|
showMessage(
|
||||||
|
"OTA Update erfordert Lizenz Level 2 oder höher",
|
||||||
|
"error",
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirm("Möchten Sie wirklich ein OTA Update durchführen? Das Gerät wird während des Updates neu gestartet.")) {
|
if (
|
||||||
window.location.href = '/update';
|
confirm(
|
||||||
|
"Möchten Sie wirklich ein OTA Update durchführen? Das Gerät wird während des Updates neu gestartet.",
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
window.location.href = "/update";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Einstellungen speichern
|
// Einstellungen speichern
|
||||||
document.getElementById("settingsForm")
|
document
|
||||||
|
.getElementById("settingsForm")
|
||||||
.addEventListener("submit", function (e) {
|
.addEventListener("submit", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const maxTime = parseInt(document.getElementById("maxTime").value);
|
const maxTime = parseInt(document.getElementById("maxTime").value);
|
||||||
const maxTimeDisplay = parseInt(
|
const maxTimeDisplay = parseInt(
|
||||||
document.getElementById("maxTimeDisplay").value
|
document.getElementById("maxTimeDisplay").value,
|
||||||
);
|
);
|
||||||
|
|
||||||
fetch("/api/set-max-time", {
|
fetch("/api/set-max-time", {
|
||||||
@@ -652,7 +720,7 @@
|
|||||||
if (data.success) {
|
if (data.success) {
|
||||||
showMessage(
|
showMessage(
|
||||||
"Einstellungen erfolgreich gespeichert!",
|
"Einstellungen erfolgreich gespeichert!",
|
||||||
"success"
|
"success",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showMessage("Fehler beim Speichern der Einstellungen", "error");
|
showMessage("Fehler beim Speichern der Einstellungen", "error");
|
||||||
@@ -670,7 +738,7 @@
|
|||||||
if (data.success) {
|
if (data.success) {
|
||||||
showMessage(
|
showMessage(
|
||||||
"Beste Zeiten erfolgreich zurückgesetzt!",
|
"Beste Zeiten erfolgreich zurückgesetzt!",
|
||||||
"success"
|
"success",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showMessage("Fehler beim Zurücksetzen", "error");
|
showMessage("Fehler beim Zurücksetzen", "error");
|
||||||
@@ -718,13 +786,11 @@
|
|||||||
// Anlern-Anweisung aktualisieren
|
// Anlern-Anweisung aktualisieren
|
||||||
function updateLearningInstruction() {
|
function updateLearningInstruction() {
|
||||||
if (learningStep < learningSteps.length) {
|
if (learningStep < learningSteps.length) {
|
||||||
document.getElementById(
|
document.getElementById("learningInstruction").innerHTML =
|
||||||
"learningInstruction"
|
`Drücken Sie jetzt den Button für: <strong>${learningSteps[learningStep]}</strong>`;
|
||||||
).innerHTML = `Drücken Sie jetzt den Button für: <strong>${learningSteps[learningStep]}</strong>`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Anlern-Status abfragen
|
// Anlern-Status abfragen
|
||||||
function pollLearningStatus() {
|
function pollLearningStatus() {
|
||||||
const pollInterval = setInterval(() => {
|
const pollInterval = setInterval(() => {
|
||||||
@@ -748,7 +814,7 @@
|
|||||||
if (learningStep > 0) {
|
if (learningStep > 0) {
|
||||||
showMessage(
|
showMessage(
|
||||||
`${learningSteps[learningStep - 1]} erfolgreich angelernt!`,
|
`${learningSteps[learningStep - 1]} erfolgreich angelernt!`,
|
||||||
"success"
|
"success",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -770,13 +836,13 @@
|
|||||||
if (data.success) {
|
if (data.success) {
|
||||||
showMessage(
|
showMessage(
|
||||||
"Button-Zuweisungen erfolgreich zurückgesetzt!",
|
"Button-Zuweisungen erfolgreich zurückgesetzt!",
|
||||||
"success"
|
"success",
|
||||||
);
|
);
|
||||||
loadSystemInfo();
|
loadSystemInfo();
|
||||||
} else {
|
} else {
|
||||||
showMessage(
|
showMessage(
|
||||||
"Fehler beim Zurücksetzen der Button-Zuweisungen",
|
"Fehler beim Zurücksetzen der Button-Zuweisungen",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -806,7 +872,7 @@
|
|||||||
alert(statusText);
|
alert(statusText);
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
showMessage("Fehler beim Laden des Button-Status", "error")
|
showMessage("Fehler beim Laden des Button-Status", "error"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,7 +888,6 @@
|
|||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|
||||||
const select = document.getElementById("locationSelect");
|
const select = document.getElementById("locationSelect");
|
||||||
|
|
||||||
// Vorhandene Optionen löschen (außer der ersten "Bitte wählen...")
|
// Vorhandene Optionen löschen (außer der ersten "Bitte wählen...")
|
||||||
@@ -858,15 +923,22 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("Aktueller Standort konnte nicht geladen werden:", error);
|
console.log(
|
||||||
|
"Aktueller Standort konnte nicht geladen werden:",
|
||||||
|
error,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Location-Zugriff basierend auf Lizenz-Level kontrollieren
|
// Location-Zugriff basierend auf Lizenz-Level kontrollieren
|
||||||
function updateLocationAccess(licenseLevel) {
|
function updateLocationAccess(licenseLevel) {
|
||||||
const locationSubmitBtn = document.getElementById("locationSubmitBtn");
|
const locationSubmitBtn = document.getElementById("locationSubmitBtn");
|
||||||
const locationRestrictionNotice = document.getElementById("locationRestrictionNotice");
|
const locationRestrictionNotice = document.getElementById(
|
||||||
const locationCurrentLevelSpan = document.getElementById("currentLocationLicenseLevel");
|
"locationRestrictionNotice",
|
||||||
|
);
|
||||||
|
const locationCurrentLevelSpan = document.getElementById(
|
||||||
|
"currentLocationLicenseLevel",
|
||||||
|
);
|
||||||
const locationSelect = document.getElementById("locationSelect");
|
const locationSelect = document.getElementById("locationSelect");
|
||||||
|
|
||||||
const level = parseInt(licenseLevel) || 0;
|
const level = parseInt(licenseLevel) || 0;
|
||||||
@@ -888,14 +960,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Location Form Handler
|
// Location Form Handler
|
||||||
document.getElementById("locationForm").addEventListener("submit", function(e) {
|
document
|
||||||
|
.getElementById("locationForm")
|
||||||
|
.addEventListener("submit", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const locationSubmitBtn = document.getElementById("locationSubmitBtn");
|
const locationSubmitBtn =
|
||||||
|
document.getElementById("locationSubmitBtn");
|
||||||
|
|
||||||
// Lizenz-Level prüfen
|
// Lizenz-Level prüfen
|
||||||
if (locationSubmitBtn.disabled || locationSubmitBtn.classList.contains("btn-disabled")) {
|
if (
|
||||||
showMessage("Standort-Konfiguration erfordert Lizenz Level 3 oder höher", "error");
|
locationSubmitBtn.disabled ||
|
||||||
|
locationSubmitBtn.classList.contains("btn-disabled")
|
||||||
|
) {
|
||||||
|
showMessage(
|
||||||
|
"Standort-Konfiguration erfordert Lizenz Level 3 oder höher",
|
||||||
|
"error",
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user