✅ MEROS v2.1 - ALLE FUNKTIONEN AKTIV

🚂 MEROS v3.0 - Eifelquerbahn

Filter:

🔐 MEROS Login

Demo: test@test.com / test123

// ===== DROHNEN-LAYER (Pix4D-ready) =====let droneLayer = null;function initDroneLayer() { droneLayer = L.tileLayer("/drone-tiles/{z}/{x}/{y}.png", { attribution: "© Drohnenaufnahme MoRE", opacity: 1, minZoom: 10, maxZoom: 22, tms: false });}function toggleDroneLayer(show) { if (!droneLayer) initDroneLayer(); if (show && !map.hasLayer(droneLayer)) droneLayer.addTo(map); else if (!show && map.hasLayer(droneLayer)) map.removeLayer(droneLayer);} function createTaskForStructure(structureId) { // Speichere ausgewähltes Bauwerk selectedStructureId = structureId; // Schließe Popup map.closePopup(); // Öffne Aufgaben-Modal showCreateModal(); // Zeige Hinweis setTimeout(() => { const form = document.getElementById('createModal'); if (form) { const info = document.createElement('div'); info.id = 'structureInfo'; info.style.cssText = 'background: #f0fff4; border: 1px solid #38a169; padding: 10px; margin-bottom: 15px; border-radius: 4px; font-size: 13px;'; info.innerHTML = '🏗️ Aufgabe wird Bauwerk zugeordnet
ID: ' + structureId; const firstInput = form.querySelector('.modal-content'); if (firstInput) { firstInput.insertBefore(info, firstInput.firstChild); } } }, 100); } // Bauwerk-Auswahl Info async function loadStructuresForSelect() { try { const res = await fetch(API_URL + '/structures', { headers: {'Authorization': 'Bearer ' + token} }); const structures = await res.json(); const select = document.getElementById('createRailObjectId'); if (select) { // Speichere aktuellen Wert const currentValue = select.value; // Leere Option + Strukturen let options = ''; structures.forEach(s => { options += ``; }); select.innerHTML = options; // Setze gespeicherten Wert if (selectedStructureId) { select.value = selectedStructureId; updateStructureInfo(); } } } catch(e) { console.error('Fehler beim Laden der Bauwerke:', e); } } function updateStructureInfo() { const select = document.getElementById('createRailObjectId'); const infoBox = document.getElementById('structureInfoBox'); if (select && select.value) { const option = select.options[select.selectedIndex]; const km = option.getAttribute('data-km'); const type = option.getAttribute('data-type'); document.getElementById('structureKm').textContent = km; document.getElementById('structureType').textContent = type; infoBox.style.display = 'block'; // Auto-setze Position basierend auf km const kmNum = parseFloat(km); const lat = 50.23 + ((kmNum - 43) * 0.02); const lng = 6.85 + ((kmNum - 43) * 0.04); clickLat = lat; clickLng = lng; document.getElementById('locationDisplay').innerHTML = `Position: ${lat.toFixed(4)}, ${lng.toFixed(4)}
✓ Automatisch aus Bauwerk`; } else { infoBox.style.display = 'none'; } } // Bauwerke beim Öffnen des Modals laden const originalShowCreateModal = showCreateModal; showCreateModal = function() { selectedStructureId = null; loadStructuresForSelect(); if (typeof originalShowCreateModal === 'function') originalShowCreateModal(); else { // Fallback: direkt Modal öffnen const modal = document.getElementById('createModal'); if (modal) modal.style.display = 'flex'; } };