diff --git a/web/snapshots/brass_web__endpoints__events__get_edit__inner_produces_template.snap b/web/snapshots/brass_web__endpoints__events__get_edit__inner_produces_template.snap index 988f3899..453e02fa 100644 --- a/web/snapshots/brass_web__endpoints__events__get_edit__inner_produces_template.snap +++ b/web/snapshots/brass_web__endpoints__events__get_edit__inner_produces_template.snap @@ -163,10 +163,17 @@ snapshot_kind: text
-
+
- +
+ +
diff --git a/web/src/endpoints/events/get_edit.rs b/web/src/endpoints/events/get_edit.rs index 3f8ced30..6909c26a 100644 --- a/web/src/endpoints/events/get_edit.rs +++ b/web/src/endpoints/events/get_edit.rs @@ -11,7 +11,7 @@ use chrono::{NaiveDate, NaiveTime}; use crate::{ endpoints::{events::NewOrEditEventTemplate, IdPath}, - models::{Assignment, Event, Function, Location, Role, User}, + models::{Assignment, Clothing, Event, Function, Location, Role, User}, utils::{ApplicationError, TemplateResponse}, }; @@ -37,6 +37,8 @@ pub async fn get( let assignments = Assignment::read_all_by_event(pool.get_ref(), event.id).await?; + let clothing_options = Clothing::read_all(pool.get_ref()).await?; + let template = NewOrEditEventTemplate { user: user.into_inner(), date: event.start.date(), @@ -60,6 +62,7 @@ pub async fn get( voluntary_fuehrungsassistent: event.voluntary_fuehrungsassistent, amount_of_posten: Some(event.amount_of_posten), clothing: Some(event.clothing.id), + clothing_options, canceled: event.canceled, note: event.note, }; diff --git a/web/src/endpoints/events/get_new.rs b/web/src/endpoints/events/get_new.rs index 52f580d9..da0e19f5 100644 --- a/web/src/endpoints/events/get_new.rs +++ b/web/src/endpoints/events/get_new.rs @@ -4,7 +4,7 @@ use sqlx::PgPool; use crate::{ endpoints::{events::NewOrEditEventTemplate, NaiveDateQuery}, - models::{Location, Role, User}, + models::{Clothing, Location, Role, User}, utils::{ApplicationError, TemplateResponse}, }; @@ -24,6 +24,8 @@ pub async fn get( Location::read_by_area(pool.get_ref(), user.area_id).await? }; + let clothing_options = Clothing::read_all(pool.get_ref()).await?; + let template = NewOrEditEventTemplate { user: user.into_inner(), date: query.date, @@ -42,6 +44,7 @@ pub async fn get( voluntary_fuehrungsassistent: false, amount_of_posten: None, clothing: None, + clothing_options, canceled: false, note: None, }; diff --git a/web/src/endpoints/events/mod.rs b/web/src/endpoints/events/mod.rs index 96a8a292..07e67b29 100644 --- a/web/src/endpoints/events/mod.rs +++ b/web/src/endpoints/events/mod.rs @@ -4,7 +4,7 @@ use chrono::{NaiveDate, NaiveTime}; use serde::Deserialize; use crate::filters; -use crate::models::{Location, Role, User}; +use crate::models::{Clothing, Location, Role, User}; use crate::utils::DateTimeFormat::{DayMonthYear, HourMinute, YearMonthDayTHourMinute}; pub mod delete; @@ -31,6 +31,7 @@ pub struct NewOrEditEventTemplate { voluntary_fuehrungsassistent: bool, amount_of_posten: Option, clothing: Option, + clothing_options: Vec, canceled: bool, note: Option, amount_of_planned_posten: usize, diff --git a/web/templates/events/new_or_edit.html b/web/templates/events/new_or_edit.html index 40354fe3..3ff06f8a 100644 --- a/web/templates/events/new_or_edit.html +++ b/web/templates/events/new_or_edit.html @@ -181,10 +181,17 @@
-
+
- +
+ +