change select properly if boat is selected on the left
This commit is contained in:
		| @@ -35,12 +35,20 @@ | ||||
| 			<select name="shipmaster" id="shipmaster" class="input rounded-md h-10"> | ||||
| 				<optgroup label="Steuerleute"> | ||||
| 					{% for cox in coxes %} | ||||
| 						<option value="{{ cox.id }}" {% if cox.on_water %} disabled="disabled" {% else %} {% if cox.id == shipmaster %} selected {% endif %}  {% endif %}>{{ cox.name }} {% if cox.on_water %} (am Wasser) {% endif %}</option> | ||||
| 						<option value="{{ cox.id }}" {% if cox.on_water %} disabled="disabled" {% else %} {% if cox.id == shipmaster %} selected {% endif %} {% endif %}>{{ cox.name }} | ||||
| 							{% if cox.on_water %} | ||||
| 								(am Wasser) | ||||
| 							{% endif %} | ||||
| 						</option> | ||||
| 					{% endfor %} | ||||
| 				</optgroup> | ||||
| 				<optgroup label="Mitglieder"> | ||||
| 					{% for user in users | filter(attribute="is_cox", value=false) %} | ||||
| 						<option value="{{ user.id }}" {% if user.id == shipmaster %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>{{ user.name }} {% if user.on_water %} (am Wasser) {% endif %}</option> | ||||
| 						<option value="{{ user.id }}" {% if user.id == shipmaster %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>{{ user.name }} | ||||
| 							{% if user.on_water %} | ||||
| 								(am Wasser) | ||||
| 							{% endif %} | ||||
| 						</option> | ||||
| 					{% endfor %} | ||||
| 				</optgroup> | ||||
| 			</select> | ||||
| @@ -58,16 +66,16 @@ | ||||
| 		{{ macros::input(label='Abfahrtszeit', name='departure', type='datetime-local', required=true) }} | ||||
| 		{{ macros::input(label='Ankunftszeit', name='arrival', type='datetime-local') }} | ||||
|  | ||||
|     <div class="relative"> | ||||
| 		<div class="relative"> | ||||
| 			<label for="destination" class="small text-gray-600">Ziel</label> | ||||
|  | ||||
| 			<input class="input rounded-md set-distance-js" type="search" list="destinations" placeholder="Destination" id="destination" name="destination" value="" data-relation="distance_in_km"/> | ||||
|       <datalist id="destinations"> | ||||
|         {% for distance in distances %} | ||||
|           <option value="{{ distance.0 }}" distance={{ distance.1 }} /> | ||||
|         {% endfor %} | ||||
|       </datalist> | ||||
|     </div> | ||||
| 			<datalist id="destinations"> | ||||
| 				{% for distance in distances %} | ||||
| 					<option value="{{ distance.0 }}" distance={{ distance.1 }}/> | ||||
| 				{% endfor %} | ||||
| 			</datalist> | ||||
| 		</div> | ||||
|  | ||||
| 		<div class="relative"> | ||||
| 			{{ macros::input(label="Distanz", name="distance_in_km", id="distance_in_km" , type="number", min=0, value='', class="rounded-md") }} | ||||
| @@ -95,21 +103,26 @@ | ||||
| {% endmacro boat_select %} | ||||
|  | ||||
| {% macro rower_select(id, selected, amount_seats='', class='', init='false') %} | ||||
|   {% if not amount_seats or amount_seats > 1 %}  | ||||
|     <div class="{{ class }}"> | ||||
|       <select style="width: 100%;" multiple name="rowers[]" id="{{id}}" class="w-full" data-seats="{{amount_seats}}" data-init={{init}}> | ||||
|         {% for user in users %} | ||||
|           {% set_global sel = false %} | ||||
|           {% for rower in selected %} | ||||
|             {% if rower.id == user.id %} | ||||
|               {% set_global sel = true %} | ||||
|             {% endif %} | ||||
|           {% endfor %} | ||||
|           <option value="{{ user.id }}" {% if sel %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>{{user.name}} {% if user.on_water %} (am Wasser) {% endif %}</option> | ||||
|         {% endfor %} | ||||
|       </select> | ||||
|     </div> | ||||
|   {% endif %} | ||||
| 	{% if not amount_seats or amount_seats > 1 %} | ||||
| 		<div class="{{ class }}"> | ||||
| 			<select style="width: 100%;" multiple name="rowers[]" id="{{id}}" class="w-full" data-seats="{{amount_seats}}" data-init={{init}}> | ||||
| 				{% for user in users %} | ||||
| 					{% set_global sel = false %} | ||||
| 					{% for rower in selected %} | ||||
| 						{% if rower.id == user.id %} | ||||
| 							{% set_global sel = true %} | ||||
| 						{% endif %} | ||||
| 					{% endfor %} | ||||
| 					<option value="{{ user.id }}" {% if sel %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}> | ||||
| 						{{user.name}} | ||||
| 						{% if user.on_water %} | ||||
| 							(am Wasser) | ||||
| 						{% endif %} | ||||
| 					</option> | ||||
| 				{% endfor %} | ||||
| 			</select> | ||||
| 		</div> | ||||
| 	{% endif %} | ||||
| {% endmacro rower_select %} | ||||
|  | ||||
| {% macro show(log, state, allowed_to_close=false, only_ones) %} | ||||
| @@ -215,13 +228,13 @@ | ||||
|  | ||||
| {% macro home(log, only_ones) %} | ||||
| 	<form class="grid grid-cols-1 gap-3" action="/log/{{log.id}}" method="post"> | ||||
|     {% for user in users %} | ||||
|       {% if user.id == log.shipmaster %} | ||||
|         <p> | ||||
|           <strong>{{ user.name }}</strong> | ||||
|         </p> | ||||
|       {% endif %} | ||||
|     {% endfor %} | ||||
| 		{% for user in users %} | ||||
| 			{% if user.id == log.shipmaster %} | ||||
| 				<p> | ||||
| 					<strong>{{ user.name }}</strong> | ||||
| 				</p> | ||||
| 			{% endif %} | ||||
| 		{% endfor %} | ||||
| 		{% if not only_ones %} | ||||
| 			{{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats) }} | ||||
| 		{% endif %} | ||||
| @@ -229,7 +242,7 @@ | ||||
| 			<label for="destination" class="small text-gray-600">Ziel</label> | ||||
|  | ||||
| 			<input class="input rounded-md set-distance-js change-id-js" type="search" list="destinations" placeholder="Destination" required="required" id="destination{{ log.id }}" name="destination" value="{{log.destination}}" data-relation="distance_in_km{{log.id}}"/> | ||||
|     </div> | ||||
| 		</div> | ||||
|  | ||||
| 		<div class="relative"> | ||||
| 			{{ macros::input(label="Distanz", name="distance_in_km", id="distance_in_km" ~ log.id , type="number", min=0, value=log.distance_in_km, required=true, class="rounded-md change-id-js") }} | ||||
|   | ||||
| @@ -15,10 +15,10 @@ | ||||
| 				</a> | ||||
| 				{% if loggedin_user.is_admin%} | ||||
| 					<a href="/boatdamage" class="inline-flex justify-center rounded-md bg-primary-600 mx-1 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"> | ||||
| 						Bootsschaden	 | ||||
| 						Bootsschaden | ||||
| 						<span class="sr-only">Bootsschaden</span> | ||||
| 					</a> | ||||
| 					 | ||||
|  | ||||
| 				{% endif %} | ||||
| 				{% if loggedin_user.is_admin %} | ||||
| 					<a href="/stat" class="inline-flex justify-center rounded-md bg-primary-600 mx-1 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"> | ||||
| @@ -83,7 +83,7 @@ | ||||
| 			<option selected value>{{ default }}</option> | ||||
| 		{% endif %} | ||||
| 		{% for d in data %} | ||||
| 			<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data-{{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %}{% endif %} {% endfor %} {% endif %}> | ||||
| 			<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data- {{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %} {% endif %} {% endfor %} {% endif %}> | ||||
| 				{% for displa in display -%} | ||||
| 					{%- if d[displa] -%} | ||||
| 						{{- d[displa] -}} | ||||
| @@ -116,7 +116,7 @@ | ||||
| 				{% if rower.is_real_guest %} | ||||
| 					<small class="text-gray-600">(Gast)</small> | ||||
| 					{% if allow_removing %} | ||||
| 				  	<a href="/remove/{{ trip_details_id }}/{{ rower.name }}" class="btn btn-attention btn-fw">Abmelden</a> | ||||
| 						<a href="/remove/{{ trip_details_id }}/{{ rower.name }}" class="btn btn-attention btn-fw">Abmelden</a> | ||||
| 					{% endif %} | ||||
| 				{% endif %} | ||||
| 				<span class="hidden">(angemeldet seit | ||||
|   | ||||
		Reference in New Issue
	
	Block a user