Workbench: backend target aktualisiert

This commit is contained in:
chris
2026-10-10 17:19:30 +00:00
parent 55c9acbfef
commit 04c952f9ae
119 changed files with 963 additions and 2080 deletions

View File

@@ -2,11 +2,10 @@
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Contacts Import / Export</title>
<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">
<title>Contacts Import / Export</title>
<script src="/backend/xlsx/xlsx.full.min.js"></script>
<script src="/backend/excel-preview.js"></script>
<style>
/* ===== BASE THEME (Workbench / HMI) ===== */
@@ -104,22 +103,14 @@ button:hover{
filter:brightness(1.1);
}
/* ===== HANDSONTABLE ===== */
#import-table{
flex:1;
overflow:hidden;
border-radius:14px;
border:1px solid var(--border);
}
.handsontable{
background:transparent;
}
.ht_master .wtHolder{
background:transparent;
}
</style>
#import-table{
flex:1;
overflow:auto;
border-radius:14px;
border:1px solid var(--border);
}
</style>
<link rel="stylesheet" href="/backend/ios.css">
</head>
<body>
@@ -148,12 +139,12 @@ button:hover{
</main>
<script>
document.addEventListener("DOMContentLoaded", function () {
let importedData = [];
let hot;
const url = sessionStorage.getItem("url");
const stationNumber = sessionStorage.getItem("stationNumber");
document.addEventListener("DOMContentLoaded", function () {
let importedData = [];
let currentHeaders = [];
const url = sessionStorage.getItem("url");
const stationNumber = sessionStorage.getItem("stationNumber");
function exportExcel() {
fetch(url + '/backend/api/getContact', {
@@ -190,36 +181,20 @@ document.addEventListener("DOMContentLoaded", function () {
if (jsonData.length < 2) return;
const headers = jsonData[0];
importedData = jsonData.slice(1)
currentHeaders = jsonData[0];
importedData = jsonData.slice(1)
.filter(row =>
Array.isArray(row) &&
row.some(cell => cell !== null && cell !== undefined && String(cell).trim() !== "")
);
if (hot) {
hot.loadData(importedData);
hot.updateSettings({ colHeaders: headers });
} else {
hot = new Handsontable(document.getElementById("import-table"), {
data: importedData,
colHeaders: headers,
rowHeaders: true,
width: '100%',
height: '100%',
licenseKey: 'non-commercial-and-evaluation'
});
}
WorkbenchExcelPreview.render("import-table", currentHeaders, importedData);
};
reader.readAsBinaryString(fileInput.files[0]);
}
function sendExcelData() {
const jsonData = importedData.map(row => {
const obj = {};
hot.getColHeader().forEach((h, i) => obj[h] = row[i] || "");
return obj;
});
function sendExcelData() {
const jsonData = WorkbenchExcelPreview.rowsToObjects(currentHeaders, importedData);
fetch(url + '/backend/api/updateContacts', {
method: 'POST',
@@ -234,10 +209,11 @@ document.addEventListener("DOMContentLoaded", function () {
.catch(err => alert("Fehler beim Senden: " + err.message));
}
document.getElementById("export-button").addEventListener("click", exportExcel);
document.getElementById("file-input").addEventListener("change", importExcelData);
document.getElementById("send-button").addEventListener("click", sendExcelData);
});
document.getElementById("export-button").addEventListener("click", exportExcel);
document.getElementById("file-input").addEventListener("change", importExcelData);
document.getElementById("send-button").addEventListener("click", sendExcelData);
WorkbenchExcelPreview.render("import-table", currentHeaders, importedData);
});
</script>
</body>