diff --git a/frontend/main.ts b/frontend/main.ts index 5321d27..51c9455 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -19,9 +19,57 @@ document.addEventListener('DOMContentLoaded', function() { }); function selectBoatChange() { - const boatSelect = document.querySelector('#boat_id'); - if(boatSelect) { - boatSelect.addEventListener('change', function() { + const boatSelect = document.querySelector('#boat_id'); + const boatChoice = new Choices(boatSelect, { + loadingText: 'Wird geladen...', + noResultsText: 'Keine Ergebnisse gefunden', + noChoicesText: 'Keine Ergebnisse gefunden', + itemSelectText: 'Zum Auswählen klicken', + callbackOnCreateTemplates: function () { + console.log('here'); + return { + option: ({ label, value, customProperties, active, disabled, }: Item) => { + const opt: HTMLOptionElement = Choices.defaults.templates.option.call( + this, + { label, value, customProperties, active, disabled } + ); + + // We get the original