better layout
This commit is contained in:
		| @@ -21,9 +21,10 @@ use sqlx::SqlitePool; | ||||
| use tera::Context; | ||||
|  | ||||
| use crate::model::{ | ||||
|     logbook::Logbook, | ||||
|     notification::Notification, | ||||
|     role::Role, | ||||
|     user::{User, UserWithDetails}, | ||||
|     user::{User, UserWithDetails, SCHECKBUCH}, | ||||
| }; | ||||
|  | ||||
| pub(crate) mod admin; | ||||
| @@ -52,8 +53,15 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_ | ||||
|         context.insert("flash", &msg.into_inner()); | ||||
|     } | ||||
|  | ||||
|     if user.has_role(db, "scheckbuch").await { | ||||
|         let last_trips = Logbook::completed_with_user(db, &user).await; | ||||
|         context.insert("last_trips", &last_trips); | ||||
|     } | ||||
|  | ||||
|     context.insert("notifications", &Notification::for_user(db, &user).await); | ||||
|     context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await); | ||||
|     context.insert("costs_scheckbuch", &SCHECKBUCH); | ||||
|  | ||||
|     Template::render("index", context.into_json()) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -32,11 +32,6 @@ async fn index( | ||||
|         context.insert("trip_types", &triptypes); | ||||
|     } | ||||
|  | ||||
|     if user.has_role(db, "scheckbuch").await { | ||||
|         let last_trips = Logbook::completed_with_user(db, &user).await; | ||||
|         context.insert("last_trips", &last_trips); | ||||
|     } | ||||
|  | ||||
|     let days = user.get_days(db).await; | ||||
|  | ||||
|     if let Some(msg) = flash { | ||||
| @@ -46,7 +41,6 @@ async fn index( | ||||
|     context.insert("fee", &user.fee(db).await); | ||||
|     context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await); | ||||
|     context.insert("days", &days); | ||||
|     context.insert("costs_scheckbuch", &SCHECKBUCH); | ||||
|     Template::render("planned", context.into_json()) | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user