Krankheitstage
This commit is contained in:
@@ -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
|
||||
});
|
||||
});
|
||||
|
||||
@@ -316,6 +316,11 @@
|
||||
${data.remainingVacation !== undefined ? `<span style="color: #28a745;">(verbleibend: ${data.remainingVacation.toFixed(1)} Tage)</span>` : ''}
|
||||
</div>`;
|
||||
}
|
||||
if (data.sickDays !== undefined && data.sickDays > 0) {
|
||||
statsHTML += `<div class="stats-inline" style="display: inline-block; margin-right: 20px;">
|
||||
<strong>Krankheitstage:</strong> <span style="color: #e74c3c;">${data.sickDays} Tag${data.sickDays !== 1 ? 'e' : ''}</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
if (statsHTML) {
|
||||
statsDiv.insertAdjacentHTML('beforeend', statsHTML);
|
||||
|
||||
Reference in New Issue
Block a user