feat: timeline for role house manager

closes #869b9vmmx
This commit is contained in:
Björn Fromme
2026-03-15 12:42:28 +01:00
parent 6dfd8fd3ef
commit 1a536c044e
7 changed files with 87 additions and 27 deletions
@@ -2,10 +2,12 @@
namespace App\Controller\Administrative\Assignment;
use App\Entity\User;
use App\Repository\AssignmentRepository;
use App\Service\Assignment\TimelineService;
use App\Service\Common\TimelineFilterHandler;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
@@ -20,17 +22,26 @@ class TimelineController extends AbstractController
}
#[Route('/administrative/timeline', name: 'app_administrative_timeline')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted(new Expression('is_granted("ROLE_ADMINISTRATIVE") or is_granted("ROLE_HOUSE_MANAGER")'))]
public function index(): Response
{
/** @var User $user */
$user = $this->getUser();
$period = $this->timelineService->getActiveWindow();
$this->filterHandler->setPeriod($period);
$filterDto = $this->filterHandler->getFilterSettings();
$hotelCodes = null;
if ($this->isGranted('ROLE_HOUSE_MANAGER')) {
$filterDto->setHotels([]);
$hotelCodes = $user->getHotelCodes();
}
$assignments = $this
->assignmentRepository
->getListQuery($filterDto, 'destination.dateFrom')
->getListQuery($filterDto, 'destination.dateFrom', $hotelCodes)
->getResult()
;
$timelineData = $this->timelineService->preprocess($assignments);