brass/web/templates/availability/new_or_edit.html

121 lines
4.5 KiB
HTML

{% extends "nav.html" %}
{% block content %}
<section class="section">
<div class="container">
{% if id.is_some() %}
<form method="post" action="/availabillity/edit/{{ id.unwrap() }}">
<h1 class="title">Bearbeite Vefügbarkeit für den {{ date.format("%d.%m.%Y") }}</h1>
{% else %}
<form method="post" action="/availabillity/new">
<h1 class="title">Neue Vefügbarkeit für den {{ date.format("%d.%m.%Y") }}</h1>
{% endif %}
<input type="hidden" name="date" value="{{ date }}">
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Dauer</label>
</div>
<div class="field-body">
<div class="field">
<div class="control" hx-target="closest body">
<label class="radio">
{% let time_url -%}
{% if id.is_some() -%}
{% let time_url = "/availabillity/edit/{}?wholeday="|format(id.unwrap()) -%}
{% else -%}
{% let time_url = "/availabillity/new?date={}&wholeday="|format(date) -%}
{% endif -%}
<input type="radio" name="hasTime" hx-get="{{ time_url }}true" {{
whole_day_selected|cond_show("checked") }} />
ganztägig
</label>
<label class="radio">
<input type="radio" name="hasTime" hx-get="{{ time_url }}false" {{
whole_day_selected|invert|ref|cond_show("checked") }} />
zeitweise
</label>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Von - Bis</label>
</div>
<div class="field-body">
{% let times = ("00:00".to_string(), "23:59".to_string()) -%}
{% if let Some(times) = time -%}
{% if let AvailabilityTime::Temporarily(start, end) = times -%}
{% let times = (start.to_string(), end.to_string()) -%}
{% endif -%}
{% endif -%}
<div class="field">
<input class="input" type="time" id="from" name="from" value='{{ times.0 }}' {{
whole_day_selected|cond_show("disabled") }} {{ whole_day_selected|invert|ref|cond_show("required") }}>
<p class="help">noch mögliche Zeiträume:</p>
<div class="tags help">
{% for (s, e) in slot_suggestions %}
<span class="tag">{{ s }} - {{ e }}</span>
{% endfor %}
</div>
</div>
<div class="field">
<input class="input" type="time" id="till" name="till" value='{{ times.1 }}' {{
whole_day_selected|cond_show("disabled") }} {{ whole_day_selected|invert|ref|cond_show("required") }}>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">Kommentar</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<textarea class="textarea" name="comment" placeholder="nur Posten, nur Wachhabender, etc..">{{
comment.unwrap_or("") }}</textarea>
</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">
<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 %}