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
+23 -1
View File
@@ -32,7 +32,7 @@ class AssignmentRepository extends ServiceEntityRepository
parent::__construct($registry, Assignment::class);
}
public function getListQuery(AssignmentFilterDto $filterDto, ?string $orderBy = null): Query
public function getListQuery(AssignmentFilterDto $filterDto, ?string $orderBy = null, ?array $hotelCodes = null): Query
{
$qb = $this->createQueryBuilder('assignment');
@@ -56,6 +56,7 @@ class AssignmentRepository extends ServiceEntityRepository
}
$this->applyFilterSettings($filterDto, $qb);
$this->applyHotelCodeRestriction($qb, $hotelCodes);
return $qb->getQuery();
}
@@ -231,6 +232,27 @@ class AssignmentRepository extends ServiceEntityRepository
}
}
private function applyHotelCodeRestriction(QueryBuilder $qb, ?array $hotelCodes = null): void
{
if (null === $hotelCodes) {
return;
}
if ([] === $hotelCodes) {
$qb->andWhere('1 = 0');
return;
}
$qb
->andWhere($qb->expr()->orX(
$qb->expr()->in($qb->expr()->substring('destination.hotelCode', 1, 3), ':hotelCodes'),
$qb->expr()->in($qb->expr()->substring('destination.hotelCode', -3, 3), ':hotelCodes'),
))
->setParameter('hotelCodes', $hotelCodes)
;
}
public function getBookmarkQueryForTeamer(Teamer $teamer): Query
{
// Find ids of assignments with available slots first