diff --git a/src/Service/WorkHours/YearlyHoursExportBuilder.php b/src/Service/WorkHours/YearlyHoursExportBuilder.php index 1399ef5..71471d3 100644 --- a/src/Service/WorkHours/YearlyHoursExportBuilder.php +++ b/src/Service/WorkHours/YearlyHoursExportBuilder.php @@ -110,7 +110,7 @@ class YearlyHoursExportBuilder * * @param list $employees * - * @return list @@ -158,15 +158,19 @@ class YearlyHoursExportBuilder $workDaysMap[$employeeId][$ymd] ?? null, ); - $statut = $absenceData['labels'][$ymd] ?? null; + $statut = $absenceData['labels'][$ymd] ?? null; + $statutColor = ($absenceData['colors'][$ymd] ?? '') ?: null; if (null === $statut && null !== $holidayLabel) { - $statut = $holidayLabel; + // Férié sans absence : badge bleu clair, comme la vue Jour. + $statut = $holidayLabel; + $statutColor = '#b3e5fc'; } $row = [ 'employeeId' => $employeeId, 'employeeName' => trim(($employee->getLastName() ?? '').' '.($employee->getFirstName() ?? '')), 'statut' => $statut, + 'statutColor' => $statutColor, 'morningFrom' => '', 'morningTo' => '', 'afternoonFrom' => '', @@ -292,12 +296,13 @@ class YearlyHoursExportBuilder } /** - * @return array{credited: array, labels: array, absentMorning: array, absentAfternoon: array, hasDayAbsence: array} + * @return array{credited: array, labels: array, colors: array, absentMorning: array, absentAfternoon: array, hasDayAbsence: array} */ private function resolveAbsenceDataForEmployee(array $absences, array $days, Employee $employee): array { $credited = []; $labels = []; + $colors = []; $absentMorning = []; $absentAfternoon = []; $hasDayAbsence = []; @@ -318,6 +323,7 @@ class YearlyHoursExportBuilder $absentAfternoon[$date] = ($absentAfternoon[$date] ?? false) || $isAfternoon; if (!isset($labels[$date])) { $labels[$date] = $absence->getType()?->getLabel() ?? ''; + $colors[$date] = $absence->getType()?->getColor() ?? ''; } } @@ -329,6 +335,7 @@ class YearlyHoursExportBuilder return [ 'credited' => $credited, 'labels' => $labels, + 'colors' => $colors, 'absentMorning' => $absentMorning, 'absentAfternoon' => $absentAfternoon, 'hasDayAbsence' => $hasDayAbsence, diff --git a/templates/work-hour-day-export/print.html.twig b/templates/work-hour-day-export/print.html.twig index 4fc5d82..e2f73f8 100644 --- a/templates/work-hour-day-export/print.html.twig +++ b/templates/work-hour-day-export/print.html.twig @@ -16,7 +16,6 @@ td.name { text-align: left; } tr.site-title td { font-weight: bold; font-size: 11px; text-transform: uppercase; text-align: left; padding: 2px 6px; white-space: nowrap; } tr.weekend td { background: #c0c0c0; } - td.statut { background: #b3e5fc; } @@ -28,14 +27,14 @@ - - - - - - - - + + + + + + + + @@ -49,7 +48,7 @@ {% for row in group.rows %} - + {{ row.statut }} diff --git a/tests/Service/WorkHours/YearlyHoursDayRowsTest.php b/tests/Service/WorkHours/YearlyHoursDayRowsTest.php index ba2974b..6ede5f6 100644 --- a/tests/Service/WorkHours/YearlyHoursDayRowsTest.php +++ b/tests/Service/WorkHours/YearlyHoursDayRowsTest.php @@ -100,6 +100,7 @@ final class YearlyHoursDayRowsTest extends TestCase self::assertSame('8h', $rows[0]['dayHours']); self::assertSame('', $rows[0]['nightHours']); self::assertNull($rows[0]['statut']); + self::assertNull($rows[0]['statutColor']); self::assertFalse($rows[0]['isWeekend']); }
NomStatutDébut matinFin matinDébut après-midiFin après-midiDébut soirFin soirNomStatutDébut matinFin matinDébut après-midiFin après-midiDébut soirFin soir Jour Nuit Total
{{ row.employeeName }}{{ row.statut }}{{ row.morningFrom }} {{ row.morningTo }} {{ row.afternoonFrom }}