Merge commit 'e5088bddb0ab694abac5f6d2ab2d76a5042e52bb' into feature/frontend-triptype

# Conflicts:
#	templates/index.html.tera
This commit is contained in:
Marie Birner
2023-05-03 15:26:41 +02:00
22 changed files with 326 additions and 122 deletions

View File

@ -50,10 +50,13 @@
{% if user.pw %}
<a class="inline-block mt-1 text-primary-600 hover:text-primary-900 underline" href="/admin/user/{{ user.id }}/reset-pw">Passwort zurücksetzen</a>
{% endif %}
<a class="inline-block mt-1 text-primary-600 hover:text-primary-900 underline" href="/admin/user/{{ user.id }}/delete" onclick="return confirm('Really delete user?');">User löschen</a>
</div>
<div>
<input value="Ändern" type="submit" class="w-28 rounded-md bg-primary-600 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"/>
<div class="grid gap-3">
<a href="/admin/user/{{ user.id }}/delete" class="inline-block btn btn-alert" onclick="return confirm('Wirklich löschen?');">
{% include "includes/delete-icon" %}
Löschen
</a>
<input value="Ändern" type="submit" class="w-28 btn btn-primary"/>
</div>
</form>
{% endfor %}

View File

@ -14,10 +14,10 @@
<input type="hidden" name="remember" value="true">
<div class="-space-y-px rounded-md shadow-sm">
<div>
{{ macros::input(label='Name', name='name', type='input', required=true, class='rounded-t-md') }}
{{ macros::input(label='Name', name='name', type='input', required=true, class='rounded-t-md',hide_label=true) }}
</div>
<div>
{{ macros::input(label='Passwort', name='password', type='password', class='rounded-b-md') }}
{{ macros::input(label='Passwort', name='password', type='password', class='rounded-b-md',hide_label=true) }}
</div>
</div>

View File

@ -9,10 +9,10 @@
<input type="hidden" name="userid" value="{{ userid }}" />
<div class="-space-y-px rounded-md shadow-sm">
<div>
{{ macros::input(label='Passwort', name='password', type='password', required=true, class='rounded-t-md') }}
{{ macros::input(label='Passwort', name='password', type='password', required=true, class='rounded-t-md',hide_label=true) }}
</div>
<div>
{{ macros::input(label='Passwort bestätigen', name='password_confirm', type='password', required=true, class='rounded-b-md') }}
{{ macros::input(label='Passwort bestätigen', name='password_confirm', type='password', required=true, class='rounded-b-md',hide_label=true) }}
</div>
</div>

View File

