From 0ba2590bfd5595009314c92bb8411c59d966751f Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 30 Mar 2024 09:17:32 +0100 Subject: [PATCH] hide reservations if there are none; clean code --- src/model/boatreservation.rs | 1 - src/tera/boatreservation.rs | 3 +-- templates/includes/macros.html.tera | 30 +++++++++++++++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/model/boatreservation.rs b/src/model/boatreservation.rs index a7a3baa..c20e841 100644 --- a/src/model/boatreservation.rs +++ b/src/model/boatreservation.rs @@ -2,7 +2,6 @@ use crate::model::{boat::Boat, user::User}; use chrono::NaiveDate; use chrono::NaiveDateTime; use rocket::serde::{Deserialize, Serialize}; -use rocket::FromForm; use sqlx::{FromRow, SqlitePool}; use super::log::Log; diff --git a/src/tera/boatreservation.rs b/src/tera/boatreservation.rs index 16625af..bbb67ce 100644 --- a/src/tera/boatreservation.rs +++ b/src/tera/boatreservation.rs @@ -13,9 +13,8 @@ use tera::Context; use crate::{ model::{ boat::Boat, - boatdamage::{BoatDamage, BoatDamageFixed, BoatDamageToAdd, BoatDamageVerified}, boatreservation::{BoatReservation, BoatReservationToAdd}, - user::{AdminUser, CoxUser, DonauLinzUser, TechUser, User, UserWithRoles}, + user::{DonauLinzUser, User, UserWithRoles}, }, tera::log::KioskCookie, }; diff --git a/templates/includes/macros.html.tera b/templates/includes/macros.html.tera index c922ee7..db89100 100644 --- a/templates/includes/macros.html.tera +++ b/templates/includes/macros.html.tera @@ -1,19 +1,21 @@ {% macro boatreservation() %} -
-

Bootsreservierungen

-
-
    - {% for reservation in reservations %} -
  • - {{ reservation.boat.name }} • {{ reservation.start_date }} - {% if reservation.end_date != reservation.start_date %}- {{ reservation.end_date }}{% endif %} - • Uhrzeit: {{ reservation.time_desc }} • Zweck: {{ reservation.usage }} -
  • - {% endfor %} -
+ {% if reservations %} +
+

Bootsreservierungen

+
+
    + {% for reservation in reservations %} +
  • + {{ reservation.boat.name }} • {{ reservation.start_date }} + {% if reservation.end_date != reservation.start_date %}- {{ reservation.end_date }}{% endif %} + • Uhrzeit: {{ reservation.time_desc }} • Zweck: {{ reservation.usage }} +
  • + {% endfor %} +
+
-
+ {% endif %} {% endmacro boatreservation %} {% macro header(loggedin_user) %}