Aufteilung in 2 Tabs
Zugriff auf ionos-Mongo
This commit is contained in:
@@ -13,6 +13,36 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
let editId = null;
|
||||
|
||||
// Modal für Fehleranzeige
|
||||
function showModal(message, callback) {
|
||||
// Vorherige Modals entfernen
|
||||
document.querySelectorAll('.custom-modal-popup').forEach(m => m.remove());
|
||||
|
||||
let modal = document.createElement('div');
|
||||
modal.className = 'custom-modal-popup';
|
||||
|
||||
let box = document.createElement('div');
|
||||
box.className = 'custom-modal-box';
|
||||
|
||||
let msg = document.createElement('div');
|
||||
msg.className = 'custom-modal-msg';
|
||||
msg.textContent = message;
|
||||
box.appendChild(msg);
|
||||
|
||||
let btn = document.createElement('button');
|
||||
btn.className = 'custom-modal-btn';
|
||||
btn.textContent = 'OK';
|
||||
btn.onclick = () => {
|
||||
if (modal.parentNode) {
|
||||
modal.parentNode.removeChild(modal);
|
||||
}
|
||||
if (callback) callback();
|
||||
};
|
||||
box.appendChild(btn);
|
||||
modal.appendChild(box);
|
||||
document.body.appendChild(modal);
|
||||
}
|
||||
|
||||
// Sensornummer nur Zahlen erlauben
|
||||
sensorNumberInput.addEventListener('input', () => {
|
||||
sensorNumberInput.value = sensorNumberInput.value.replace(/\D/g, '');
|
||||
@@ -29,9 +59,20 @@ async function fetchAddressIfValid() {
|
||||
addressInput.value = data.address;
|
||||
} else {
|
||||
addressInput.value = '';
|
||||
sensorNumberInput.disabled = true;
|
||||
showModal('Sensor unbekannt', () => {
|
||||
sensorNumberInput.disabled = false;
|
||||
sensorNumberInput.focus();
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Fehler beim Abrufen der Adresse:', err);
|
||||
addressInput.value = '';
|
||||
sensorNumberInput.disabled = true;
|
||||
showModal('Sensor unbekannt', () => {
|
||||
sensorNumberInput.disabled = false;
|
||||
sensorNumberInput.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user