forked from Ruderverein-Donau-Linz/rowt
		
	clean up + make maxitemcount in sidebar work
This commit is contained in:
		| @@ -84,7 +84,6 @@ function reloadPage() { | ||||
| } | ||||
|  | ||||
| function setMaxAmountRowers(name: string, rowers: number) { | ||||
| 	console.log("called fct: name="+name+"; rowers="+rowers); | ||||
|   if(choiceObjects[name]) { | ||||
|     choiceObjects[name].removeActiveItems(-1); | ||||
|     //let curSelection = choiceObjects[name].getValue(true); | ||||
| @@ -131,7 +130,6 @@ function setMaxAmountRowers(name: string, rowers: number) { | ||||
|     //  } | ||||
|     //} | ||||
|   } | ||||
|   console.log(choiceObjects["newrower"].config.maxItemCount); | ||||
| } | ||||
|  | ||||
| function initBoatActions() { | ||||
| @@ -180,31 +178,9 @@ function initNewChoice(select: HTMLInputElement) { | ||||
|     noChoicesText: 'Keine Ergebnisse gefunden', | ||||
|     itemSelectText: 'Zum Auswählen klicken', | ||||
|     placeholderValue: 'Ruderer auswählen', | ||||
|     maxItemCount: -1, //TODO | ||||
|     maxItemCount: select.dataset.seats,  | ||||
|     maxItemText: (maxItemCount) => { | ||||
|       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() { | ||||
|               this._currentState.items.forEach(function(obj){ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user