list.html

26 Zeilen · 1,6 KB · HTML
Rohdatei
{% extends 'base.html' %}
{% from 'macros.html' import status_badge, due with context %}
{% block title %}Geräte{% endblock %}
{% block content %}
<div class="page-head"><h1>Geräte</h1>
  <div class="actions"><a class="btn" href="?alle={{ '0' if show_all else '1' }}">{{ 'Nur aktive' if show_all else 'Auch ausgemusterte' }}</a>
  {% if is_leitung %}<a class="btn primary" href="/geraete/neu">+ Gerät</a>{% endif %}</div></div>
<div class="panel flush table-wrap">
  {% if devices %}
  <table>
    <thead><tr><th>Gerät</th><th>Kategorie</th><th>Standort</th><th>Nächste Fälligkeit</th><th>Status</th></tr></thead>
    <tbody>
    {% for d in devices %}{% set nxt = d.tasks|selectattr('active')|list|sort(attribute='next_due')|first %}
    <tr {% if not d.active %}style="opacity:.55"{% endif %}>
      <td><a href="/geraete/{{ d.id }}"><b>{{ d.name }}</b></a><br><small>{{ [d.manufacturer, d.model]|select|join(' ') }}{% if d.serial_no %} · SN {{ d.serial_no }}{% endif %}</small></td>
      <td>{{ d.category }}{% if d.is_steri %} <span class="badge brand">Chargen</span>{% endif %}{% if d.required_permission %}<br><small>nur: {{ PERMISSIONS.get(d.required_permission, d.required_permission) }}</small>{% endif %}</td>
      <td>{{ d.location or '–' }}</td>
      <td>{% if nxt %}{{ nxt.title }}<br>{{ due(nxt.next_due, nxt.warn_days) }}{% else %}<small class="muted">keine Prüfungen hinterlegt</small>{% endif %}</td>
      <td>{{ status_badge(status[d.id]) }}</td>
    </tr>
    {% endfor %}
    </tbody>
  </table>
  {% else %}<div class="empty">Noch keine Geräte angelegt.</div>{% endif %}
</div>
{% endblock %}