diff --git a/frontend/scss/app.scss b/frontend/scss/app.scss index 71b73ac..c9e7c41 100644 --- a/frontend/scss/app.scss +++ b/frontend/scss/app.scss @@ -84,10 +84,4 @@ z-index: 1; } } - -.deregister-btn { - + .register-btn { - display: none; - } -} /* purgecss end ignore */ diff --git a/src/model/planned_event.rs b/src/model/planned_event.rs index c1718c2..f837149 100644 --- a/src/model/planned_event.rs +++ b/src/model/planned_event.rs @@ -19,6 +19,7 @@ pub struct PlannedEvent { pub struct PlannedEventWithUser { #[serde(flatten)] planned_event: PlannedEvent, + cox_needed: bool, cox: Vec, rower: Vec, } @@ -47,9 +48,11 @@ WHERE day=?", let mut ret = Vec::new(); for event in events { + let cox = Self::get_all_cox_for_id(db, event.id).await; ret.push(PlannedEventWithUser { planned_event: event.clone(), - cox: Self::get_all_cox_for_id(db, event.id).await, + cox_needed: event.planned_amount_cox > cox.len() as i64, + cox, rower: Self::get_all_rower_for_id(db, event.id).await, }); } diff --git a/templates/index.html.tera b/templates/index.html.tera index ad9ba52..20e6ad8 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -30,34 +30,50 @@
+ {% if planned_event.cox_needed %} + zusätzliche steuerperson notwendig!!!!!!elf!! + {% else %} + keine zusätzliche unbedingt notwendig + {% endif %} {{ planned_event.planned_starting_time }} Uhr ({{ planned_event.name }})
Details
+ {% set_global cur_user_participates = false %} {% for rower in planned_event.rower%} {% if rower.name == loggedin_user.name %} - Abmelden + {% set_global cur_user_participates = true %} {% endif %} {% endfor %} + {% if cur_user_participates %} + Abmelden + {% endif %} {% if planned_event.max_people > planned_event.rower | length %} - Mitrudern - {% endif %} + {% if cur_user_participates == false %} + Mitrudern + {% endif %} + {% endif %}
{% if loggedin_user.is_cox %} + {% set_global cur_user_participates = false %} {% for cox in planned_event.cox %} {% if cox.name == loggedin_user.name %} + {% set_global cur_user_participates = true %} + {% endif %} + {% endfor %} + {% if cur_user_participates %} Abmelden - {% endif %} - {% endfor %} - - - Steuern - + {% else %} + + + Steuern + + {% endif %} {% endif %}