feat(heures) : colonne nom -25% et statut sur la couleur de l'absence en BDD
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -110,7 +110,7 @@ class YearlyHoursExportBuilder
|
||||
*
|
||||
* @param list<Employee> $employees
|
||||
*
|
||||
* @return list<array{employeeId:int, employeeName:string, statut:?string,
|
||||
* @return list<array{employeeId:int, employeeName:string, statut:?string, statutColor:?string,
|
||||
* morningFrom:string, morningTo:string, afternoonFrom:string, afternoonTo:string,
|
||||
* eveningFrom:string, eveningTo:string, dayHours:string, nightHours:string,
|
||||
* total:string, isWeekend:bool, isHoliday:bool}>
|
||||
@@ -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<string, int>, labels: array<string, string>, absentMorning: array<string, bool>, absentAfternoon: array<string, bool>, hasDayAbsence: array<string, bool>}
|
||||
* @return array{credited: array<string, int>, labels: array<string, string>, colors: array<string, string>, absentMorning: array<string, bool>, absentAfternoon: array<string, bool>, hasDayAbsence: array<string, bool>}
|
||||
*/
|
||||
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,
|
||||
|
||||
@@ -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; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -28,14 +27,14 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 28%;">Nom</th>
|
||||
<th style="width: 12%;">Statut</th>
|
||||
<th style="width: 7%;">Début matin</th>
|
||||
<th style="width: 7%;">Fin matin</th>
|
||||
<th style="width: 7%;">Début après-midi</th>
|
||||
<th style="width: 7%;">Fin après-midi</th>
|
||||
<th style="width: 7%;">Début soir</th>
|
||||
<th style="width: 7%;">Fin soir</th>
|
||||
<th style="width: 21%;">Nom</th>
|
||||
<th style="width: 13%;">Statut</th>
|
||||
<th style="width: 8%;">Début matin</th>
|
||||
<th style="width: 8%;">Fin matin</th>
|
||||
<th style="width: 8%;">Début après-midi</th>
|
||||
<th style="width: 8%;">Fin après-midi</th>
|
||||
<th style="width: 8%;">Début soir</th>
|
||||
<th style="width: 8%;">Fin soir</th>
|
||||
<th style="width: 6%;">Jour</th>
|
||||
<th style="width: 6%;">Nuit</th>
|
||||
<th style="width: 6%;">Total</th>
|
||||
@@ -49,7 +48,7 @@
|
||||
{% for row in group.rows %}
|
||||
<tr class="{{ row.isWeekend ? 'weekend' : '' }}">
|
||||
<td class="name">{{ row.employeeName }}</td>
|
||||
<td class="{{ row.statut ? 'statut' : '' }}">{{ row.statut }}</td>
|
||||
<td{% if row.statutColor %} style="background: {{ row.statutColor }};"{% endif %}>{{ row.statut }}</td>
|
||||
<td>{{ row.morningFrom }}</td>
|
||||
<td>{{ row.morningTo }}</td>
|
||||
<td>{{ row.afternoonFrom }}</td>
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user