feat: use select clothing in event
This commit is contained in:
parent
f874fcd788
commit
10468ceba2
@ -163,10 +163,17 @@ snapshot_kind: text
|
|||||||
<label class="label">Anzugsordnung</label>
|
<label class="label">Anzugsordnung</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="field-body">
|
<div class="field-body">
|
||||||
<div class="field">
|
<div class="field is-narrow">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" name="clothing" placeholder="Tuchuniform" required value="1"
|
<div class="select is-fullwidth">
|
||||||
/>
|
<select name="clothing" required >
|
||||||
|
|
||||||
|
<option value="1"
|
||||||
|
selected>
|
||||||
|
Tuchuniform</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,7 +11,7 @@ use chrono::{NaiveDate, NaiveTime};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
endpoints::{events::NewOrEditEventTemplate, IdPath},
|
endpoints::{events::NewOrEditEventTemplate, IdPath},
|
||||||
models::{Assignment, Event, Function, Location, Role, User},
|
models::{Assignment, Clothing, Event, Function, Location, Role, User},
|
||||||
utils::{ApplicationError, TemplateResponse},
|
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 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 {
|
let template = NewOrEditEventTemplate {
|
||||||
user: user.into_inner(),
|
user: user.into_inner(),
|
||||||
date: event.start.date(),
|
date: event.start.date(),
|
||||||
@ -60,6 +62,7 @@ pub async fn get(
|
|||||||
voluntary_fuehrungsassistent: event.voluntary_fuehrungsassistent,
|
voluntary_fuehrungsassistent: event.voluntary_fuehrungsassistent,
|
||||||
amount_of_posten: Some(event.amount_of_posten),
|
amount_of_posten: Some(event.amount_of_posten),
|
||||||
clothing: Some(event.clothing.id),
|
clothing: Some(event.clothing.id),
|
||||||
|
clothing_options,
|
||||||
canceled: event.canceled,
|
canceled: event.canceled,
|
||||||
note: event.note,
|
note: event.note,
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ use sqlx::PgPool;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
endpoints::{events::NewOrEditEventTemplate, NaiveDateQuery},
|
endpoints::{events::NewOrEditEventTemplate, NaiveDateQuery},
|
||||||
models::{Location, Role, User},
|
models::{Clothing, Location, Role, User},
|
||||||
utils::{ApplicationError, TemplateResponse},
|
utils::{ApplicationError, TemplateResponse},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -24,6 +24,8 @@ pub async fn get(
|
|||||||
Location::read_by_area(pool.get_ref(), user.area_id).await?
|
Location::read_by_area(pool.get_ref(), user.area_id).await?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let clothing_options = Clothing::read_all(pool.get_ref()).await?;
|
||||||
|
|
||||||
let template = NewOrEditEventTemplate {
|
let template = NewOrEditEventTemplate {
|
||||||
user: user.into_inner(),
|
user: user.into_inner(),
|
||||||
date: query.date,
|
date: query.date,
|
||||||
@ -42,6 +44,7 @@ pub async fn get(
|
|||||||
voluntary_fuehrungsassistent: false,
|
voluntary_fuehrungsassistent: false,
|
||||||
amount_of_posten: None,
|
amount_of_posten: None,
|
||||||
clothing: None,
|
clothing: None,
|
||||||
|
clothing_options,
|
||||||
canceled: false,
|
canceled: false,
|
||||||
note: None,
|
note: None,
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ use chrono::{NaiveDate, NaiveTime};
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::filters;
|
use crate::filters;
|
||||||
use crate::models::{Location, Role, User};
|
use crate::models::{Clothing, Location, Role, User};
|
||||||
use crate::utils::DateTimeFormat::{DayMonthYear, HourMinute, YearMonthDayTHourMinute};
|
use crate::utils::DateTimeFormat::{DayMonthYear, HourMinute, YearMonthDayTHourMinute};
|
||||||
|
|
||||||
pub mod delete;
|
pub mod delete;
|
||||||
@ -31,6 +31,7 @@ pub struct NewOrEditEventTemplate {
|
|||||||
voluntary_fuehrungsassistent: bool,
|
voluntary_fuehrungsassistent: bool,
|
||||||
amount_of_posten: Option<i16>,
|
amount_of_posten: Option<i16>,
|
||||||
clothing: Option<i32>,
|
clothing: Option<i32>,
|
||||||
|
clothing_options: Vec<Clothing>,
|
||||||
canceled: bool,
|
canceled: bool,
|
||||||
note: Option<String>,
|
note: Option<String>,
|
||||||
amount_of_planned_posten: usize,
|
amount_of_planned_posten: usize,
|
||||||
|
@ -181,10 +181,17 @@
|
|||||||
<label class="label">Anzugsordnung</label>
|
<label class="label">Anzugsordnung</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="field-body">
|
<div class="field-body">
|
||||||
<div class="field">
|
<div class="field is-narrow">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" name="clothing" placeholder="Tuchuniform" required {{ clothing|insert_value|safe }}
|
<div class="select is-fullwidth">
|
||||||
{{ canceled|cond_show("disabled") }} />
|
<select name="clothing" required {{ canceled|cond_show("disabled") }}>
|
||||||
|
{% for c in clothing_options %}
|
||||||
|
<option value="{{ c.id }}"
|
||||||
|
{{ (clothing.is_some() && *clothing.as_ref().unwrap()==c.id)|cond_show("selected") }}>
|
||||||
|
{{ c.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user