46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Administrative\Assignment;
|
|
|
|
use App\Model\AssignmentFilterDto;
|
|
use App\Repository\AssignmentRepository;
|
|
use App\Service\Assignment\TimelineService;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
class TimelineController extends AbstractController
|
|
{
|
|
public function __construct(
|
|
private readonly AssignmentRepository $assignmentRepository,
|
|
private readonly TimelineService $timelineService
|
|
) {
|
|
}
|
|
|
|
#[Route('/administrative/timeline', name: 'app_administrative_assignment_timeline')]
|
|
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
|
public function index(): Response
|
|
{
|
|
$period = $this->timelineService->getActiveWindow();
|
|
$filterDto = new AssignmentFilterDto();
|
|
$filterDto
|
|
->setDateFrom($period->first()->toDateTimeImmutable())
|
|
->setDateTo($period->last()->toDateTimeImmutable())
|
|
->setIncludePast(true)
|
|
;
|
|
|
|
$assignments = $this
|
|
->assignmentRepository
|
|
->getListQuery($filterDto, 'destination.dateFrom')
|
|
->getResult()
|
|
;
|
|
$timelineData = $this->timelineService->preprocess($assignments);
|
|
|
|
return $this->render('administrative/assignment/timeline.html.twig', [
|
|
'data' => $timelineData,
|
|
'period' => $period,
|
|
]);
|
|
}
|
|
}
|