fix: correctly assign items to timeline

This commit is contained in:
Björn Fromme
2025-03-25 15:47:08 +01:00
parent ecc059cefc
commit da18856cc2
4 changed files with 63 additions and 50 deletions
@@ -2,35 +2,27 @@
{% block title %}Zeitleiste{% endblock %}
{% macro cell(row, day) %}
{% if colspan is defined and colspan > 1 %}
{% set colspan = colspan - 1 %}
{% elseif row[day|date('Ymd')] is defined %}
{% set item = row[day|date('Ymd')] %}
{% set colspan = item.numberOfDays %}
<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',
}) }}" 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>
{% else %}
{% 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'),
}) }}" 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>
{% endif %}
</td>
{% else %}
<td class="border border-gray-700"></td>
{% endif %}
<span class="text-xs">{{ item.teamerName | raw }}</span>
{{ icon('info', 'w-4 h-4') }}
</button>
{% else %}
<span class="text-xs font-semibold">{{ item.jobProfile }}</span>
{% endif %}
</td>
{% endmacro %}
{% block content %}
@@ -75,13 +67,29 @@
{{ hotelCode }}
</td>
{% for day in filterDto.period %}
{{ _self.cell(rows[0], day) }}
{% if colspan is defined and colspan > 1 %}
{% set colspan = colspan - 1 %}
{% elseif rows[0][day|date('Ymd')] is defined %}
{% set item = rows[0][day|date('Ymd')] %}
{% set colspan = item.numberOfDays %}
{{ _self.cell(item, colspan) }}
{% else %}
<td class="border border-gray-700"></td>
{% endif %}
{% endfor %}
</tr>
{% for row in rows[1:] %}
<tr>
{% for day in filterDto.period %}
{{ _self.cell(row, day) }}
{% if colspan is defined and colspan > 1 %}
{% set colspan = colspan - 1 %}
{% elseif row[day|date('Ymd')] is defined %}
{% set item = row[day|date('Ymd')] %}
{% set colspan = item.numberOfDays %}
{{ _self.cell(item, colspan) }}
{% else %}
<td class="border border-gray-700"></td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}