feat: filter timeline by date range and hotels
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user