[TASK] select boat on click

This commit is contained in:
Marie Birner 2023-09-23 23:23:42 +02:00
parent a186b96c67
commit f392e83af3
2 changed files with 5 additions and 1 deletions

View File

@ -42,6 +42,10 @@ function initBoatActions() {
const rowers = Number(select.dataset.seats) - 1;
choiceObjects['newrower'].config.maxItemCount = rowers;
choiceObjects['newrower'].removeActiveItems(rowers);
let boatSelect = <HTMLSelectElement>document.querySelector('#boat_id');
if(boatSelect && select.dataset.id) {
boatSelect.value = select.dataset.id;
}
(rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable());
}
});

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 boats-js" {% if boat.damage != 'locked' %} data-seats="{{boat.amount_seats}}" data-onclick="true" {% endif %}>
<div id="boat-{{ boat.id }}" class="px-3 boats-js" {% if boat.damage != 'locked' %} data-seats="{{boat.amount_seats}}" data-onclick="true" {% endif %} data-id="{{ boat.id }}">
<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 %}