feat(wip): modern approach for planning
This commit is contained in:
parent
016e690dbd
commit
95c0324098
@ -18,7 +18,8 @@ pub struct NewAssignmentTemplate {
|
|||||||
user: User,
|
user: User,
|
||||||
event: Event,
|
event: Event,
|
||||||
available_wachhabende: Vec<Availabillity>,
|
available_wachhabende: Vec<Availabillity>,
|
||||||
available_posten: Vec<Availabillity>
|
available_posten: Vec<Availabillity>,
|
||||||
|
all: Vec<Availabillity>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::get("/assignments/new")]
|
#[actix_web::get("/assignments/new")]
|
||||||
@ -29,10 +30,11 @@ pub async fn get(user: Identity, pool: web::Data<PgPool>, query: web::Query<Even
|
|||||||
|
|
||||||
if let Ok(event) = Event::read_by_id_including_location(pool.get_ref(), query.event).await {
|
if let Ok(event) = Event::read_by_id_including_location(pool.get_ref(), query.event).await {
|
||||||
if current_user.role == Role::Admin || current_user.role == Role::AreaManager && event.location.as_ref().unwrap().area_id == current_user.area_id {
|
if current_user.role == Role::Admin || current_user.role == Role::AreaManager && event.location.as_ref().unwrap().area_id == current_user.area_id {
|
||||||
|
let all = Availabillity::read_not_assigned_by_date_including_user(pool.get_ref(), event.date).await.unwrap();
|
||||||
let available_posten = Availabillity::read_not_assigned_by_date_including_user(pool.get_ref(), event.date).await.unwrap();
|
let available_posten = Availabillity::read_not_assigned_by_date_including_user(pool.get_ref(), event.date).await.unwrap();
|
||||||
let available_wachhabende = available_posten.iter().filter(|a| a.user.as_ref().unwrap().function == Function::Wachhabender).map(|avl| avl.clone()).collect();
|
let available_wachhabende = available_posten.iter().filter(|a| a.user.as_ref().unwrap().function == Function::Wachhabender).map(|avl| avl.clone()).collect();
|
||||||
|
|
||||||
let template = NewAssignmentTemplate { user: current_user, event, available_wachhabende, available_posten };
|
let template = NewAssignmentTemplate { user: current_user, event, available_wachhabende, available_posten, all };
|
||||||
|
|
||||||
return template.to_response();
|
return template.to_response();
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,47 @@
|
|||||||
<p>Kleidungsordnung: {{ event.clothing }}</p>
|
<p>Kleidungsordnung: {{ event.clothing }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<table class="table is-fullwidth">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Funktion</th>
|
||||||
|
<th>Zeit</th>
|
||||||
|
<th>Kommentar</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for a in all %}
|
||||||
|
{% let u = a.user.as_ref().unwrap() %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ u.name }}</td>
|
||||||
|
<td>
|
||||||
|
{% match user.function %}
|
||||||
|
{% when Function::Posten %}
|
||||||
|
<span class="tag is-info">Posten</span>
|
||||||
|
{% when Function::Wachhabender %}
|
||||||
|
<span class="tag is-info">Wachhabender</span>
|
||||||
|
{% else %}
|
||||||
|
{% endmatch %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if a.start_time.is_some() && a.end_time.is_some() %}
|
||||||
|
{{ a.start_time.as_ref().unwrap() }} - {{ a.end_time.as_ref().unwrap() }}
|
||||||
|
{% else %}
|
||||||
|
ganztägig
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ a.comment.as_deref().unwrap_or("") }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if event.voluntary_wachhabender %}
|
{% if event.voluntary_wachhabender %}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Wachhabender</label>
|
<label class="label">Wachhabender</label>
|
||||||
@ -24,20 +65,20 @@
|
|||||||
{% for a in available_wachhabende %}
|
{% for a in available_wachhabende %}
|
||||||
{% let user = a.user.as_ref().unwrap() %}
|
{% let user = a.user.as_ref().unwrap() %}
|
||||||
<option value="{{ a.id }}">
|
<option value="{{ a.id }}">
|
||||||
{{ user.name }} -
|
{{ user.name }} -
|
||||||
{% match user.function %}
|
{% match user.function %}
|
||||||
{% when Function::Posten %}
|
{% when Function::Posten %}
|
||||||
Posten
|
Posten
|
||||||
{% when Function::Wachhabender %}
|
{% when Function::Wachhabender %}
|
||||||
Wachhabender
|
Wachhabender
|
||||||
{% else %}
|
{% else %}
|
||||||
{% endmatch %}
|
{% endmatch %}
|
||||||
-
|
-
|
||||||
{% if a.start_time.is_some() && a.end_time.is_some() %}
|
{% if a.start_time.is_some() && a.end_time.is_some() %}
|
||||||
{{ a.start_time.as_ref().unwrap() }} - {{ a.end_time.as_ref().unwrap() }}
|
{{ a.start_time.as_ref().unwrap() }} - {{ a.end_time.as_ref().unwrap() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
ganztägig
|
ganztägig
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</option>
|
</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
@ -53,20 +94,20 @@
|
|||||||
{% for a in available_posten %}
|
{% for a in available_posten %}
|
||||||
{% let user = a.user.as_ref().unwrap() %}
|
{% let user = a.user.as_ref().unwrap() %}
|
||||||
<option value="{{ a.id }}">
|
<option value="{{ a.id }}">
|
||||||
{{ user.name }} -
|
{{ user.name }} -
|
||||||
{% match user.function %}
|
{% match user.function %}
|
||||||
{% when Function::Posten %}
|
{% when Function::Posten %}
|
||||||
Posten
|
Posten
|
||||||
{% when Function::Wachhabender %}
|
{% when Function::Wachhabender %}
|
||||||
Wachhabender
|
Wachhabender
|
||||||
{% else %}
|
{% else %}
|
||||||
{% endmatch %}
|
{% endmatch %}
|
||||||
-
|
-
|
||||||
{% if a.start_time.is_some() && a.end_time.is_some() %}
|
{% if a.start_time.is_some() && a.end_time.is_some() %}
|
||||||
{{ a.start_time.as_ref().unwrap() }} - {{ a.end_time.as_ref().unwrap() }}
|
{{ a.start_time.as_ref().unwrap() }} - {{ a.end_time.as_ref().unwrap() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
ganztägig
|
ganztägig
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</option>
|
</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
@ -83,17 +124,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field is-horizontal">
|
<div class="field is-horizontal">
|
||||||
<div class="field-label"></div>
|
<div class="field-label"></div>
|
||||||
<div class="field-body">
|
<div class="field-body">
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="button is-link" type="submit" value="Erstellen">
|
<input class="button is-link" type="submit" value="Erstellen">
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<a class="button is-link is-light" href="/">Zurück</a>
|
<a class="button is-link is-light" href="/">Zurück</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user