This commit is contained in:
philipp 2023-10-30 15:37:01 +01:00
parent d6043384a5
commit d297893086

View File

@ -29,6 +29,16 @@ function setCurrentdate(input: HTMLInputElement) {
} }
} }
interface ChoiceBoatEvent extends Event{
detail: {
value: string;
label: string,
customProperties: {
amount_seats: number,
}
};
}
function selectBoatChange() { function selectBoatChange() {
const boatSelect = <HTMLSelectElement>document.querySelector('#boat_id'); const boatSelect = <HTMLSelectElement>document.querySelector('#boat_id');
@ -41,7 +51,8 @@ function selectBoatChange() {
} as any); } as any);
boatSelect.addEventListener('addItem', function(e) { boatSelect.addEventListener('addItem', function(e) {
const amount_seats = e.detail.customProperties.amount_seats; const event = e as ChoiceBoatEvent;
const amount_seats = event.detail.customProperties.amount_seats;
setMaxAmountRowers("newrower", amount_seats); setMaxAmountRowers("newrower", amount_seats);
const inputElement = document.getElementById("departure") as HTMLInputElement; const inputElement = document.getElementById("departure") as HTMLInputElement;
@ -75,7 +86,7 @@ function reloadPage() {
function setMaxAmountRowers(name: string, rowers: number) { function setMaxAmountRowers(name: string, rowers: number) {
console.log("called fct: name="+name+"; rowers="+rowers); console.log("called fct: name="+name+"; rowers="+rowers);
if(choiceObjects[name]) { if(choiceObjects[name]) {
choiceObjects[name].removeActiveItems(); choiceObjects[name].removeActiveItems(-1);
//let curSelection = choiceObjects[name].getValue(true); //let curSelection = choiceObjects[name].getValue(true);
//let amount_to_delete = (<any>curSelection).length - rowers; //let amount_to_delete = (<any>curSelection).length - rowers;
@ -157,7 +168,6 @@ interface ChoiceEvent extends Event{
is_cox: boolean, is_cox: boolean,
steers: boolean, steers: boolean,
cox_on_boat: boolean, cox_on_boat: boolean,
amount_seats: number,
} }
}; };
} }