[BUGFIX] sorting trips & events

This commit is contained in:
Marie Birner 2023-06-08 11:25:08 +02:00
parent 2fa6992938
commit 5d0bfddadf
2 changed files with 18 additions and 19 deletions

View File

@ -10,7 +10,7 @@
{% include "includes/plus-icon" %} {% include "includes/plus-icon" %}
</button> </button>
</div> </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 Formular wird ersetzt
</div> </div>
</div> </div>

View File

@ -22,23 +22,23 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% 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> <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> <small class="inline-block ml-1 text-xs text-gray-400">{{ day.day | date(format="%A", locale="de_AT") }}</small>
</h2> </h2>
{% if day.planned_events | length > 0 or day.trips | length > 0 %} {% 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 --- #} {# --- START Events --- #}
{% if day.planned_events | length > 0 %} {% if day.planned_events | length > 0 %}
{% for planned_event in day.planned_events | sort(attribute="planned_starting_time") %} {% for planned_event in day.planned_events | sort(attribute="planned_starting_time") %}
{% set amount_cur_cox = planned_event.cox | length %} {% set amount_cur_cox = planned_event.cox | length %}
{% set amount_cox_missing = planned_event.planned_amount_cox - amount_cur_cox %} {% 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 class="flex justify-between items-center">
<div> <div class="mr-1">
<strong class="text-primary-900"> <strong class="text-primary-900">
{{ planned_event.planned_starting_time }} Uhr {{ planned_event.planned_starting_time }} Uhr
{% if planned_event.trip_type %} {% if planned_event.trip_type %}
@ -156,10 +156,10 @@
{# --- START Trips --- #} {# --- START Trips --- #}
{% if day.trips | length > 0 %} {% if day.trips | length > 0 %}
{% for trip in day.trips %} {% for trip in day.trips | sort(attribute="planned_starting_time") %}
<div class="pt-2 reset-js" data-coxneeded="false"> <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 class="flex justify-between items-center">
<div> <div class="mr-1">
{% if trip.max_people == 0 %} {% if trip.max_people == 0 %}
<strong class="text-[#f43f5e]">&#9888; {{ trip.planned_starting_time }} Uhr <strong class="text-[#f43f5e]">&#9888; {{ trip.planned_starting_time }} Uhr
{% if trip.trip_type %} {% if trip.trip_type %}
@ -201,8 +201,6 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
{# --- START Sidebar Content --- #} {# --- START Sidebar Content --- #}
<div class="hidden"> <div class="hidden">
<div id="trip{{ trip.trip_details_id }}"> <div id="trip{{ trip.trip_details_id }}">
@ -239,6 +237,7 @@
</div> </div>
</div> </div>
{# --- END Sidebar Content --- #} {# --- END Sidebar Content --- #}
</div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{# --- END Trips --- #} {# --- END Trips --- #}
@ -248,7 +247,7 @@
{# --- START Add Buttons --- #} {# --- START Add Buttons --- #}
{% if loggedin_user.is_admin or loggedin_user.is_cox %} {% 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 %} {% if loggedin_user.is_admin %}
<a href="#" data-sidebar="true" data-trigger="sidebar" <a href="#" data-sidebar="true" data-trigger="sidebar"
data-header="<strong>Event</strong> am {{ day.day| date(format='%d.%m.%Y') }} erstellen" data-header="<strong>Event</strong> am {{ day.day| date(format='%d.%m.%Y') }} erstellen"