264 lines
13 KiB
Plaintext
264 lines
13 KiB
Plaintext
{% import "includes/macros" as macros %}
|
|
|
|
{% extends "base" %}
|
|
|
|
{% block content %}
|
|
<div class="max-w-screen-xl w-full grid sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{% if flash %}
|
|
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}
|
|
{% endif %}
|
|
|
|
<h1 class="h1 sm:col-span-2 lg:col-span-3">Ausfahrten</h1>
|
|
|
|
{% for day in days %}
|
|
<div class="bg-white p-3 rounded-md flex justify-between flex-col">
|
|
<div>
|
|
<h2 class="text-lg text-primary-950 font-bold uppercase tracking-wide">{{ day.day| date(format="%d.%m.%Y") }}</h2>
|
|
|
|
{% if day.planned_events | length > 0 %}
|
|
<div class="grid grid-cols-1 gap-3 divide-y mb-3">
|
|
{% for planned_event in day.planned_events %}
|
|
<div class="pt-2" data-coxneeded="{{ planned_event.cox_needed }}">
|
|
<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 />
|
|
<a href="#" data-sidebar="true" data-trigger="detailEvent{{ planned_event.id }}"
|
|
class="inline-block mr-3 link-primary">Details</a>
|
|
</div>
|
|
<div class="text-right grid gap-2">
|
|
{% set_global cur_user_participates = false %}
|
|
{% for rower in planned_event.rower%}
|
|
{% if rower.name == loggedin_user.name %}
|
|
{% set_global cur_user_participates = true %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if cur_user_participates %}
|
|
<a href="/remove/{{ planned_event.trip_details_id }}" class="btn btn-attention btn-fw">Abmelden</a>
|
|
{% 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>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if loggedin_user.is_cox %}
|
|
|
|
{% set_global cur_user_participates = false %}
|
|
{% for cox in planned_event.cox %}
|
|
{% if cox.name == loggedin_user.name %}
|
|
{% set_global cur_user_participates = true %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if cur_user_participates %}
|
|
<a href="/cox/remove/{{ planned_event.id }}" class="block btn btn-attention btn-fw">
|
|
{% include "includes/cox-icon" %}
|
|
Abmelden
|
|
</a>
|
|
{% else %}
|
|
<a href="/cox/join/{{ planned_event.id }}" class="block btn btn-dark btn-fw">
|
|
{% include "includes/cox-icon" %}
|
|
Steuern
|
|
</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="sidebar slide-in from-right" id="detailEvent{{ planned_event.id }}" aria-modal="false">
|
|
<div class="bg-primary-900 text-white px-2 py-3 flex justify-between sidebar-header">
|
|
<div class="ps-1">
|
|
<strong>{{ planned_event.planned_starting_time }} Uhr</strong> ({{ planned_event.name }})
|
|
{% if planned_event.notes %}
|
|
<small class="block">{{ planned_event.notes }}</small>
|
|
{% endif %}
|
|
</div>
|
|
<div>
|
|
<button type="button" title="Details schließen" class="sidebar-close border-0 bg-primary-600 text-black"
|
|
data-trigger="detailEvent{{ planned_event.id }}">
|
|
x
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
|
|
{# --- START List Coxes --- #}
|
|
{% if planned_event.planned_amount_cox > 0 %}
|
|
{% set amount_cur_cox = planned_event.cox | length %}
|
|
{{ macros::box(participants=planned_event.cox, empty_seats=planned_event.planned_amount_cox - amount_cur_cox, header='Steuerleute werden benötigt', text='Keine Steuerleute angemeldet') }}
|
|
{% endif %}
|
|
{# --- END List Coxes --- #}
|
|
|
|
{# --- START List Rowers --- #}
|
|
{% if planned_event.max_people > 0 %}
|
|
{% set amount_cur_rower = planned_event.rower | length %}
|
|
{{ macros::box(participants=planned_event.rower, empty_seats=planned_event.max_people - amount_cur_rower, bg='primary-100', color='black') }}
|
|
{% endif %}
|
|
{# --- END List Rowers --- #}
|
|
|
|
{% if planned_event.allow_guests %}
|
|
<div class="text-primary-900 bg-primary-50 text-center p-1 mb-4">Gäste sind erlaubt</div>
|
|
{% endif %}
|
|
|
|
{# --- START Delete Btn --- #}
|
|
{% if loggedin_user.is_admin %}
|
|
<div class="text-right">
|
|
<a href="/admin/planned-event/{{ planned_event.id }}/delete" class="inline-block btn btn-alert">
|
|
{% include "includes/delete-icon" %}
|
|
Termin löschen
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
{# --- END Delete Btn --- #}
|
|
</div>
|
|
</div>
|
|
<div class="sidebar-overlay" data-trigger="detailEvent{{ planned_event.id }}"></div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
{% if day.trips | length > 0 %}
|
|
<div class="grid grid-cols-1 gap-3 divide-y mb-3">
|
|
{% for trip in day.trips %}
|
|
<div class="pt-2">
|
|
<div class="flex justify-between items-center">
|
|
<div>
|
|
<strong class="text-primary-900">{{ trip.planned_starting_time }} Uhr</strong> <small
|
|
class="text-gray-600">({{ trip.cox_name }})</small><br />
|
|
<a href="#" data-sidebar="true" data-trigger="detailTrip{{ trip.trip_details_id }}"
|
|
class="inline-block link-primary mr-3">Details</a>
|
|
</div>
|
|
<div>
|
|
{% set_global cur_user_participates = false %}
|
|
{% for rower in trip.rower %}
|
|
{% if rower.name == loggedin_user.name %}
|
|
{% set_global cur_user_participates = true %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if cur_user_participates %}
|
|
<a href="/remove/{{ trip.trip_details_id }}"
|
|
class="inline-block rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer">Abmelden</a>
|
|
{% 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="inline-block rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">Mitrudern</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sidebar slide-in from-right" id="detailTrip{{ trip.trip_details_id }}" aria-modal="false">
|
|
<div class="bg-primary-900 text-white px-2 py-3 flex justify-between sidebar-header">
|
|
<div class="ps-1">
|
|
<strong>{{ trip.planned_starting_time }} Uhr</strong> ({{ trip.cox_name }})
|
|
{% if trip.notes %}
|
|
<small class="block">{{ trip.notes }}</small>
|
|
{% endif %}
|
|
</div>
|
|
<div>
|
|
<button type="button" title="Details schließen" class="sidebar-close border-0 bg-primary-600 text-black"
|
|
data-trigger="detailTrip{{ trip.trip_details_id }}">
|
|
x
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
|
|
{% if trip.max_people > 0 %}
|
|
<div class="text-primay-900 bg-primary-100 text-center p-1 mt-1 rounded-t-md">{{ trip.max_people }} - {{
|
|
trip.rower | length }} Ruderer können teilnehmen ({{ trip.max_people }})</div>
|
|
<div class="p-2 border border-t-0 border-primary-100 mb-4 rounded-b-md">
|
|
{% if trip.rower | length > 0 %}
|
|
{% for rower in trip.rower %}
|
|
{{ rower.name }} <span class="hidden">(angemeldet seit {{ rower.registered_at }})</span><br />
|
|
{% endfor %}
|
|
{% else %}
|
|
Keine Ruderer angemeldet
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div><a href="/cox/remove/trip/{{ trip.id }}">LÖSCHEN</a></div>
|
|
</div>
|
|
<div class="sidebar-overlay" data-trigger="detailTrip{{ trip.trip_details_id }}"></div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div>
|
|
{% if loggedin_user.is_admin %}
|
|
<a href="#" data-sidebar="true" data-trigger="plannedTrip{{ loop.index }}"
|
|
class="inline-block link-dark mr-3">Event hinzufügen</a>
|
|
|
|
<!-- START Sidebar plannedTrip -->
|
|
<div class="sidebar slide-in from-right" id="plannedTrip{{ loop.index }}" aria-modal="false">
|
|
<div class="bg-primary-900 text-white px-2 py-3 flex justify-between sidebar-header">
|
|
<div>
|
|
<span class="ps-1">
|
|
<strong>Event</strong> am {{ day.day| date(format="%d.%m.%Y") }} erstellen
|
|
</span>
|
|
</div>
|
|
<button type="button" title="Add planned event schließen"
|
|
class="sidebar-close border-0 bg-primary-600 text-black" data-trigger="plannedTrip{{ loop.index }}">
|
|
x
|
|
</button>
|
|
</div>
|
|
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
|
|
<form action="/admin/planned-event" method="post" class="grid gap-3">
|
|
<input type="hidden" name="day" value="{{ day.day }}" />
|
|
{{ macros::input(label='Titel (z.B. Firmenrudern)', name='name', type='text', required=true) }}
|
|
{{ macros::input(label='Startzeit', name='planned_starting_time', type='text', required=true) }}
|
|
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', required=true) }}
|
|
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true) }}
|
|
{{ macros::checkbox(label='Gäste erlauben', name='max_allow_guestspeople') }}
|
|
{{ macros::input(label='Anmerkungen', name='notes', type='text') }}
|
|
<input value="Erstellen"
|
|
class="w-full rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
|
type="submit" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="sidebar-overlay" data-trigger="plannedTrip{{ loop.index }}"></div>
|
|
<!-- END Sidebar plannedTrip -->
|
|
{% endif %}
|
|
|
|
{% if loggedin_user.is_cox%}
|
|
<a href="#" data-sidebar="true" data-trigger="trip{{ loop.index }}"
|
|
class="inline-block link-primary">Ausfahrt hinzufügen</a>
|
|
|
|
<div class="sidebar slide-in from-right" id="trip{{ loop.index }}" aria-modal="false">
|
|
<div class="bg-primary-900 text-white px-2 py-3 flex justify-between sidebar-header">
|
|
<div>
|
|
<span class="ps-1">
|
|
<strong>Ausfahrt</strong> am {{ day.day| date(format="%d.%m.%Y") }} erstellen
|
|
</span>
|
|
</div>
|
|
<button type="button" title="Add trip schließen" class="sidebar-close border-0 bg-primary-600 text-black"
|
|
data-trigger="trip{{ loop.index }}">
|
|
x
|
|
</button>
|
|
</div>
|
|
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
|
|
<form action="/cox/trip" method="post" class="grid gap-3">
|
|
<input type="hidden" name="day" value="{{ day.day }}" />
|
|
{{ macros::input(label='Startzeit', name='planned_starting_time', type='text', required=true) }}
|
|
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true) }}
|
|
{{ macros::input(label='Anmerkungen', name='notes', type='text') }}
|
|
|
|
<input value="Erstellen"
|
|
class="w-full rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
|
type="submit" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="sidebar-overlay" data-trigger="trip{{ loop.index }}"></div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endblock content %}
|