getMessage(); } function adminAbsenceStatusLabel(?string $status): string { $status = trim((string)$status); if ($status === '' || $status === 'beantragt') { return 'Beantragt'; } if ($status === 'genehmigt') { return 'Genehmigt'; } if ($status === 'abgelehnt') { return 'Abgelehnt'; } return ucfirst($status); } function adminAbsenceColor(string $reason, string $status): string { $reason = vacationAbsenceNormalizeReason($reason); $status = trim(strtolower($status)); $palette = [ 'urlaub' => '#2f855a', 'krankheit_mit_atest' => '#c53030', 'krankheit_ohne_atest' => '#9b2c2c', 'berufsschule' => '#dd6b20', 'weiterbildung' => '#6b46c1', 'persoenliche_gruende' => '#4a5568', 'sonstiges' => '#718096', ]; $color = $palette[$reason] ?? '#2d3748'; if ($status === 'beantragt') { return $color; } return $color; } function adminAbsenceEventTitle(array $row): string { $employee = trim(($row['vorname'] ?? '') . ' ' . ($row['nachname'] ?? '')); $reasonLabel = vacationAbsenceReasonLabel($row['absence_reason'] ?? 'urlaub'); $statusLabel = adminAbsenceStatusLabel($row['status'] ?? ''); if ($employee === '') { return $reasonLabel . ' (' . $statusLabel . ')'; } if ($statusLabel !== 'Genehmigt') { return $employee . ' · ' . $reasonLabel . ' (' . $statusLabel . ')'; } return $employee . ' · ' . $reasonLabel; } $events = []; $vacStmt = $pdo->prepare(" SELECT v.id, v.user_id, v.start_date, v.end_date, v.days, v.status, v.comment_user, v.absence_reason, u.vorname, u.nachname, u.email FROM vacations v JOIN users u ON u.id = v.user_id WHERE LOWER(TRIM(COALESCE(v.status, ''))) != 'abgelehnt' ORDER BY v.start_date ASC, v.end_date ASC, u.nachname ASC, u.vorname ASC "); $vacStmt->execute(); $vacations = $vacStmt->fetchAll(PDO::FETCH_ASSOC); foreach ($vacations as $row) { $endInclusive = (new DateTime($row['end_date']))->modify('+1 day')->format('Y-m-d'); $reason = vacationAbsenceNormalizeReason($row['absence_reason'] ?? 'urlaub'); $status = trim((string)($row['status'] ?? '')); $statusLabel = adminAbsenceStatusLabel($status); $events[] = [ 'id' => 'vac_' . $row['id'], 'title' => adminAbsenceEventTitle($row), 'start' => $row['start_date'], 'end' => $endInclusive, 'allDay' => true, 'backgroundColor' => adminAbsenceColor($reason, $status), 'borderColor' => adminAbsenceColor($reason, $status), 'extendedProps' => [ 'type' => 'absence', 'user_id' => $row['user_id'], 'employee_name' => trim(($row['vorname'] ?? '') . ' ' . ($row['nachname'] ?? '')), 'email' => $row['email'] ?? '', 'status' => $status, 'status_label' => $statusLabel, 'reason' => $reason, 'reason_label' => vacationAbsenceReasonLabel($reason), 'days' => (int)($row['days'] ?? 0), 'comment' => $row['comment_user'] ?? '', ], ]; } $companyStmt = $pdo->prepare(" SELECT id, start_date, end_date, description FROM company_holidays ORDER BY start_date ASC, end_date ASC "); $companyStmt->execute(); $companyHolidays = $companyStmt->fetchAll(PDO::FETCH_ASSOC); foreach ($companyHolidays as $row) { $endInclusive = (new DateTime($row['end_date']))->modify('+1 day')->format('Y-m-d'); $events[] = [ 'id' => 'com_' . $row['id'], 'title' => $row['description'] ?: 'Betriebsurlaub', 'start' => $row['start_date'], 'end' => $endInclusive, 'allDay' => true, 'backgroundColor' => '#005f73', 'borderColor' => '#005f73', 'extendedProps' => [ 'type' => 'company', 'description' => $row['description'] ?: 'Betriebsurlaub', ], ]; } include 'header.php'; ?>

Leitungskalender

Hinweis: Dieser Kalender zeigt alle Abwesenheiten aller Personen sowie Betriebsurlaub.

Urlaub Krankheit mit Attest Krankheit ohne Attest Berufsschule Weiterbildung Persönliche Gründe Sonstiges Betriebsurlaub