allow-scheckbuch-to-be-entered #476

Merged
philipp merged 4 commits from allow-scheckbuch-to-be-entered into staging 2024-05-01 19:37:11 +02:00
2 changed files with 21 additions and 10 deletions

View File

@ -189,11 +189,6 @@ function selectBoatChange() {
inputElement.value = formattedDateTime; inputElement.value = formattedDateTime;
const distinput = <HTMLInputElement>(
document.querySelector("#distance_in_km")
);
distinput.value = "";
const destinput = <HTMLInputElement>( const destinput = <HTMLInputElement>(
document.querySelector("#destination") document.querySelector("#destination")
); );
@ -759,9 +754,11 @@ function addRelationMagic(bodyElement: HTMLElement) {
}, },
); );
if (option && option.value !== ""){
// Get distance // Get distance
const distance = option.getAttribute("distance"); const distance = option.getAttribute("distance");
if (distance) relatedField.value = distance; if (distance && relatedField.value === "") relatedField.value = distance;
}
} }
}); });
} }

View File

@ -58,7 +58,9 @@ async fn index(
.map(|user| UserWithWaterStatus::from_user(user, db)), .map(|user| UserWithWaterStatus::from_user(user, db)),
) )
.await; .await;
coxes.retain(|u| u.roles.contains(&"Donau Linz".into())); coxes.retain(|u| {
u.roles.contains(&"Donau Linz".into()) || u.roles.contains(&"scheckbuch".into())
});
let mut users: Vec<UserWithWaterStatus> = futures::future::join_all( let mut users: Vec<UserWithWaterStatus> = futures::future::join_all(
User::all(db) User::all(db)
@ -67,7 +69,9 @@ async fn index(
.map(|user| UserWithWaterStatus::from_user(user, db)), .map(|user| UserWithWaterStatus::from_user(user, db)),
) )
.await; .await;
users.retain(|u| u.roles.contains(&"Donau Linz".into())); users.retain(|u| {
u.roles.contains(&"Donau Linz".into()) || u.roles.contains(&"scheckbuch".into())
});
let logtypes = LogType::all(db).await; let logtypes = LogType::all(db).await;
let distances = Logbook::distances(db).await; let distances = Logbook::distances(db).await;
@ -149,20 +153,30 @@ async fn kiosk(
_kiosk: KioskCookie, _kiosk: KioskCookie,
) -> Template { ) -> Template {
let boats = Boat::all(db).await; let boats = Boat::all(db).await;
let coxes: Vec<UserWithWaterStatus> = futures::future::join_all( let mut coxes: Vec<UserWithWaterStatus> = futures::future::join_all(
User::cox(db) User::cox(db)
.await .await
.into_iter() .into_iter()
.map(|user| UserWithWaterStatus::from_user(user, db)), .map(|user| UserWithWaterStatus::from_user(user, db)),
) )
.await; .await;
let users: Vec<UserWithWaterStatus> = futures::future::join_all(
coxes.retain(|u| {
u.roles.contains(&"Donau Linz".into()) || u.roles.contains(&"scheckbuch".into())
});
let mut users: Vec<UserWithWaterStatus> = futures::future::join_all(
User::all(db) User::all(db)
.await .await
.into_iter() .into_iter()
.map(|user| UserWithWaterStatus::from_user(user, db)), .map(|user| UserWithWaterStatus::from_user(user, db)),
) )
.await; .await;
users.retain(|u| {
u.roles.contains(&"Donau Linz".into()) || u.roles.contains(&"scheckbuch".into())
});
let logtypes = LogType::all(db).await; let logtypes = LogType::all(db).await;
let distances = Logbook::distances(db).await; let distances = Logbook::distances(db).await;