2023-04-06 09:30:43 +02:00
{% macro header(loggedin_user) %}
2023-07-30 14:33:50 +02:00
<header class="bg-primary-900 text-white flex justify-center p-3 fixed w-full z-10">
<div class="max-w-screen-xl w-full flex justify-between items-center">
2023-10-24 15:28:06 +02:00
<div class="w-1/3 truncate">
2023-07-30 14:33:50 +02:00
<a href="/">
Hü
{{ loggedin_user.name }}
</a>
</div>
2023-04-06 09:30:43 +02:00
2023-07-30 14:33:50 +02:00
<div>
2023-10-24 15:28:06 +02:00
<a href="https://wiki.rudernlinz.at/ruderassistent#faq" target="_blank" class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">
2023-07-30 14:33:50 +02:00
{% include "includes/question-icon" %}
<span class="sr-only">FAQs</span>
</a>
2023-10-24 10:57:51 +02:00
{% if not loggedin_user.is_guest %}
2023-09-27 13:47:43 +02:00
<a href="#" class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
data-sidebar="true" data-trigger="sidebar" data-header="Logbuch" data-body="#mobile-menu">
{% include "includes/book" %}
<span class="sr-only">Logbuch</span>
</a>
<div class="hidden">
<div id="mobile-menu">
<a href="/log" class="block w-100 py-2 hover:text-primary-600">
Ausfahrt eintragen
</a>
<a href="/log/show" class="block w-100 py-2 hover:text-primary-600 border-t">
Logbuch
</a>
<a href="/stat" class="block w-100 py-2 hover:text-primary-600 border-t">
2023-10-31 20:29:33 +01:00
Statistik
2023-10-31 16:07:15 +01:00
</a>
<a href="/stat/boats" class="block w-100 py-2 hover:text-primary-600 border-t">
2023-10-31 20:29:33 +01:00
Bootsauswertung
2023-09-27 13:47:43 +02:00
</a>
2023-10-24 09:22:07 +02:00
{% if loggedin_user.is_admin %}
<a href="/admin/boat" class="block w-100 py-2 hover:text-primary-600 border-t">
Boote
</a>
{% endif %}
2023-09-27 13:47:43 +02:00
<a href="/boatdamage" class="block w-100 py-2 hover:text-primary-600 border-t">
Bootsschaden
</a>
</div>
</div>
2023-10-24 10:57:51 +02:00
{% endif %}
2023-07-22 13:57:17 +02:00
2023-10-24 09:22:07 +02:00
{% if loggedin_user.is_admin %}
2023-07-30 14:33:50 +02:00
<a href="/admin/user" class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">
<svg class="inline h-4" width="16" height="16" fill="currentColor" class="bi bi-person-lines-fill" viewbox="0 0 16 16">
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-5 6s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zM11 3.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5zm.5 2.5a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4zm2 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2zm0 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2z"/>
</svg>
<span class="sr-only">Userverwaltung</span>
</a>
{% endif %}
<a href="/auth/logout" class="inline-flex justify-center rounded-md bg-primary-600 ml-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">
<svg class="inline h-4" width="24" height="24" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
<span class="sr-only">Ausloggen</span>
</a>
</div>
</div>
</header>
<div class="h-8"></div>
2023-04-06 17:54:08 +02:00
{% endmacro header %}
2023-07-30 13:42:33 +02:00
{% macro input(label, name, type, required=false, class='rounded-md', value='', min='', hide_label=false, id='', autofocus=false, wrapper_class='') %}
2023-07-30 14:33:50 +02:00
<div class="{{wrapper_class}}">
2023-09-28 11:52:14 +02:00
<label for="{{ name }}" class="{% if hide_label %} sr-only {% else %} text-sm text-gray-600 {% endif %}">{{ label }}</label>
2023-09-23 22:31:19 +02:00
<input {% if id %} id="{{ id }}" {% else %} id="{{ name }}" {% endif %} name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} value="{{ value }}" class="input {{ class }}" placeholder="{% if hide_label %}{{ label }}{% endif %}" {% if min is defined %} min="{{ min }}" {% endif %} {% if autofocus %} autofocus {% endif %}>
2023-07-30 14:33:50 +02:00
</div>
2023-04-06 17:54:08 +02:00
{% endmacro input %}
2023-09-28 16:07:52 +02:00
{% macro checkbox(label, name, id='', checked=false, class='', disabled=false) %}
2023-07-30 14:33:50 +02:00
<label for="{{ name }}{{ id }}" class="flex items-center cursor-pointer hover:text-gray-900 {{ class }}">
2023-09-28 16:07:52 +02:00
<input type="checkbox" id="{{ name }}{{ id }}" name="{{ name }}" {% if checked %} checked {% endif %} {% if disabled %} disabled {% endif %} class="h-4 w-4 accent-primary-600 mr-2"/>
2023-07-30 14:33:50 +02:00
{{ label }}
</label>
2023-04-06 17:54:08 +02:00
{% endmacro checkbox %}
2023-04-07 09:57:38 +02:00
2023-10-30 15:19:43 +01:00
{% macro select(label, data, name='trip_type', default='', id='', selected_id='', display='', extras='', class='', wrapper_class='', required=false, show_seats=false) %}
2023-09-28 15:07:05 +02:00
<div class="{{wrapper_class}}">
2023-10-30 13:39:58 +01:00
<label for="{{ name }}" class="text-sm text-gray-600">{{ label }}</label>
{% if display == '' %}
{% set display = ["name"] %}
{% endif %}
<select name="{{ name }}" {% if id %} id="{{ id }}" {% else %} id="{{ name }}" {% endif %} class="input rounded-md {{ class }}" {% if required %}required="required"{% endif %}>
{% if default %}
<option selected value>{{ default }}</option>
{% endif %}
{% for d in data %}
2023-10-30 15:19:43 +01:00
<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data- {{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}}'{% endif %}>
2023-10-30 13:39:58 +01:00
{% for displa in display -%}
{%- if d[displa] -%}
{{- d[displa] -}}
{%- else -%}
{{- displa -}}
{%- endif -%}
{%- endfor %}
</option>
{% endfor %}
</select>
</div>
2023-05-03 16:14:18 +02:00
{% endmacro select %}
2023-07-27 13:07:00 +02:00
2023-04-07 09:57:38 +02:00
{% macro alert(message, type, class='') %}
2023-07-30 14:33:50 +02:00
<div class="{{ class }} alert-{{ type }} text-white px-3 py-1 rounded-md text-center">
{{ message }}
</div>
2023-04-07 09:57:38 +02:00
{% endmacro alert %}
2023-08-09 22:30:37 +02:00
{% macro box(participants, empty_seats='', header='Freie Plätze:', text='Keine Ruderer angemeldet', bg='primary-600', color='white', trip_details_id='', allow_removing=false) %}
2023-07-30 14:33:50 +02:00
<div class="text-{{ color }} bg-{{ bg }} text-center p-1 mt-1 rounded-t-md">{{ header }}
{{ empty_seats }}</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 }}
{% if rower.is_guest %}
2023-08-09 22:30:37 +02:00
<small class="text-gray-600">(Scheckbuch)</small>
{% endif %}
{% if rower.is_real_guest %}
2023-07-30 14:33:50 +02:00
<small class="text-gray-600">(Gast)</small>
2023-08-09 22:30:37 +02:00
{% if allow_removing %}
2023-09-24 11:19:10 +02:00
<a href="/remove/{{ trip_details_id }}/{{ rower.name }}" class="btn btn-attention btn-fw">Abmelden</a>
2023-08-09 22:30:37 +02:00
{% endif %}
2023-07-30 14:33:50 +02:00
{% endif %}
<span class="hidden">(angemeldet seit
{{ rower.registered_at }})</span><br/>
{% endfor %}
{% else %}
{{ text }}
{% endif %}
</div>
2023-04-07 10:39:15 +02:00
{% endmacro box %}
2023-05-03 22:41:37 +02:00
{% macro faq(question, answer) %}
2023-07-30 14:33:50 +02:00
<div>
<h2 class="flex mb-4 text-lg font-bold text-primary-900">
{{ question }}
</h2>
<p class="text-primary-950">{{ answer | safe }}</p>
</div>
2023-05-03 22:50:05 +02:00
{% endmacro faq %}