forked from Ruderverein-Donau-Linz/rowt
push
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
{% macro new(only_ones, allow_any_shipmaster, shipmaster) %}
|
||||
<form action="/log" method="post" id="form" class="grid grid-cols-2 gap-3">
|
||||
{{ log::boat_select(only_ones=only_ones) }}
|
||||
|
||||
{% if allow_any_shipmaster %}
|
||||
<select name="shipmaster" id="shipmaster" class="input rounded-md h-10">
|
||||
<optgroup label="Steuerpersonen">
|
||||
@ -72,12 +74,33 @@
|
||||
</script>
|
||||
{% endmacro new %}
|
||||
|
||||
{% macro boats(only_ones) %}
|
||||
{% macro show_boats(only_ones) %}
|
||||
{% if only_ones %}
|
||||
{% set_global boats = boats | filter(attribute="amount_seats", value=1) %}
|
||||
{% endif %}
|
||||
{% for boat in boats %}
|
||||
<div onclick="document.getElementById('boat_id').value='{{ boat.id }}';updateElementsBasedOnSelectedOption()">{{ boat.name }}</div>
|
||||
{% endfor %}
|
||||
<script>
|
||||
function updateElementsBasedOnSelectedOption() {
|
||||
var selectElement = document.getElementById('boat_id');
|
||||
var selectedOption = selectElement.selectedOptions[0];
|
||||
var shipmaster_only_steering = selectedOption.getAttribute("extra-default_shipmaster_only_steering") === 'true';
|
||||
document.getElementById('shipmaster_only_steering').checked = shipmaster_only_steering;
|
||||
document.getElementById('newrower-max_rower_allowed').innerHTML = selectedOption.getAttribute("extra-amount_seats");
|
||||
}
|
||||
|
||||
document.getElementById('boat_id').addEventListener('change', updateElementsBasedOnSelectedOption);
|
||||
document.addEventListener('DOMContentLoaded', updateElementsBasedOnSelectedOption);
|
||||
</script>
|
||||
{% endmacro boats %}
|
||||
|
||||
{% macro boat_select(only_ones) %}
|
||||
{% if not only_ones %}
|
||||
{{ macros::select(data=boats, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="col-span-2") }}
|
||||
{{ macros::select(data=boats, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="col-span-2 md:hidden") }}
|
||||
{% 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"]) }}
|
||||
{{ macros::select(data=ones, select_name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats"], class="md:hidden") }}
|
||||
{% endif %}
|
||||
<script>
|
||||
function updateElementsBasedOnSelectedOption() {
|
||||
@ -91,9 +114,7 @@
|
||||
document.getElementById('boat_id').addEventListener('change', updateElementsBasedOnSelectedOption);
|
||||
document.addEventListener('DOMContentLoaded', updateElementsBasedOnSelectedOption);
|
||||
</script>
|
||||
|
||||
|
||||
{% endmacro boats %}
|
||||
{% endmacro boat_select %}
|
||||
|
||||
{% macro show(log, state, allowed_to_close=false, only_ones) %}
|
||||
Bootsname: {{ log.boat.name }}<br />
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<div class="w-full grid grid-cols-5 gap-3">
|
||||
<div style="background-color: red;">
|
||||
{{ log::boats(only_ones=false) }}
|
||||
{{ log::show_boats(only_ones=false) }}
|
||||
</div>
|
||||
<div class="col-span-3" style="background-color: yellow;">
|
||||
<h2>Neue Ausfahrt starten</h2>
|
||||
|
Reference in New Issue
Block a user