feat: filter timeline by date range and hotels

This commit is contained in:
Björn Fromme
2025-03-21 11:52:29 +01:00
parent 9ffada111c
commit 06c32fd597
14 changed files with 316 additions and 28 deletions
+26
View File
@@ -6,6 +6,7 @@ use App\Entity\Application;
use App\Entity\Assignment;
use App\Entity\Teamer;
use App\Model\AssignmentFilterDto;
use App\Model\TimelineFilterDto;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\Expr\Join;
@@ -309,4 +310,29 @@ class AssignmentRepository extends ServiceEntityRepository
return array_column($availableAssignments, 'id');
}
public function getSelectableHotelCodes(): array
{
$qb = $this->createQueryBuilder('assignment');
$codes = [];
$result = $qb
->select('assignment.id', 'destination.hotelCode')
->innerJoin('assignment.destination', 'destination')
->groupBy('destination.hotelCode')
->orderBy('destination.hotelCode', 'ASC')
->getQuery()
->getArrayResult();
foreach ($result as $row) {
if (str_starts_with($row['hotelCode'], 'SER')) {
$codes[] = substr($row['hotelCode'], 2, 3);
} else {
$codes[] = substr($row['hotelCode'], 0, 3);
}
}
return array_unique($codes);
}
}