feat: filter timeline by date range and hotels
This commit is contained in:
@@ -17,6 +17,12 @@ abstract class AbstractFilterDto
|
||||
|
||||
foreach ($reflection->getProperties() as $property) {
|
||||
$name = $property->getName();
|
||||
|
||||
// don't count properties starting with '_'
|
||||
if (str_starts_with($name, '_')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->$name !== $freshInstance->$name) {
|
||||
++$filterCount;
|
||||
}
|
||||
@@ -24,4 +30,4 @@ abstract class AbstractFilterDto
|
||||
|
||||
return $filterCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\JobProfile;
|
||||
|
||||
class AssignmentFilterDto extends AbstractFilterDto
|
||||
{
|
||||
public const DURATION_WEEKEND = 1;
|
||||
@@ -116,4 +113,4 @@ class AssignmentFilterDto extends AbstractFilterDto
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Carbon\CarbonPeriod;
|
||||
|
||||
class TimelineFilterDto extends AssignmentFilterDto
|
||||
{
|
||||
protected ?CarbonPeriod $_period = null;
|
||||
|
||||
public function getPeriod(): ?CarbonPeriod
|
||||
{
|
||||
return $this->_period;
|
||||
}
|
||||
|
||||
public function setPeriod(?CarbonPeriod $_period): static
|
||||
{
|
||||
$this->_period = $_period;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -159,6 +159,6 @@ class TimelineItem
|
||||
return 1;
|
||||
}
|
||||
|
||||
return $this->getDateFrom()->diff($this->getDateTo())->days;
|
||||
return $this->getDateFrom()->diff($this->getDateTo())->days + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user