From bfa5fa786616020ec994fad92a80806e579e8097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 25 Mar 2025 09:38:55 +0100 Subject: [PATCH] feat: compressed timeline items --- .../assignment/timeline.html.twig | 85 +++++++------------ 1 file changed, 33 insertions(+), 52 deletions(-) diff --git a/templates/administrative/assignment/timeline.html.twig b/templates/administrative/assignment/timeline.html.twig index c5434e8..9c6925d 100644 --- a/templates/administrative/assignment/timeline.html.twig +++ b/templates/administrative/assignment/timeline.html.twig @@ -2,6 +2,37 @@ {% block title %}Timeline{% 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 %} + + {% if item.type == 'disposition' %} + + {% else %} + {{ item.jobProfile }} + {% endif %} + + {% else %} + + {% endif %} +{% endmacro %} + {% block content %}

@@ -44,63 +75,13 @@ {{ hotelCode }} {% for day in filterDto.period %} - {% 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 %} - - {% if item.type == 'disposition' %} - - {% endif %} - {{ item.jobProfile }} - - {% else %} - - {% endif %} + {{ _self.cell(rows[0], day) }} {% endfor %} {% for row in rows[1:] %} {% for day in filterDto.period %} - {% 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 %} - - {% if item.type == 'disposition' %} - - {% endif %} - {{ item.jobProfile }} - - {% else %} - - {% endif %} + {{ _self.cell(row, day) }} {% endfor %} {% endfor %}