feat: allow events with zero posten

refs #22
This commit is contained in:
Max Hohlfeld 2025-04-29 23:55:02 +02:00
parent e4cc1e78ab
commit e369178d98
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ pub struct EventChangeset {
pub voluntary_wachhabender: bool, pub voluntary_wachhabender: bool,
#[garde(custom(can_unset_fuehrungsassistent))] #[garde(custom(can_unset_fuehrungsassistent))]
pub voluntary_fuehrungsassistent: bool, pub voluntary_fuehrungsassistent: bool,
#[garde(range(min = ctx.as_ref().map(|c: &EventContext| c.amount_of_assigned_posten).unwrap_or(1), max = 100))] #[garde(range(min = ctx.as_ref().map(|c: &EventContext| c.amount_of_assigned_posten).unwrap_or(0), max = 100))]
pub amount_of_posten: i16, pub amount_of_posten: i16,
pub clothing: String, pub clothing: String,
pub note: Option<String>, pub note: Option<String>,

View File

@ -163,7 +163,7 @@
{% let posten_planned = event.is_some() && amount_of_planned_posten > 0 %} {% let posten_planned = event.is_some() && amount_of_planned_posten > 0 %}
<div class="control"> <div class="control">
<input class="input" type="number" name="amount" <input class="input" type="number" name="amount"
min="{% if posten_planned %}{{ amount_of_planned_posten }}{% else %}1{% endif %}" max="100" required min="{% if posten_planned %}{{ amount_of_planned_posten }}{% else %}0{% endif %}" max="100" required
{% if let Some(event)=event %} value="{{ event.amount_of_posten }}" {% endif %} {{ {% if let Some(event)=event %} value="{{ event.amount_of_posten }}" {% endif %} {{
disabled|cond_show("disabled") }} /> disabled|cond_show("disabled") }} />
</div> </div>