import Choices from "choices.js"; import { Sidebar } from './js/sidebar'; import './scss/app.scss' export interface choiceMap { [details: string]: Choices; } let choiceObjects: choiceMap = {}; document.addEventListener('DOMContentLoaded', function() { initSearch(); initSidebar(); initToggle(); replaceStrings(); initChoices(); initBoatActions(); selectBoatChange(); addRelationMagic(document.querySelector('body')); reloadPage(); setCurrentdate(document.querySelector('#departure')); }); function setCurrentdate(input: HTMLInputElement) { if(input) { input.value = (new Date().toJSON().slice(0,16)); } } function selectBoatChange() { const boatSelect = document.querySelector('#boat_id'); if(boatSelect) { const boatChoice = new Choices(boatSelect, { loadingText: 'Wird geladen...', noResultsText: 'Keine Ergebnisse gefunden', noChoicesText: 'Keine Ergebnisse gefunden', itemSelectText: 'Zum Auswählen klicken', callbackOnCreateTemplates: function () { return { option: ({ label, value, customProperties, active, disabled, }: any) => { const opt: HTMLOptionElement = Choices.defaults.templates.option.call( this, { label, value, customProperties, active, disabled } ); // We get the original