[TASK] style edit form trip
This commit is contained in:
		| @@ -24,9 +24,9 @@ | |||||||
|     <div class="h-8"></div> |     <div class="h-8"></div> | ||||||
| {% endmacro header %} | {% 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> |   <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 %} | {% endmacro input %} | ||||||
|  |  | ||||||
| {% macro checkbox(label, name, id='', checked=false) %} | {% macro checkbox(label, name, id='', checked=false) %} | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ | |||||||
|   {% set amount_trips = day.planned_events | length + day.trips | length %} |   {% 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 class="bg-white p-3 rounded-md flex justify-between flex-col" data-trips="{{ amount_trips }}"> | ||||||
|     <div> |     <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 %} |       {% if day.planned_events | length > 0 %} | ||||||
|       <div class="grid grid-cols-1 gap-3 divide-y mb-3"> |       <div class="grid grid-cols-1 gap-3 divide-y mb-3"> | ||||||
| @@ -180,35 +180,26 @@ | |||||||
|           </div> |           </div> | ||||||
|           <div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px"> |           <div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px"> | ||||||
|             {% if trip.max_people > 0 %} |             {% 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 }} - {{ |             {% set amount_cur_rower = trip.rower | length %} | ||||||
| 		      trip.rower | length }} Ruderer können teilnehmen ({{ trip.max_people }})</div> |             {{ macros::box(participants=trip.rower, empty_seats=trip.max_people - amount_cur_rower, bg='primary-100', color='black') }} | ||||||
| 		    <div class="p-2 border border-t-0 border-primary-100 mb-4 rounded-b-md"> | 		        {% if trip.cox_id == loggedin_user.id %} | ||||||
| 		      {% if trip.rower | length > 0 %} |             <div> | ||||||
| 		      {% for rower in trip.rower %} |               <h3 class="text-lg text-primary-950 font-bold uppercase tracking-wide">Edit trip</h3> | ||||||
| 		      {{ rower.name }} <span class="hidden">(angemeldet seit {{ rower.registered_at }})</span><br /> |               <form action="/cox/trip/{{ trip.id }}" method="post" class="grid gap-3"> | ||||||
| 		      {% endfor %} |                 {{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=trip.max_people) }} | ||||||
| 		      {% else %} |                 {{ macros::input(label='Anmerkungen', name='notes', type='input', required=true, value=trip.notes) }} | ||||||
| 		      Keine Ruderer angemeldet |                 <input value="Bearbeiten" class="btn btn-primary" type="submit" /> | ||||||
| 		      {% endif %} |               </form> | ||||||
| 		    </div> |               </div> | ||||||
| 		    {% if trip.cox_id == loggedin_user.id %} |               {% if trip.rower | length == 0 %} | ||||||
| 			{% if trip.rower | length == 0 %} |                 <div class="text-right mt-6"> | ||||||
| 			      <div class="text-right mt-2"> |                   <a href="/cox/remove/trip/{{ trip.id }}" class="inline-block btn btn-alert"> | ||||||
| 				<a href="/cox/remove/trip/{{ trip.id }}" class="inline-block btn btn-alert"> |                     {% include "includes/delete-icon" %} | ||||||
| 				  {% include "includes/delete-icon" %} |                     Termin löschen | ||||||
| 				  Termin löschen |                   </a> | ||||||
| 				</a> |                   </div> | ||||||
| 			      </div> |               {% endif %} | ||||||
| 			{% endif %} |             {% 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 %} |  | ||||||
|             {% endif %} |             {% endif %} | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
| @@ -276,12 +267,12 @@ | |||||||
| <div class="hidden"> | <div class="hidden"> | ||||||
|   <form action="/admin/planned-event" method="post" class="grid gap-3" id="addEventForm"> |   <form action="/admin/planned-event" method="post" class="grid gap-3" id="addEventForm"> | ||||||
|     <input class="day-js" type="hidden" name="day" value="" /> |     <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='Titel (z.B. Firmenrudern)', name='name', type='input', required=true) }} | ||||||
|     {{ macros::input(label='Startzeit', name='planned_starting_time', type='text', 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 Steuerleute', name='planned_amount_cox', type='number', required=true) }} | ||||||
|     {{ macros::input(label='Anzahl Ruderer', name='max_people', 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::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" /> |     <input value="Erstellen" class="w-full btn btn-primary" type="submit" /> | ||||||
|   </form> |   </form> | ||||||
| </div> | </div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Marie Birner
					Marie Birner