forked from Ruderverein-Donau-Linz/rowt
		
	[TASK] style edit form trip
This commit is contained in:
		@@ -24,9 +24,9 @@
 | 
			
		||||
    <div class="h-8"></div>
 | 
			
		||||
{% endmacro header %}
 | 
			
		||||
 | 
			
		||||
{% macro input(label, name, type, required=false, class='rounded-md') %}
 | 
			
		||||
{% macro input(label, name, type, required=false, class='rounded-md', value='') %}
 | 
			
		||||
  <label for="{{ name }}" class="sr-only">{{ label }}</label>
 | 
			
		||||
  <input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} class="input {{ class }}" placeholder="{{ label }}">
 | 
			
		||||
  <input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} value="{{ value }}" class="input {{ class }}" placeholder="{{ label }}">
 | 
			
		||||
{% endmacro input %}
 | 
			
		||||
 | 
			
		||||
{% macro checkbox(label, name, id='', checked=false) %}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
  {% set amount_trips = day.planned_events | length + day.trips | length %}
 | 
			
		||||
  <div class="bg-white p-3 rounded-md flex justify-between flex-col" data-trips="{{ amount_trips }}">
 | 
			
		||||
    <div>
 | 
			
		||||
      <h2 class="text-lg text-primary-950 font-bold uppercase tracking-wide">{{ day.day| date(format="%d.%m.%Y") }} <small>{{ day.day | date(format="%A", locale="de_AT") }}</small></h2>
 | 
			
		||||
      <h2 class="text-lg text-primary-950 font-bold uppercase tracking-wide">{{ day.day| date(format="%d.%m.%Y") }} <small class="inline-block ml-1">{{ day.day | date(format="%A", locale="de_AT") }}</small></h2>
 | 
			
		||||
 | 
			
		||||
      {% if day.planned_events | length > 0 %}
 | 
			
		||||
      <div class="grid grid-cols-1 gap-3 divide-y mb-3">
 | 
			
		||||
@@ -180,35 +180,26 @@
 | 
			
		||||
          </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>
 | 
			
		||||
		    {% if trip.cox_id == loggedin_user.id %}
 | 
			
		||||
			{% if trip.rower | length == 0 %}
 | 
			
		||||
			      <div class="text-right mt-2">
 | 
			
		||||
				<a href="/cox/remove/trip/{{ trip.id }}" class="inline-block btn btn-alert">
 | 
			
		||||
				  {% include "includes/delete-icon" %}
 | 
			
		||||
				  Termin löschen
 | 
			
		||||
				</a>
 | 
			
		||||
			      </div>
 | 
			
		||||
			{% endif %}
 | 
			
		||||
			    <div>
 | 
			
		||||
				<h3>Edit trip</h3>
 | 
			
		||||
				<form action="/cox/trip/{{ trip.id }}" method="post">
 | 
			
		||||
					Ruderer: <input type="number" name="max_people" required value="{{ trip.max_people }}" /><br />
 | 
			
		||||
					Notes: <input type="text" name="notes" required value="{{ trip.notes }}" /><br />
 | 
			
		||||
					<input type="submit" />
 | 
			
		||||
				</form>
 | 
			
		||||
			    </div>
 | 
			
		||||
		    {% endif %}
 | 
			
		||||
            {% set amount_cur_rower = trip.rower | length %}
 | 
			
		||||
            {{ macros::box(participants=trip.rower, empty_seats=trip.max_people - amount_cur_rower, bg='primary-100', color='black') }}
 | 
			
		||||
		        {% if trip.cox_id == loggedin_user.id %}
 | 
			
		||||
            <div>
 | 
			
		||||
              <h3 class="text-lg text-primary-950 font-bold uppercase tracking-wide">Edit trip</h3>
 | 
			
		||||
              <form action="/cox/trip/{{ trip.id }}" method="post" class="grid gap-3">
 | 
			
		||||
                {{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=trip.max_people) }}
 | 
			
		||||
                {{ macros::input(label='Anmerkungen', name='notes', type='input', required=true, value=trip.notes) }}
 | 
			
		||||
                <input value="Bearbeiten" class="btn btn-primary" type="submit" />
 | 
			
		||||
              </form>
 | 
			
		||||
              </div>
 | 
			
		||||
              {% if trip.rower | length == 0 %}
 | 
			
		||||
                <div class="text-right mt-6">
 | 
			
		||||
                  <a href="/cox/remove/trip/{{ trip.id }}" class="inline-block btn btn-alert">
 | 
			
		||||
                    {% include "includes/delete-icon" %}
 | 
			
		||||
                    Termin löschen
 | 
			
		||||
                  </a>
 | 
			
		||||
                  </div>
 | 
			
		||||
              {% endif %}
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            {% endif %}
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
@@ -276,12 +267,12 @@
 | 
			
		||||
<div class="hidden">
 | 
			
		||||
  <form action="/admin/planned-event" method="post" class="grid gap-3" id="addEventForm">
 | 
			
		||||
    <input class="day-js" type="hidden" name="day" value="" />
 | 
			
		||||
    {{ 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='Titel (z.B. Firmenrudern)', name='name', type='input', required=true) }}
 | 
			
		||||
    {{ macros::input(label='Startzeit', name='planned_starting_time', type='input', 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') }}
 | 
			
		||||
    {{ macros::input(label='Anmerkungen', name='notes', type='input') }}
 | 
			
		||||
    <input value="Erstellen" class="w-full btn btn-primary" type="submit" />
 | 
			
		||||
  </form>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user