allow adding rowers to logbook

This commit is contained in:
2023-07-24 13:01:39 +02:00
parent c43feb1834
commit c42cd2cd9c
9 changed files with 273 additions and 65 deletions

View File

@ -13,7 +13,7 @@
<h2>Neue Ausfahrt starten</h2>
<form action="/log" method="post" id="form">
{{ macros::select(data=boats, select_name='boat_id') }}
{{ macros::select(data=users, select_name='shipmaster', selected_id=loggedin_user.id) }}
{{ macros::select(data=coxes, select_name='shipmaster', selected_id=loggedin_user.id) }}
{{ macros::checkbox(label='shipmaster_only_steering', name='shipmaster_only_steering') }} <!-- TODO: depending on boat, deselect by default -->
Departure: <input type="datetime-local" id="datetime-dep" value="2023-07-24T08:00" name="departure" required/>
Arrival: <input type="datetime-local" id="datetime-arr" name="arrival" />
@ -35,6 +35,11 @@
{{ macros::input(label="Distanz", name="distance_in_km", type="number", min=0) }}
{{ macros::input(label="Kommentar", name="comments", type="text") }}
{{ macros::select(data=logtypes, select_name='logtype', default="Normal") }}
<select multiple="multiple" name="rower[]">
{% for user in users %}
<option value="{{ user.id }}" onmousedown="event.preventDefault(); this.selected = !this.selected; return false;">{{user.name}}</option>
{% endfor %}
</select>
<input type="submit" />
<script>
@ -53,8 +58,8 @@
<h2 style="font-size: 100px">Am Wasser</h2>
{% for log in on_water %}
Bootsname: {{ log.boat }}<br />
Schiffsführer: {{ log.shipmaster_name }}<br />
Bootsname: {{ log.boat.name }}<br />
Schiffsführer: {{ log.shipmaster_user.name }}<br />
{% if log.shipmaster_only_steering %}
Schiffsführer steuert nur
{% endif %}
@ -62,6 +67,13 @@
Ziel: {{ log.destination }}<br />
Kommentare: {{ log.comments }}<br />
Logtype: {{ log.logtype }}<br />
Ruderer:
{% for rower in log.rowers %}
{{ rower.name }}
{% endfor %}
{% set amount_rowers = log.rowers | length %}
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
{{ amount_guests }} Gäste (ohne Account)
{% if log.shipmaster == loggedin_user.id %}
<form action="/log/{{log.id}}" method="post">
Destination: <input type="search" list="destinations" placeholder="Destination" id="destination-home" name="destination" value="{{log.destination}}" oninput="var inputElement = document.getElementById('destination-home');
@ -85,11 +97,18 @@
<h2 style="font-size: 100px">Einträge</h2>
{% for log in completed %}
Bootsname: {{ log.boat }}<br />
Schiffsführer: {{ log.shipmaster_name }}<br />
Bootsname: {{ log.boat.name }}<br />
Schiffsführer: {{ log.shipmaster_user.name }}<br />
{% if log.shipmaster_only_steering %}
Schiffsführer steuert nur
{% endif %}
Ruderer:
{% for rower in log.rowers %}
{{ rower.name }}
{% endfor %}
{% set amount_rowers = log.rowers | length %}
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
{{ amount_guests }} Gäste (ohne Account)
Weggefahren: {{ log.departure }}<br />
Angekommen: {{ log.arrival}}<br />
Ziel: {{ log.destination }}<br />