diff --git a/routes/verwaltung.js b/routes/verwaltung.js index 6b1379d..a297d7c 100644 --- a/routes/verwaltung.js +++ b/routes/verwaltung.js @@ -152,7 +152,7 @@ function registerVerwaltungRoutes(app) { const overtimeOffsetHours = user.overtime_offset_hours ? parseFloat(user.overtime_offset_hours) : 0; // Einträge für die Woche abrufen - db.all(`SELECT date, total_hours, overtime_taken_hours, vacation_type + db.all(`SELECT date, total_hours, overtime_taken_hours, vacation_type, sick_status FROM timesheet_entries WHERE user_id = ? AND date >= ? AND date <= ? ORDER BY date`, @@ -167,12 +167,18 @@ function registerVerwaltungRoutes(app) { let overtimeTaken = 0; let vacationDays = 0; let vacationHours = 0; + let sickDays = 0; entries.forEach(entry => { if (entry.overtime_taken_hours) { overtimeTaken += entry.overtime_taken_hours; } + // Krankheitstage zählen + if (entry.sick_status === 1 || entry.sick_status === true) { + sickDays += 1; + } + // Urlaub hat Priorität - wenn Urlaub, zähle nur Urlaubsstunden, nicht zusätzlich Arbeitsstunden if (entry.vacation_type === 'full') { vacationDays += 1; @@ -229,6 +235,7 @@ function registerVerwaltungRoutes(app) { remainingOvertimeWithOffset, vacationDays, remainingVacation, + sickDays, workdays }); }); diff --git a/views/verwaltung.ejs b/views/verwaltung.ejs index bfa6327..f02bc80 100644 --- a/views/verwaltung.ejs +++ b/views/verwaltung.ejs @@ -316,6 +316,11 @@ ${data.remainingVacation !== undefined ? `(verbleibend: ${data.remainingVacation.toFixed(1)} Tage)` : ''} `; } + if (data.sickDays !== undefined && data.sickDays > 0) { + statsHTML += `