fix: wire year selector and fix shallow copy in loadPlanFromHistory

This commit is contained in:
Ferdinand
2026-04-08 13:25:36 +02:00
parent bcdba20e09
commit b9fb08299e

View File

@@ -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) {