_form.html

23 Zeilen · 1,8 KB · HTML
Rohdatei
{# Eingabeformular für eine Ablesung. Erwartet: p (Gerät), back (Rücksprung-URL) #}
{% set err = request.query_params.get('fehler') == p.id|string %}
<form method="post" action="/temperatur/{{ p.id }}" class="temp-form" data-min="{{ p.temp_min }}" data-max="{{ p.temp_max }}">
  <input type="hidden" name="csrf_token" value="{{ csrf }}">
  <input type="hidden" name="back" value="{{ back }}">
  <div class="temp-inputs">
    <div class="field"><label>Aktuell °C *</label><input type="text" inputmode="decimal" name="current" required autocomplete="off"
      value="{{ request.query_params.get('wert', '') if err else '' }}" placeholder="z. B. 5,2"></div>
    <div class="field"><label>Min °C</label><input type="text" inputmode="decimal" name="min_value" autocomplete="off" placeholder="opt."></div>
    <div class="field"><label>Max °C</label><input type="text" inputmode="decimal" name="max_value" autocomplete="off" placeholder="opt."></div>
    <button class="primary">Speichern</button>
  </div>
  <div class="temp-out callout bad" {{ '' if err else 'hidden' }}>
    <b>Außerhalb des Sollbereichs ({{ p.temp_min|num }} bis {{ p.temp_max|num }} °C).</b> Was wurde unternommen?
    <textarea name="action" rows="2" placeholder="z. B. Tür war offen – geschlossen, nach 30 min erneut gemessen; Impfstoffe gesperrt, Apotheke/Hersteller zur Verwendbarkeit befragt" {{ 'required autofocus' if err }}></textarea>
  </div>
  <details class="temp-more"><summary>Bemerkung / Nachtrag</summary>
    <div class="temp-inputs">
      <div class="field" style="flex:2"><label>Bemerkung</label><input type="text" name="note" maxlength="300"></div>
      <div class="field"><label>Zeitpunkt (nur für Nachträge)</label><input type="datetime-local" name="when" max="{{ now.strftime('%Y-%m-%dT%H:%M') }}"></div>
    </div>
  </details>
</form>