[TASK] improve ux in mobile form
This commit is contained in:
parent
8cec4e4c11
commit
9b433f977a
@ -93,31 +93,46 @@ function reloadPage() {
|
||||
|
||||
function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') {
|
||||
let curSelection = choiceObjects['newrower'].getValue(true);
|
||||
let amount_to_delete = (<any>curSelection).length - rowers;
|
||||
if (amount_to_delete > 0){
|
||||
let to_delete = (<any>curSelection).slice(-amount_to_delete);
|
||||
for (let del of to_delete) {
|
||||
choiceObjects['newrower'].removeActiveItemsByValue(del);
|
||||
}
|
||||
}
|
||||
let amount_to_delete = (<any>curSelection).length - rowers;
|
||||
|
||||
choiceObjects['newrower'].config.maxItemCount = rowers;
|
||||
if (rowers === 0) {
|
||||
choiceObjects['newrower'].disable()
|
||||
}else{
|
||||
choiceObjects['newrower'].enable()
|
||||
}
|
||||
if (amount_to_delete > 0){
|
||||
let to_delete = (<any>curSelection).slice(-amount_to_delete);
|
||||
for (let del of to_delete) {
|
||||
choiceObjects['newrower'].removeActiveItemsByValue(del);
|
||||
}
|
||||
}
|
||||
|
||||
let input = <HTMLElement>document.querySelector('#newrower');
|
||||
|
||||
if(input) {
|
||||
choiceObjects['newrower'].config.maxItemCount = rowers;
|
||||
if (rowers === 0) {
|
||||
choiceObjects['newrower'].disable()
|
||||
input.parentElement?.parentElement?.parentElement?.classList.add('hidden');
|
||||
input.parentElement?.parentElement?.parentElement?.classList.add('md:block');
|
||||
input.parentElement?.parentElement?.parentElement?.classList.add('opacity-50');
|
||||
} else{
|
||||
choiceObjects['newrower'].enable();
|
||||
input.parentElement?.parentElement?.parentElement?.classList.remove('hidden');
|
||||
input.parentElement?.parentElement?.parentElement?.classList.remove('md:block');
|
||||
input.parentElement?.parentElement?.parentElement?.classList.remove('opacity-50');
|
||||
}
|
||||
}
|
||||
|
||||
let only_steering = <HTMLSelectElement>document.querySelector('#shipmaster_only_steering');
|
||||
if(only_steering) {
|
||||
if(isShipmasterSteering == 'true') {
|
||||
only_steering.removeAttribute('disabled');
|
||||
only_steering.setAttribute('checked', 'true');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.remove('hidden');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.remove('md:block');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.remove('opacity-50');
|
||||
} else {
|
||||
only_steering.setAttribute('disabled', 'disabled');
|
||||
only_steering.removeAttribute('checked');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.add('opacity-50');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.add('hidden');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.add('md:block');
|
||||
only_steering.parentElement?.parentElement?.parentElement?.classList.add('opacity-50');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user