diff --git a/backend/src/main/webapp/Config.html b/backend/src/main/webapp/Config.html
index ddcb725..e9cfae7 100644
--- a/backend/src/main/webapp/Config.html
+++ b/backend/src/main/webapp/Config.html
@@ -1,531 +1,462 @@
-
-
-
+
+
+
- Config
-
-
-
-
-
-
- Station
-
-
-
-
-
-
-
-
-
-
+ Config
+
+
+
+
+
+
+ Station
+
+
+
+
-
-
-
+}
+
+/* 3) Tabulator: editierbare Werte, Suche und sortierbares Ein/Aus am Tabellenende */
+function switchFormatter(cell){const on=cell.getValue()===true;const e=document.createElement("span");e.className="parameter-switch"+(on?" is-on":"");e.innerHTML='';return e}
+function valueFormatter(cell){return typeof cell.getValue()==="boolean"?switchFormatter(cell):(cell.getValue()??"")}
+function valueEditor(cell,onRendered,success,cancel){const value=cell.getValue();if(typeof value==="boolean"){success(!value);return false}const input=document.createElement("input");input.type="text";input.value=value??"";input.style.cssText="width:100%;height:100%;border:0;padding:6px";onRendered(()=>{input.focus();input.select()});input.addEventListener("blur",()=>success(input.value));input.addEventListener("keydown",e=>{if(e.key==="Enter")success(input.value);if(e.key==="Escape")cancel()});return input}
+function toggleCell(event,cell){event.preventDefault();event.stopPropagation();cell.setValue(cell.getValue()!==true)}
+function booleanSorter(a,b){return Number(a===true)-Number(b===true)}
+function applyTableFilters(){if(!table)return;const q=document.getElementById("globalSearch").value.trim().toLowerCase(),state=document.getElementById("activeFilter").value;table.setFilter(data=>{const text=!q||[data.code_nr,data.description,data.code_wert,data.changedby,data.timestamp].some(v=>String(v??"").toLowerCase().includes(q));const status=state==="all"||(state==="active"?data.used===true:data.used!==true);return text&&status});updateFilterCount()}
+function updateFilterCount(){if(table)document.getElementById("filterCount").textContent=table.getRows("active").length+" / "+table.getData().length}
+let table;
+document.addEventListener("DOMContentLoaded",function(){table=new Tabulator("#hot",{data:transformData(myDataRaw),index:"code_nr",height:Math.max(320,window.innerHeight-160)+"px",layout:"fitDataStretch",responsiveLayout:false,movableColumns:true,placeholder:"Keine Parameter gefunden",rowHeader:{formatter:"rownum",headerSort:false,width:48},columns:[
+{title:"Code",field:"code_nr",sorter:"number",width:90,frozen:true,headerFilter:"input"},
+{title:"Beschreibung",field:"description",minWidth:300,widthGrow:4,headerFilter:"input"},
+{title:"Wert",field:"code_wert",minWidth:160,widthGrow:2,formatter:valueFormatter,editor:valueEditor,editable:true,headerFilter:"input",cssClass:"value-editable",cellClick:function(e,c){if(typeof c.getValue()==="boolean")toggleCell(e,c);else c.edit(true)}},
+{title:"Geändert von",field:"changedby",minWidth:130,headerFilter:"input"},{title:"Geändert am",field:"timestamp",minWidth:170,headerFilter:"input"},
+{title:"Ein / Aus",field:"used",width:120,hozAlign:"center",headerHozAlign:"center",formatter:switchFormatter,cellClick:toggleCell,headerSort:true,sorter:booleanSorter,cssClass:"switch-cell"}
+]});
+table.on("dataFiltered",updateFilterCount);table.on("dataLoaded",updateFilterCount);document.getElementById("globalSearch").addEventListener("input",applyTableFilters);document.getElementById("activeFilter").addEventListener("change",applyTableFilters);updateFilterCount();window.addEventListener("resize",()=>{table.setHeight(Math.max(320,window.innerHeight-160));table.redraw(true)})});
+/*
+ 5a) getConfig() =>
+ Lädt vom Server (z.B. '/backend/api/getStationConfig') und merged
+*/
+function getConfig() {
+ fetch(url + '/backend/api/getStationConfig', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ station: stationNumber })
+ })
+ .then(response => {
+ if (!response.ok) {
+ throw new Error(`Server error: ${response.status}`);
+ }
+ return response.json();
+ })
+ .then(data => {
+ if (!data || data.length === 0) {
+ alert("Keine Daten zum Importieren.");
+ return;
+ }
+
+ // Merge mit myDataRaw:
+ // Für jedes Item in 'data' => passendes localItem
+ data.forEach(apiItem => {
+ const localItem = myDataRaw.find(x => x.code_nr === apiItem.code_nr);
+ if (localItem) {
+ // Felder anpassen
+ localItem.code_wert = apiItem.code_wert;
+ localItem.used = "USED";
+ localItem.timestamp = formatTimestampToYMDHMS(apiItem.timestamp);
+ localItem.changedby = apiItem.changedby;
+ } else {
+ // optional: Neu hinzufügen
+ // myDataRaw.push(apiItem);
+ }
+ });
+
+ // Neu transformieren & in Tabulator laden
+ const newData = transformData(myDataRaw);
+ table.replaceData(newData).then(applyTableFilters);
+
+ //alert("Daten gemerged & aktualisiert!");
+ })
+ .catch(err => {
+ console.error("Fehler bei getStationConfig:", err);
+ alert("Fehler beim Laden der Daten!");
+ });
+}
+
+
+function formatTimestampToYMDHMS(timestampNumber) {
+ const dateObj = new Date(timestampNumber); // ms seit 1970
+
+ const yyyy = dateObj.getFullYear();
+ const MM = String(dateObj.getMonth() + 1).padStart(2, "0"); // Monat 1-based
+ const dd = String(dateObj.getDate()).padStart(2, "0");
+ const HH = String(dateObj.getHours()).padStart(2, "0");
+ const mm = String(dateObj.getMinutes()).padStart(2, "0");
+ const ss = String(dateObj.getSeconds()).padStart(2, "0");
+
+ // z.B. "2021-02-08 15:50:49"
+ return `${yyyy}-${MM}-${dd} ${HH}:${mm}:${ss}`;
+}
+
+/*
+ 5b) setConfig() =>
+ Liest nur used==true aus der Tabelle,
+ wandelt true => "USED" etc.
+ => sendet an '/backend/api/setStationConfig'
+*/
+function setConfig() {
+ // 1) Daten aus Tabulator
+ const allRows = table.getData();
+
+ // 2) Filtern: Nur used === true
+ const usedRows = allRows.filter(row => row.used === true);
+
+ // 3) "used" => "USED" und ggf. Felder leeren
+ const finalData = usedRows.map(item => {
+ // Neues Objekt aus dem Original (damit wir nicht direkt in allRows schreiben)
+ const newObj = { ...item };
+
+ // used = "USED"
+ newObj.used = "USED";
+ if (typeof newObj.code_wert === "boolean") {
+ // true => "true", false => "false"
+ newObj.code_wert = newObj.code_wert ? "true" : "false";
+ }
+
+
+ // Wenn gewünscht: Andere Felder leeren
+ // newObj.code_nr = "";
+ // newObj.description = "";
+ // newObj.code_wert = "";
+ // newObj.changedby = "";
+ // newObj.timestamp = "";
+
+ return newObj;
+ });
+
+ if (finalData.length === 0) {
+ alert("Keine Zeilen mit 'used' = true gefunden!");
+ return;
+ }
+
+ // 4) fetch an /backend/api/setStationConfig
+ fetch(url + "/backend/api/setStationConfig", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ station: stationNumber,
+ persID: persID,
+ data: finalData
+ })
+ })
+ .then(response => {
+ if (!response.ok) {
+ throw new Error("Server error: " + response.status);
+ }
+ return response.json();
+ })
+ .then(result => {
+ alert("Save successfully!");
+ console.log("SetStationConfig result:", result);
+ })
+ .catch(err => {
+ console.error("Fehler bei setStationConfig:", err);
+ alert("Fehler beim Speichern.");
+ });
+}
+
+getConfig();
+
+
+
+
diff --git a/backend/src/main/webapp/Contacts.html b/backend/src/main/webapp/Contacts.html
index 45fb226..ddcd028 100644
--- a/backend/src/main/webapp/Contacts.html
+++ b/backend/src/main/webapp/Contacts.html
@@ -1,150 +1,134 @@
-
-
-
+
+
+
- Excel Contact Import & Export
-
-
-
+ Excel Contact Import & Export
+
+
+
-
-
-
-
-
Excel Export & Import
-
-
-
-
-
-
-
-
-
+
+
+
+
+
Excel Export & Import
+
+
+
+
+
+
+
+
+
+
+
diff --git a/backend/src/main/webapp/ErpAdd.html b/backend/src/main/webapp/ErpAdd.html
index 08c0e19..4a31af4 100644
--- a/backend/src/main/webapp/ErpAdd.html
+++ b/backend/src/main/webapp/ErpAdd.html
@@ -1,154 +1,134 @@
-
-
-
+
+
+
- Excel Contact Import & Export
-
-
-
+ Excel ERP Groups Import & Export
+
+
+
-
-
-
-
-
Excel Export & Import
-
-
-
-
-
-
-
-
-
+
+
+
+
+
Excel Export & Import
+
+
+
+
+
+
+
+
+
+
+