Replace tree navigation with touch UI

This commit is contained in:
2026-10-13 06:54:51 +00:00
parent 7258714ca7
commit 9285371808
253 changed files with 510407 additions and 92659 deletions

View File

@@ -8,10 +8,8 @@
<script src="/backend/xlsx/xlsx.full.min.js"></script>
<script src="/backend/handsontable/handsontable/dist/handsontable.full.min.js"></script>
<link rel="stylesheet" href="/backend/handsontable/handsontable/dist/handsontable.full.min.css">
<link rel="stylesheet" href="/backend/jstree/dist/themes/default/style.min.css" />
<link rel="stylesheet" href="/backend/ios.css">
<script src="/backend/jquery/jquery-3.7.1.min.js"></script>
<script src="/backend/jstree/dist/jstree.min.js"></script>
<script src="/backend/jquery/jquery-3.7.1.min.js"></script>
<style>
body {
@@ -192,21 +190,56 @@
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({'station': sessionStorage.getItem("stationNumber")})
})
.then(response => response.json())
.then(data => {
let treeData = buildJsTree(data);
$('#tree').jstree({ 'core': { 'data': treeData } });
})
.catch(error => console.error('Fehler beim Laden der Daten:', error));
}
function buildJsTree(data) {
return data.map(node => ({
id: node.id,
text: node.id + " | " + node.text,
children: node.children ? buildJsTree(node.children) : []
}));
}
.then(response => response.json())
.then(data => {
renderStationTree(data);
})
.catch(error => console.error('Fehler beim Laden der Daten:', error));
}
function renderStationTree(data) {
const tree = document.getElementById("tree");
tree.innerHTML = "";
tree.className = "touch-tree";
tree.appendChild(buildTouchTree(data));
}
function buildTouchTree(nodes) {
const list = document.createElement("div");
list.className = "touch-tree-list";
nodes.forEach(node => {
const children = node.children || [];
const title = node.id + " | " + node.text;
if (children.length > 0) {
const group = document.createElement("details");
group.className = "touch-tree-group";
group.open = true;
const summary = document.createElement("summary");
summary.textContent = title;
group.appendChild(summary);
group.appendChild(buildTouchTree(children));
list.appendChild(group);
return;
}
const button = document.createElement("button");
button.type = "button";
button.className = "touch-tree-leaf";
button.textContent = title;
button.addEventListener("click", function() {
sessionStorage.setItem("selectedStation", node.id);
const iframe = document.getElementById("config-iframe");
iframe.src = url + "/backend/Config.html?station=" + node.id;
openConfigModal();
});
list.appendChild(button);
});
return list;
}
function exportExcel() {
fetch(url + '/backend/api/getStationExport', {
@@ -305,24 +338,9 @@
document.getElementById("config-modal").style.display = "none";
}
$(document).ready(function() {
fetchTreeData();
$('#tree').on("dblclick.jstree", function (e) {
let node = $('#tree').jstree(true).get_node(e.target);
// Nur wenn kein weiterer Kindknoten vorhanden ist
if (node && node.children.length === 0) {
sessionStorage.setItem("selectedStation", node.id);
// Hier iframe-Source setzen, ggf. mit Parametern
let iframe = document.getElementById("config-iframe");
iframe.src = url + "/backend/Config.html?station=" + node.id;
// Modal öffnen
openConfigModal();
}
});
});
document.addEventListener("DOMContentLoaded", function() {
fetchTreeData();
});
</script>
</body>
</html>