[TASK] refactor list in sidebar (cox, rower)

This commit is contained in:
Marie Birner 2023-04-07 10:39:15 +02:00
parent c59a2c3a29
commit 5e4df13289
2 changed files with 32 additions and 33 deletions

View File

@ -41,3 +41,15 @@
</div>
{% endmacro alert %}
{% macro box(participants, empty_seats, header='Ruderer können noch teilnehmen', text='Keine Ruderer angemeldet', bg='primary-600', color='white') %}
<div class="text-{{ color }} bg-{{ bg }} text-center p-1 mt-1 rounded-t-md">{{ empty_seats }} {{ header }}</div>
<div class="p-2 border border-t-0 border-{{ bg }} mb-4 rounded-b-md">
{% if participants | length > 0 %}
{% for rower in participants %}
{{ rower.name }} <span class="hidden">(angemeldet seit {{ rower.registered_at }})</span><br />
{% endfor %}
{% else %}
{{ text }}
{% endif %}
</div>
{% endmacro box %}

View File

@ -13,7 +13,7 @@
{% for day in days %}
<div class="bg-white p-3 rounded-md flex justify-between flex-col">
<div>
<h2 class="text-lg font-bold uppercase tracking-wide">{{ day.day| date(format="%d.%m.%Y") }}</h2>
<h2 class="text-lg text-primary-950 font-bold uppercase tracking-wide">{{ day.day| date(format="%d.%m.%Y") }}</h2>
{% if day.planned_events | length > 0 %}
<div class="grid grid-cols-1 gap-3 divide-y mb-3">
@ -82,47 +82,34 @@
</div>
</div>
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
{# --- START List Coxes --- #}
{% if planned_event.planned_amount_cox > 0 %}
{% set amount_cur_cox = planned_event.cox | length %}
<div class="bg-primary-600 text-white text-center p-1 mt-1 rounded-t-md">{{ planned_event.planned_amount_cox
- amount_cur_cox }} Steuerleute werden benötigt ({{ planned_event.planned_amount_cox }})</div>
<div class="p-2 border border-t-0 border-primary-600 mb-4 rounded-b-md">
{% if planned_event.cox | length > 0 %}
{% for cox in planned_event.cox %}
{{ cox.name }} <span class="hidden">(angemeldet seit {{ cox.registered_at }})</span><br />
{% endfor %}
{% else %}
Keine Steuerleute angemeldet
{% endif %}
</div>
{% 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 %}
<div class="text-primay-900 bg-primary-100 text-center p-1 mt-1 rounded-t-md">{{ planned_event.max_people }}
- {{ planned_event.rower | length }} Ruderer können teilnehmen ({{ planned_event.max_people }})</div>
<div class="p-2 border border-t-0 border-primary-100 mb-4 rounded-b-md">
{% if planned_event.rower | length > 0 %}
{% for rower in planned_event.rower %}
{{ rower.name }} <span class="hidden">(angemeldet seit {{ rower.registered_at }})</span><br />
{% endfor %}
{% else %}
Keine Ruderer angemeldet
{% endif %}
</div>
{% 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 %}
<div class="text-primary-900 bg-primary-50 text-center p-1 mb-4">Gäste sind erlaubt</div>
<div class="text-primary-900 bg-primary-50 text-center p-1 mb-4">Gäste sind erlaubt</div>
{% endif %}
{# --- START Delete Btn --- #}
{% if loggedin_user.is_admin %}
<a href="/admin/planned-event/{{ planned_event.id }}/delete"
class="inline-block btn btn-alert">
{% include "includes/delete-icon" %}
Termin löschen
</a>
<div class="text-right">
<a href="/admin/planned-event/{{ planned_event.id }}/delete" class="inline-block btn btn-alert">
{% include "includes/delete-icon" %}
Termin löschen
</a>
</div>
{% endif %}
{# --- END Delete Btn --- #}
</div>
</div>
<div class="sidebar-overlay" data-trigger="detailEvent{{ planned_event.id }}"></div>