Merge branch 'new-db' into 'staging'

New db

See merge request PhilippHofer/rot!57
This commit is contained in:
PhilippHofer 2023-10-30 18:27:06 +00:00
commit 10529234da

View File

@ -84,7 +84,6 @@ function reloadPage() {
} }
function setMaxAmountRowers(name: string, rowers: number) { function setMaxAmountRowers(name: string, rowers: number) {
console.log("called fct: name="+name+"; rowers="+rowers);
if(choiceObjects[name]) { if(choiceObjects[name]) {
choiceObjects[name].removeActiveItems(-1); choiceObjects[name].removeActiveItems(-1);
//let curSelection = choiceObjects[name].getValue(true); //let curSelection = choiceObjects[name].getValue(true);
@ -131,7 +130,6 @@ function setMaxAmountRowers(name: string, rowers: number) {
// } // }
//} //}
} }
console.log(choiceObjects["newrower"].config.maxItemCount);
} }
function initBoatActions() { function initBoatActions() {
@ -173,6 +171,11 @@ interface ChoiceEvent extends Event{
} }
function initNewChoice(select: HTMLInputElement) { function initNewChoice(select: HTMLInputElement) {
let seats = 0;
if (select.dataset && select.dataset.seats) {
seats = +select.dataset.seats;
}
const choice = new Choices(select, { const choice = new Choices(select, {
removeItemButton: true, removeItemButton: true,
loadingText: 'Wird geladen...', loadingText: 'Wird geladen...',
@ -180,31 +183,9 @@ function initNewChoice(select: HTMLInputElement) {
noChoicesText: 'Keine Ergebnisse gefunden', noChoicesText: 'Keine Ergebnisse gefunden',
itemSelectText: 'Zum Auswählen klicken', itemSelectText: 'Zum Auswählen klicken',
placeholderValue: 'Ruderer auswählen', placeholderValue: 'Ruderer auswählen',
maxItemCount: -1, //TODO maxItemCount: seats,
maxItemText: (maxItemCount) => { maxItemText: (maxItemCount) => {
return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`; return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`;
},
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];
//
//const rowers = Number(originalOption.dataset.amount_seats);
//const isShipmasterSteering = originalOption.dataset.default_shipmaster_only_steering;
//setMaxAmountRowersoselect.id, curr_boat_rowers, isShipmasterSteering);
return opt;
}
}
}, },
callbackOnInit: function() { callbackOnInit: function() {
this._currentState.items.forEach(function(obj){ this._currentState.items.forEach(function(obj){