rowt/templates/index.html.tera
2023-02-09 17:08:07 +01:00

88 lines
3.2 KiB
Plaintext

{% extends "base" %}
{% block content %}
{% for day_with_trip in data %}
{% set day = day_with_trip.day %}
{% set day_string = day.day | date(format="%Y-%m-%d") %}
{% set trips = day_with_trip.trips %}
<h1>{{ day.day | date(format="%d.%m.%Y")}}</h1>
<br />
{% if day.planned_amount_cox > 0%}
{% set cox = trips | filter(attribute="user.is_cox", value=true) %}
{% set amount_cox = cox | length %}
{% set rowers = trips | filter(attribute="user.is_cox", value=false) %}
{% if amount_cox < day.planned_amount_cox %}
{% set cox_left = day.planned_amount_cox - amount_cox %}
Es {{ cox_left | pluralize(singular="wird", plural="werden")}} noch {{ cox_left }} Steuerperson{{ cox_left | pluralize(plural="en")}} gesucht!<br />
{% endif %}
Geplante Abfahrtszeit: {{ day.planned_starting_time }}<br />
{{ trips | length }} angemeldete Person{{ trips | length | pluralize(plural="en") }}: {{ cox | length }} Steuerperson{{ cox | length | pluralize(plural="en") }} ({% for c in cox %}{{ c.user.name }} {% endfor %}), {{ rowers | length }} Ruderer:
<ol>
{% for r in rowers %}
<li>{{ r.user.name }} (angemeldet seit {{ r.trip.created }})</li>
{% endfor %}
</ol>
{% if day.open_registration or user.is_cox %}
<details>
<summary class="button">&plus;</summary>
<form method="post" action="/register">
<input type="hidden" name="_method" value="put" />
<input type="hidden" name="day" value="{{ day_string }}" />
<div class="row">
<div class="six columns">
<label for="name">Name</label>
<input class="u-full-width" type="text" id="name" name="name" value="{{ user.name }}" />
</div>
<div class="six columns">
<input class="button-primary" type="submit" value="Speichern">
</div>
</div>
</form>
</details>
{% else %}
Anmeldung an diesem Tag leider nicht möglich (zB bei USI Kursen)
{% endif %}
{% else %}
(Noch) keine Ausfahrt geplant
{% endif %}
{% if user.is_admin %}
<details>
<summary class="button">&#x270e;</summary>
<form method="post" action="/day">
<input type="hidden" name="_method" value="put" />
<input type="hidden" name="day" value="{{ day_string }}" />
<div class="row">
<div class="three columns">
<label for="planned_amount_cox">Geplante Steuerpersonen</label>
<input class="u-full-width" type="number" id="planned_amount_cox" name="planned_amount_cox" value="{{ day.planned_amount_cox }}">
</div>
<div class="three columns">
<label for="planned_starting_time">Geplante Abfahrtszeit</label>
<input class="u-full-width" type="time" id="planned_starting_time" name="planned_starting_time" value="{% if day.planned_starting_time %}{{ day.planned_starting_time }}{% else %}17:00{%endif%}">
</div>
<div class="three columns">
<label for="open_registration">Registrierung offen</label>
<input class="u-full-width" type="checkbox" id="open_registration" name="open_registration" {% if not day or day.open_registration %} checked="true" {% endif %}/>
</div>
<div class="three columns">
<input class="button-primary" type="submit" value="Speichern">
</div>
</div>
</form>
</details>
{% endif %}
<hr />
{% endfor %}
{% endblock content %}