[BUGFIX] js errors
This commit is contained in:
parent
c2e0c874ad
commit
885fb0f2c1
@ -20,46 +20,51 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
function selectBoatChange() {
|
||||
const boatSelect = <HTMLSelectElement>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 () {
|
||||
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 <option> from choicejs
|
||||
const originalOption: HTMLOptionElement = this._presetOptions.filter(
|
||||
(option: HTMLOptionElement) => option.value === value
|
||||
)[0];
|
||||
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 }
|
||||
);
|
||||
|
||||
const rowers = Number(originalOption.dataset.amount_seats) - 1;
|
||||
// We get the original <option> from choicejs
|
||||
const originalOption: HTMLOptionElement = this._presetOptions.filter(
|
||||
(option: HTMLOptionElement) => option.value === value
|
||||
)[0];
|
||||
|
||||
setMaxAmountRowers(rowers);
|
||||
const rowers = Number(originalOption.dataset.amount_seats) - 1;
|
||||
|
||||
setMaxAmountRowers(rowers);
|
||||
|
||||
|
||||
return opt;
|
||||
}
|
||||
return opt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} as any);
|
||||
} as any);
|
||||
|
||||
choiceObjects[boatSelect.id] = boatChoice;
|
||||
choiceObjects[boatSelect.id] = boatChoice;
|
||||
}
|
||||
|
||||
const shipmasterSelect = <HTMLSelectElement>document.querySelector('#shipmaster');
|
||||
const shipmasterChoice = new Choices(shipmasterSelect, {
|
||||
loadingText: 'Wird geladen...',
|
||||
noResultsText: 'Keine Ergebnisse gefunden',
|
||||
noChoicesText: 'Keine Ergebnisse gefunden',
|
||||
itemSelectText: 'Zum Auswählen klicken',
|
||||
});
|
||||
if(shipmasterSelect) {
|
||||
const shipmasterChoice = new Choices(shipmasterSelect, {
|
||||
loadingText: 'Wird geladen...',
|
||||
noResultsText: 'Keine Ergebnisse gefunden',
|
||||
noChoicesText: 'Keine Ergebnisse gefunden',
|
||||
itemSelectText: 'Zum Auswählen klicken',
|
||||
});
|
||||
|
||||
choiceObjects[shipmasterSelect.id] = shipmasterChoice;
|
||||
choiceObjects[shipmasterSelect.id] = shipmasterChoice;
|
||||
}
|
||||
}
|
||||
|
||||
function setMaxAmountRowers(rowers: number){
|
||||
|
Loading…
Reference in New Issue
Block a user