auto select owner as rower of private boat, Fixes #46

This commit is contained in:
philipp 2023-11-02 19:50:19 +01:00
parent d9322c9702
commit f5ad37a0bb
2 changed files with 6 additions and 2 deletions

View File

@ -35,6 +35,7 @@ interface ChoiceBoatEvent extends Event{
label: string, label: string,
customProperties: { customProperties: {
amount_seats: number, amount_seats: number,
owner: number,
} }
}; };
} }
@ -55,6 +56,10 @@ function selectBoatChange() {
const amount_seats = event.detail.customProperties.amount_seats; const amount_seats = event.detail.customProperties.amount_seats;
setMaxAmountRowers("newrower", amount_seats); setMaxAmountRowers("newrower", amount_seats);
if (event.detail.customProperties.owner){
choiceObjects["newrower"].setChoiceByValue(event.detail.customProperties.owner+"");
}
const inputElement = document.getElementById("departure") as HTMLInputElement; const inputElement = document.getElementById("departure") as HTMLInputElement;
const now = new Date(); const now = new Date();
const formattedDateTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}T${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`; const formattedDateTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}T${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
@ -201,7 +206,6 @@ function initNewChoice(select: HTMLInputElement) {
if (select.dataset && select.dataset.seats) { if (select.dataset && select.dataset.seats) {
seats = +select.dataset.seats; seats = +select.dataset.seats;
} }
console.log(seats);
let shipmaster = <HTMLElement>document.querySelector('#shipmaster-'+select.id+'js'); let shipmaster = <HTMLElement>document.querySelector('#shipmaster-'+select.id+'js');
let steering_person = <HTMLElement>document.querySelector('#steering_person-'+select.id+'js'); let steering_person = <HTMLElement>document.querySelector('#steering_person-'+select.id+'js');

View File

@ -151,7 +151,7 @@
<option selected value>{{ default }}</option> <option selected value>{{ default }}</option>
{% endif %} {% endif %}
{% for d in data %} {% for d in data %}
<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data- {{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}}'{% endif %}> <option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data- {{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}, "owner": {{ d["owner"] }}}'{% endif %}>
{% for displa in display -%} {% for displa in display -%}
{%- if d[displa] -%} {%- if d[displa] -%}
{{- d[displa] -}} {{- d[displa] -}}