fix: draw only active placements on the timeline and keep trips overlapping its dates
This commit is contained in:
1 parent
5ca9b812c3
commit
4e50f23558
6 files changed
+216
-32
No files matched your search
@@ -10,11 +10,17 @@ class TimelineItem
|
||||
public const TYPE_ASSIGNMENT = 'assignment';
|
||||
public const TYPE_DISPOSITION = 'disposition';
|
||||
|
||||
// what the bar shows: a vacancy nobody applied for, one in progress, or a placed teamer
|
||||
public const STATE_OPEN = 'open';
|
||||
public const STATE_PENDING = 'pending';
|
||||
public const STATE_STAFFED = 'staffed';
|
||||
|
||||
private ?string $assignmentUuid = null;
|
||||
private ?string $dispositionUuid = null;
|
||||
private ?\DateTimeImmutable $dateFrom = null;
|
||||
private ?\DateTimeImmutable $dateTo = null;
|
||||
private ?string $status = null;
|
||||
private ?string $state = null;
|
||||
private ?string $dateRange = null;
|
||||
private ?string $jobProfile = null;
|
||||
private ?string $teamerName = null;
|
||||
@@ -36,6 +42,8 @@ class TimelineItem
|
||||
->setJobProfile($assignment->getJobProfile()->getName())
|
||||
->setDateRange(sprintf('%s - %s', $dateFrom->format('d.m.Y'), $dateTo->format('d.m.Y')))
|
||||
->setStatus($assignment->getStaffingStatus())
|
||||
// applications are removed when a teamer is placed, so the valid ones are unplaced
|
||||
->setState(0 < $assignment->getValidApplications()->count() ? static::STATE_PENDING : static::STATE_OPEN)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -54,6 +62,10 @@ class TimelineItem
|
||||
->setJobProfile($assignment->getJobProfile()->getName())
|
||||
->setDateRange(sprintf('%s - %s', $dateFrom->format('d.m.Y'), $dateTo->format('d.m.Y')))
|
||||
->setStatus($disposition->getStatus())
|
||||
->setState(match ($disposition->getStatus()) {
|
||||
Disposition::STATUS_NEW, Disposition::STATUS_CHECKING_CONTRACT => static::STATE_PENDING,
|
||||
default => static::STATE_STAFFED,
|
||||
})
|
||||
->setTeamerName($disposition->getTeamer()->getFullName())
|
||||
->setTeamerUuid($disposition->getTeamer()->getUuid())
|
||||
;
|
||||
@@ -148,6 +160,18 @@ class TimelineItem
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getState(): ?string
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
public function setState(?string $state): static
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTeamerName(): ?string
|
||||
{
|
||||
return $this->teamerName;
|
||||
|
||||
Reference in new issue
Block a user