From 588045ac04e1705718e90af88c8987bbf82ec72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesko=20Ansch=C3=BCtz?= Date: Fri, 27 Mar 2026 07:23:38 +0100 Subject: [PATCH] feat(ui): Zeitplan-Formular in Playlist-Verwaltung --- .../internal/httpapi/manage/templates.go | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/server/backend/internal/httpapi/manage/templates.go b/server/backend/internal/httpapi/manage/templates.go index 9e8e888..14a7c57 100644 --- a/server/backend/internal/httpapi/manage/templates.go +++ b/server/backend/internal/httpapi/manage/templates.go @@ -783,6 +783,10 @@ const manageTmpl = ` .display-state-badge.on { background:#dcfce7; color:#166534; } .display-state-badge.off { background:#fee2e2; color:#991b1b; } .display-state-badge.unknown { background:#f3f4f6; color:#6b7280; } + /* Schedule control */ + .schedule-row { display:flex; gap:.75rem; align-items:flex-end; flex-wrap:wrap; margin-top:.75rem; } + .schedule-row .field { margin:0; } + .schedule-row label { font-size:.75rem; color:#6b7280; display:block; margin-bottom:.2rem; font-weight:600; } @@ -951,6 +955,33 @@ const manageTmpl = ` onclick="sendDisplayCmd('off')">Ausschalten + +
+

Zeitplan

+ +
+
+ + +
+
+ + +
+
+

✓ Gespeichert

+
@@ -1129,6 +1160,35 @@ function sendDisplayCmd(state) { }).catch(function() { showToast('Netzwerkfehler', 'is-danger'); }); } +// ─── Schedule control ──────────────────────────────────────────────────────── +function saveSchedule() { + var slug = {{.Screen.Slug | printf "%q"}}; + var enabled = document.getElementById('schedule-enabled').checked; + var onTime = document.getElementById('power-on-time').value; + var offTime = document.getElementById('power-off-time').value; + fetch('/api/v1/screens/' + slug + '/schedule', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-CSRF-Token': getCsrf(), + 'X-Requested-With': 'fetch' + }, + body: JSON.stringify({ + schedule_enabled: enabled, + power_on_time: onTime, + power_off_time: offTime + }) + }).then(function(r) { + var ok = document.getElementById('schedule-save-ok'); + if (r.ok && ok) { + ok.classList.add('show'); + setTimeout(function() { ok.classList.remove('show'); }, 2000); + } else if (!r.ok) { + showToast('Zeitplan konnte nicht gespeichert werden', 'is-danger'); + } + }).catch(function() { showToast('Netzwerkfehler', 'is-danger'); }); +} + // ─── ?msg= toast ───────────────────────────────────────────────── (function() { var msg = new URLSearchParams(window.location.search).get('msg');