[TASK] layout trip_types and add onclick join msg javascript

This commit is contained in:
Marie Birner 2023-05-03 16:14:18 +02:00
parent 15644e8a0b
commit 1f29779ede
4 changed files with 40 additions and 32 deletions

View File

@ -9,12 +9,8 @@
{{ 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>
{% for trip_type in trip_types %}
<option value="{{ trip_type.id }}">{{ trip_type.name }}</option>
{% endfor %}
</select>
{{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt') }}
<input value="Erstellen" class="w-full btn btn-primary" type="submit" />
</form>
</div>

View File

@ -5,14 +5,10 @@
<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::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>
{% for trip_type in trip_types %}
<option value="{{ trip_type.id }}">{{ trip_type.name }}</option>
{% endfor %}
</select>
{{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt') }}
<input value="Erstellen" class="w-full btn btn-primary" type="submit" />
</form>
</div>

View File

@ -37,6 +37,15 @@
</label>
{% endmacro checkbox %}
{% macro select(trip_types, select_name='trip_type', default='') %}
<select name="{{ select_name }}" class="input rounded-md h-10">
<option selected value>{{ default }}</option>
{% for trip_type in trip_types %}
<option value="{{ trip_type.id }}">{{ trip_type.name }}</option>
{% endfor %}
</select>
{% endmacro select %}
{% macro alert(message, type, class='') %}
<div class="{{ class }} alert-{{ type }} text-white px-3 py-1 rounded-md text-center">
{{ message }}

View File

@ -39,14 +39,16 @@
<div class="pt-2">
<div class="flex justify-between items-center">
<div>
<strong class="text-primary-900">{{ planned_event.planned_starting_time }} Uhr</strong> <small
class="text-gray-600">({{ planned_event.name }})</small><br />
{% if planned_event.trip_type %}
Spezielles Event: {{ planned_event.trip_type.name }}
{% endif %}
<strong class="text-primary-900">
{{ planned_event.planned_starting_time }} Uhr
{% if planned_event.trip_type %}
{{ planned_event.trip_type.icon | safe }}{{ planned_event.trip_type.name }}
{% endif %}
</strong>
<small class="text-gray-600">({{ planned_event.name }})</small><br />
<a href="#" data-sidebar="true" data-trigger="sidebar"
data-header="<strong>{{ planned_event.planned_starting_time }} Uhr</strong> ({{ planned_event.name }}){% if planned_event.notes %}<small class='block'>{{ planned_event.notes }}</small>{% endif %}"
data-header="<strong>{{ planned_event.planned_starting_time }} Uhr</strong> ({{ planned_event.name }}){% if planned_event.trip_type %}<small class='block'>{{ planned_event.trip_type.desc }}</small>{% endif %}{% if planned_event.notes %}<small class='block'>{{ planned_event.notes }}</small>{% endif %}"
data-body="#event{{ planned_event.trip_details_id }}"
class="inline-block link-primary mr-3">
Details
@ -65,7 +67,7 @@
{% endif %}
{% if planned_event.max_people > planned_event.rower | length %}
{% if cur_user_participates == false %}
<a href="/join/{{ planned_event.trip_details_id }}" class="btn btn-primary btn-fw">Mitrudern</a>
<a href="/join/{{ planned_event.trip_details_id }}" class="btn btn-primary btn-fw" {% if planned_event.trip_type %}onclick="return confirm('{{ planned_event.trip_type.question }}');"{% endif %}>Mitrudern</a>
{% endif %}
{% endif %}
{# --- END Row Buttons --- #}
@ -84,7 +86,7 @@
Abmelden
</a>
{% else %}
<a href="/cox/join/{{ planned_event.id }}" class="block btn {% if amount_cox_missing > 0 %} btn-dark {% else %} btn-gray {% endif %} btn-fw">
<a href="/cox/join/{{ planned_event.id }}" class="block btn {% if amount_cox_missing > 0 %} btn-dark {% else %} btn-gray {% endif %} btn-fw" {% if planned_event.trip_type %}onclick="return confirm('{{ planned_event.trip_type.question }}');"{% endif %}>
{% include "includes/cox-icon" %}
Steuern
</a>
@ -99,11 +101,11 @@
<div id="event{{ planned_event.trip_details_id }}">
{# --- START List Coxes --- #}
{% if planned_event.planned_amount_cox > 0 %}
{% if amount_cox_missing > 0 %}
{% if amount_cox_missing > 0 %}
{{ macros::box(participants=planned_event.cox, empty_seats=planned_event.planned_amount_cox - amount_cur_cox, header='Noch benötigte Steuerleute:', text='Keine Steuerleute angemeldet') }}
{% else %}
{% else %}
{{ macros::box(participants=planned_event.cox, empty_seats="", header='Genügend Steuerleute haben sich angemeldet :-)', text='Keine Steuerleute angemeldet') }}
{% endif %}
{% endif %}
{% endif %}
{# --- END List Coxes --- #}
@ -143,18 +145,23 @@
<div class="flex justify-between items-center">
<div>
{% if trip.max_people == 0 %}
<strong class="text-[#f43f5e]">&#9888; {{ trip.planned_starting_time }} Uhr</strong>
<strong class="text-[#f43f5e]">&#9888; {{ trip.planned_starting_time }} Uhr
{% if trip.trip_type %}
{{ trip.trip_type.icon | safe }}{{ trip.trip_type.name }}
{% endif %}
</strong>
<small class="text-[#f43f5e]">(Absage {{ trip.cox_name }})</small>
{% else %}
<strong class="text-primary-900">{{ trip.planned_starting_time }} Uhr</strong>
<strong class="text-primary-900">{{ trip.planned_starting_time }} Uhr
{% if trip.trip_type %}
{{ trip.trip_type.icon | safe }}{{ trip.trip_type.name }}
{% endif %}
</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>{% 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-header="<strong>{% if trip.max_people == 0 %}&#9888; {% endif %}{{ trip.planned_starting_time }} Uhr</strong> ({{ trip.cox_name }}){% if trip.trip_type %}<small class='block'>{{ trip.trip_type.desc }}</small>{% endif %}{% 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
@ -174,7 +181,7 @@
{% endif %}
{% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id and cur_user_participates == false%}
<a href="/join/{{ trip.trip_details_id }}"
class="btn btn-primary btn-fw">Mitrudern</a>
class="btn btn-primary btn-fw" {% if trip.trip_type %}onclick="return confirm('{{ trip.trip_type.question }}');"{% endif %}>Mitrudern</a>
{% endif %}
</div>
</div>