121 lines
5.0 KiB
HTML
121 lines
5.0 KiB
HTML
{% extends "nav.html" %}
|
|
|
|
{% block content %}
|
|
<section class="section">
|
|
<div class="container">
|
|
{% let is_edit = id.is_some() %}
|
|
<form method="post" action="/availability/{% if is_edit %}edit/{{ id.unwrap() }}{% else %}new{% endif %}">
|
|
<h1 class="title">{% if is_edit %}Bearbeite{% else %}Neue{% endif %} Vefügbarkeit für den {{
|
|
date|fmt_date(DayMonthYear) }}</h1>
|
|
|
|
<input type="hidden" name="startdate" value="{{ date }}">
|
|
<input type="hidden" name="enddate" value="{{ enddate.as_ref().unwrap_or(date) }}" id="enddate">
|
|
|
|
<div class="field is-horizontal">
|
|
<div class="field-label">
|
|
<label class="label">Dauer Von - Bis</label>
|
|
</div>
|
|
<div class="field-body">
|
|
<div class="field">
|
|
<input class="input" type="time" name="starttime" required {{ start|insert_time_value|safe }}
|
|
_="on change put the value of me into #st">
|
|
{% if slot_suggestions.len() > 0 %}
|
|
<p class="help">noch mögliche Zeiträume:</p>
|
|
<div class="tags help">
|
|
{% for (s, e) in slot_suggestions %}
|
|
<span class="tag">{{ s|fmt_datetime(DayMonthYearHourMinute) }} -
|
|
{{ e|fmt_datetime(DayMonthYearHourMinute) }}</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="field">
|
|
<input class="input" type="time" name="endtime" required {{ end|insert_time_value|safe }}
|
|
_='on change put the value of me into #et
|
|
then if (value of the previous <input/>) is greater than (value of me)
|
|
then set the value of #enddate to "{{ datetomorrow }}"
|
|
then put "{{ datetomorrow|fmt_date(DayMonth) }}" into #ed
|
|
then set checked of #radionextday to true
|
|
end' />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field is-horizontal">
|
|
<div class="field-label">
|
|
<label class="label">Verfügbarkeitsende</label>
|
|
</div>
|
|
<div class="field-body">
|
|
<div class="field is-narrow">
|
|
{% let is_overnight = enddate.is_some() && enddate.as_ref().unwrap() == datetomorrow|ref %}
|
|
<div class="control">
|
|
<label class="radio">
|
|
<input type="radio" name="isovernight" {{ is_overnight|invert|ref|cond_show("checked")|safe }}
|
|
_='on click set the value of #enddate to "{{ date }}"
|
|
then put "{{ date|fmt_date(DayMonth) }}" into #ed'>
|
|
am selben Tag
|
|
</label>
|
|
<label class="radio ml-3">
|
|
<input type="radio" id="radionextday" name="isovernight" {{ is_overnight|cond_show("checked")|safe }}
|
|
_='on click set the value of #enddate to "{{ datetomorrow }}"
|
|
then put "{{ datetomorrow|fmt_date(DayMonth) }}" into #ed'>
|
|
am Tag darauf
|
|
</label>
|
|
</div>
|
|
</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>
|
|
<p class="help is-info">
|
|
<svg class="icon is-small">
|
|
<use href="/static/feather-sprite.svg#info" />
|
|
</svg>
|
|
{% let start_time = start.unwrap_or(NaiveTime::from_hms_opt(10, 0, 0).unwrap()) %}
|
|
{% let end_time = end.unwrap_or(NaiveTime::from_hms_opt(20, 0, 0).unwrap()) %}
|
|
verfügbar von {{ date|fmt_date(DayMonth) }} <span id="st">{{ start_time|fmt_time(HourMinute) }}</span> Uhr
|
|
bis <span id="ed">{{ enddate.as_ref().unwrap_or(date)|fmt_date(DayMonth) }}</span>
|
|
<span id="et">{{ end_time|fmt_time(HourMinute) }}</span> Uhr
|
|
</p>
|
|
</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 is_edit %}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 %}
|