diff --git a/frontend/main.ts b/frontend/main.ts index c578df6..5a4d8ff 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -129,6 +129,26 @@ function setMaxAmountRowers(name: string, rowers: number) { // only_steering.parentElement?.parentElement?.parentElement?.classList.add('opacity-50'); // } //} + let shipmaster = document.querySelector('#shipmaster-newrowerjs'); + let steering_person = document.querySelector('#steering_person-newrowerjs'); + if (rowers == 1){ + if (shipmaster.parentNode) { + (shipmaster.parentNode).classList.add('hidden'); + } + if (steering_person.parentNode){ + (steering_person.parentNode).classList.add('hidden'); + } + }else{ + if (shipmaster.parentNode){ + (shipmaster.parentNode).classList.remove('hidden'); + } + shipmaster.setAttribute('required', 'required'); + + if (steering_person.parentNode){ + (steering_person.parentNode).classList.remove('hidden'); + } + steering_person.setAttribute('required', 'required'); + } } } diff --git a/src/model/logbook.rs b/src/model/logbook.rs index 30ec70a..6230ad4 100644 --- a/src/model/logbook.rs +++ b/src/model/logbook.rs @@ -244,7 +244,7 @@ ORDER BY departure DESC }; if let Ok(log_to_finalize) = TryInto::::try_into(log.clone()) { - //TODO: fix clone() + //TODO: fix clone() above if !boat.shipmaster_allowed(created_by_user).await { return Err(LogbookCreateError::UserNotAllowedToUseBoat);