feat: filter teamers by training attendances
This commit is contained in:
@@ -50,6 +50,10 @@ class TeamerFilterType extends AbstractType
|
|||||||
->orderBy('job_profile.name', 'ASC');
|
->orderBy('job_profile.name', 'ASC');
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
->add('noTrainings', CheckboxType::class, [
|
||||||
|
'label' => 'an keinen Fortbildungen teilgenommen',
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
->add('apply', SubmitType::class, [
|
->add('apply', SubmitType::class, [
|
||||||
'label' => 'filtern',
|
'label' => 'filtern',
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class TeamerFilterDto extends AbstractFilterDto
|
|||||||
protected string $pickupId = '';
|
protected string $pickupId = '';
|
||||||
protected bool $skiLicense = false;
|
protected bool $skiLicense = false;
|
||||||
protected bool $snowboardLicense = false;
|
protected bool $snowboardLicense = false;
|
||||||
|
protected bool $noTrainings = false;
|
||||||
|
|
||||||
public function getName(): ?string
|
public function getName(): ?string
|
||||||
{
|
{
|
||||||
@@ -97,4 +98,14 @@ class TeamerFilterDto extends AbstractFilterDto
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasNoTrainings(): bool
|
||||||
|
{
|
||||||
|
return $this->noTrainings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNoTrainings(bool $noTrainings): void
|
||||||
|
{
|
||||||
|
$this->noTrainings = $noTrainings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -94,6 +94,13 @@ class TeamerRepository extends ServiceEntityRepository
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (true === $filterDto->hasNoTrainings()) {
|
||||||
|
$qb
|
||||||
|
->leftJoin('teamer.trainingAttendances', 'training_attendance')
|
||||||
|
->andWhere($qb->expr()->isNull('training_attendance'))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
return $qb->getQuery();
|
return $qb->getQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class TeamerFilterHandler
|
|||||||
->setPickupId($data['pickup_id'])
|
->setPickupId($data['pickup_id'])
|
||||||
->setSkiLicense($data['ski_license'])
|
->setSkiLicense($data['ski_license'])
|
||||||
->setSnowboardLicense($data['snowboard_license'])
|
->setSnowboardLicense($data['snowboard_license'])
|
||||||
|
->setNoTrainings($data['no_trainings'])
|
||||||
;
|
;
|
||||||
|
|
||||||
if (0 < (int) $data['job_profile']) {
|
if (0 < (int) $data['job_profile']) {
|
||||||
@@ -84,6 +85,7 @@ class TeamerFilterHandler
|
|||||||
'ski_license' => $filterDto->hasSkiLicense(),
|
'ski_license' => $filterDto->hasSkiLicense(),
|
||||||
'snowboard_license' => $filterDto->hasSnowboardLicense(),
|
'snowboard_license' => $filterDto->hasSnowboardLicense(),
|
||||||
'job_profile' => $filterDto->getJobProfile()?->getId(),
|
'job_profile' => $filterDto->getJobProfile()?->getId(),
|
||||||
|
'no_trainings' => $filterDto->hasNoTrainings(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
{{ form_row(filterForm.pickupId) }}
|
{{ form_row(filterForm.pickupId) }}
|
||||||
{{ form_row(filterForm.skiLicense) }}
|
{{ form_row(filterForm.skiLicense) }}
|
||||||
{{ form_row(filterForm.snowboardLicense) }}
|
{{ form_row(filterForm.snowboardLicense) }}
|
||||||
|
{{ form_row(filterForm.noTrainings) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
{{ form_widget(filterForm.apply, { 'attr': { 'class': 'btn' } }) }}
|
{{ form_widget(filterForm.apply, { 'attr': { 'class': 'btn' } }) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user