Dateien nach "backend/src/main/webapp" hochladen

This commit is contained in:
2026-10-15 15:57:36 +02:00
parent db181d3020
commit 38fbe1e301
2 changed files with 362 additions and 290 deletions

View File

@@ -1,187 +1,242 @@
<!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, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Fertigungsbaum</title> <title>Fertigungsbaum</title>
<script src="/backend/xlsx/xlsx.full.min.js"></script> <script src="/backend/xlsx/xlsx.full.min.js"></script>
<script src="/backend/handsontable/handsontable/dist/handsontable.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/handsontable/handsontable/dist/handsontable.full.min.css">
<link rel="stylesheet" href="/backend/ios.css"> <link rel="stylesheet" href="/backend/ios.css">
<script src="/backend/jquery/jquery-3.7.1.min.js"></script> <script src="/backend/jquery/jquery-3.7.1.min.js"></script>
<style> <style>
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100vh; height: 100vh;
margin: 0; margin: 0;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
#tree-container { #tree-container {
width: 60%; width: 60%;
max-width: 800px; max-width: 800px;
background: white; background: white;
padding: 20px; padding: 20px;
border-radius: 10px; border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
} }
#tree { #tree {
max-height: 600px; max-height: 600px;
overflow-y: auto; overflow-y: auto;
} }
.button-container { .button-container {
position: fixed; position: fixed;
bottom: 20px; bottom: 20px;
right: 20px; right: 20px;
display: flex; display: flex;
gap: 10px; gap: 10px;
} }
.button-container button { .button-container button {
background-color: red; background-color: red;
color: white; color: white;
padding: 10px 20px; padding: 10px 20px;
border: none; border: none;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
} }
.modal { .modal {
display: none; display: none;
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.modal-content { .modal-content {
background: white; background: white;
padding: 20px; padding: 20px;
border-radius: 5px; border-radius: 5px;
width: 600px; width: 600px;
text-align: center; text-align: center;
position: relative; position: relative;
} }
.close { .close {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 10px; top: 10px;
font-size: 20px; font-size: 20px;
} }
#import-table { #import-table {
width: 100%; width: 100%;
margin-top: 10px; margin-top: 10px;
} }
/* Neues Modal für die Config.html */ /* Neues Modal für die Config.html */
#config-modal iframe { #config-modal iframe {
width: 100%; width: 100%;
height: 100%; height: 100%;
border: none; border: none;
} }
#config-modal { #config-modal {
position: fixed; position: fixed;
top: 0; left: 0; right: 0; bottom: 0; top: 0; left: 0; right: 0; bottom: 0;
background-color: rgba(0,0,0,0.6); /* halbtransparenter Hintergrund */ background-color: rgba(0,0,0,0.6); /* halbtransparenter Hintergrund */
display: none; /* per default ausgeblendet */ display: none; /* per default ausgeblendet */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 9999; /* ganz oben anzeigen */ z-index: 9999; /* ganz oben anzeigen */
} }
/* Der weiße Container im Overlay: hier auf 100% */ /* Der weiße Container im Overlay: hier auf 100% */
#config-modal-content { #config-modal-content {
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #fff; background-color: #fff;
position: relative; /* für den Close-Button */ position: relative; /* für den Close-Button */
} }
/* Kopfbereich mit Title + Close-Button (optional) */ /* Kopfbereich mit Title + Close-Button (optional) */
#config-modal-header { #config-modal-header {
background: #f2f2f2; background: #f2f2f2;
padding: 10px; padding: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
#config-modal-header h2 { #config-modal-header h2 {
margin: 0; margin: 0;
} }
#config-modal-close { #config-modal-close {
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;
} }
/* Körper: hier das iframe auf Vollbild */ /* Körper: hier das iframe auf Vollbild */
#config-modal-body { #config-modal-body {
width: 100%; width: 100%;
height: calc(100% - 50px); /* 50px = ungefährer Header-Höhenwert */ height: calc(100% - 50px); /* 50px = ungefährer Header-Höhenwert */
overflow: hidden; /* Kein Scrollen auf dem Container selbst */ overflow: hidden; /* Kein Scrollen auf dem Container selbst */
} }
</style>
</head>
<body> /* Fertigungsbaum: eindeutige Kontraste für alle Zustände */
<div id="config-modal"> .touch-tree-group,
<div id="config-modal-content"> .touch-tree-group[open] {
<div id="config-modal-header"> color: var(--itac-ink) !important;
<h2>Konfiguration</h2> background: var(--itac-soft) !important;
<span id="config-modal-close" onclick="closeConfigModal()">[X]</span> border-color: var(--itac-border) !important;
</div> }
<div id="config-modal-body"> .touch-tree-group > summary,
<iframe id="config-iframe"></iframe> .touch-tree-group > summary:hover,
</div> .touch-tree-group > summary:focus {
</div> color: var(--itac-slate) !important;
</div> -webkit-text-fill-color: var(--itac-slate) !important;
background: var(--itac-soft) !important;
<div id="tree-container"> border-radius: var(--itac-radius) !important;
<h2 style="text-align: center;">Fertigungsbaum</h2> outline: none;
<div id="tree"></div> }
</div> .touch-tree-group[open] > summary {
color: var(--itac-ink) !important;
<div class="button-container"> -webkit-text-fill-color: var(--itac-ink) !important;
<button onclick="exportExcel()">Excel Export</button> background: var(--itac-surface) !important;
<button onclick="openImportModal()">Excel Import</button> }
</div> .touch-tree-leaf,
.touch-tree-leaf:not(:hover):not(:focus):not(:active) {
<!-- Import-Modal --> color: var(--itac-ink) !important;
<div id="import-modal" class="modal"> -webkit-text-fill-color: var(--itac-ink) !important;
<div class="modal-content"> background: var(--itac-surface) !important;
<span class="close" onclick="closeImportModal()">&times;</span> border-color: var(--itac-border) !important;
<h3>Excel Datei hochladen</h3> box-shadow: none !important;
<input type="file" id="file-input" accept=".xlsx"> }
<div id="import-table"></div> .touch-tree-leaf::after {
<button onclick="importExcelData()">Importieren</button> color: var(--itac-red) !important;
<button onclick="sendExcelData()">Senden</button> -webkit-text-fill-color: var(--itac-red) !important;
</div> }
</div> .touch-tree-leaf:hover,
.touch-tree-leaf:focus,
.touch-tree-leaf:focus-visible,
.touch-tree-leaf:active,
.touch-tree-leaf.is-selected {
color: #fff !important;
-webkit-text-fill-color: #fff !important;
background: var(--itac-red-dark) !important;
border-color: var(--itac-red-dark) !important;
box-shadow: var(--itac-shadow) !important;
outline: none !important;
}
.touch-tree-leaf:hover::after,
.touch-tree-leaf:focus::after,
.touch-tree-leaf:focus-visible::after,
.touch-tree-leaf:active::after,
.touch-tree-leaf.is-selected::after {
color: #fff !important;
-webkit-text-fill-color: #fff !important;
}
</style>
</head>
<body>
<div id="config-modal">
<div id="config-modal-content">
<div id="config-modal-header">
<h2>Konfiguration</h2>
<span id="config-modal-close" onclick="closeConfigModal()">[X]</span>
</div>
<div id="config-modal-body">
<iframe id="config-iframe"></iframe>
</div>
</div>
</div>
<div id="tree-container">
<h2 style="text-align: center;">Fertigungsbaum</h2>
<div id="tree"></div>
</div>
<div class="button-container">
<button onclick="exportExcel()">Excel Export</button>
<button onclick="openImportModal()">Excel Import</button>
</div>
<!-- Import-Modal -->
<div id="import-modal" class="modal">
<div class="modal-content">
<span class="close" onclick="closeImportModal()">&times;</span>
<h3>Excel Datei hochladen</h3>
<input type="file" id="file-input" accept=".xlsx">
<div id="import-table"></div>
<button onclick="importExcelData()">Importieren</button>
<button onclick="sendExcelData()">Senden</button>
</div>
</div>
<script> <script>
let rawTable; let rawTable;
let importHot; let importHot;
const url = sessionStorage.getItem("url"); const url = sessionStorage.getItem("url");
function fetchTreeData() { function fetchTreeData() {
fetch(url + '/backend/api/getStations', { fetch(url + '/backend/api/getStations', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({'station': sessionStorage.getItem("stationNumber")}) body: JSON.stringify({'station': sessionStorage.getItem("stationNumber")})
}) })
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
renderStationTree(data); renderStationTree(data);
@@ -226,6 +281,12 @@
button.className = "touch-tree-leaf"; button.className = "touch-tree-leaf";
button.textContent = title; button.textContent = title;
button.addEventListener("click", function() { button.addEventListener("click", function() {
document.querySelectorAll(".touch-tree-leaf.is-selected").forEach(item => {
item.classList.remove("is-selected");
item.removeAttribute("aria-current");
});
button.classList.add("is-selected");
button.setAttribute("aria-current", "true");
sessionStorage.setItem("selectedStation", node.id); sessionStorage.setItem("selectedStation", node.id);
const iframe = document.getElementById("config-iframe"); const iframe = document.getElementById("config-iframe");
iframe.src = url + "/backend/Config.html?station=" + node.id; iframe.src = url + "/backend/Config.html?station=" + node.id;
@@ -236,45 +297,45 @@
return list; return list;
} }
function exportExcel() { function exportExcel() {
fetch(url + '/backend/api/getStationExport', { fetch(url + '/backend/api/getStationExport', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({'station': sessionStorage.getItem("stationNumber")}) body: JSON.stringify({'station': sessionStorage.getItem("stationNumber")})
}) })
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
data.sort((a, b) => data.sort((a, b) =>
a.line_nr.localeCompare(b.line_nr) || a.line_nr.localeCompare(b.line_nr) ||
a.line_bez.localeCompare(b.line_bez) || a.line_bez.localeCompare(b.line_bez) ||
a.ma_grp_nr.localeCompare(b.ma_grp_nr) || a.ma_grp_nr.localeCompare(b.ma_grp_nr) ||
a.ma_grp_bez.localeCompare(b.ma_grp_bez) || a.ma_grp_bez.localeCompare(b.ma_grp_bez) ||
a.kap_nr.localeCompare(b.kap_nr) || a.kap_nr.localeCompare(b.kap_nr) ||
a.kap_bez.localeCompare(b.kap_bez) a.kap_bez.localeCompare(b.kap_bez)
); );
const worksheet = XLSX.utils.json_to_sheet(data, { const worksheet = XLSX.utils.json_to_sheet(data, {
header: ["line_nr", "line_bez", "ma_grp_nr", "ma_grp_bez", "kap_nr", "kap_bez"] header: ["line_nr", "line_bez", "ma_grp_nr", "ma_grp_bez", "kap_nr", "kap_bez"]
}); });
const workbook = XLSX.utils.book_new(); const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, "Export"); XLSX.utils.book_append_sheet(workbook, worksheet, "Export");
XLSX.writeFile(workbook, "StationsExport.xlsx"); XLSX.writeFile(workbook, "StationsExport.xlsx");
}) })
.catch(error => { .catch(error => {
console.error('Fehler beim Excel-Export:', error); console.error('Fehler beim Excel-Export:', error);
alert('Fehler beim Excel-Export: ' + error.message); alert('Fehler beim Excel-Export: ' + error.message);
}); });
} }
function importExcelData() { function importExcelData() {
const fileInput = document.getElementById("file-input"); const fileInput = document.getElementById("file-input");
if (!fileInput.files.length) return; if (!fileInput.files.length) return;
const reader = new FileReader(); const reader = new FileReader();
reader.onload = function(event) { reader.onload = function(event) {
const workbook = XLSX.read(event.target.result, { type: "binary" }); const workbook = XLSX.read(event.target.result, { type: "binary" });
const sheet = workbook.Sheets[workbook.SheetNames[0]]; const sheet = workbook.Sheets[workbook.SheetNames[0]];
const data = XLSX.utils.sheet_to_json(sheet); const data = XLSX.utils.sheet_to_json(sheet);
if (!data.length) { if (!data.length) {
alert("Keine Daten in der Datei gefunden."); alert("Keine Daten in der Datei gefunden.");
@@ -299,56 +360,60 @@
wordWrap: false, wordWrap: false,
licenseKey: 'non-commercial-and-evaluation' licenseKey: 'non-commercial-and-evaluation'
}); });
}; };
reader.readAsBinaryString(fileInput.files[0]); reader.readAsBinaryString(fileInput.files[0]);
} }
function sendExcelData() { function sendExcelData() {
const stationNumber = sessionStorage.getItem("stationNumber") || "TEST"; const stationNumber = sessionStorage.getItem("stationNumber") || "TEST";
const filteredData = rawTable.map(item => ({ const filteredData = rawTable.map(item => ({
line_nr: item.line_nr, line_nr: item.line_nr,
line_bez: item.line_bez, line_bez: item.line_bez,
ma_grp_nr: item.ma_grp_nr, ma_grp_nr: item.ma_grp_nr,
ma_grp_bez: item.ma_grp_bez, ma_grp_bez: item.ma_grp_bez,
kap_nr: item.kap_nr, kap_nr: item.kap_nr,
kap_bez: item.kap_bez kap_bez: item.kap_bez
})); }));
let sendata = JSON.stringify({ let sendata = JSON.stringify({
station: stationNumber, station: stationNumber,
data: filteredData data: filteredData
}); });
console.log(sendata); console.log(sendata);
fetch(url + '/backend/api/updateStations', { fetch(url + '/backend/api/updateStations', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: sendata body: sendata
}) })
//.then(response => response.json()) //.then(response => response.json())
.then(result => alert("Daten erfolgreich gesendet!")) .then(result => alert("Daten erfolgreich gesendet!"))
.catch(error => alert("Fehler beim Senden der Daten: " + error.message)); .catch(error => alert("Fehler beim Senden der Daten: " + error.message));
} }
// Modal-Steuerung für den Import-Dialog // Modal-Steuerung für den Import-Dialog
function openImportModal() { function openImportModal() {
document.getElementById("import-modal").style.display = "flex"; document.getElementById("import-modal").style.display = "flex";
} }
function closeImportModal() { function closeImportModal() {
document.getElementById("import-modal").style.display = "none"; document.getElementById("import-modal").style.display = "none";
} }
// Modal-Steuerung für das Config-Dialog // Modal-Steuerung für das Config-Dialog
function openConfigModal() { function openConfigModal() {
document.getElementById("config-modal").style.display = "flex"; document.getElementById("config-modal").style.display = "flex";
} }
function closeConfigModal() { function closeConfigModal() {
document.getElementById("config-modal").style.display = "none"; document.getElementById("config-modal").style.display = "none";
} document.querySelectorAll(".touch-tree-leaf.is-selected").forEach(item => {
item.classList.remove("is-selected");
item.removeAttribute("aria-current");
});
}
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
fetchTreeData(); fetchTreeData();
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@@ -671,41 +671,48 @@ tbody tr:hover {
} }
/* Button text and highlighted rows: keep sufficient contrast. */ /* Navigation contrast: menu buttons are not primary action buttons. */
button, .touch-nav .nav-item,
button strong, .touch-nav .nav-item:hover,
button small, .touch-nav .nav-item:focus {
button span, color: var(--itac-ink) !important;
button .label, -webkit-text-fill-color: var(--itac-ink) !important;
button .sub { background: rgba(255,255,255,0.82) !important;
color: #fff !important; border-color: transparent !important;
-webkit-text-fill-color: #fff !important; box-shadow: none !important;
} }
button.secondary, .touch-nav .nav-item span {
button.secondary strong, color: var(--itac-ink) !important;
button.secondary small, -webkit-text-fill-color: var(--itac-ink) !important;
button.secondary span,
.pill,
.lang-switch {
color: var(--itac-slate) !important;
-webkit-text-fill-color: var(--itac-slate) !important;
} }
button[aria-expanded="true"], .touch-nav .nav-item small {
button.active, color: var(--itac-muted) !important;
.nav-item.active.is-highlighted, -webkit-text-fill-color: var(--itac-muted) !important;
.is-highlighted { }
.touch-nav .nav-item.active,
.touch-nav .nav-item.active:hover,
.touch-nav .nav-item.active:focus {
color: #fff !important; color: #fff !important;
-webkit-text-fill-color: #fff !important; -webkit-text-fill-color: #fff !important;
background: var(--itac-red-dark) !important; background: var(--itac-red-dark) !important;
border-color: var(--itac-red-dark) !important; border-color: var(--itac-red-dark) !important;
box-shadow: inset 4px 0 0 var(--itac-red-light), 0 8px 18px rgba(36,55,70,.12) !important;
} }
button[aria-expanded="true"] *, .touch-nav .nav-item.active span,
button.active *, .touch-nav .nav-item.active small {
.nav-item.active.is-highlighted *, color: #fff !important;
.is-highlighted * { -webkit-text-fill-color: #fff !important;
}
/* Primary action and expanded/highlighted controls keep white text. */
button.primary-action,
button.primary-action *,
button[aria-expanded="true"]:not(.nav-item),
button[aria-expanded="true"]:not(.nav-item) * {
color: #fff !important; color: #fff !important;
-webkit-text-fill-color: #fff !important; -webkit-text-fill-color: #fff !important;
} }