From ac5996693f51b8e9b19db048f8d19d6234e7d8a1 Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Tue, 5 May 2026 17:46:12 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Termine=20in=20unchecked=20Kalendern=20e?= =?UTF-8?q?rstellen=20+=20HA-Kalender=20als=20Kopier-Ziel=20-=20populateCa?= =?UTF-8?q?lendarSelect:=20filtert=20jetzt=20nach=20!sidebar=5Fhidden=20st?= =?UTF-8?q?att=20=20=20enabled.=20Unchecked=20(versteckte)=20Kalender=20bl?= =?UTF-8?q?eiben=20so=20im=20=20=20Termin-erstellen-Dropdown=20verf=C3=BCg?= =?UTF-8?q?bar=20-=20buildWritableCalendars:=20HA-Kalender=20werden=20als?= =?UTF-8?q?=20Kopier-Ziele=20aufgef=C3=BChrt=20-=20copyEventToCalendar:=20?= =?UTF-8?q?routet=20HA-Ziele=20=C3=BCber=20/homeassistant/events=20=20=20E?= =?UTF-8?q?ndpoint=20(vorher=20fielen=20sie=20in=20den=20CalDAV-Fallback)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/js/calendar.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/frontend/js/calendar.js b/frontend/js/calendar.js index c2c38a5..fca22db 100644 --- a/frontend/js/calendar.js +++ b/frontend/js/calendar.js @@ -1071,9 +1071,9 @@ document.addEventListener('click', e => { function populateCalendarSelect(selectedId) { const sel = document.getElementById('ev-calendar'); sel.innerHTML = ''; - // CalDAV calendars + // CalDAV calendars (show all that aren't removed from sidebar, even if unchecked) state.accounts.forEach(acc => { - acc.calendars.filter(c => c.enabled).forEach(cal => { + acc.calendars.filter(c => !c.sidebar_hidden).forEach(cal => { const opt = document.createElement('option'); opt.value = cal.id; opt.textContent = `${acc.name} / ${cal.name}`; @@ -1082,7 +1082,7 @@ function populateCalendarSelect(selectedId) { }); }); // Local calendars - state.localCalendars.filter(c => c.enabled).forEach(cal => { + state.localCalendars.filter(c => !c.sidebar_hidden).forEach(cal => { const opt = document.createElement('option'); opt.value = `local-${cal.id}`; opt.textContent = cal.name; @@ -1092,7 +1092,7 @@ function populateCalendarSelect(selectedId) { // iCal subscriptions are read-only, not shown here // Google calendars (read/write) state.googleAccounts.forEach(acc => { - acc.calendars.filter(c => c.enabled).forEach(cal => { + acc.calendars.filter(c => !c.sidebar_hidden).forEach(cal => { const opt = document.createElement('option'); opt.value = `google-${cal.id}`; opt.textContent = `${acc.email} / ${cal.name}`; @@ -1102,7 +1102,7 @@ function populateCalendarSelect(selectedId) { }); // Home Assistant calendars state.haAccounts.forEach(acc => { - acc.calendars.filter(c => c.enabled).forEach(cal => { + acc.calendars.filter(c => !c.sidebar_hidden).forEach(cal => { const opt = document.createElement('option'); opt.value = `homeassistant-${cal.id}`; opt.textContent = `${acc.name} / ${cal.name}`; @@ -2512,6 +2512,7 @@ function buildWritableCalendars(_excludeEv) { } } for (const cal of state.localCalendars) { + if (cal.sidebar_hidden) continue; list.push({ _idx: idx++, id: cal.id, name: cal.name, color: cal.color || '#34a853', type: 'local' }); } for (const acc of state.googleAccounts) { @@ -2520,6 +2521,12 @@ function buildWritableCalendars(_excludeEv) { list.push({ _idx: idx++, id: cal.id, name: `${acc.email} / ${cal.name}`, color: cal.color || '#4285f4', type: 'google' }); } } + for (const acc of state.haAccounts) { + for (const cal of acc.calendars) { + if (cal.sidebar_hidden) continue; + list.push({ _idx: idx++, id: cal.id, name: `${acc.name} / ${cal.name}`, color: cal.color || '#03a9f4', type: 'homeassistant' }); + } + } return list; } @@ -2540,6 +2547,11 @@ async function copyEventToCalendar(ev, cal) { calendar_id: cal.id, title, start, end, allDay, location: location || '', description: description || '', color: color || null, }); + } else if (cal.type === 'homeassistant') { + await api.post('/homeassistant/events', { + calendar_id: cal.id, title, start, end, allDay, + location: location || '', description: description || '', + }); } else { await api.post('/caldav/events', { calendar_id: cal.id, title, start, end, allDay,