2023-02-08 16:25:06 +01:00
{% extends "base" %}
{% block content %}
2023-03-04 11:39:10 +01:00
<h1 class="bold">Ausfahrten</h1>
2023-02-09 15:29:44 +01:00
{% for day_with_trip in data %}
{% set day = day_with_trip.day %}
{% set day_string = day.day | date(format="%Y-%m-%d") %}
2023-03-14 14:00:53 +01:00
{% set_global default_trips = [] %}
{% set_global indep_trips = [] %}
{% for trip in day_with_trip.trips %}
{% if trip.trip.begin or trip.trip.cox_id %}
{% set_global indep_trips = indep_trips | concat(with=trip) %}
{% else %}
{% set_global default_trips = default_trips | concat(with=trip) %}
{% endif %}
{% endfor %}
2023-03-05 16:33:02 +01:00
2023-03-14 14:00:53 +01:00
{% set cox = default_trips | filter(attribute="user.is_cox", value=true) %}
2023-03-05 16:33:02 +01:00
{% set amount_cox = cox | length %}
{% set cox_needed = amount_cox < day.planned_amount_cox %}
<div class="bg-gray p-3 mb-1 data-block" data-needed="{{ cox_needed}}">
2023-03-14 14:00:53 +01:00
<strong class="block">{{ day.day | date(format="%A, %d.%m.%Y", locale="de_AT")}}</strong>
2023-02-09 15:29:44 +01:00
2023-03-14 14:00:53 +01:00
{% if user.is_cox %}
<details class="text-right">
<summary class="button">NEUE AUSFAHRT</summary>
<form method="post" class="text-left" action="/register">
<input type="hidden" name="_method" value="put" />
<input type="hidden" name="day" value="{{ day_string }}" />
<div class="row content-align-bottom">
2023-03-14 19:24:20 +01:00
<input class="u-full-width" type="hidden" id="name" name="name" value="{{ user.name }}" />
<div class="six columns">
2023-03-14 14:00:53 +01:00
<label for="time">Time</label>
<input class="u-full-width" type="text" id="time" name="time" value="17:00" />
</div>
2023-03-14 19:24:20 +01:00
<div class="six columns">
2023-03-14 14:00:53 +01:00
<input class="button-primary" type="submit" value="Speichern">
</div>
</div>
</form>
</details>
{% endif %}
2023-03-05 16:33:02 +01:00
{% if user.is_admin %}
<details class="text-right" style="margin-top: -3rem;">
2023-02-08 22:02:17 +01:00
<summary class="button">✎</summary>
2023-03-05 16:33:02 +01:00
<form method="post" class="text-left" action="/day">
2023-02-08 16:25:06 +01:00
<input type="hidden" name="_method" value="put" />
2023-02-08 22:02:17 +01:00
<input type="hidden" name="day" value="{{ day_string }}" />
2023-03-05 16:33:02 +01:00
<div class="row content-align-bottom">
2023-02-08 16:25:06 +01:00
<div class="three columns">
2023-03-05 16:33:02 +01:00
<label for="planned_amount_cox">Steuerpersonen</label>
2023-02-09 15:29:44 +01:00
<input class="u-full-width" type="number" id="planned_amount_cox" name="planned_amount_cox" value="{{ day.planned_amount_cox }}">
2023-02-08 16:25:06 +01:00
</div>
<div class="three columns">
2023-03-05 16:33:02 +01:00
<label for="planned_starting_time">Abfahrtszeit</label>
2023-02-09 15:29:44 +01:00
<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%}">
2023-02-08 16:25:06 +01:00
</div>
<div class="three columns">
<label for="open_registration">Registrierung offen</label>
2023-02-09 15:29:44 +01:00
<input class="u-full-width" type="checkbox" id="open_registration" name="open_registration" {% if not day or day.open_registration %} checked="true" {% endif %}/>
2023-02-08 16:25:06 +01:00
</div>
<div class="three columns">
2023-02-08 22:02:17 +01:00
<input class="button-primary" type="submit" value="Speichern">
2023-02-08 16:25:06 +01:00
</div>
</div>
</form>
</details>
2023-02-09 17:08:07 +01:00
{% endif %}
2023-03-05 16:33:02 +01:00
{% if day.planned_amount_cox > 0%}
2023-03-14 14:00:53 +01:00
{% set rowers = default_trips | filter(attribute="user.is_cox", value=false) | sort(attribute="trip.created") %}
2023-03-05 16:33:02 +01:00
{% if cox_needed %}
{% set cox_left = day.planned_amount_cox - amount_cox %}
<div class="block text-red">Es {{ cox_left | pluralize(singular="wird", plural="werden")}} noch {{ cox_left }} Steuerperson{{ cox_left | pluralize(plural="en")}} gesucht!</div>
{% endif %}
2023-03-23 11:13:19 +01:00
{% set_global user_registered = false %}
2023-03-05 16:33:02 +01:00
<strong class="block mt-1">Abfahrtszeit: {{ day.planned_starting_time }} Uhr</strong>
2023-03-14 14:00:53 +01:00
<div style="max-width: 75%">{{ default_trips | length }} angemeldete Person{{ default_trips | length | pluralize(plural="en") }}: {{ cox | length }} Steuerperson{{ cox | length | pluralize(plural="en") }} ({% for c in cox %}{{ c.user.name }} {% if c.user.name == user.name %}
2023-03-23 11:13:19 +01:00
{% set_global user_registered = true %}
2023-03-12 13:32:42 +01:00
<form method="post" action="/register">
<input type="hidden" name="_method" value="delete" />
2023-03-14 16:49:32 +01:00
<input type="hidden" name="id" value="{{ c.trip.id }}" />
2023-03-12 13:32:42 +01:00
<input type="submit" value="Abmelden" style="float: left;" />
</form>
{% endif %} {% endfor %}), {{ rowers | length }} Ruderer:</div>
2023-03-05 16:33:02 +01:00
<ol style="max-width: 75%">
{% for r in rowers %}
<li>
2023-03-12 13:41:09 +01:00
{{ r.user.name }} (angemeldet seit {{ r.trip.created | date(format="%d.%m. %H:%M", timezone="Europe/Vienna") }})
2023-03-05 16:33:02 +01:00
{% if r.user.name == user.name %}
2023-03-23 11:13:19 +01:00
{% set_global user_registered = true %}
2023-03-05 16:33:02 +01:00
<form method="post" action="/register">
<input type="hidden" name="_method" value="delete" />
2023-03-14 16:49:32 +01:00
<input type="hidden" name="id" value="{{ r.trip.id }}" />
2023-03-12 13:32:42 +01:00
<input type="submit" value="Abmelden" />
2023-03-05 16:33:02 +01:00
</form>
{% endif %}
</li>
{% endfor %}
</ol>
{% if day.open_registration or user.is_cox %}
2023-03-23 11:13:19 +01:00
{% if not user_registered or user.add_different_user %}
<details class="text-right" style="margin-top: -6rem;">
<summary class="button">+</summary>
<form method="post" class="text-left" action="/register">
<input type="hidden" name="_method" value="put" />
<input type="hidden" name="day" value="{{ day_string }}" />
<div class="row content-align-bottom">
<div class="six columns">
{% if user.add_different_user %}
<label for="name">Name</label>
<input class="u-full-width" type="text" id="name" name="name" value="{{ user.name }}" />
{% else %}
<input class="u-full-width" type="hidden" id="name" name="name" value="{{ user.name }}" />
{% endif %}
</div>
<div class="six columns">
<input class="button-primary" type="submit" value="Speichern">
</div>
</div>
</form>
</details>
{% else %}
{% endif %}
2023-03-05 16:33:02 +01:00
{% else %}
Anmeldung an diesem Tag leider nicht möglich (zB bei USI Kursen)
{% endif %}
{% endif %}
2023-03-14 14:00:53 +01:00
{% for trip in indep_trips %}
2023-03-23 11:13:19 +01:00
{% set_global user_registered = false %}
2023-03-14 14:00:53 +01:00
{% if trip.trip.begin %}
{{trip.user.name}} @ {{trip.trip.begin}}
2023-03-23 11:13:19 +01:00
{% set rowers = indep_trips | filter(attribute="trip.cox_id", value=trip.trip.id) | sort(attribute="trip.created")%}
2023-03-14 14:00:53 +01:00
{% if trip.user.name == user.name and rowers | length == 0 %}
2023-03-23 11:13:19 +01:00
{% set_global user_registered = true %}
2023-03-14 14:00:53 +01:00
<form method="post" action="/register">
<input type="hidden" name="_method" value="delete" />
2023-03-14 16:49:32 +01:00
<input type="hidden" name="id" value="{{ trip.trip.id }}" />
2023-03-14 14:00:53 +01:00
<input type="submit" value="Abmelden" style="float: left;" />
</form>
{% endif %}
:
<ol>
{% for r in rowers %}
<li>
{{ r.user.name }} (angemeldet seit {{ r.trip.created | date(format="%d.%m. %H:%M", timezone="Europe/Vienna") }})
{% if r.user.name == user.name %}
2023-03-23 11:13:19 +01:00
{% set_global user_registered = true %}
2023-03-14 14:00:53 +01:00
<form method="post" action="/register">
<input type="hidden" name="_method" value="delete" />
2023-03-14 16:49:32 +01:00
<input type="hidden" name="id" value="{{ r.trip.id }}" />
2023-03-14 14:00:53 +01:00
<input type="submit" value="Abmelden" />
</form>
{% endif %}
</li>
{% endfor %}
</ol>
2023-03-23 11:13:19 +01:00
{% if not user_registered or user.add_different_user %}
2023-03-14 14:00:53 +01:00
<details class="text-right">
<summary class="button">+</summary>
<form method="post" class="text-left" action="/register">
<input type="hidden" name="_method" value="put" />
<input type="hidden" name="day" value="{{ day_string }}" />
2023-03-14 16:49:32 +01:00
<input type="hidden" name="cox_id" value="{{ trip.trip.id }}" />
2023-03-14 14:00:53 +01:00
<div class="row content-align-bottom">
<div class="six columns">
2023-03-23 11:13:19 +01:00
{% if user.add_different_user %}
<label for="name">Name</label>
<input class="u-full-width" type="text" id="name" name="name" value="{{ user.name }}" />
{% else %}
<input class="u-full-width" type="hidden" id="name" name="name" value="{{ user.name }}" />
{% endif %}
2023-03-14 14:00:53 +01:00
</div>
<div class="six columns">
<input class="button-primary" type="submit" value="Speichern">
</div>
</div>
</form>
</details>
2023-03-23 11:13:19 +01:00
{% endif %}
2023-03-14 14:00:53 +01:00
{% endif %}
{% endfor %}
2023-03-04 11:39:10 +01:00
</div>
2023-02-08 16:25:06 +01:00
{% endfor %}
2023-02-16 11:26:41 +01:00
{% if user.is_cox %}
2023-03-05 16:33:02 +01:00
<a class="button button-primary light font-base mb-3" href="/?all">Alle heurigen Ausfahrten anzeigen</a>
2023-02-16 11:26:41 +01:00
{% endif %}
2023-02-08 16:25:06 +01:00
{% endblock content %}