forked from Ruderverein-Donau-Linz/rowt
rename planned_event to event
This commit is contained in:
@ -58,11 +58,11 @@
|
||||
<h1 class="h1 sm:col-span-2 lg:col-span-3">Ausfahrten</h1>
|
||||
{% include "includes/buttons" %}
|
||||
{% for day in days %}
|
||||
{% set amount_trips = day.planned_events | length + day.trips | length %}
|
||||
{% set amount_trips = day.events | length + day.trips | length %}
|
||||
{% set_global day_cox_needed = false %}
|
||||
{% if day.planned_events | length > 0 %}
|
||||
{% for planned_event in day.planned_events %}
|
||||
{% if planned_event.cox_needed %}
|
||||
{% if day.events | length > 0 %}
|
||||
{% for event in day.events %}
|
||||
{% if event.cox_needed %}
|
||||
{% set_global day_cox_needed = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@ -88,82 +88,82 @@
|
||||
</small>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if day.planned_events | length > 0 or day.trips | length > 0 %}
|
||||
{% if day.events | length > 0 or day.trips | length > 0 %}
|
||||
<div class="grid grid-cols-1 gap-3 mb-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 %}
|
||||
{% if day.events | length > 0 %}
|
||||
{% for event in day.events | sort(attribute="planned_starting_time") %}
|
||||
{% set amount_cur_cox = event.cox | length %}
|
||||
{% set amount_cox_missing = event.planned_amount_cox - amount_cur_cox %}
|
||||
<div class="pt-2 px-3 border-t border-gray-200"
|
||||
style="order: {{ planned_event.planned_starting_time | replace(from=":", to="") }}">
|
||||
style="order: {{ event.planned_starting_time | replace(from=":", to="") }}">
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="mr-1">
|
||||
{% if planned_event.max_people == 0 %}
|
||||
{% if event.max_people == 0 %}
|
||||
<strong class="text-[#f43f5e]">⚠ Absage
|
||||
{{ planned_event.planned_starting_time }}
|
||||
{{ event.planned_starting_time }}
|
||||
Uhr
|
||||
</strong>
|
||||
<small class="text-[#f43f5e]">({{ planned_event.name }}
|
||||
{%- if planned_event.trip_type %}
|
||||
- {{ planned_event.trip_type.icon | safe }} {{ planned_event.trip_type.name }}
|
||||
<small class="text-[#f43f5e]">({{ event.name }}
|
||||
{%- if event.trip_type %}
|
||||
- {{ event.trip_type.icon | safe }} {{ event.trip_type.name }}
|
||||
{%- endif -%}
|
||||
)</small>
|
||||
{% else %}
|
||||
<strong class="text-primary-900 dark:text-white">
|
||||
{{ planned_event.planned_starting_time }}
|
||||
{{ event.planned_starting_time }}
|
||||
Uhr
|
||||
</strong>
|
||||
<small class="text-gray-600 dark:text-gray-100">({{ planned_event.name }}
|
||||
{%- if planned_event.trip_type %}
|
||||
- {{ planned_event.trip_type.icon | safe }} {{ planned_event.trip_type.name }}
|
||||
<small class="text-gray-600 dark:text-gray-100">({{ event.name }}
|
||||
{%- if event.trip_type %}
|
||||
- {{ event.trip_type.icon | safe }} {{ event.trip_type.name }}
|
||||
{%- endif -%}
|
||||
)</small>
|
||||
{% endif %}
|
||||
<br />
|
||||
<a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>{{ planned_event.planned_starting_time }} Uhr</strong> ({{ planned_event.name }})
|
||||
{% if planned_event.trip_type %}<small class='block'>{{ planned_event.trip_type.desc }}</small>{% endif %}
|
||||
{% if planned_event.notes %}<small class='block'>{{ planned_event.notes }}</small>{% endif %}
|
||||
" data-body="#event{{ planned_event.trip_details_id }}" class="inline-block link-primary mr-3">
|
||||
<a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>{{ event.planned_starting_time }} Uhr</strong> ({{ event.name }})
|
||||
{% if event.trip_type %}<small class='block'>{{ event.trip_type.desc }}</small>{% endif %}
|
||||
{% if event.notes %}<small class='block'>{{ event.notes }}</small>{% endif %}
|
||||
" data-body="#event{{ event.trip_details_id }}" class="inline-block link-primary mr-3">
|
||||
Details
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-right grid gap-2">
|
||||
{# --- START Row Buttons --- #}
|
||||
{% set_global cur_user_participates = false %}
|
||||
{% for rower in planned_event.rower %}
|
||||
{% for rower in event.rower %}
|
||||
{% if rower.name == loggedin_user.name %}
|
||||
{% set_global cur_user_participates = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if cur_user_participates %}
|
||||
<a href="/planned/remove/{{ planned_event.trip_details_id }}"
|
||||
<a href="/planned/remove/{{ event.trip_details_id }}"
|
||||
class="btn btn-attention btn-fw">Abmelden</a>
|
||||
{% endif %}
|
||||
{% if planned_event.max_people > planned_event.rower | length and cur_user_participates == false %}
|
||||
<a href="/planned/join/{{ planned_event.trip_details_id }}"
|
||||
{% if event.max_people > event.rower | length and cur_user_participates == false %}
|
||||
<a href="/planned/join/{{ event.trip_details_id }}"
|
||||
class="btn btn-primary btn-fw"
|
||||
{% if planned_event.trip_type %}onclick="return confirm('{{ planned_event.trip_type.question }}');"{% endif %}>Mitrudern</a>
|
||||
{% if event.trip_type %}onclick="return confirm('{{ event.trip_type.question }}');"{% endif %}>Mitrudern</a>
|
||||
{% endif %}
|
||||
{# --- END Row Buttons --- #}
|
||||
{# --- START Cox Buttons --- #}
|
||||
{% if "cox" in loggedin_user.roles %}
|
||||
{% set_global cur_user_participates = false %}
|
||||
{% for cox in planned_event.cox %}
|
||||
{% for cox in 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 }}"
|
||||
<a href="/cox/remove/{{ event.id }}"
|
||||
class="block btn btn-attention btn-fw">
|
||||
{% include "includes/cox-icon" %}
|
||||
Abmelden
|
||||
</a>
|
||||
{% elif planned_event.planned_amount_cox > 0 %}
|
||||
<a href="/cox/join/{{ planned_event.id }}"
|
||||
{% elif event.planned_amount_cox > 0 %}
|
||||
<a href="/cox/join/{{ event.id }}"
|
||||
class="block btn {% if amount_cox_missing > 0 %} btn-dark {% else %} btn-gray {% endif %} btn-fw"
|
||||
{% if planned_event.trip_type %}onclick="return confirm('{{ planned_event.trip_type.question }}');"{% endif %}>
|
||||
{% if event.trip_type %}onclick="return confirm('{{ event.trip_type.question }}');"{% endif %}>
|
||||
{% include "includes/cox-icon" %}
|
||||
Steuern
|
||||
</a>
|
||||
@ -174,30 +174,30 @@
|
||||
</div>
|
||||
{# --- START Sidebar Content --- #}
|
||||
<div class="hidden">
|
||||
<div id="event{{ planned_event.trip_details_id }}">
|
||||
<div id="event{{ event.trip_details_id }}">
|
||||
{# --- START List Coxes --- #}
|
||||
{% if planned_event.planned_amount_cox > 0 %}
|
||||
{% if planned_event.max_people == 0 %}
|
||||
{{ macros::box(participants=planned_event.cox, empty_seats="", header='Absage', bg='[#f43f5e]') }}
|
||||
{% if event.planned_amount_cox > 0 %}
|
||||
{% if event.max_people == 0 %}
|
||||
{{ macros::box(participants=event.cox, empty_seats="", header='Absage', bg='[#f43f5e]') }}
|
||||
{% else %}
|
||||
{% if amount_cox_missing > 0 %}
|
||||
{{ macros::box(participants=planned_event.cox, empty_seats=planned_event.planned_amount_cox - amount_cur_cox, header='Noch benötigte Steuerleute:', text='Keine Steuerleute angemeldet') }}
|
||||
{{ macros::box(participants=event.cox, empty_seats=event.planned_amount_cox - amount_cur_cox, header='Noch benötigte Steuerleute:', text='Keine Steuerleute angemeldet') }}
|
||||
{% else %}
|
||||
{{ macros::box(participants=planned_event.cox, empty_seats="", header='Genügend Steuerleute haben sich angemeldet :-)', text='Keine Steuerleute angemeldet') }}
|
||||
{{ macros::box(participants=event.cox, empty_seats="", header='Genügend Steuerleute haben sich angemeldet :-)', text='Keine Steuerleute angemeldet') }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{# --- END List Coxes --- #}
|
||||
{# --- START List Rowers --- #}
|
||||
{% set amount_cur_rower = planned_event.rower | length %}
|
||||
{% if planned_event.max_people == 0 %}
|
||||
{{ macros::box(header='Absage', bg='[#f43f5e]', participants=planned_event.rower, trip_details_id=planned_event.trip_details_id, allow_removing="planned_event" in loggedin_user.roles) }}
|
||||
{% set amount_cur_rower = event.rower | length %}
|
||||
{% if event.max_people == 0 %}
|
||||
{{ macros::box(header='Absage', bg='[#f43f5e]', participants=event.rower, trip_details_id=event.trip_details_id, allow_removing="event" in loggedin_user.roles) }}
|
||||
{% else %}
|
||||
{{ macros::box(participants=planned_event.rower, empty_seats=planned_event.max_people - amount_cur_rower, bg='primary-100', color='black', trip_details_id=planned_event.trip_details_id, allow_removing="planned_event" in loggedin_user.roles) }}
|
||||
{{ macros::box(participants=event.rower, empty_seats=event.max_people - amount_cur_rower, bg='primary-100', color='black', trip_details_id=event.trip_details_id, allow_removing="event" in loggedin_user.roles) }}
|
||||
{% endif %}
|
||||
{# --- END List Rowers --- #}
|
||||
{% if "planned_event" in loggedin_user.roles %}
|
||||
<form action="/planned/join/{{ planned_event.trip_details_id }}"
|
||||
{% if "event" in loggedin_user.roles %}
|
||||
<form action="/planned/join/{{ event.trip_details_id }}"
|
||||
method="get" />
|
||||
{{ macros::input(label='Gast', class="input rounded-t", name='user_note', type='text', required=true) }}
|
||||
<input value="Gast hinzufügen"
|
||||
@ -205,51 +205,51 @@
|
||||
type="submit" />
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if planned_event.allow_guests %}
|
||||
{% if event.allow_guests %}
|
||||
<div class="text-primary-900 bg-primary-50 text-center p-1 mb-4">Gäste willkommen!</div>
|
||||
{% endif %}
|
||||
{% if "planned_event" in loggedin_user.roles %}
|
||||
{% if "event" in loggedin_user.roles %}
|
||||
{# --- START Edit Form --- #}
|
||||
<div class="bg-gray-100 dark:bg-primary-900 p-3 mt-4 rounded-md">
|
||||
<h3 class="text-primary-950 dark:text-white 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 }}" />
|
||||
{{ macros::input(label='Titel', name='name', type='input', value=planned_event.name) }}
|
||||
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=planned_event.max_people, min='1') }}
|
||||
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', value=planned_event.planned_amount_cox, required=true, min='0') }}
|
||||
{{ macros::checkbox(label='Immer anzeigen', name='always_show', id=planned_event.id,checked=planned_event.always_show) }}
|
||||
{{ macros::checkbox(label='Gesperrt', name='is_locked', id=planned_event.id,checked=planned_event.is_locked) }}
|
||||
{{ macros::input(label='Anmerkungen', name='notes', type='input', value=planned_event.notes) }}
|
||||
<input type="hidden" name="id" value="{{ event.id }}" />
|
||||
{{ macros::input(label='Titel', name='name', type='input', value=event.name) }}
|
||||
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=event.max_people, min='1') }}
|
||||
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', value=event.planned_amount_cox, required=true, min='0') }}
|
||||
{{ macros::checkbox(label='Immer anzeigen', name='always_show', id=event.id,checked=event.always_show) }}
|
||||
{{ macros::checkbox(label='Gesperrt', name='is_locked', id=event.id,checked=event.is_locked) }}
|
||||
{{ macros::input(label='Anmerkungen', name='notes', type='input', value=event.notes) }}
|
||||
<input value="Speichern" class="btn btn-primary" type="submit" />
|
||||
</form>
|
||||
</div>
|
||||
{# --- END Edit Form --- #}
|
||||
{# --- START Delete Btn --- #}
|
||||
{% if planned_event.rower | length == 0 and amount_cur_cox == 0 %}
|
||||
{% if event.rower | length == 0 and amount_cur_cox == 0 %}
|
||||
<div class="text-right mt-6">
|
||||
<a href="/admin/planned-event/{{ planned_event.id }}/delete"
|
||||
<a href="/admin/planned-event/{{ event.id }}/delete"
|
||||
class="inline-block btn btn-alert">
|
||||
{% include "includes/delete-icon" %}
|
||||
Termin löschen
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
{% if planned_event.max_people == 0 %}
|
||||
{% if event.max_people == 0 %}
|
||||
Wenn du deine Absage absagen (:^)) willst, einfach entsprechende Anzahl an Ruderer oben eintragen.
|
||||
{% else %}
|
||||
<div class="bg-gray-100 dark:bg-primary-900 p-3 mt-4 rounded-md">
|
||||
<h3 class="text-primary-950 dark:text-white font-bold uppercase tracking-wide mb-2">Event absagen</h3>
|
||||
<form action="/admin/planned-event" method="post" class="grid">
|
||||
<input type="hidden" name="_method" value="put" />
|
||||
<input type="hidden" name="id" value="{{ planned_event.id }}" />
|
||||
<input type="hidden" name="id" value="{{ event.id }}" />
|
||||
{{ macros::input(label='Grund der Absage', name='notes', type='input', value='') }}
|
||||
{{ macros::input(label='', name='max_people', type='hidden', value=0) }}
|
||||
{{ macros::input(label='', name='name', type='hidden', value=planned_event.name) }}
|
||||
{{ macros::input(label='', name='max_people', type='hidden', value=planned_event.max_people) }}
|
||||
{{ macros::input(label='', name='planned_amount_cox', type='hidden', value=planned_event.planned_amount_cox) }}
|
||||
{{ macros::input(label='', name='always_show', type='hidden', value=planned_event.always_show) }}
|
||||
{{ macros::input(label='', name='is_locked', type='hidden', value=planned_event.is_locked) }}
|
||||
{{ macros::input(label='', name='name', type='hidden', value=event.name) }}
|
||||
{{ macros::input(label='', name='max_people', type='hidden', value=event.max_people) }}
|
||||
{{ macros::input(label='', name='planned_amount_cox', type='hidden', value=event.planned_amount_cox) }}
|
||||
{{ macros::input(label='', name='always_show', type='hidden', value=event.always_show) }}
|
||||
{{ macros::input(label='', name='is_locked', type='hidden', value=event.is_locked) }}
|
||||
<input value="Ausfahrt absagen" class="btn btn-alert" type="submit" />
|
||||
</form>
|
||||
</div>
|
||||
@ -389,9 +389,9 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{# --- START Add Buttons --- #}
|
||||
{% if "planned_event" in loggedin_user.roles or "cox" in loggedin_user.roles %}
|
||||
<div class="grid {% if "planned_event" in loggedin_user.roles %}grid-cols-2{% endif %} text-center">
|
||||
{% if "planned_event" in loggedin_user.roles %}
|
||||
{% if "event" in loggedin_user.roles or "cox" in loggedin_user.roles %}
|
||||
<div class="grid {% if "event" in loggedin_user.roles %}grid-cols-2{% endif %} text-center">
|
||||
{% if "event" in loggedin_user.roles %}
|
||||
<a href="#"
|
||||
data-sidebar="true"
|
||||
data-trigger="sidebar"
|
||||
@ -405,7 +405,7 @@
|
||||
{% endif %}
|
||||
{% if "cox" in loggedin_user.roles %}
|
||||
<a href="#" data-sidebar="true" data-trigger="sidebar" data-header="<strong>Ausfahrt</strong> am {{ day.day| date(format='%d.%m.%Y') }} erstellen" data-day="{{ day.day }}" data-body="#sidebarForm" class="relative inline-block w-full py-2 text-primary-900 hover:text-primary-950 dark:bg-primary-600 dark:text-white dark:hover:bg-primary-500 dark:hover:text-white focus:text-primary-950 text-sm font-semibold bg-gray-100 hover:bg-gray-200 focus:bg-gray-200
|
||||
{% if "planned_event" in loggedin_user.roles %}
|
||||
{% if "event" in loggedin_user.roles %}
|
||||
rounded-br-md
|
||||
{% else %}
|
||||
rounded-b-md
|
||||
@ -425,7 +425,7 @@
|
||||
{% if "cox" in loggedin_user.roles %}
|
||||
{% include "forms/trip" %}
|
||||
{% endif %}
|
||||
{% if "planned_event" in loggedin_user.roles %}
|
||||
{% if "event" in loggedin_user.roles %}
|
||||
{% include "forms/event" %}
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
Reference in New Issue
Block a user