Feat: Add filter toggle and info about active filters for teamer
This commit is contained in:
@@ -60,6 +60,7 @@ class IndexController extends AbstractController
|
||||
'errors' => $errors,
|
||||
'pagination' => $pagination,
|
||||
'filterForm' => $filterForm,
|
||||
'filterDto' => $filterDto,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,27 @@ class AssignmentFilterDto
|
||||
$this->reset = $reset;
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->getActiveFiltersCount() > 0;
|
||||
}
|
||||
|
||||
public function getActiveFiltersCount(): int
|
||||
{
|
||||
$freshInstance = new static();
|
||||
$filterCount = 0;
|
||||
$reflection = new \ReflectionClass(static::class);
|
||||
|
||||
foreach ($reflection->getProperties() as $property) {
|
||||
$name = $property->getName();
|
||||
if ($this->$name !== $freshInstance->$name) {
|
||||
++$filterCount;
|
||||
}
|
||||
}
|
||||
|
||||
return $filterCount;
|
||||
}
|
||||
|
||||
public function getDateFrom(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->dateFrom;
|
||||
|
||||
Reference in New Issue
Block a user