[#322] Page horaire (#4)
Auto Tag Develop / tag (push) Successful in 5s

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|        #322          |        Page horaire         |

## Description de la PR
[#322] Page horaire

## Modification du .env

## Check list

- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié

Reviewed-on: #4
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #4.
This commit is contained in:
2026-02-20 11:23:52 +00:00
committed by Autin
parent f6c1f7eead
commit ee16779777
85 changed files with 6232 additions and 242 deletions
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App\Service\WorkHours;
use App\Entity\Absence;
use App\Enum\HalfDay;
final class AbsenceSegmentsResolver
{
/**
* @return array{bool, bool}
*/
public function resolveForDate(Absence $absence, string $dateYmd): array
{
$startDate = $absence->getStartDate()->format('Y-m-d');
$endDate = $absence->getEndDate()->format('Y-m-d');
$startHalf = $absence->getStartHalf();
$endHalf = $absence->getEndHalf();
// Cas d'une absence sur une seule date: on déduit matin/après-midi depuis les bornes.
if ($startDate === $endDate) {
if (HalfDay::AM === $startHalf && HalfDay::AM === $endHalf) {
// Uniquement le matin absent.
return [true, false];
}
if (HalfDay::PM === $startHalf && HalfDay::PM === $endHalf) {
// Uniquement l'après-midi absent.
return [false, true];
}
// Sinon, on considère la journée complète absente.
return [true, true];
}
// Premier jour d'une absence multi-jours qui commence l'après-midi.
if ($dateYmd === $startDate && HalfDay::PM === $startHalf) {
return [false, true];
}
// Dernier jour d'une absence multi-jours qui se termine le matin.
if ($dateYmd === $endDate && HalfDay::AM === $endHalf) {
return [true, false];
}
// Les jours intermédiaires sont entièrement absents.
return [true, true];
}
}