feat: filter assignments and applications by country
closes #8698fpqq5
This commit is contained in:
@@ -63,6 +63,17 @@ class ApplicationFilterType extends AbstractType
|
||||
'label' => 'vergangene Einsätze anzeigen',
|
||||
'required' => false,
|
||||
])
|
||||
->add('country', ChoiceType::class, [
|
||||
'label' => 'Land',
|
||||
'required' => false,
|
||||
'placeholder' => 'nicht filtern',
|
||||
'choices' => [
|
||||
'Österreich' => 'a',
|
||||
'Schweiz' => 'ch',
|
||||
'Frankreich' => 'f',
|
||||
'Italien' => 'i',
|
||||
],
|
||||
])
|
||||
->add('apply', SubmitType::class, [
|
||||
'label' => 'filtern',
|
||||
])
|
||||
@@ -127,4 +138,4 @@ class ApplicationFilterType extends AbstractType
|
||||
->setAllowedTypes('max_date', [\DateTimeImmutable::class, 'null'])
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,17 @@ class AssignmentFilterType extends AbstractType
|
||||
'label' => 'vergangene Einsätze anzeigen',
|
||||
'required' => false,
|
||||
])
|
||||
->add('country', ChoiceType::class, [
|
||||
'label' => 'Land',
|
||||
'required' => false,
|
||||
'placeholder' => 'nicht filtern',
|
||||
'choices' => [
|
||||
'Österreich' => 'a',
|
||||
'Schweiz' => 'ch',
|
||||
'Frankreich' => 'f',
|
||||
'Italien' => 'i',
|
||||
],
|
||||
])
|
||||
->add('apply', SubmitType::class, [
|
||||
'label' => 'filtern',
|
||||
])
|
||||
@@ -130,4 +141,4 @@ class AssignmentFilterType extends AbstractType
|
||||
->setAllowedTypes('max_date', [\DateTimeImmutable::class, 'null'])
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class ApplicationFilterDto extends AbstractFilterDto
|
||||
protected ?int $duration = null;
|
||||
protected array $status = [];
|
||||
protected bool $includePast = false;
|
||||
protected ?string $country = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -113,4 +114,16 @@ class ApplicationFilterDto extends AbstractFilterDto
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function setCountry(?string $country): static
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class AssignmentFilterDto extends AbstractFilterDto
|
||||
protected ?int $duration = null;
|
||||
protected array $status = [];
|
||||
protected bool $includePast = false;
|
||||
protected ?string $country = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -113,4 +114,16 @@ class AssignmentFilterDto extends AbstractFilterDto
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function setCountry(?string $country): static
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,13 @@ class ApplicationRepository extends ServiceEntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $country = $filterDto->getCountry()) {
|
||||
$qb
|
||||
->andWhere($qb->expr()->eq('destination.country', ':country'))
|
||||
->setParameter('country', $country)
|
||||
;
|
||||
}
|
||||
|
||||
return $qb->getQuery();
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +169,13 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $country = $filterDto->getCountry()) {
|
||||
$qb
|
||||
->andWhere($qb->expr()->eq('destination.country', ':country'))
|
||||
->setParameter('country', $country)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBookmarkQueryForTeamer(Teamer $teamer): Query
|
||||
|
||||
@@ -48,6 +48,9 @@ class ApplicationFilterHandler extends AbstractFilterHandler
|
||||
if (isset($data['include_past'])) {
|
||||
$filterDto->setIncludePast((bool) $data['include_past']);
|
||||
}
|
||||
if (isset($data['country'])) {
|
||||
$filterDto->setCountry($data['country']);
|
||||
}
|
||||
|
||||
return $filterDto;
|
||||
}
|
||||
@@ -66,6 +69,7 @@ class ApplicationFilterHandler extends AbstractFilterHandler
|
||||
'duration' => $filterDto->getDuration(),
|
||||
'status' => $filterDto->getStatus(),
|
||||
'include_past' => $filterDto->isIncludePast(),
|
||||
'country' => $filterDto->getCountry(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ class AssignmentFilterHandler extends AbstractFilterHandler
|
||||
if (isset($data['include_past'])) {
|
||||
$filterDto->setIncludePast((bool) $data['include_past']);
|
||||
}
|
||||
if (isset($data['country'])) {
|
||||
$filterDto->setCountry($data['country']);
|
||||
}
|
||||
|
||||
return $filterDto;
|
||||
}
|
||||
@@ -66,6 +69,7 @@ class AssignmentFilterHandler extends AbstractFilterHandler
|
||||
'duration' => $filterDto->getDuration(),
|
||||
'status' => $filterDto->getStatus(),
|
||||
'include_past' => $filterDto->isIncludePast(),
|
||||
'country' => $filterDto->getCountry(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
{{ form_row(filterForm.jobProfiles) }}
|
||||
{{ form_row(filterForm.hotels) }}
|
||||
{{ form_row(filterForm.duration) }}
|
||||
{{ form_row(filterForm.country) }}
|
||||
{{ form_row(filterForm.includePast) }}
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
@@ -26,4 +27,4 @@
|
||||
</div>
|
||||
{{ form_rest(filterForm) }}
|
||||
{{ form_end(filterForm) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
{{ form_row(filterForm.jobProfiles) }}
|
||||
{{ form_row(filterForm.hotels) }}
|
||||
{{ form_row(filterForm.duration) }}
|
||||
{{ form_row(filterForm.country) }}
|
||||
{{ form_row(filterForm.includePast) }}
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
@@ -26,4 +27,4 @@
|
||||
</div>
|
||||
{{ form_rest(filterForm) }}
|
||||
{{ form_end(filterForm) }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user