brass/web/templates/events/new_or_edit.html

243 lines
9.4 KiB
HTML

{% extends "nav.html" %}
{% block content %}
<section class="section">
<div class="container">
<form method="post" action="/events/{% if let Some(id) = id %}{{ id }}/edit{% else %}new{% endif %}">
{% if let Some(name) = name %}
<h1 class="title">Event '{{ name }}' bearbeiten</h1>
{% else %}
<h1 class="title">Neues Event anlegen für den {{ date|fmt_date(DayMonthYear) }}</h1>
{% endif %}
<input type="hidden" name="date" value="{{ date }}">
<input type="hidden" name="voluntarywachhabender" id="voluntarywachhabender" value="{{ voluntary_wachhabender }}">
<input type="hidden" name="voluntaryfuehrungsassistent" id="voluntaryfuehrungsassistent"
value="{{ voluntary_fuehrungsassistent }}">
{% if let Some(id) = id %}
<div class="field is-horizontal">
<div class="field-label"></div>
<div class="field-body">
<div class="field is-grouped">
<div class="control">
<button class="button is-warning" type="button"
hx-put="/events/{{ id }}/{% if canceled %}uncancel{% else %}cancel{% endif %}">
<svg class="icon">
<use href="/static/feather-sprite.svg#alert-circle" />
</svg>
<span>
{% if canceled %}Absage zurücknehmen{% else %}Als abgesagt markieren{% endif %}
</span>
</button>
</div>
<div class="control">
{% let delete_disabled = amount_of_planned_posten > 0 || is_wachhabender_planned ||
is_fuehrungsassistent_planned %}
<button class="button is-danger" type="button"
hx-delete="/events/{{ id }}" {{ delete_disabled|cond_show("disabled") }}
hx-trigger="confirmed">
<svg class="icon">
<use href="/static/feather-sprite.svg#x-circle" />
</svg>
<span>Löschen</span>
</button>
</div>
{% if delete_disabled %}
<p class="help is-align-content-center">
Löschen nicht möglich, da bereits eine Planung existiert.
</p>
{% endif %}
</div>
</div>
</div>
{% endif %}
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Veranstaltungsname</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" name="name" placeholder="Wave Gotik Treffen" required
{{ name|insert_value|safe }} {{ canceled|cond_show("disabled") }} />
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Startzeit - Endzeit</label>
</div>
<div class="field-body">
<div class="field">
<input class="input" type="time" name="start" required
value="{{ start|fmt_time(HourMinute) }}" {{ canceled|cond_show("disabled") }} />
</div>
<div class="field">
{% let tomorrow = date.checked_add_days(Days::new(1)).unwrap() %}
<input class="input" type="datetime-local" name="end" required
value="{{ end|fmt_datetime(YearMonthDayTHourMinute) }}" {{ canceled|cond_show("disabled") }}
min="{{ date }}T00:00" max="{{ tomorrow }}T23:59" />
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Veranstaltungsort</label>
</div>
<div class="field-body">
<div class="field is-narrow">
<div class="control">
<div class="select is-fullwidth">
<select name="location" required {{ canceled|cond_show("disabled") }}>
{% for l in locations %}
<option value="{{ l.id }}"
{{ (location.is_some() && *location.as_ref().unwrap()==l.id)|cond_show("selected") }}>
{{ l.name }}
{% if user.role == Role::Admin %} - ({{ l.area.as_ref().unwrap().name }}){% endif %}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Wachhabender durch FF gestellt?</label>
</div>
<div class="field-body">
<div class="field is-narrow">
{% let wh_disabled = id.is_some() && is_wachhabender_planned %}
<div class="control">
<label class="checkbox">
<input class="checkbox" type="checkbox" {{ (wh_disabled || canceled)|cond_show("disabled")}}
{{ voluntary_wachhabender|cond_show("checked") }}
_="on click put (the value of #voluntarywachhabender) as inverseBool into the value of #voluntarywachhabender">
</label>
</div>
{% if wh_disabled %}
<p class="help">
Keine Änderung möglich, da ein Wachhabender bereits eingeplant ist. Diesen zuerst entplanen!
</p>
{% endif %}
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Führungsassistent benötigt?</label>
</div>
<div class="field-body">
<div class="field is-narrow">
{% let fa_disabled = id.is_some() && is_fuehrungsassistent_planned %}
<div class="control">
<label class="checkbox">
<input class="checkbox" type="checkbox" {{ (fa_disabled || canceled)|cond_show("disabled") }}
{{ voluntary_fuehrungsassistent|cond_show("checked") }}
_="on click put (the value of #voluntaryfuehrungsassistent) as inverseBool into the value of #voluntaryfuehrungsassistent">
</label>
</div>
{% if fa_disabled %}
<p class="help">
Keine Änderung möglich, da ein Führungsassistent bereits eingeplant ist. Diesen zuerst entplanen!
</p>
{% endif %}
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Anzahl der Posten</label>
</div>
<div class="field-body">
<div class="field">
{% let posten_planned = id.is_some() && amount_of_planned_posten > 0 %}
<div class="control">
<input class="input" type="number" name="amount"
min="{% if posten_planned %}{{ amount_of_planned_posten }}{% else %}0{% endif %}" max="100"
required {{ amount_of_posten|insert_value|safe }} {{ canceled|cond_show("disabled") }} />
</div>
{% if posten_planned %}
<p class="help">
Mindestens {{ amount_of_planned_posten }} Posten, da bereits diese Anzahl eingeplant ist. Zum
verringern diese erst entplanen!
</p>
{% endif %}
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Anzugsordnung</label>
</div>
<div class="field-body">
<div class="field is-narrow">
<div class="control">
<div class="select is-fullwidth">
<select name="clothing" required {{ canceled|cond_show("disabled") }}>
{% for c in clothing_options %}
<option value="{{ c.id }}"
{{ (clothing.is_some() && *clothing.as_ref().unwrap()==c.id)|cond_show("selected") }}>
{{ c.name }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Anmerkung</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" name="note" {{ note|insert_value|safe }} {{ canceled|cond_show("disabled") }} />
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label"></div>
<div class="field-body">
<div class="field is-grouped">
<div class="control">
<button class="button is-success" {{ canceled|cond_show("disabled") }}>
<svg class="icon">
<use href="/static/feather-sprite.svg#check-circle" />
</svg>
<span>
{% if id.is_some() %}Speichern{% else %}Erstellen{% endif %}
</span>
</button>
</div>
<div class="control">
<a class="button is-link is-light" hx-boost="true" href="/?date={{ date }}">
<svg class="icon">
<use href="/static/feather-sprite.svg#arrow-left" />
</svg>
<span>Zurück</span>
</a>
</div>
</div>
</div>
</div>
</form>
</div>
</section>
{% endblock %}