Merge commit '4d49574ebb9565523acf16853be3d4922f2a6e63'

This commit is contained in:
Marie Birner 2023-04-06 20:29:50 +02:00
commit 484e4e4175
3 changed files with 37 additions and 19 deletions

View File

@ -84,10 +84,4 @@
z-index: 1; z-index: 1;
} }
} }
.deregister-btn {
+ .register-btn {
display: none;
}
}
/* purgecss end ignore */ /* purgecss end ignore */

View File

@ -19,6 +19,7 @@ pub struct PlannedEvent {
pub struct PlannedEventWithUser { pub struct PlannedEventWithUser {
#[serde(flatten)] #[serde(flatten)]
planned_event: PlannedEvent, planned_event: PlannedEvent,
cox_needed: bool,
cox: Vec<Registration>, cox: Vec<Registration>,
rower: Vec<Registration>, rower: Vec<Registration>,
} }
@ -47,9 +48,11 @@ WHERE day=?",
let mut ret = Vec::new(); let mut ret = Vec::new();
for event in events { for event in events {
let cox = Self::get_all_cox_for_id(db, event.id).await;
ret.push(PlannedEventWithUser { ret.push(PlannedEventWithUser {
planned_event: event.clone(), 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, rower: Self::get_all_rower_for_id(db, event.id).await,
}); });
} }

View File

@ -30,34 +30,50 @@
<div class="pt-2"> <div class="pt-2">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div> <div>
{% if planned_event.cox_needed %}
zusätzliche steuerperson notwendig!!!!!!elf!!
{% else %}
keine zusätzliche unbedingt notwendig
{% endif %}
<strong class="text-primary-900">{{ planned_event.planned_starting_time }} Uhr</strong> <small class="text-gray-600">({{ planned_event.name }})</small><br/> <strong class="text-primary-900">{{ planned_event.planned_starting_time }} Uhr</strong> <small class="text-gray-600">({{ planned_event.name }})</small><br/>
<a href="#" data-sidebar="true" data-trigger="detailEvent{{ planned_event.id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a> <a href="#" data-sidebar="true" data-trigger="detailEvent{{ planned_event.id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a>
</div> </div>
<div> <div>
{% set_global cur_user_participates = false %}
{% for rower in planned_event.rower%} {% for rower in planned_event.rower%}
{% if rower.name == loggedin_user.name %} {% if rower.name == loggedin_user.name %}
<a href="/remove/{{ planned_event.trip_details_id }}" class="deregister-btn rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer">Abmelden</a> {% set_global cur_user_participates = true %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if cur_user_participates %}
<a href="/remove/{{ planned_event.trip_details_id }}" class="deregister-btn rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer">Abmelden</a>
{% endif %}
{% if planned_event.max_people > planned_event.rower | length %} {% if planned_event.max_people > planned_event.rower | length %}
<a href="/join/{{ planned_event.trip_details_id }}" class="register-btn rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">Mitrudern</a> {% if cur_user_participates == false %}
{% endif %} <a href="/join/{{ planned_event.trip_details_id }}" class="register-btn rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">Mitrudern</a>
{% endif %}
{% endif %}
</div> </div>
</div> </div>
</div> </div>
{% if loggedin_user.is_cox %} {% if loggedin_user.is_cox %}
{% set_global cur_user_participates = false %}
{% for cox in planned_event.cox %} {% for cox in planned_event.cox %}
{% if cox.name == loggedin_user.name %} {% if cox.name == loggedin_user.name %}
{% set_global cur_user_participates = true %}
{% endif %}
{% endfor %}
{% if cur_user_participates %}
<a href="/cox/remove/{{ planned_event.id }}" class="deregister-btn rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer"> <a href="/cox/remove/{{ planned_event.id }}" class="deregister-btn rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer">
<svg width="16" height="16" fill="currentColor" class="inline-block mr-1 h-3 w-3" viewBox="0 0 16 16"> <path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/> </svg> <svg width="16" height="16" fill="currentColor" class="inline-block mr-1 h-3 w-3" viewBox="0 0 16 16"> <path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/> </svg>
Abmelden Abmelden
</a> </a>
{% endif %} {% else %}
{% endfor %} <a href="/cox/join/{{ planned_event.id }}" class="register-btn rounded-md bg-primary-900 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-950 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-950 cursor-pointer">
<a href="/cox/join/{{ planned_event.id }}" class="register-btn rounded-md bg-primary-900 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-950 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-950 cursor-pointer"> <svg width="16" height="16" fill="currentColor" class="inline-block mr-1 h-3 w-3" viewBox="0 0 16 16"> <path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/> </svg>
<svg width="16" height="16" fill="currentColor" class="inline-block mr-1 h-3 w-3" viewBox="0 0 16 16"> <path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/> </svg> Steuern
Steuern </a>
</a> {% endif %}
{% endif %} {% endif %}
<div class="sidebar slide-in from-right" id="detailEvent{{ planned_event.id }}" aria-modal="false"> <div class="sidebar slide-in from-right" id="detailEvent{{ planned_event.id }}" aria-modal="false">
@ -77,7 +93,8 @@
<div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px"> <div class="px-2 pt-2" style="margin-top: 63px; margin-bottom: 157px">
{% if planned_event.planned_amount_cox > 0 %} {% if planned_event.planned_amount_cox > 0 %}
<div class="bg-primary-600 text-white text-center p-1 mt-1 rounded-t-md">{{ planned_event.planned_amount_cox }} - {{ planned_event.cox | length }} Steuerleute werden benötigt ({{ planned_event.planned_amount_cox }})</div> {% set amount_cur_cox = planned_event.cox | length %}
<div class="bg-primary-600 text-white text-center p-1 mt-1 rounded-t-md">{{ planned_event.planned_amount_cox - amount_cur_cox }} Steuerleute werden benötigt ({{ planned_event.planned_amount_cox }})</div>
<div class="p-2 border border-t-0 border-primary-600 mb-4 rounded-b-md"> <div class="p-2 border border-t-0 border-primary-600 mb-4 rounded-b-md">
{% if planned_event.cox | length > 0 %} {% if planned_event.cox | length > 0 %}
{% for cox in planned_event.cox %} {% for cox in planned_event.cox %}
@ -130,12 +147,16 @@
<a href="#" data-sidebar="true" data-trigger="detailTrip{{ trip.trip_details_id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a> <a href="#" data-sidebar="true" data-trigger="detailTrip{{ trip.trip_details_id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a>
</div> </div>
<div> <div>
{% set_global cur_user_participates = false %}
{% for rower in trip.rower %} {% for rower in trip.rower %}
{% if rower.name == loggedin_user.name %} {% if rower.name == loggedin_user.name %}
<a href="/remove/{{ trip.trip_details_id }}" class="deregister-btn inline-block rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer">Abmelden</a> {% set_global cur_user_participates = true %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id %} {% if cur_user_participates %}
<a href="/remove/{{ trip.trip_details_id }}" class="deregister-btn inline-block rounded-md bg-[#f43f5e] px-3 py-2 text-sm font-semibold text-white hover:bg-[#ff0000] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff0000] cursor-pointer">Abmelden</a>
{% endif %}
{% if trip.max_people > trip.rower | length and trip.cox_id != loggedin_user.id and cur_user_participates == false%}
<a href="/join/{{ trip.trip_details_id }}" class="register-btn inline-block rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">Mitrudern</a> <a href="/join/{{ trip.trip_details_id }}" class="register-btn inline-block rounded-md bg-primary-600 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">Mitrudern</a>
{% endif %} {% endif %}
</div> </div>