feat: show available/open assignments in timeline
This commit is contained in:
@@ -25,10 +25,21 @@ class TimelineService
|
|||||||
$rows[$hotelCode] = [[]];
|
$rows[$hotelCode] = [[]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === $assignment->getDispositions()->count()) {
|
$dispositionsCount = $assignment->getDispositions()->count();
|
||||||
|
$dispositionsAvailable = $assignment->getAvailableDispositions();
|
||||||
|
|
||||||
|
if (0 === $dispositionsCount) {
|
||||||
$item = TimelineItem::fromAssignment($assignment);
|
$item = TimelineItem::fromAssignment($assignment);
|
||||||
|
for ($i = 1; $i <= $assignment->getAvailableDispositions(); $i++) {
|
||||||
$this->addItem($rows[$hotelCode], $item);
|
$this->addItem($rows[$hotelCode], $item);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ($dispositionsCount < $dispositionsAvailable) {
|
||||||
|
$item = TimelineItem::fromAssignment($assignment);
|
||||||
|
for ($i = 1; $i <= $dispositionsAvailable - $dispositionsCount; $i++) {
|
||||||
|
$this->addItem($rows[$hotelCode], $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($assignment->getDispositions() as $disposition) {
|
foreach ($assignment->getDispositions() as $disposition) {
|
||||||
$item = TimelineItem::fromDisposition($disposition);
|
$item = TimelineItem::fromDisposition($disposition);
|
||||||
$this->addItem($rows[$hotelCode], $item);
|
$this->addItem($rows[$hotelCode], $item);
|
||||||
@@ -42,12 +53,16 @@ class TimelineService
|
|||||||
private function addItem(array &$rows, TimelineItem $item): void
|
private function addItem(array &$rows, TimelineItem $item): void
|
||||||
{
|
{
|
||||||
$rowIndex = 0;
|
$rowIndex = 0;
|
||||||
|
$fitsRow = false;
|
||||||
|
|
||||||
foreach ($rows as $index => $row) {
|
foreach ($rows as $index => $row) {
|
||||||
$fitsRow = true;
|
$fitsRow = true;
|
||||||
foreach ($row as $entry) {
|
foreach ($row as $entry) {
|
||||||
/** @var TimelineItem $entry */
|
/** @var TimelineItem $entry */
|
||||||
if ($entry->getDateTo() >= $item->getDateFrom() && $entry->getDateFrom() <= $item->getDateTo()) {
|
if (
|
||||||
|
isset($row[$item->getKey()]) ||
|
||||||
|
$entry->getDateTo() >= $item->getDateFrom() && $entry->getDateFrom() <= $item->getDateTo()
|
||||||
|
) {
|
||||||
$fitsRow = false;
|
$fitsRow = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ path('app_administrative_assignment_edit', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
||||||
class="text-xs font-semibold">
|
class="text-xs font-semibold">
|
||||||
{{ item.jobProfile }}
|
{{ item.jobProfile }}
|
||||||
</a>
|
</a>
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
<span>Bedarf</span>
|
<span>Bedarf</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2 bg-blue-500 text-gray-50 px-4 py-1">
|
<div class="flex items-center space-x-2 bg-blue-500 text-gray-50 px-4 py-1">
|
||||||
<span>in Bewerbung</span>
|
<span>in Bearbeitung</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2 bg-green-500 text-gray-50 px-4 py-1">
|
<div class="flex items-center space-x-2 bg-green-500 text-gray-50 px-4 py-1">
|
||||||
<span>besetzt</span>
|
<span>besetzt</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user