feat: additional filter options for documents

This commit is contained in:
Björn Fromme
2025-01-13 11:58:32 +01:00
parent 520e6b79f0
commit c5df1c2a67
8 changed files with 146 additions and 15 deletions
+9 -7
View File
@@ -19,8 +19,15 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class AssignmentFilterType extends AbstractType
{
private array $hotelChoices = [];
public function __construct(private readonly Security $security, private readonly array $destinations)
{
$destinations = $this->destinations;
sort($destinations);
foreach ($destinations as $item) {
$this->hotelChoices[$item] = $item;
}
}
public function buildForm(FormBuilderInterface $builder, array $options): void
@@ -99,18 +106,13 @@ class AssignmentFilterType extends AbstractType
])
;
}
$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,
'choices' => $this->hotelChoices,
])
;
}
+39
View File
@@ -2,6 +2,7 @@
namespace App\Form;
use App\Entity\JobProfile;
use App\Entity\Teamer;
use App\Entity\Upload;
use App\Model\DocumentFilterDto;
@@ -13,6 +14,17 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class DocumentFilterType extends AbstractType
{
private array $hotelChoices = [];
public function __construct(private readonly array $destinations)
{
$destinations = $this->destinations;
sort($destinations);
foreach ($destinations as $item) {
$this->hotelChoices[$item] = $item;
}
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
@@ -32,6 +44,20 @@ class DocumentFilterType extends AbstractType
'Honorarvertrag' => Upload::TYPE_CONTRACT,
],
])
->add('jobProfiles', MultiselectEntityType::class, [
'label' => 'Job-Profil',
'class' => JobProfile::class,
'required' => false,
'empty_label' => 'nicht filtern',
'choice_label' => 'name',
'choices' => $options['job_profiles'],
])
->add('hotels', MultiselectType::class, [
'label' => 'Haus/Destination',
'required' => false,
'empty_label' => 'nicht filtern',
'choices' => $this->hotelChoices,
])
->add('dateFrom', DatepickerType::class, [
'label' => 'Einsatzzeitraum von',
'attr' => [
@@ -44,6 +70,18 @@ class DocumentFilterType extends AbstractType
'placeholder' => 'nicht filtern',
],
])
->add('status', ChoiceType::class, [
'label' => 'Status',
'required' => false,
'placeholder' => 'nicht filtern',
'choices' => [
'neu' => Upload::STATUS_NEW,
'in Bearbeitung' => Upload::STATUS_PENDING,
'bestätigt' => Upload::STATUS_CHECKED,
'abgelehnt' => Upload::STATUS_REJECTED,
'bezahlt' => Upload::STATUS_PAID,
],
])
->add('apply', SubmitType::class, [
'label' => 'filtern',
])
@@ -58,6 +96,7 @@ class DocumentFilterType extends AbstractType
$resolver
->setDefaults([
'data_class' => DocumentFilterDto::class,
'job_profiles' => [],
])
;
}