allow non-cox to (only) use 1x
This commit is contained in:
parent
fad7d747d7
commit
d5c16ad7a0
@ -1,6 +1,12 @@
|
|||||||
{% macro new() %}
|
{% macro new() %}
|
||||||
<form action="/log" method="post" id="form">
|
<form action="/log" method="post" id="form">
|
||||||
{{ macros::select(data=boats, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"]) }}
|
{% if loggedin_user.is_cox %}
|
||||||
|
{{ macros::select(data=boats, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"]) }}
|
||||||
|
{% else %}
|
||||||
|
{% set ones = boats | filter(attribute="amount_seats", value=1) %}
|
||||||
|
{{ macros::select(data=ones, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"]) }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
<script>
|
<script>
|
||||||
function updateElementsBasedOnSelectedOption() {
|
function updateElementsBasedOnSelectedOption() {
|
||||||
var selectElement = document.getElementById('boat_id');
|
var selectElement = document.getElementById('boat_id');
|
||||||
@ -13,8 +19,25 @@
|
|||||||
document.getElementById('boat_id').addEventListener('change', updateElementsBasedOnSelectedOption);
|
document.getElementById('boat_id').addEventListener('change', updateElementsBasedOnSelectedOption);
|
||||||
document.addEventListener('DOMContentLoaded', updateElementsBasedOnSelectedOption);
|
document.addEventListener('DOMContentLoaded', updateElementsBasedOnSelectedOption);
|
||||||
</script>
|
</script>
|
||||||
{{ macros::select(data=coxes, select_name='shipmaster', selected_id=loggedin_user.id) }}
|
{% if loggedin_user.is_cox %}
|
||||||
{{ macros::checkbox(label='shipmaster_only_steering', name='shipmaster_only_steering') }}
|
<select name="shipmaster" id="shipmaster" class="input rounded-md h-10">
|
||||||
|
<optgroup label="Steuerpersonen">
|
||||||
|
{% for cox in coxes %}
|
||||||
|
<option value="{{ cox.id }}" {% if cox.id == loggedin_user.id%} selected {% endif %}>{{ cox.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Alle Mitglieder">
|
||||||
|
{% for user in users%}
|
||||||
|
<option value="{{ user.id }}" {% if user.id == loggedin_user.id%} selected {% endif %}>{{ user.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
{% else %}
|
||||||
|
<input type="hidden" name="shipmaster" value="{{loggedin_user.id}}" />
|
||||||
|
{% endif %}
|
||||||
|
{% if loggedin_user.is_cox %}
|
||||||
|
{{ macros::checkbox(label='shipmaster_only_steering', name='shipmaster_only_steering') }}
|
||||||
|
{% endif %}
|
||||||
Departure: <input type="datetime-local" id="datetime-dep" name="departure" required/>
|
Departure: <input type="datetime-local" id="datetime-dep" name="departure" required/>
|
||||||
Arrival: <input type="datetime-local" id="datetime-arr" name="arrival" />
|
Arrival: <input type="datetime-local" id="datetime-arr" name="arrival" />
|
||||||
Destination: <input type="search" list="destinations" placeholder="Destination" name="destination" id="destination" oninput="var inputElement = document.getElementById('destination');
|
Destination: <input type="search" list="destinations" placeholder="Destination" name="destination" id="destination" oninput="var inputElement = document.getElementById('destination');
|
||||||
@ -35,7 +58,9 @@
|
|||||||
{{ macros::input(label="Distanz", name="distance_in_km", type="number", min=0) }}
|
{{ macros::input(label="Distanz", name="distance_in_km", type="number", min=0) }}
|
||||||
{{ macros::input(label="Kommentar", name="comments", type="text") }}
|
{{ macros::input(label="Kommentar", name="comments", type="text") }}
|
||||||
{{ macros::select(data=logtypes, select_name='logtype', default="Normal") }}
|
{{ macros::select(data=logtypes, select_name='logtype', default="Normal") }}
|
||||||
{{ log::rower_select(id="newrower", selected=[]) }}
|
{% if loggedin_user.is_cox %}
|
||||||
|
{{ log::rower_select(id="newrower", selected=[]) }}
|
||||||
|
{% endif %}
|
||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -72,21 +97,30 @@
|
|||||||
{% if state == "completed" %}
|
{% if state == "completed" %}
|
||||||
Angekommen: {{ log.arrival}}<br />
|
Angekommen: {{ log.arrival}}<br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Ziel: {{ log.destination }}<br />
|
|
||||||
{% if state == "completed" %}
|
|
||||||
Km: {{ log.distance_in_km }}<br />
|
|
||||||
{% endif %}
|
|
||||||
Kommentare: {{ log.comments }}<br />
|
|
||||||
Logtype: {{ log.logtype }}<br />
|
|
||||||
Ruderer:
|
|
||||||
{% set amount_rowers = log.rowers | length %}
|
{% set amount_rowers = log.rowers | length %}
|
||||||
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
|
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
|
||||||
{{ amount_guests }} Gäste (ohne Account)
|
|
||||||
{% for rower in log.rowers %}
|
|
||||||
{{ rower.name }}
|
|
||||||
{% endfor %}
|
|
||||||
{% if log.shipmaster == loggedin_user.id and state == "on_water" %}
|
{% if log.shipmaster == loggedin_user.id and state == "on_water" %}
|
||||||
{{ log::home(log=log) }}
|
{{ log::home(log=log) }}
|
||||||
|
{% else %}
|
||||||
|
Ziel: {{ log.destination }}<br />
|
||||||
|
{% if state == "completed" %}
|
||||||
|
Km: {{ log.distance_in_km }}<br />
|
||||||
|
{% endif %}
|
||||||
|
{% if log.comments %}
|
||||||
|
Kommentare: {{ log.comments }}<br />
|
||||||
|
{% endif %}
|
||||||
|
{% if log.logtype %}
|
||||||
|
Logtype: {{ log.logtype }}<br />
|
||||||
|
{% endif %}
|
||||||
|
{% if amount_guests > 0 or log.rowers | length > 0 %}
|
||||||
|
Ruderer:
|
||||||
|
{% endif %}
|
||||||
|
{% if amount_guests > 0 %}
|
||||||
|
{{ amount_guests }} Gäste (ohne Account)
|
||||||
|
{% endif %}
|
||||||
|
{% for rower in log.rowers %}
|
||||||
|
{{ rower.name }}
|
||||||
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro show %}
|
{% endmacro show %}
|
||||||
|
|
||||||
@ -106,7 +140,9 @@
|
|||||||
{{ macros::input(label="Kommentar", name="comments", type="text", value=log.comments) }}
|
{{ macros::input(label="Kommentar", name="comments", type="text", value=log.comments) }}
|
||||||
{{ macros::select(data=logtypes, select_name='logtype', default="Normal", selected_id=log.logtype) }}
|
{{ macros::select(data=logtypes, select_name='logtype', default="Normal", selected_id=log.logtype) }}
|
||||||
|
|
||||||
{{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats) }}
|
{% if loggedin_user.is_cox %}
|
||||||
|
{{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats) }}
|
||||||
|
{% endif %}
|
||||||
<input type="submit" value="AUSFAHRT BEENDEN"/>
|
<input type="submit" value="AUSFAHRT BEENDEN"/>
|
||||||
</form>
|
</form>
|
||||||
{% endmacro home %}
|
{% endmacro home %}
|
||||||
|
@ -77,6 +77,8 @@
|
|||||||
</select>
|
</select>
|
||||||
{% endmacro select %}
|
{% endmacro select %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% macro alert(message, type, class='') %}
|
{% macro alert(message, type, class='') %}
|
||||||
<div class="{{ class }} alert-{{ type }} text-white px-3 py-1 rounded-md text-center">
|
<div class="{{ class }} alert-{{ type }} text-white px-3 py-1 rounded-md text-center">
|
||||||
{{ message }}
|
{{ message }}
|
||||||
|
Loading…
Reference in New Issue
Block a user