Feat: Add filter toggle and info about active filters for teamer

This commit is contained in:
Björn Fromme
2023-10-23 16:19:10 +02:00
parent c155e8c19e
commit a604039426
3 changed files with 43 additions and 13 deletions
+21
View File
@@ -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;