rowt/templates/index.html.tera

176 lines
10 KiB
Plaintext
Raw Normal View History

2023-04-03 16:11:26 +02:00
{% extends "base" %}
{% block content %}
2023-04-06 13:15:40 +02:00
<div class="max-w-screen-lg w-full grid sm:grid-cols-2 lg:grid-cols-3 gap-4">
2023-04-06 09:30:43 +02:00
{% if flash %}
{% if flash.0 == "success" %}
2023-04-06 13:15:40 +02:00
<div class="sm:col-span-2 lg:col-span-3 bg-[#4ade80] text-white px-3 py-1 rounded-md text-center">
2023-04-06 09:30:43 +02:00
{{ flash.1 }}
2023-04-03 16:11:26 +02:00
</div>
2023-04-06 09:30:43 +02:00
{% endif %}
{% if flash.0 == "error" %}
2023-04-06 13:15:40 +02:00
<div class="sm:col-span-2 lg:col-span-3 bg-[#f43f5e] text-white px-3 py-1 rounded-md text-center">
2023-04-06 09:30:43 +02:00
{{ flash.1 }}
2023-04-03 16:11:26 +02:00
</div>
2023-04-06 09:30:43 +02:00
{% endif %}
{% endif %}
2023-04-05 22:35:52 +02:00
2023-04-06 13:15:40 +02:00
<h1 class="text-center text-3xl uppercase tracking-wide font-bold text-primary-900 sm:col-span-2 lg:col-span-3">Ausfahrten</h1>
2023-04-06 09:30:43 +02:00
{% for day in days %}
<div class="bg-white p-3 rounded-md">
2023-04-06 13:15:40 +02:00
<h2 class="mb-2 text-md font-bold uppercase tracking-wide">{{ day.day| date(format="%d.%m.%Y") }}</h2>
2023-04-06 09:30:43 +02:00
{% for planned_event in day.planned_events %}
<h3>Planned event '{{ planned_event.name }}'</h3>
Planned amount cox: {{ planned_event.planned_amount_cox }}<br />
Allow guests: {{ planned_event.allow_guests }}<br />
Planned starting time: {{ planned_event.planned_starting_time }}<br />
Max people: {{ planned_event.max_people }}<br />
Notes: {{ planned_event.notes }}<br />
Folgende Steuerpersonen haben sich schon angemeldet:
{% for cox in planned_event.cox %}
{{ cox }}
{% if cox == loggedin_user.name %}
2023-04-06 13:15:40 +02:00
<a href="/cox/remove/{{ planned_event.id }}" class="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">ABMELDEN</a>
2023-04-06 09:30:43 +02:00
{% endif %}
{% endfor %}
<br />
Folgende Ruderer haben sich schon angemeldet:
{% for rower in planned_event.rower%}
{{ rower.name }} (angemeldet seit {{ rower.registered_at }})
{% if rower.name == loggedin_user.name %}
2023-04-06 13:15:40 +02:00
<a href="/remove/{{ planned_event.trip_details_id }}" class="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">ABMELDEN</a>
2023-04-06 09:30:43 +02:00
{% endif %}
{% endfor %}
{% if planned_event.max_people > planned_event.rower | length %}
2023-04-06 13:15:40 +02:00
<a href="/join/{{ planned_event.trip_details_id }}" class="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>
2023-04-06 09:30:43 +02:00
{% endif %}
2023-04-05 22:35:52 +02:00
2023-04-06 09:30:43 +02:00
{% if loggedin_user.is_cox %}
2023-04-06 13:15:40 +02:00
<a href="/cox/join/{{ planned_event.id }}" class="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">STEUERN</a>
2023-04-05 22:35:52 +02:00
{% endif %}
2023-04-06 09:30:43 +02:00
{% if loggedin_user.is_admin %}
2023-04-06 13:15:40 +02:00
<a href="/admin/planned-event/{{ planned_event.id }}/delete" class="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">DELETE</a>
2023-04-05 22:35:52 +02:00
{% endif %}
{% endfor %}
2023-04-06 13:15:40 +02:00
{% if day.trips | length > 0 %}
<div class="grid grid-cols-1 gap-3 divide-y mb-3">
{% for trip in day.trips %}
<div>
<div class="flex justify-between">
<div><strong class="text-primary-900">{{ trip.planned_starting_time }} Uhr</strong> <small class="text-gray-600">({{ trip.cox_name }})</small></div>
<a href="#" data-sidebar="true" data-trigger="detailTrip{{ trip.trip_details_id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a>
</div>
{% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id %}
<a href="/join/{{ trip.trip_details_id }}" class="inline-block mt-1 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 %}
{% for rower in trip.rower %}
{% if rower.name == loggedin_user.name %}
<a href="/remove/{{ trip.trip_details_id }}" class="inline-block mt-1 rounded-md bg-[#f43f5e] 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">ABMELDEN</a>
{% endif %}
{% endfor %}
</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">
<div class="text-primay-900 bg-primary-100 text-center p-1 mt-1">{{ trip.max_people }} Ruderer können sich für diese Ausfahrt anmelden</div>
{% if trip.rower | length > 0 %}
<div class="mt-2">
<div class="font-bold">Anmeldungen:</div>
{% for rower in trip.rower %}
{{ rower.name }} <span class="hidden">(angemeldet seit {{ rower.registered_at }})</span>
{% endfor %}
</div>
{% endif %}
</div>
</div>
<div class="sidebar-overlay" data-trigger="detailTrip{{ trip.trip_details_id }}"></div>
2023-04-06 09:30:43 +02:00
{% endfor %}
2023-04-06 13:15:40 +02:00
</div>
{% endif %}
2023-04-05 22:35:52 +02:00
2023-04-06 09:30:43 +02:00
{% if loggedin_user.is_admin %}
2023-04-06 13:15:40 +02:00
<a href="#" data-sidebar="true" data-trigger="plannedTrip{{ loop.index }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Event hinzufügen</a>
<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">
Event
</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">
<input type="hidden" name="day" value="{{ day.day }}" />
<input type="text" name="name" placeholder="name (e.g. USI)" />
<input type="number" name="planned_amount_cox" placeholder="Anzahl Steuerleute" />
Gäste <input type="checkbox" name="allow_guests" />
<input type="text" name="planned_starting_time" placeholder="Startzeit" />
<input type="number" name="max_people" placeholder="Anzahl Ruderer" />
<input type="text" name="notes" placeholder="Anmerkungen" />
<input value="Anlegen" class="w-28 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>
2023-04-05 22:35:52 +02:00
{% endif %}
2023-04-06 09:30:43 +02:00
{% if loggedin_user.is_cox%}
2023-04-06 13:15:40 +02:00
<a href="#" data-sidebar="true" data-trigger="trip{{ loop.index }}" class="inline-block text-primary-600 hover:text-primary-900 underline">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">
Ausfahrt
</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">
<input type="hidden" name="day" value="{{ day.day }}" />
<input type="text" name="planned_starting_time" placeholder="Startzeit" />
<input type="number" name="max_people" placeholder="Anzahl Ruderer" />
<input type="text" name="notes" placeholder="Anmerkungen" />
<input value="Anlegen" class="w-28 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>
2023-04-06 09:30:43 +02:00
{% endif %}
2023-04-05 22:35:52 +02:00
2023-04-06 09:30:43 +02:00
</div>
{% endfor %}
</div>
2023-04-05 22:35:52 +02:00
</div>
2023-04-03 16:11:26 +02:00
{% endblock content %}