feat: filter destinations by common name
This commit is contained in:
@@ -18,7 +18,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class AssignmentFilterType extends AbstractType
|
||||
{
|
||||
public function __construct(private readonly Security $security)
|
||||
public function __construct(private readonly Security $security, private readonly array $destinations)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -90,20 +90,20 @@ class AssignmentFilterType extends AbstractType
|
||||
])
|
||||
;
|
||||
}
|
||||
if (0 < count($options['hotels'])) {
|
||||
$choices = [];
|
||||
foreach ($options['hotels'] as $item) {
|
||||
$choices[$item->getHotel()] = $item->getHotelCode();
|
||||
}
|
||||
$builder
|
||||
->add('hotels', MultiselectType::class, [
|
||||
'label' => 'Haus',
|
||||
'required' => false,
|
||||
'empty_label' => 'nicht filtern',
|
||||
'choices' => $choices,
|
||||
])
|
||||
;
|
||||
$hotelChoices = [];
|
||||
$destinations = $this->destinations;
|
||||
sort($destinations);
|
||||
foreach ($destinations as $item) {
|
||||
$hotelChoices[$item] = $item;
|
||||
}
|
||||
$builder
|
||||
->add('hotels', MultiselectType::class, [
|
||||
'label' => 'Haus/Destination',
|
||||
'required' => false,
|
||||
'empty_label' => 'nicht filtern',
|
||||
'choices' => $hotelChoices,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
@@ -114,7 +114,6 @@ class AssignmentFilterType extends AbstractType
|
||||
'min_date' => null,
|
||||
'max_date' => null,
|
||||
'job_profiles' => [],
|
||||
'hotels' => [],
|
||||
])
|
||||
->setAllowedTypes('min_date', [\DateTimeImmutable::class, 'null'])
|
||||
->setAllowedTypes('max_date', [\DateTimeImmutable::class, 'null'])
|
||||
|
||||
Reference in New Issue
Block a user