[TASK] add working choices.js

This commit is contained in:
Marie Birner
2023-09-23 21:05:08 +02:00
committed by philipp
parent 5e097a95da
commit e3012be264
3 changed files with 60 additions and 20 deletions

View File

@ -13,7 +13,7 @@
<strong>{{ amount_seats }}x</strong>
</div>
{% for boat in grouped_boats %}
<div id="boat-{{ boat.id }}" class="px-3" {% if boat.damage != 'locked' %} onclick="document.getElementById('boat_id').value={{ boat.id }}; document.getElementById('newrower-max_rower_allowed').innerHTML={{ boat.amount_seats }}; document.getElementById('departure').value = new Date().toISOString().slice(0,16);" {% endif %}>
<div id="boat-{{ boat.id }}" class="px-3 boats-js" {% if boat.damage != 'locked' %} data-seats="{{boat.amount_seats}}" data-onclick="true" {% endif %}>
<span class="status-damage status-damage-{{ boat.damage }}"></span>
<span {% if boat.damage == 'locked' or boat.on_water %} class="opacity-50" {% endif %}>{{ boat.name }}
{% if boat.owner %}
@ -52,7 +52,7 @@
{% endif %}
{% if not only_ones %}
{{ log::rower_select(id="newrower", selected=[], class="col-span-2") }}
{{ log::rower_select(id="newrower", selected=[], class="col-span-2", init=true) }}
{% endif %}
<div></div>
@ -103,9 +103,9 @@
{% endif %}
{% endmacro boat_select %}
{% macro rower_select(id, selected, amount_seats='', class='') %}
{% macro rower_select(id, selected, amount_seats='', class='', init='false') %}
<div class="{{ class }}">
<select style="width: 100%;" multiple data-multi-select-plugin name="rowers[]" id="{{id}}" class="w-full">
<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 %}
@ -117,11 +117,6 @@
{% endfor %}
</select>
</div>
<div>
<span id="{{id}}-amount_rower_selected"></span>
<span id="{{id}}-max_rower_allowed">{{amount_seats}}</span>
Ruderer auszuwählen
</div>
{% endmacro rower_select %}
{% macro show(log, state, allowed_to_close=false, only_ones) %}