@ -7,7 +7,7 @@
{{ macros::input(label='Startzeit', name='planned_starting_time', type='time', required=true) }}
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', required=true, min='0') }}
{{ macros::input(label='Anzahl Ruderer (ohne Steuerperson)', name='max_people', type='number', required=true, min='0') }}
{{ macros::checkbox(label='Gäste erlauben', name='max_allow_guestspeople') }}
{{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
<select name="trip_type">
<option selected value>Reguläre Ausfahrt</option>

View File

@ -5,6 +5,7 @@
<input class="day-js" type="hidden" name="day" value="" />
{{ macros::input(label='Startzeit (zB "10:00")', name='planned_starting_time', type='time', required=true) }}
{{ macros::input(label='Anzahl Ruderer (ohne Steuerperson)', name='max_people', type='number', required=true, min='0') }}
{{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
<select name="trip_type">
<option selected value>Reguläre Ausfahrt</option>

View File

@ -24,9 +24,11 @@
<div class="h-8"></div>
{% endmacro header %}
{% macro input(label, name, type, required=false, class='rounded-md', value='', min='') %}
<label for="{{ name }}" class="sr-only">{{ label }}</label>
<input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} value="{{ value }}" class="input {{ class }}" placeholder="{{ label }}" {% if min %} min="{{ min }}" {% endif %}>
{% macro input(label, name, type, required=false, class='rounded-md', value='', min='', hide_label=false) %}
<div>
<label for="{{ name }}" class="{% if hide_label %} sr-only {% else %} small text-gray-600 {% endif %}">{{ label }}</label>
<input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} value="{{ value }}" class="input {{ class }}" placeholder="{% if hide_label %}{{ label }}{% endif %}" {% if min %} min="{{ min }}" {% endif %}>
</div>
{% endmacro input %}
{% macro checkbox(label, name, id='', checked=false) %}
@ -41,7 +43,7 @@
</div>
{% endmacro alert %}
{% macro box(participants, empty_seats, header='Freie Plätze:', text='Keine Ruderer angemeldet', bg='primary-600', color='white') %}
{% macro box(participants, empty_seats='', header='Freie Plätze:', text='Keine Ruderer angemeldet', bg='primary-600', color='white') %}
<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 %}

View File

@ -142,13 +142,19 @@
<div class="pt-2 reset-js" data-coxneeded="false">
<div class="flex justify-between items-center">
<div>
<strong class="text-primary-900">{{ trip.planned_starting_time }} Uhr</strong> <small
class="text-gray-600">({{ trip.cox_name }})</small><br />
{% if trip.trip_type %}
Spezielles Event: {{ trip.trip_type.name }}
{% endif %}
{% if trip.max_people == 0 %}
<strong class="text-[#f43f5e]">&#9888; {{ trip.planned_starting_time }} Uhr</strong>
<small class="text-[#f43f5e]">(Absage {{ trip.cox_name }})</small>
{% else %}
<strong class="text-primary-900">{{ trip.planned_starting_time }} Uhr</strong>
<small class="text-gray-600">({{ trip.cox_name }})</small>
{% endif %}
<br />
{% if trip.trip_type %}
Spezielles Event: {{ trip.trip_type.name }}
{% endif %}
<a href="#" data-sidebar="true" data-trigger="sidebar"
data-header="<strong>{{ trip.planned_starting_time }} Uhr</strong> ({{ trip.cox_name }}){% if trip.notes %}<small class='block'>{{ trip.notes }}</small>{% endif %}"
data-header="<strong>{% if trip.max_people == 0 %}&#9888; {% endif %}{{ trip.planned_starting_time }} Uhr</strong> ({{ trip.cox_name }}){% if trip.notes %}<small class='block'>{{ trip.notes }}</small>{% endif %}"
data-body="#trip{{ trip.trip_details_id }}"
class="inline-block link-primary mr-3">
Details
@ -177,9 +183,15 @@
{# --- START Sidebar Content --- #}
<div class="hidden">
<div id="trip{{ trip.trip_details_id }}">
{% set amount_cur_rower = trip.rower | length %}
{{ macros::box(participants=trip.rower, empty_seats=trip.max_people - amount_cur_rower, bg='primary-100', color='black') }}
{# --- START Edit Form --- #}
{% if trip.max_people == 0 %}
{# --- border-[#f43f5e] bg-[#f43f5e] --- #}
{{ macros::box(participants=trip.rower,bg='[#f43f5e]',header='Absage') }}
{% else %}
{% set amount_cur_rower = trip.rower | length %}
{{ macros::box(participants=trip.rower, empty_seats=trip.max_people - amount_cur_rower, bg='primary-100', color='black') }}
{% endif %}
{# --- START Edit Form --- #}
{% if trip.cox_id == loggedin_user.id %}
<div class="bg-gray-100 p-3 mt-4 rounded-md">
<h3 class="text-primary-950 font-bold uppercase tracking-wide mb-2">Ausfahrt bearbeiten</h3>
@ -246,7 +258,13 @@
</div>
{% include "dynamics/sidebar" %}
{% include "forms/trip" %}
{% include "forms/event" %}
{% if loggedin_user.is_cox %}
{% include "forms/trip" %}
{% endif %}
{% if loggedin_user.is_admin %}
{% include "forms/event" %}
{% endif %}
{% endblock content %}