forked from Ruderverein-Donau-Linz/rowt
[TASK] style planned events and sidebar forms
This commit is contained in:
parent
d5d55909ff
commit
ecab5b4fc6
@ -1,6 +1,11 @@
|
||||
# TODO
|
||||
- [ ] Allow sign-outs only >2h before event
|
||||
|
||||
# Notes / Bugfixes
|
||||
- [ ] User loggedin status not present on user admin interface (header/footer not rendering) [ph]
|
||||
- [ ] is_cox: cox can become cox and than rower at the same event, (rower and than cox -> exception working) [ph]
|
||||
- [ ] Mobile Breakpoint: Add user broken user admin interface [mb]
|
||||
|
||||
# Frontend Process
|
||||
´cd frontend´
|
||||
´npm install´
|
||||
|
@ -1,7 +1,7 @@
|
||||
<footer class="bg-primary-950 text-white w-full flex justify-center p-3">
|
||||
<div class="max-w-screen-lg w-full flex justify-between">
|
||||
<div>
|
||||
Marie Birner <span class="text-[#ff0000]">♥</span> Philipp Hofer
|
||||
<span class="text-[#ff0000]">♥</span> ASKÖ Ruderverein Donau Linz
|
||||
</div>
|
||||
<div>
|
||||
© {{ now() | date(format="%Y") }}
|
||||
|
@ -20,4 +20,15 @@
|
||||
</div>
|
||||
</header>
|
||||
<div class="h-8"></div>
|
||||
{% endmacro header %}
|
||||
|
||||
{% macro input(label, name, type, required=false) %}
|
||||
<label for="{{ name }}" class="sr-only">{{ label }}</label>
|
||||
<input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} class="relative block w-full rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6" placeholder="{{ label }}">
|
||||
{% endmacro input %}
|
||||
|
||||
{% macro checkbox(label, name, checked=false) %}
|
||||
<label for="{{ name }}" class="flex items-center cursor-pointer hover:text-gray-900">
|
||||
<input type="checkbox" id="{{ name }}" name="{{ name }}" {% if checked %} checked {% endif %} class="h-4 w-4 accent-primary-600 mr-2"/> {{ label }}
|
||||
</label>
|
||||
{% endmacro checkbox %}
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% import "includes/macros" as macros %}
|
||||
|
||||
{% extends "base" %}
|
||||
|
||||
{% block content %}
|
||||
@ -19,45 +21,104 @@
|
||||
|
||||
{% for day in days %}
|
||||
<div class="bg-white p-3 rounded-md flex justify-between flex-col">
|
||||
<div>
|
||||
<h2 class="text-lg 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 %}
|
||||
<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 %}
|
||||
<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>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<br />
|
||||
|
||||
Folgende Ruderer haben sich schon angemeldet:
|
||||
<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/>
|
||||
<a href="#" data-sidebar="true" data-trigger="detailEvent{{ planned_event.id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a>
|
||||
</div>
|
||||
<div>
|
||||
{% for rower in planned_event.rower%}
|
||||
{{ rower.name }} (angemeldet seit {{ rower.registered_at }})
|
||||
{% if rower.name == loggedin_user.name %}
|
||||
<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>
|
||||
<a href="/remove/{{ planned_event.trip_details_id }}" class="deregister-btn 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 %}
|
||||
{% endfor %}
|
||||
|
||||
{% if planned_event.max_people > planned_event.rower | length %}
|
||||
<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>
|
||||
<a href="/join/{{ planned_event.trip_details_id }}" class="register-btn 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>
|
||||
{% if loggedin_user.is_cox %}
|
||||
{% for cox in planned_event.cox %}
|
||||
{% if cox.name == loggedin_user.name %}
|
||||
<a href="/cox/remove/{{ planned_event.id }}" class="deregister-btn 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">
|
||||
<svg width="16" height="16" fill="currentColor" class="inline-block mr-1 h-3 w-3" viewBox="0 0 16 16"> <path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/> </svg>
|
||||
Abmelden
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<a href="/cox/join/{{ planned_event.id }}" class="register-btn rounded-md bg-primary-900 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-950 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-950 cursor-pointer">
|
||||
<svg width="16" height="16" fill="currentColor" class="inline-block mr-1 h-3 w-3" viewBox="0 0 16 16"> <path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/> </svg>
|
||||
Steuern
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<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">
|
||||
|
||||
{% if loggedin_user.is_cox %}
|
||||
<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>
|
||||
{% if planned_event.planned_amount_cox > 0 %}
|
||||
<div class="bg-primary-600 text-white text-center p-1 mt-1 rounded-t-md">{{ planned_event.planned_amount_cox }} - {{ planned_event.cox | length }} Steuerleute werden benötigt ({{ planned_event.planned_amount_cox }})</div>
|
||||
<div class="p-2 border border-t-0 border-primary-600 mb-4 rounded-b-md">
|
||||
{% if planned_event.cox | length > 0 %}
|
||||
{% for cox in planned_event.cox %}
|
||||
{{ cox.name }} <span class="hidden">(angemeldet seit {{ cox.registered_at }})</span><br/>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
Keine Steuerleute angemeldet
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if planned_event.max_people > 0 %}
|
||||
<div class="text-primay-900 bg-primary-100 text-center p-1 mt-1 rounded-t-md">{{ planned_event.max_people }} - {{ planned_event.rower | length }} Ruderer können teilnehmen ({{ planned_event.max_people }})</div>
|
||||
<div class="p-2 border border-t-0 border-primary-100 mb-4 rounded-b-md">
|
||||
{% if planned_event.rower | length > 0 %}
|
||||
{% for rower in planned_event.rower %}
|
||||
{{ rower.name }} <span class="hidden">(angemeldet seit {{ rower.registered_at }})</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
Keine Ruderer angemeldet
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
{% if loggedin_user.is_admin %}
|
||||
<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>
|
||||
<a href="/admin/planned-event/{{ planned_event.id }}/delete" class="inline-block rounded-md bg-[#ff0000] 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">
|
||||
<svg width="16" height="16" fill="currentColor" class="inline h-4 w-4" viewBox="0 0 16 16"> <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/> <path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/> </svg>
|
||||
Termin löschen
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar-overlay" data-trigger="detailEvent{{ planned_event.id }}"></div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if day.trips | length > 0 %}
|
||||
<div class="grid grid-cols-1 gap-3 divide-y mb-3">
|
||||
@ -95,14 +156,16 @@
|
||||
</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 teilnehmen</div>
|
||||
|
||||
{% 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 %}
|
||||
<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 %}
|
||||
{% else %}
|
||||
Keine Ruderer angemeldet
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@ -111,16 +174,18 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% if loggedin_user.is_admin %}
|
||||
<a href="#" data-sidebar="true" data-trigger="plannedTrip{{ loop.index }}" class="inline-block text-primary-900 hover:text-primary-950 underline 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">
|
||||
Event
|
||||
<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 }}">
|
||||
@ -128,20 +193,20 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
|
||||
<form action="/admin/planned-event" method="post">
|
||||
<form action="/admin/planned-event" method="post" class="grid gap-3">
|
||||
<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" />
|
||||
{{ 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%}
|
||||
@ -151,7 +216,7 @@
|
||||
<div class="bg-primary-900 text-white px-2 py-3 flex justify-between sidebar-header">
|
||||
<div>
|
||||
<span class="ps-1">
|
||||
Ausfahrt
|
||||
<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 }}">
|
||||
@ -159,13 +224,13 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
|
||||
<form action="/cox/trip" method="post">
|
||||
<form action="/cox/trip" method="post" class="grid gap-3">
|
||||
<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" />
|
||||
{{ 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="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" />
|
||||
<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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user