diff --git a/js/calendar.js b/js/calendar.js index cc12243..d6a127e 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -82,6 +82,12 @@ export function renderCalendar() { renderGrid(wrapper, exportBtn); }); + yearSel.addEventListener('change', () => { + currentYear = parseInt(yearSel.value); + loadPlanFromHistory(); + renderGrid(wrapper, exportBtn); + }); + genBtn.addEventListener('click', () => { if (state.employees.length === 0) { alert('Bitte zuerst Mitarbeiter hinzufügen.'); @@ -106,7 +112,7 @@ function loadPlanFromHistory() { const prefix = currentYear + '-' + String(currentMonth).padStart(2,'0'); currentPlan = state.history .filter(h => h.date.startsWith(prefix)) - .slice(); + .map(h => ({ ...h })); } function renderGrid(wrapper, exportBtn) {