feat: filter timeline by date range and hotels
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Controller\Administrative\Assignment;
|
||||
|
||||
use App\Model\AssignmentFilterDto;
|
||||
use App\Repository\AssignmentRepository;
|
||||
use App\Service\Assignment\TimelineService;
|
||||
use App\Service\Common\TimelineFilterHandler;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@@ -14,7 +14,8 @@ class TimelineController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly AssignmentRepository $assignmentRepository,
|
||||
private readonly TimelineService $timelineService
|
||||
private readonly TimelineService $timelineService,
|
||||
private readonly TimelineFilterHandler $filterHandler
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -23,12 +24,9 @@ class TimelineController extends AbstractController
|
||||
public function index(): Response
|
||||
{
|
||||
$period = $this->timelineService->getActiveWindow();
|
||||
$filterDto = new AssignmentFilterDto();
|
||||
$filterDto
|
||||
->setDateFrom($period->first()->toDateTimeImmutable())
|
||||
->setDateTo($period->last()->toDateTimeImmutable())
|
||||
->setIncludePast(true)
|
||||
;
|
||||
$this->filterHandler->setPeriod($period);
|
||||
|
||||
$filterDto = $this->filterHandler->getFilterSettings();
|
||||
|
||||
$assignments = $this
|
||||
->assignmentRepository
|
||||
@@ -40,6 +38,7 @@ class TimelineController extends AbstractController
|
||||
return $this->render('administrative/assignment/timeline.html.twig', [
|
||||
'data' => $timelineData,
|
||||
'period' => $period,
|
||||
'filterDto' => $filterDto,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user