fix 1x no cox stuff

This commit is contained in:
2023-10-31 22:16:14 +01:00
parent 4179b7bd6b
commit 56ae0ae429
3 changed files with 81 additions and 39 deletions

View File

@ -129,15 +129,18 @@ function setMaxAmountRowers(name: string, rowers: number) {
// only_steering.parentElement?.parentElement?.parentElement?.classList.add('opacity-50');
// }
//}
let shipmaster = <HTMLElement>document.querySelector('#shipmaster-newrowerjs');
let steering_person = <HTMLElement>document.querySelector('#steering_person-newrowerjs');
let shipmaster = <HTMLElement>document.querySelector('#shipmaster-'+name+'js');
let steering_person = <HTMLElement>document.querySelector('#steering_person-'+name+'js');
if (rowers == 1){
if (shipmaster.parentNode) {
(<HTMLElement>shipmaster.parentNode).classList.add('hidden');
}
shipmaster.removeAttribute('required');
if (steering_person.parentNode){
(<HTMLElement>steering_person.parentNode).classList.add('hidden');
}
steering_person.removeAttribute('required');
}else{
if (shipmaster.parentNode){
(<HTMLElement>shipmaster.parentNode).classList.remove('hidden');
@ -196,6 +199,31 @@ function initNewChoice(select: HTMLInputElement) {
if (select.dataset && select.dataset.seats) {
seats = +select.dataset.seats;
}
console.log(seats);
let shipmaster = <HTMLElement>document.querySelector('#shipmaster-'+select.id+'js');
let steering_person = <HTMLElement>document.querySelector('#steering_person-'+select.id+'js');
if (seats == 1){
if (shipmaster.parentNode) {
(<HTMLElement>shipmaster.parentNode).classList.add('hidden');
}
shipmaster.removeAttribute('required');
if (steering_person.parentNode){
(<HTMLElement>steering_person.parentNode).classList.add('hidden');
}
steering_person.removeAttribute('required');
}else{
if (shipmaster.parentNode){
(<HTMLElement>shipmaster.parentNode).classList.remove('hidden');
}
shipmaster.setAttribute('required', 'required');
if (steering_person.parentNode){
(<HTMLElement>steering_person.parentNode).classList.remove('hidden');
}
steering_person.setAttribute('required', 'required');
}
const choice = new Choices(select, {
removeItemButton: true,
loadingText: 'Wird geladen...',