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

View File

@ -7,12 +7,8 @@
{{ macros::input(label='Anzahl Ruderer (ohne Steuerperson)', name='max_people', 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='allow_guests') }} {{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
{{ macros::input(label='Anmerkungen', name='notes', type='input') }} {{ macros::input(label='Anmerkungen', name='notes', type='input') }}
<select name="trip_type"> {{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt') }}
<option selected value>Reguläre Ausfahrt</option>
{% for trip_type in trip_types %}
<option value="{{ trip_type.id }}">{{ trip_type.name }}</option>
{% endfor %}
</select>
<input value="Erstellen" class="w-full btn btn-primary" type="submit" /> <input value="Erstellen" class="w-full btn btn-primary" type="submit" />
</form> </form>
</div> </div>

View File

@ -37,6 +37,15 @@
</label> </label>
{% endmacro checkbox %} {% 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='') %} {% macro alert(message, type, class='') %}
<div class="{{ class }} alert-{{ type }} text-white px-3 py-1 rounded-md text-center"> <div class="{{ class }} alert-{{ type }} text-white px-3 py-1 rounded-md text-center">
{{ message }} {{ message }}

View File

@ -39,14 +39,16 @@
<div class="pt-2"> <div class="pt-2">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div> <div>
<strong class="text-primary-900">{{ planned_event.planned_starting_time }} Uhr</strong> <small <strong class="text-primary-900">
class="text-gray-600">({{ planned_event.name }})</small><br /> {{ planned_event.planned_starting_time }} Uhr
{% if planned_event.trip_type %} {% if planned_event.trip_type %}
Spezielles Event: {{ planned_event.trip_type.name }} {{ planned_event.trip_type.icon | safe }}{{ planned_event.trip_type.name }}
{% endif %} {% endif %}
</strong>
<small class="text-gray-600">({{ planned_event.name }})</small><br />
<a href="#" data-sidebar="true" data-trigger="sidebar" <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 }}" data-body="#event{{ planned_event.trip_details_id }}"
class="inline-block link-primary mr-3"> class="inline-block link-primary mr-3">
Details Details
@ -65,7 +67,7 @@
{% endif %} {% endif %}
{% if planned_event.max_people > planned_event.rower | length %} {% if planned_event.max_people > planned_event.rower | length %}
{% if cur_user_participates == false %} {% 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 %}
{% endif %} {% endif %}
{# --- END Row Buttons --- #} {# --- END Row Buttons --- #}
@ -84,7 +86,7 @@
Abmelden Abmelden
</a> </a>
{% else %} {% 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" %} {% include "includes/cox-icon" %}
Steuern Steuern
</a> </a>
@ -143,18 +145,23 @@
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div> <div>
{% if trip.max_people == 0 %} {% 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> <small class="text-[#f43f5e]">(Absage {{ trip.cox_name }})</small>
{% else %} {% 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> <small class="text-gray-600">({{ trip.cox_name }})</small>
{% endif %} {% endif %}
<br /> <br />
{% if trip.trip_type %}
Spezielles Event: {{ trip.trip_type.name }}
{% endif %}
<a href="#" data-sidebar="true" data-trigger="sidebar" <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 }}" data-body="#trip{{ trip.trip_details_id }}"
class="inline-block link-primary mr-3"> class="inline-block link-primary mr-3">
Details Details
@ -174,7 +181,7 @@
{% endif %} {% endif %}
{% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id and cur_user_participates == false%} {% 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 }}" <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 %} {% endif %}
</div> </div>
</div> </div>