diff --git a/templates/includes/macros.html.tera b/templates/includes/macros.html.tera index 1c5de4f..f69b0a0 100644 --- a/templates/includes/macros.html.tera +++ b/templates/includes/macros.html.tera @@ -41,3 +41,15 @@ {% endmacro alert %} +{% macro box(participants, empty_seats, header='Ruderer können noch teilnehmen', text='Keine Ruderer angemeldet', bg='primary-600', color='white') %} +
{{ empty_seats }} {{ header }}
+
+ {% if participants | length > 0 %} + {% for rower in participants %} + {{ rower.name }}
+ {% endfor %} + {% else %} + {{ text }} + {% endif %} +
+{% endmacro box %} diff --git a/templates/index.html.tera b/templates/index.html.tera index b43a2ae..a3211e7 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -13,7 +13,7 @@ {% for day in days %}
-

{{ day.day| date(format="%d.%m.%Y") }}

+

{{ day.day| date(format="%d.%m.%Y") }}

{% if day.planned_events | length > 0 %}
@@ -82,47 +82,34 @@
- + {# --- START List Coxes --- #} {% if planned_event.planned_amount_cox > 0 %} - {% set amount_cur_cox = planned_event.cox | length %} -
{{ planned_event.planned_amount_cox - - amount_cur_cox }} Steuerleute werden benötigt ({{ planned_event.planned_amount_cox }})
-
- {% if planned_event.cox | length > 0 %} - {% for cox in planned_event.cox %} - {{ cox.name }}
- {% endfor %} - {% else %} - Keine Steuerleute angemeldet - {% endif %} -
+ {% set amount_cur_cox = planned_event.cox | length %} + {{ macros::box(participants=planned_event.cox, empty_seats=planned_event.planned_amount_cox - amount_cur_cox, header='Steuerleute werden benötigt', text='Keine Steuerleute angemeldet') }} {% endif %} - + {# --- END List Coxes --- #} + + {# --- START List Rowers --- #} {% if planned_event.max_people > 0 %} -
{{ planned_event.max_people }} - - {{ planned_event.rower | length }} Ruderer können teilnehmen ({{ planned_event.max_people }})
-
- {% if planned_event.rower | length > 0 %} - {% for rower in planned_event.rower %} - {{ rower.name }}
- {% endfor %} - {% else %} - Keine Ruderer angemeldet - {% endif %} -
+ {% set amount_cur_rower = planned_event.rower | length %} + {{ macros::box(participants=planned_event.rower, empty_seats=planned_event.max_people - amount_cur_rower, bg='primary-100', color='black') }} {% endif %} - + {# --- END List Rowers --- #} + {% if planned_event.allow_guests %} -
Gäste sind erlaubt
+
Gäste sind erlaubt
{% endif %} + {# --- START Delete Btn --- #} {% if loggedin_user.is_admin %} - - {% include "includes/delete-icon" %} - Termin löschen - + {% endif %} + {# --- END Delete Btn --- #}