[TASK] improve ux in mobile form
This commit is contained in:
parent
509a1b2c56
commit
ccc66200a0
@ -94,6 +94,7 @@ function reloadPage() {
|
|||||||
function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') {
|
function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') {
|
||||||
let curSelection = choiceObjects['newrower'].getValue(true);
|
let curSelection = choiceObjects['newrower'].getValue(true);
|
||||||
let amount_to_delete = (<any>curSelection).length - rowers;
|
let amount_to_delete = (<any>curSelection).length - rowers;
|
||||||
|
|
||||||
if (amount_to_delete > 0){
|
if (amount_to_delete > 0){
|
||||||
let to_delete = (<any>curSelection).slice(-amount_to_delete);
|
let to_delete = (<any>curSelection).slice(-amount_to_delete);
|
||||||
for (let del of to_delete) {
|
for (let del of to_delete) {
|
||||||
@ -101,11 +102,21 @@ function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let input = <HTMLElement>document.querySelector('#newrower');
|
||||||
|
|
||||||
|
if(input) {
|
||||||
choiceObjects['newrower'].config.maxItemCount = rowers;
|
choiceObjects['newrower'].config.maxItemCount = rowers;
|
||||||
if (rowers === 0) {
|
if (rowers === 0) {
|
||||||
choiceObjects['newrower'].disable()
|
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{
|
} else{
|
||||||
choiceObjects['newrower'].enable()
|
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');
|
let only_steering = <HTMLSelectElement>document.querySelector('#shipmaster_only_steering');
|
||||||
@ -113,10 +124,14 @@ function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') {
|
|||||||
if(isShipmasterSteering == 'true') {
|
if(isShipmasterSteering == 'true') {
|
||||||
only_steering.removeAttribute('disabled');
|
only_steering.removeAttribute('disabled');
|
||||||
only_steering.setAttribute('checked', 'true');
|
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');
|
only_steering.parentElement?.parentElement?.parentElement?.classList.remove('opacity-50');
|
||||||
} else {
|
} else {
|
||||||
only_steering.setAttribute('disabled', 'disabled');
|
only_steering.setAttribute('disabled', 'disabled');
|
||||||
only_steering.removeAttribute('checked');
|
only_steering.removeAttribute('checked');
|
||||||
|
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');
|
only_steering.parentElement?.parentElement?.parentElement?.classList.add('opacity-50');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user