From 79a9262329b6e056ce6b58db307c2459668be892 Mon Sep 17 00:00:00 2001 From: Johannes Baumeister Date: Thu, 30 Apr 2026 14:37:49 +0200 Subject: [PATCH] Add auto-save logic for notes field (onblur) --- app.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app.js b/app.js index b1976ae..37ed564 100644 --- a/app.js +++ b/app.js @@ -1464,6 +1464,28 @@ document.addEventListener('DOMContentLoaded', async () => { }; }); + // NEU: Auto-Save für Notiz-Feld bei Verlassen (Blur) + document.querySelectorAll('.notiz-input').forEach(input => { + input.onblur = async (e) => { + const name = e.target.dataset.owner; + const notiz = e.target.value; + const sel = document.querySelector(`.status-select[data-owner="${name}"]`); + const status = sel ? sel.value : 'none'; + + state.ownerStatuses[name.toLowerCase()] = { status, notiz }; + + const data = owners[name]; + if (data) { + await secureOwner(data.first, data.last, e.target, status, notiz); + } + }; + + // Enter-Taste triggert ebenfalls Speichern + input.onkeydown = (e) => { + if (e.key === 'Enter') e.target.blur(); + }; + }); + // Add event listeners to secure buttons document.querySelectorAll('.btn-secure').forEach(btn => { btn.onclick = async (e) => {