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
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user