feat: add function to db and event
This commit is contained in:
parent
7bf892207a
commit
b27bdb6daa
@ -49,7 +49,8 @@ CREATE TABLE event
|
|||||||
endTime TIME NOT NULL,
|
endTime TIME NOT NULL,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
locationId INTEGER NOT NULL REFERENCES location (id) ON DELETE CASCADE,
|
locationId INTEGER NOT NULL REFERENCES location (id) ON DELETE CASCADE,
|
||||||
voluntaryWachhabender BOOLEAN NOT NULL,
|
voluntaryWachhabender BOOLEAN NOT NULL,
|
||||||
|
voluntaryFuehrungsassistent BOOLEAN NOT NULL,
|
||||||
amountOfPosten SMALLINT NOT NULL CHECK (amountOfPosten >= 0),
|
amountOfPosten SMALLINT NOT NULL CHECK (amountOfPosten >= 0),
|
||||||
clothing TEXT NOT NULL,
|
clothing TEXT NOT NULL,
|
||||||
note TEXT,
|
note TEXT,
|
||||||
|
@ -3,17 +3,22 @@ use askama::Template;
|
|||||||
use askama_actix::TemplateToResponse;
|
use askama_actix::TemplateToResponse;
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
|
|
||||||
use crate::models::{Area, Function, Role, User};
|
use crate::{
|
||||||
|
filters,
|
||||||
|
models::{Area, Role, User},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "user/profile.html")]
|
#[template(path = "user/profile.html")]
|
||||||
struct ProfileTemplate {
|
struct ProfileTemplate {
|
||||||
user: User
|
user: User,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::get("/profile")]
|
#[actix_web::get("/profile")]
|
||||||
pub async fn get(user: web::ReqData<User>, pool: web::Data<PgPool>) -> impl Responder {
|
pub async fn get(user: web::ReqData<User>, pool: web::Data<PgPool>) -> impl Responder {
|
||||||
let area = Area::read_by_id(pool.get_ref(), user.area_id).await.unwrap();
|
let area = Area::read_by_id(pool.get_ref(), user.area_id)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let mut user = user.into_inner();
|
let mut user = user.into_inner();
|
||||||
user.area = area;
|
user.area = area;
|
||||||
|
@ -51,13 +51,6 @@
|
|||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h5 class="title is-5">Einteilung Personal</h5>
|
<h5 class="title is-5">Einteilung Personal</h5>
|
||||||
<div class="icon-text">
|
|
||||||
<svg class="icon has-text-success">
|
|
||||||
<use href="/static/feather-sprite.svg#check" />
|
|
||||||
</svg>
|
|
||||||
<span>Alle Plätze verplant!</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include "plan_personal_table.html" %}
|
{% include "plan_personal_table.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
{% if !further_posten_required && !further_fuehrungsassistent_required && !further_wachhabender_required %}
|
||||||
|
<div class="icon-text">
|
||||||
|
<svg class="icon has-text-success">
|
||||||
|
<use href="/static/feather-sprite.svg#check" />
|
||||||
|
</svg>
|
||||||
|
<span>Alle Plätze verplant!</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<table class="table is-fullwidth">
|
<table class="table is-fullwidth">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -69,6 +69,8 @@
|
|||||||
<div class="select is-fullwidth">
|
<div class="select is-fullwidth">
|
||||||
<select name="function">
|
<select name="function">
|
||||||
<option value="1" {{ function|is_some_and_eq(1|as_ref)|cond_show("selected") }}>Posten</option>
|
<option value="1" {{ function|is_some_and_eq(1|as_ref)|cond_show("selected") }}>Posten</option>
|
||||||
|
<option value="1" {{ function|is_some_and_eq(5|as_ref)|cond_show("selected") }}>Führungsassistent
|
||||||
|
</option>
|
||||||
<option value="10" {{ function|is_some_and_eq(10|as_ref)|cond_show("selected") }}>Wachhabender
|
<option value="10" {{ function|is_some_and_eq(10|as_ref)|cond_show("selected") }}>Wachhabender
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -62,13 +62,7 @@
|
|||||||
<div class="field-body">
|
<div class="field-body">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
{% match user.function %}
|
{{ user.function|show_tree|safe }}
|
||||||
{% when Function::Posten %}
|
|
||||||
<span class="tag is-primary is-light">Posten</span>
|
|
||||||
{% when Function::Wachhabender %}
|
|
||||||
<span class="tag is-primary">Wachhabender</span>
|
|
||||||
{% else %}
|
|
||||||
{% endmatch %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user