feat : ajout des demi-journées d'absence dans le calendrier et l'export pdf
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled

This commit is contained in:
2026-02-10 16:11:09 +01:00
parent 4cf00e6ef3
commit 2a8c874985
11 changed files with 404 additions and 46 deletions

View File

@@ -184,17 +184,38 @@ class AbsencePrintProvider implements ProviderInterface
$absenceStart = DateTimeImmutable::createFromInterface($absence->getStartDate());
$absenceEnd = DateTimeImmutable::createFromInterface($absence->getEndDate());
$startHalf = $absence->getStartHalf();
$endHalf = $absence->getEndHalf();
$start = max($absenceStart, $from);
$end = min($absenceEnd, $to);
$current = $start;
while ($current <= $end) {
$dateKey = $current->format('Y-m-d');
$dateKey = $current->format('Y-m-d');
$isSameDay = $absenceStart->format('Y-m-d') === $absenceEnd->format('Y-m-d');
$isStartDay = $current->format('Y-m-d') === $absenceStart->format('Y-m-d');
$isEndDay = $current->format('Y-m-d') === $absenceEnd->format('Y-m-d');
$halfLabel = null;
if ($isSameDay) {
if ($startHalf === $endHalf) {
$halfLabel = $startHalf;
}
} else {
if ($isStartDay && 'PM' === $startHalf) {
$halfLabel = 'PM';
}
if ($isEndDay && 'AM' === $endHalf) {
$halfLabel = 'AM';
}
}
$map[$employeeId][$dateKey] = [
'code' => (string) $type->getCode(),
'color' => (string) $type->getColor(),
'code' => (string) $type->getCode(),
'color' => (string) $type->getColor(),
'half' => null !== $halfLabel,
'halfLabel' => $halfLabel,
];
$current = $current->add(new DateInterval('P1D'));