From f3b0c74bbcd9713945cd45176f29c81bab4a805c Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Sun, 24 Sep 2023 10:47:18 +0200 Subject: [PATCH] [BUGFIX] issues with option create --- frontend/main.ts | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/frontend/main.ts b/frontend/main.ts index 51c9455..7830dbe 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -26,9 +26,8 @@ function selectBoatChange() { noChoicesText: 'Keine Ergebnisse gefunden', itemSelectText: 'Zum Auswählen klicken', callbackOnCreateTemplates: function () { - console.log('here'); return { - option: ({ label, value, customProperties, active, disabled, }: Item) => { + option: ({ label, value, customProperties, active, disabled, }: any) => { const opt: HTMLOptionElement = Choices.defaults.templates.option.call( this, { label, value, customProperties, active, disabled } @@ -39,21 +38,15 @@ function selectBoatChange() { (option: HTMLOptionElement) => option.value === value )[0]; - const selectedValue = Number(originalOption.dataset.amount_seats); - const rowers = Number(selectedValue) - 1; - console.log(rowers); + const rowers = Number(originalOption.dataset.amount_seats) - 1; choiceObjects['newrower'].config.maxItemCount = rowers; - choiceObjects['newrower'].removeActiveItems(rowers); - - console.log(choiceObjects['newrower']); - (rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable()); return opt; } } - } - }); + } + } as any); choiceObjects[boatSelect.id] = boatChoice; @@ -66,19 +59,6 @@ function selectBoatChange() { }); choiceObjects[shipmasterSelect.id] = shipmasterChoice; - - if(boatChoice) { - boatChoice.passedElement.element.addEventListener('change', function(event) { - console.log(event); - const selectedElement = boatSelect as HTMLSelectElement; - const opt = selectedElement.options[selectedElement.selectedIndex]; - const selectedValue = (opt).dataset.amount_seats; - const rowers = Number(selectedValue) - 1; - choiceObjects['newrower'].config.maxItemCount = rowers; - choiceObjects['newrower'].removeActiveItems(rowers); - (rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable()) - }); - } } function initBoatActions() {