show ottensheim boats to rennjugend

This commit is contained in:
2024-03-03 20:03:20 +01:00
parent d1296ec40a
commit 5781937bee
4 changed files with 33 additions and 25 deletions

View File

@ -6,6 +6,7 @@ export interface choiceMap {
}
let choiceObjects: choiceMap = {};
let boat_in_ottensheim = true;
document.addEventListener('DOMContentLoaded', function() {
changeTheme();
@ -123,6 +124,8 @@ function selectBoatChange() {
boatSelect.addEventListener('addItem', function(e) {
const event = e as ChoiceBoatEvent;
boat_in_ottensheim = event.detail.customProperties.boat_in_ottensheim;
const amount_seats = event.detail.customProperties.amount_seats;
setMaxAmountRowers("newrower", amount_seats);
@ -320,6 +323,16 @@ function initNewChoice(select: HTMLInputElement) {
},
callbackOnInit: function() {
this._currentState.items.forEach(function(obj){
if (boat_in_ottensheim) {
if (obj.customProperties.is_racing) {
const coxSelect = <HTMLSelectElement>document.querySelector('#shipmaster-' + select.id + 'js');
var new_option = new Option(obj.label, obj.value);
if (obj.customProperties.cox_on_boat){
new_option.selected = true;
}
coxSelect.add(new_option);
}
}
if (obj.customProperties && obj.customProperties.is_cox){
const coxSelect = <HTMLSelectElement>document.querySelector('#shipmaster-' + select.id + 'js');
var new_option = new Option(obj.label, obj.value);
@ -346,6 +359,14 @@ function initNewChoice(select: HTMLInputElement) {
const user_id = event.detail.value;
const name = event.detail.label;
if (boat_in_ottensheim) {
if (event.detail.customProperties.is_racing) {
const coxSelect = <HTMLSelectElement>document.querySelector('#shipmaster-' + select.id + 'js');
if (coxSelect){
coxSelect.add(new Option(name, user_id));
}
}
}
if (event.detail.customProperties.is_cox) {
const coxSelect = <HTMLSelectElement>document.querySelector('#shipmaster-' + select.id + 'js');
if (coxSelect){