diff --git a/app.js b/app.js index 0247623..6884375 100644 --- a/app.js +++ b/app.js @@ -335,9 +335,17 @@ class DienstplanApp { const month = parseInt(monthSelect.value); const year = parseInt(yearSelect.value); + const yearMonth = `${year}-${String(month).padStart(2, '0')}`; const employeeDuties = this.storage.getAllEmployeeDutiesForMonth(year, month); - const results = this.calculator.calculateAllEmployees(employeeDuties); + + // Build vacation map for this month: { name: boolean } + const vacationMap = {}; + Object.keys(employeeDuties).forEach(name => { + vacationMap[name] = this.storage.getVacationMode(name, yearMonth); + }); + + const results = this.calculator.calculateAllEmployees(employeeDuties, vacationMap); const monthNames = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']; @@ -350,6 +358,9 @@ class DienstplanApp { return; } + // Stash current calc context for vacation-toggle handler + this._currentCalcContext = { year, month, yearMonth }; + employees.forEach(employeeName => { const result = results[employeeName]; const resultCard = this.createResultCard(employeeName, result);