feat(heures) : codes d'absence, total en gras et légende sur l'export PDF jour (#25)
Auto Tag Develop / tag (push) Successful in 7s
Auto Tag Develop / tag (push) Successful in 7s
Affinements de l'export PDF des heures (vue Jour) : - **Colonne Statut** : affiche le **code** du type d'absence (ex. `AT`) au lieu du libellé, sur sa couleur de fond. Férié sans absence inchangé (nom du férié sur fond bleu clair). - **Colonne Total** en gras. - **Légende** sous le tableau : carré coloré contenant le code + libellé à droite, 6 éléments par ligne, triée et dédupliquée (hors férié). - **Bouton Exporter masqué en vue Semaine** (visible uniquement en vue Jour). Docs mises à jour : `doc/hours-day-export.md`, `frontend/data/documentation-content.ts`, `CLAUDE.md`. Tests backend verts (173/361). Reviewed-on: #25 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #25.
This commit is contained in:
@@ -110,7 +110,7 @@ class YearlyHoursExportBuilder
|
||||
*
|
||||
* @param list<Employee> $employees
|
||||
*
|
||||
* @return list<array{employeeId:int, employeeName:string, statut:?string, statutColor:?string,
|
||||
* @return list<array{employeeId:int, employeeName:string, statut:?string, statutLabel:?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,11 +158,14 @@ class YearlyHoursExportBuilder
|
||||
$workDaysMap[$employeeId][$ymd] ?? null,
|
||||
);
|
||||
|
||||
$statut = $absenceData['labels'][$ymd] ?? null;
|
||||
// Colonne Statut = code d'absence (ex. « AT »), pas le libellé.
|
||||
$statut = ($absenceData['codes'][$ymd] ?? '') ?: null;
|
||||
$statutLabel = $absenceData['labels'][$ymd] ?? null;
|
||||
$statutColor = ($absenceData['colors'][$ymd] ?? '') ?: null;
|
||||
if (null === $statut && null !== $holidayLabel) {
|
||||
// Férié sans absence : badge bleu clair, comme la vue Jour.
|
||||
$statut = $holidayLabel;
|
||||
$statutLabel = null;
|
||||
$statutColor = '#b3e5fc';
|
||||
}
|
||||
|
||||
@@ -170,6 +173,7 @@ class YearlyHoursExportBuilder
|
||||
'employeeId' => $employeeId,
|
||||
'employeeName' => trim(($employee->getLastName() ?? '').' '.($employee->getFirstName() ?? '')),
|
||||
'statut' => $statut,
|
||||
'statutLabel' => $statutLabel,
|
||||
'statutColor' => $statutColor,
|
||||
'morningFrom' => '',
|
||||
'morningTo' => '',
|
||||
@@ -296,11 +300,12 @@ class YearlyHoursExportBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @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>}
|
||||
* @return array{credited: array<string, int>, codes: array<string, string>, 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 = [];
|
||||
$codes = [];
|
||||
$labels = [];
|
||||
$colors = [];
|
||||
$absentMorning = [];
|
||||
@@ -322,6 +327,7 @@ class YearlyHoursExportBuilder
|
||||
$absentMorning[$date] = ($absentMorning[$date] ?? false) || $isMorning;
|
||||
$absentAfternoon[$date] = ($absentAfternoon[$date] ?? false) || $isAfternoon;
|
||||
if (!isset($labels[$date])) {
|
||||
$codes[$date] = $absence->getType()?->getCode() ?? '';
|
||||
$labels[$date] = $absence->getType()?->getLabel() ?? '';
|
||||
$colors[$date] = $absence->getType()?->getColor() ?? '';
|
||||
}
|
||||
@@ -334,6 +340,7 @@ class YearlyHoursExportBuilder
|
||||
|
||||
return [
|
||||
'credited' => $credited,
|
||||
'codes' => $codes,
|
||||
'labels' => $labels,
|
||||
'colors' => $colors,
|
||||
'absentMorning' => $absentMorning,
|
||||
|
||||
@@ -75,6 +75,7 @@ class WorkHourDayExportProvider implements ProviderInterface
|
||||
});
|
||||
|
||||
$groups = [];
|
||||
$legend = [];
|
||||
foreach ($siteMeta as $siteId => $meta) {
|
||||
$siteEmployees = $bySite[$siteId];
|
||||
usort($siteEmployees, static fn ($a, $b) => ($a->getLastName() ?? '') <=> ($b->getLastName() ?? ''));
|
||||
@@ -84,7 +85,21 @@ class WorkHourDayExportProvider implements ProviderInterface
|
||||
continue;
|
||||
}
|
||||
$groups[] = ['siteName' => $meta['name'], 'siteColor' => $meta['color'], 'rows' => $rows];
|
||||
|
||||
// Légende : codes d'absence présents (hors férié), dédupliqués par code.
|
||||
foreach ($rows as $row) {
|
||||
if ($row['isHoliday'] || null === $row['statut'] || null === $row['statutLabel']) {
|
||||
continue;
|
||||
}
|
||||
$legend[$row['statut']] ??= [
|
||||
'code' => $row['statut'],
|
||||
'label' => $row['statutLabel'],
|
||||
'color' => $row['statutColor'] ?? '#e8e8e8',
|
||||
];
|
||||
}
|
||||
}
|
||||
ksort($legend);
|
||||
$legend = array_values($legend);
|
||||
|
||||
$options = new Options();
|
||||
$options->set('isRemoteEnabled', true);
|
||||
@@ -92,6 +107,7 @@ class WorkHourDayExportProvider implements ProviderInterface
|
||||
|
||||
$html = $this->twig->render('work-hour-day-export/print.html.twig', [
|
||||
'groups' => $groups,
|
||||
'legend' => $legend,
|
||||
'dateLabel' => $date->format('d/m/Y'),
|
||||
'exportedAt' => new DateTimeImmutable('now')->format('d/m/Y H:i'),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user