task.html

57 Zeilen · 2,9 KB · HTML
Rohdatei
{% extends 'base.html' %}
{% from 'macros.html' import due, file_link, result_badge, status_badge with context %}
{% block title %}{{ task.title }}{% endblock %}
{% block content %}
<div class="page-head">
  <div><div class="crumb"><a href="/pruefungen">Prüfungen</a>{% if task.device %} · <a href="/geraete/{{ task.device.id }}">{{ task.device.name }}</a>{% endif %}</div>
    <h1>{{ task.title }}</h1></div>
  <div class="actions"><a class="btn" href="/etiketten/druck?typ=p&id={{ task.id }}&format=62x29">QR-Etikett</a> {{ status_badge(due_status(task.next_due, task.warn_days)) if task.active else '<span class="badge">inaktiv</span>'|safe }}</div>
</div>

<div class="grid two">
  <div class="panel">
    <h2>Details</h2>
    <dl class="props">
      <dt>Gerät</dt><dd>{{ task.device.name if task.device else 'allgemein' }}</dd>
      <dt>Intervall</dt><dd>{{ task.interval_label }}{% if task.external %} · extern{% endif %}</dd>
      <dt>Zuletzt</dt><dd>{{ task.last_done|d }}</dd>
      <dt>Nächste Fälligkeit</dt><dd>{{ due(task.next_due, task.warn_days) }}</dd>
      <dt>Verantwortlich</dt><dd>{{ task.responsible.full_name if task.responsible else '–' }}</dd>
      {% if task.device and task.device.required_permission and not task.external %}<dt>Erforderlich</dt><dd>{{ PERMISSIONS.get(task.device.required_permission, task.device.required_permission) }}</dd>{% endif %}
    </dl>
    {% if task.description %}<p style="white-space:pre-line;margin-bottom:0">{{ task.description }}</p>{% endif %}
  </div>
  <div class="panel">
    <h2>Erledigt dokumentieren</h2>
    {% if task.active %}{% include 'geraete/_done_form.html' %}{% else %}<p class="muted">Diese Prüfung ist inaktiv.</p>{% endif %}
  </div>
</div>

<div class="panel flush table-wrap" style="margin-top:1.1rem">
  <h2>Verlauf</h2>
  {% if task.records %}
  <table>
    <thead><tr><th>Datum</th><th>Ergebnis</th><th>Durch</th><th>Bemerkung</th><th>Protokoll</th><th>Erfasst</th></tr></thead>
    <tbody>{% for r in task.records %}
    <tr><td>{{ r.done_on|d }}</td><td>{{ result_badge(r.result) }}</td>
      <td>{{ r.provider or (r.done_by.full_name if r.done_by else '') }}</td><td>{{ r.note or '' }}</td>
      <td>{{ file_link(r.file_path, r.file_name) }}</td><td><small>{{ r.created_at|d }} · {{ r.done_by.full_name if r.done_by else '' }}</small></td></tr>
    {% endfor %}</tbody>
  </table>
  {% else %}<div class="empty">Noch nichts dokumentiert.</div>{% endif %}
</div>

{% if is_leitung %}
<details class="box">
  <summary>Prüfung bearbeiten</summary>
  <div class="inner">
    <form method="post" action="/pruefungen/{{ task.id }}/bearbeiten">
      <input type="hidden" name="csrf_token" value="{{ csrf }}">
      {% set t = task %}{% set preset_device = None %}
      {% include 'geraete/_task_form.html' %}
      <div class="form-actions"><button class="primary">Speichern</button></div>
    </form>
  </div>
</details>
{% endif %}
{% endblock %}