forked from Ruderverein-Donau-Linz/rowt
		
	[BUGFIX] sorting trips & events
This commit is contained in:
		@@ -10,7 +10,7 @@
 | 
			
		||||
        {% include "includes/plus-icon" %}
 | 
			
		||||
        </button>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="body-js px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
 | 
			
		||||
    <div class="body-js px-2 pt-2">
 | 
			
		||||
        Formular wird ersetzt
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -22,23 +22,23 @@
 | 
			
		||||
      {% endif %}
 | 
			
		||||
   {% endfor %}
 | 
			
		||||
  {% endif %}
 | 
			
		||||
  <div class="bg-white p-3 rounded-md flex justify-between flex-col shadow reset-js" style="min-height: 10rem;" data-trips="{{ amount_trips }}" data-month="{{ day.day| date(format='%m') }}" data-coxneeded="{{ day_cox_needed }}">
 | 
			
		||||
  <div class="bg-white rounded-md flex justify-between flex-col shadow reset-js" style="min-height: 10rem;" data-trips="{{ amount_trips }}" data-month="{{ day.day| date(format='%m') }}" data-coxneeded="{{ day_cox_needed }}">
 | 
			
		||||
    <div>
 | 
			
		||||
      <h2 class="font-bold uppercase tracking-wide text-center text-primary-950 text-lg">{{ day.day| date(format="%d.%m.%Y") }}
 | 
			
		||||
      <h2 class="font-bold uppercase tracking-wide text-center text-primary-950 text-lg px-3 pt-3">{{ day.day| date(format="%d.%m.%Y") }}
 | 
			
		||||
        <small class="inline-block ml-1 text-xs text-gray-400">{{ day.day | date(format="%A", locale="de_AT") }}</small>  
 | 
			
		||||
      </h2>
 | 
			
		||||
 | 
			
		||||
      {% if day.planned_events | length > 0 or  day.trips | length > 0 %}
 | 
			
		||||
      <div class="grid grid-cols-1 gap-3 divide-y mb-3">
 | 
			
		||||
      <div class="grid grid-cols-1 gap-3 my-3">
 | 
			
		||||
 | 
			
		||||
      {# --- START Events --- #}
 | 
			
		||||
      {% if day.planned_events | length > 0 %}
 | 
			
		||||
        {% for planned_event in day.planned_events | sort(attribute="planned_starting_time") %}
 | 
			
		||||
                {% set amount_cur_cox = planned_event.cox | length %}
 | 
			
		||||
		{% set amount_cox_missing = planned_event.planned_amount_cox - amount_cur_cox %}
 | 
			
		||||
        <div class="pt-2">
 | 
			
		||||
        <div class="pt-2 px-3 border-t" style="order: {{ planned_event.planned_starting_time | replace(from=":", to="") | trim_start_matches(pat="0") }}">
 | 
			
		||||
          <div class="flex justify-between items-center">
 | 
			
		||||
            <div>
 | 
			
		||||
            <div class="mr-1">
 | 
			
		||||
              <strong class="text-primary-900">
 | 
			
		||||
                {{ planned_event.planned_starting_time }} Uhr 
 | 
			
		||||
                {% if planned_event.trip_type %}
 | 
			
		||||
@@ -126,10 +126,10 @@
 | 
			
		||||
            <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>
 | 
			
		||||
              <form action="/admin/planned-event" method="post" class="grid gap-3">
 | 
			
		||||
	      	<input type="hidden" name="_method" value="put" />
 | 
			
		||||
	      	<input type="hidden" name="id" value="{{ planned_event.id }}" />
 | 
			
		||||
                <input type="hidden" name="_method" value="put" />
 | 
			
		||||
                <input type="hidden" name="id" value="{{ planned_event.id }}" />
 | 
			
		||||
                {{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=planned_event.max_people, min='0') }}
 | 
			
		||||
    		{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', value=planned_event.planned_amount_cox, required=true, min='0') }}
 | 
			
		||||
                {{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', value=planned_event.planned_amount_cox, required=true, min='0') }}
 | 
			
		||||
                {{ macros::input(label='Anmerkungen', name='notes', type='input', value=planned_event.notes) }}
 | 
			
		||||
 | 
			
		||||
                <input value="Bearbeiten" class="btn btn-primary" type="submit" />
 | 
			
		||||
@@ -156,10 +156,10 @@
 | 
			
		||||
 | 
			
		||||
      {# --- START Trips --- #}
 | 
			
		||||
      {% if day.trips | length > 0 %}
 | 
			
		||||
        {% for trip in day.trips %}
 | 
			
		||||
        <div class="pt-2 reset-js" data-coxneeded="false">
 | 
			
		||||
        {% for trip in day.trips | sort(attribute="planned_starting_time") %}
 | 
			
		||||
        <div class="pt-2 px-3 reset-js border-t" style="order: {{ trip.planned_starting_time | replace(from=":", to="") | trim_start_matches(pat="0")  }}" data-coxneeded="false">
 | 
			
		||||
          <div class="flex justify-between items-center">
 | 
			
		||||
            <div>
 | 
			
		||||
            <div class="mr-1">
 | 
			
		||||
              {% if trip.max_people == 0 %}
 | 
			
		||||
                <strong class="text-[#f43f5e]">⚠ {{ trip.planned_starting_time }} Uhr
 | 
			
		||||
                  {% if trip.trip_type %}
 | 
			
		||||
@@ -201,10 +201,8 @@
 | 
			
		||||
              {% endif %}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        {# --- START Sidebar Content --- #}
 | 
			
		||||
        <div class="hidden">
 | 
			
		||||
          {# --- START Sidebar Content --- #}
 | 
			
		||||
          <div class="hidden">
 | 
			
		||||
            <div id="trip{{ trip.trip_details_id }}">
 | 
			
		||||
              {% if trip.max_people == 0 %}
 | 
			
		||||
                {# --- border-[#f43f5e] bg-[#f43f5e] --- #}
 | 
			
		||||
@@ -214,14 +212,14 @@
 | 
			
		||||
                {{ macros::box(participants=trip.rower, empty_seats=trip.max_people - amount_cur_rower, bg='primary-100', color='black') }}
 | 
			
		||||
              {% endif %}
 | 
			
		||||
 | 
			
		||||
                 {# --- START Edit Form --- #}
 | 
			
		||||
                {# --- 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>
 | 
			
		||||
              <form action="/cox/trip/{{ trip.id }}" method="post" class="grid gap-3">
 | 
			
		||||
                {{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=trip.max_people, min='0') }}
 | 
			
		||||
                {{ macros::input(label='Anmerkungen', name='notes', type='input', value=trip.notes) }}
 | 
			
		||||
        	{{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt', selected_id=trip.trip_type_id) }}
 | 
			
		||||
                {{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt', selected_id=trip.trip_type_id) }}
 | 
			
		||||
 | 
			
		||||
                <input value="Bearbeiten" class="btn btn-primary" type="submit" />
 | 
			
		||||
              </form>
 | 
			
		||||
@@ -239,6 +237,7 @@
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          {# --- END Sidebar Content --- #}
 | 
			
		||||
        </div>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
      {% endif %}
 | 
			
		||||
       {# --- END Trips --- #}
 | 
			
		||||
@@ -248,7 +247,7 @@
 | 
			
		||||
 | 
			
		||||
    {# --- START Add Buttons --- #}
 | 
			
		||||
    {% if loggedin_user.is_admin or loggedin_user.is_cox %}
 | 
			
		||||
      <div class="-mb-3 -mx-3 grid {% if loggedin_user.is_admin %} grid-cols-2 {% endif %} text-center">
 | 
			
		||||
      <div class="grid {% if loggedin_user.is_admin %} grid-cols-2 {% endif %} text-center">
 | 
			
		||||
        {% if loggedin_user.is_admin %}
 | 
			
		||||
        <a href="#" data-sidebar="true" data-trigger="sidebar" 
 | 
			
		||||
          data-header="<strong>Event</strong> am {{ day.day| date(format='%d.%m.%Y') }} erstellen"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user