_task_form.html

25 Zeilen · 2,6 KB · HTML
Rohdatei
{# Erwartet: t (Task oder None), devices, users, preset_device (optional) #}
<div class="form-grid">
  <div class="field full"><label>Bezeichnung *</label><input type="text" name="title" required value="{{ t.title if t else '' }}" placeholder="z. B. Validierung, Konstanzprüfung, Bowie-Dick-Test, DGUV V3"></div>
  <div class="field"><label>Gerät</label><select name="device_id">
    <option value="">– allgemein / ohne Gerät –</option>
    {% for d in devices %}<option value="{{ d.id }}" {{ 'selected' if (t and t.device_id == d.id) or (not t and preset_device and preset_device.id == d.id) }}>{{ d.name }}</option>{% endfor %}</select></div>
  <div class="field"><label>Intervall *</label><div style="display:flex;gap:.4rem">
    <input type="number" min="1" name="interval_value" value="{{ t.interval_value if t else 1 }}" style="max-width:90px" required>
    <select name="interval_unit">{% for k, v in INTERVAL_UNITS.items() %}<option value="{{ k }}" {{ 'selected' if (t and t.interval_unit == k) or (not t and k == 'jahr') }}>{{ v }}</option>{% endfor %}</select></div></div>
  <div class="field"><label>Verantwortlich</label><select name="responsible_id">
    <option value="">– niemand Bestimmtes –</option>
    {% for u in users %}<option value="{{ u.id }}" {{ 'selected' if t and t.responsible_id == u.id }}>{{ u.full_name }}</option>{% endfor %}</select></div>
  <div class="field"><label>Vorwarnung (Tage vorher)</label><input type="number" min="0" name="warn_days" value="{{ t.warn_days if t else 14 }}"></div>
  {% if t %}
  <div class="field"><label>Nächste Fälligkeit</label><input type="date" name="next_due" value="{{ t.next_due.isoformat() }}"><div class="hint">wird beim Erledigen automatisch neu berechnet</div></div>
  {% else %}
  <div class="field"><label>Zuletzt erledigt am</label><input type="date" name="last_done"><div class="hint">daraus wird die nächste Fälligkeit berechnet</div></div>
  <div class="field"><label>… oder nächste Fälligkeit direkt</label><input type="date" name="next_due"></div>
  {% endif %}
  <div class="field full"><label>Beschreibung / Anleitung</label><textarea name="description" placeholder="Was ist zu tun, worauf achten, wer ist der Dienstleister …">{{ t.description or '' if t else '' }}</textarea></div>
  <div class="field full checks">
    <label class="check"><input type="checkbox" name="external" value="1" {{ 'checked' if t and t.external }}> Durch externe Firma / Sachverständige</label>
    {% if t %}<label class="check"><input type="checkbox" name="active" value="1" {{ 'checked' if t.active }}> Aktiv</label>{% endif %}
  </div>
</div>