diff --git a/frontend/main.ts b/frontend/main.ts index 1cb7271..5ff4a0a 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -773,3 +773,4 @@ function replaceStrings() { weekday.innerHTML = weekday.innerHTML.replace("Freitag", "Markttag"); }); } + diff --git a/src/model/trip.rs b/src/model/trip.rs index 8c6cf41..393d119 100644 --- a/src/model/trip.rs +++ b/src/model/trip.rs @@ -1,4 +1,4 @@ -use chrono::NaiveDate; +use chrono::{Local, NaiveDate}; use serde::Serialize; use sqlx::SqlitePool; @@ -164,6 +164,11 @@ WHERE trip.id=? } } + pub async fn get_for_today(db: &SqlitePool) -> Vec { + let today = Local::now().date_naive(); + Self::get_for_day(db, today).await + } + pub async fn get_for_day(db: &SqlitePool, day: NaiveDate) -> Vec { let day = format!("{day}"); let trips = sqlx::query_as!( diff --git a/src/tera/log.rs b/src/tera/log.rs index 2086f77..9244bbb 100644 --- a/src/tera/log.rs +++ b/src/tera/log.rs @@ -24,6 +24,7 @@ use crate::model::{ LogbookDeleteError, LogbookUpdateError, }, logtype::LogType, + trip::Trip, user::{AdminUser, DonauLinzUser, User, UserWithDetails, VorstandUser}, }; @@ -84,6 +85,7 @@ async fn index( } context.insert("boats", &boats); + context.insert("planned_trips", &Trip::get_for_today(db).await); context.insert( "reservations", &BoatReservation::all_future_with_groups(db).await, @@ -187,6 +189,7 @@ async fn kiosk( context.insert("flash", &msg.into_inner()); } + context.insert("planned_trips", &Trip::get_for_today(db).await); context.insert("boats", &boats); context.insert( "reservations", diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index ec76c48..adf1026 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -61,7 +61,8 @@ {% for role in user.roles -%} {{ role }} - {%- if not loop.last %}, {% endif -%} + {%- if not loop.last %}, + {% endif -%} {% endfor %} diff --git a/templates/includes/forms/log.html.tera b/templates/includes/forms/log.html.tera index 2ad3b08..e666945 100644 --- a/templates/includes/forms/log.html.tera +++ b/templates/includes/forms/log.html.tera @@ -262,12 +262,12 @@ - - {% include "includes/delete-icon" %} - Löschen - + + {% include "includes/delete-icon" %} + Löschen + {% endif %} diff --git a/templates/includes/macros.html.tera b/templates/includes/macros.html.tera index a68069a..e73c0a4 100644 --- a/templates/includes/macros.html.tera +++ b/templates/includes/macros.html.tera @@ -1,3 +1,42 @@ +{% macro plannedtrips() %} + {% if planned_trips %} + +
+

Heute geplante Ausfahrten

+
+ {% for planned_trip in planned_trips | sort(attribute='planned_starting_time') %} +
+ + {{ planned_trip.cox_name }} ({{ planned_trip.rower | length + 1 }} Personen) + {{ planned_trip.planned_starting_time }} + + +
+ {% endfor %} +
+
+ {% endif %} +{% endmacro plannedtrips %} {% macro boatreservation() %}

Reservierungen ({{ reservations | length }})

diff --git a/templates/kiosk.html.tera b/templates/kiosk.html.tera index 500e584..f93bc7c 100644 --- a/templates/kiosk.html.tera +++ b/templates/kiosk.html.tera @@ -53,6 +53,7 @@
{{ macros::boatreservation() }} + {{ macros::plannedtrips() }} diff --git a/templates/log.html.tera b/templates/log.html.tera index 1bf266b..aeae283 100644 --- a/templates/log.html.tera +++ b/templates/log.html.tera @@ -35,6 +35,7 @@ {% endif %} {{ macros::boatreservation() }} + {{ macros::plannedtrips() }}