feat : surlignage des jours fériés sur la vue semaine des heures
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Quand un employé n'a pas d'absence sur un jour férié, la cellule prend le fond bleu clair (#b3e5fc) et affiche le nom du férié au survol — cohérent avec la vue jour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,5 +22,6 @@ final class WeeklyDaySummary
|
||||
public bool $hasDinner = false,
|
||||
public bool $hasOvernight = false,
|
||||
public int $virtualHolidayMinutes = 0,
|
||||
public ?string $holidayLabel = null,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ use App\Repository\Contract\AbsenceReadRepositoryInterface;
|
||||
use App\Repository\Contract\EmployeeScopedRepositoryInterface;
|
||||
use App\Repository\Contract\WorkHourReadRepositoryInterface;
|
||||
use App\Service\Contracts\EmployeeContractResolver;
|
||||
use App\Service\PublicHolidayServiceInterface;
|
||||
use App\Service\WorkHours\AbsenceSegmentsResolver;
|
||||
use App\Service\WorkHours\DailyReferenceMinutesResolver;
|
||||
use App\Service\WorkHours\HolidayVirtualHoursResolver;
|
||||
@@ -31,6 +32,7 @@ use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
use Throwable;
|
||||
|
||||
final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
{
|
||||
@@ -45,6 +47,7 @@ final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
private EmployeeContractResolver $contractResolver,
|
||||
private DailyReferenceMinutesResolver $dailyReferenceResolver,
|
||||
private HolidayVirtualHoursResolver $holidayVirtualHoursResolver,
|
||||
private PublicHolidayServiceInterface $publicHolidayService,
|
||||
) {}
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): WorkHourWeeklySummary
|
||||
@@ -122,6 +125,7 @@ final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
$contractNaturesByEmployeeDate = $this->contractResolver->resolveNaturesForEmployeesAndDays($employees, $days);
|
||||
$isDriverByEmployeeDate = $this->contractResolver->resolveIsDriverForEmployeesAndDays($employees, $days);
|
||||
$workDaysByEmployeeDate = $this->contractResolver->resolveWorkDaysMinutesForEmployeesAndDays($employees, $days);
|
||||
$holidayLabelsByDate = $this->buildHolidayLabelsForDays($days);
|
||||
$metricsByEmployeeDate = [];
|
||||
foreach ($workHours as $workHour) {
|
||||
$employeeId = $workHour->getEmployee()?->getId();
|
||||
@@ -324,6 +328,7 @@ final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
hasDinner: $hasDinner,
|
||||
hasOvernight: $hasOvernight,
|
||||
virtualHolidayMinutes: $virtualHolidayMinutes,
|
||||
holidayLabel: $holidayLabelsByDate[$date] ?? null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -376,6 +381,38 @@ final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $days
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function buildHolidayLabelsForDays(array $days): array
|
||||
{
|
||||
if ([] === $days) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$years = [];
|
||||
foreach ($days as $day) {
|
||||
$years[substr($day, 0, 4)] = true;
|
||||
}
|
||||
|
||||
$map = [];
|
||||
|
||||
try {
|
||||
foreach (array_keys($years) as $year) {
|
||||
$holidays = $this->publicHolidayService->getHolidaysDayByYears('metropole', (string) $year);
|
||||
foreach ($holidays as $date => $label) {
|
||||
$map[(string) $date] = (string) $label;
|
||||
}
|
||||
}
|
||||
} catch (Throwable) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
private function computeMetrics(WorkHour $workHour): WorkMetrics
|
||||
{
|
||||
$ranges = [
|
||||
|
||||
Reference in New Issue
Block a user