fix: assign correct status colors, link items in timeline
This commit is contained in:
+25
-15
@@ -10,7 +10,8 @@ class TimelineItem
|
||||
public const TYPE_ASSIGNMENT = 'assignment';
|
||||
public const TYPE_DISPOSITION = 'disposition';
|
||||
|
||||
private ?int $dispositionId = null;
|
||||
private ?string $assignmentUuid = null;
|
||||
private ?string $dispositionUuid = null;
|
||||
private ?\DateTimeImmutable $dateFrom = null;
|
||||
private ?\DateTimeImmutable $dateTo = null;
|
||||
private ?string $status = null;
|
||||
@@ -19,7 +20,7 @@ class TimelineItem
|
||||
private ?string $teamerName = null;
|
||||
private ?string $teamerUuid = null;
|
||||
|
||||
public function __construct(private readonly int $assignmentId, private readonly string $type)
|
||||
public function __construct(private readonly string $type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,12 +29,13 @@ class TimelineItem
|
||||
$dateFrom = $assignment->getDestination()->getDateFrom();
|
||||
$dateTo = $assignment->getDestination()->getDateTo();
|
||||
|
||||
return (new static($assignment->getId(), static::TYPE_ASSIGNMENT))
|
||||
return (new static(static::TYPE_ASSIGNMENT))
|
||||
->setAssignmentUuid($assignment->getUuid())
|
||||
->setDateFrom($dateFrom)
|
||||
->setDateTo($dateTo)
|
||||
->setJobProfile($assignment->getJobProfile()->getName())
|
||||
->setDateRange(sprintf('%s - %s', $dateFrom->format('d.m.Y'), $dateTo->format('d.m.Y')))
|
||||
->setStatus($assignment->getStatus());
|
||||
->setStatus($assignment->getStatus())
|
||||
;
|
||||
}
|
||||
|
||||
@@ -44,8 +46,9 @@ class TimelineItem
|
||||
$dateFrom = $assignment->getDestination()->getDateFrom();
|
||||
$dateTo = $assignment->getDestination()->getDateTo();
|
||||
|
||||
return (new static($assignment->getId(), static::TYPE_DISPOSITION))
|
||||
->setDispositionId($disposition->getId())
|
||||
return (new static(static::TYPE_DISPOSITION))
|
||||
->setAssignmentUuid($assignment->getUuid())
|
||||
->setDispositionUuid($disposition->getUuid())
|
||||
->setDateFrom($dateFrom)
|
||||
->setDateTo($dateTo)
|
||||
->setJobProfile($assignment->getJobProfile()->getName())
|
||||
@@ -56,24 +59,31 @@ class TimelineItem
|
||||
;
|
||||
}
|
||||
|
||||
public function getAssignmentId(): int
|
||||
{
|
||||
return $this->assignmentId;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getDispositionId(): ?int
|
||||
public function getAssignmentUuid(): ?string
|
||||
{
|
||||
return $this->dispositionId;
|
||||
return $this->assignmentUuid;
|
||||
}
|
||||
|
||||
public function setDispositionId(?int $dispositionId): static
|
||||
public function setAssignmentUuid(?string $assignmentUuid): static
|
||||
{
|
||||
$this->dispositionId = $dispositionId;
|
||||
$this->assignmentUuid = $assignmentUuid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDispositionUuid(): ?string
|
||||
{
|
||||
return $this->dispositionUuid;
|
||||
}
|
||||
|
||||
public function setDispositionUuid(?string $dispositionUuid): static
|
||||
{
|
||||
$this->dispositionUuid = $dispositionUuid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -5,22 +5,29 @@
|
||||
{% macro cell(item, colspan) %}
|
||||
<td class="{{ html_classes('border border-gray-700', {
|
||||
'bg-gray-100': item.type == 'assignment',
|
||||
'bg-blue-500 text-gray-50': item.type == 'disposition' and item.status != 'confirmed',
|
||||
'bg-green-500 text-gray-50': item.type == 'disposition' and (item.status == 'confirmed' or item.status == 'ended' or item.status == 'completed'),
|
||||
'bg-blue-500 text-gray-50': item.type == 'disposition' and item.status in ['new', 'checking_contract'],
|
||||
'bg-green-500 text-gray-50': item.type == 'disposition' and item.status in ['confirmed', 'ended', 'checking_invoice', 'completed'],
|
||||
}) }}" colspan="{{ colspan }}">
|
||||
{% if item.type == 'disposition' %}
|
||||
<button type="button"
|
||||
class="flex items-center space-x-2"
|
||||
title="Teamer:inneninfo {{ item.teamerName }}"
|
||||
hx-get="{{ path('app_administrative_teamer_info', { 'uuid': item.teamerUuid }) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">
|
||||
<span class="text-xs font-semibold">{{ item.jobProfile }}</span>
|
||||
<span class="text-xs">{{ item.teamerName | raw }}</span>
|
||||
{{ icon('info', 'w-4 h-4') }}
|
||||
</button>
|
||||
<div class="flex items-center space-x-2">
|
||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
||||
class="inline-block text-xs font-semibold">
|
||||
{{ item.jobProfile }}
|
||||
</a>
|
||||
<button type="button"
|
||||
class="flex items-center space-x-2"
|
||||
title="Teamer:inneninfo {{ item.teamerName }}"
|
||||
hx-get="{{ path('app_administrative_teamer_info', { 'uuid': item.teamerUuid }) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">
|
||||
<span class="text-xs font-semibold">{{ item.teamerName | raw }}</span>
|
||||
</button>
|
||||
</div>
|
||||
{% else %}
|
||||
<span class="text-xs font-semibold">{{ item.jobProfile }}</span>
|
||||
<a href="{{ path('app_administrative_assignment_edit', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
||||
class="text-xs font-semibold">
|
||||
{{ item.jobProfile }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user