forked from Ruderverein-Donau-Linz/rowt
		
	Merge branch 'feature/frontend-triptype' into 'main'
first draft of using trip types See merge request PhilippHofer/rot!5
This commit is contained in:
		@@ -9,6 +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') }}
 | 
			
		||||
    {{ 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>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +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') }}
 | 
			
		||||
        {{ 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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 }}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,11 +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 />
 | 
			
		||||
                
 | 
			
		||||
              <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
 | 
			
		||||
@@ -62,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 --- #}
 | 
			
		||||
@@ -81,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>
 | 
			
		||||
@@ -96,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 --- #}
 | 
			
		||||
 | 
			
		||||
@@ -140,15 +145,23 @@
 | 
			
		||||
          <div class="flex justify-between items-center">
 | 
			
		||||
            <div>
 | 
			
		||||
              {% if trip.max_people == 0 %}
 | 
			
		||||
                <strong class="text-[#f43f5e]">⚠ {{ trip.planned_starting_time }} Uhr</strong>
 | 
			
		||||
                <strong class="text-[#f43f5e]">⚠ {{ 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 />
 | 
			
		||||
              <a href="#" data-sidebar="true" data-trigger="sidebar" 
 | 
			
		||||
                data-header="<strong>{% if trip.max_people == 0 %}⚠ {% 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 %}⚠ {% 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
 | 
			
		||||
@@ -168,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>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user