protocol.html

59 Zeilen · 3,9 KB · HTML
Rohdatei
{% extends 'base.html' %}
{% block title %}Temperatur {{ dev.name }}{% endblock %}
{% block content %}
<div class="page-head">
  <div><div class="crumb"><a href="/temperatur">Temperaturprotokoll</a> · <a href="/geraete/{{ dev.id }}">Gerät</a></div>
    <h1>{{ dev.name }} <small class="muted">{{ MONTHS[first.month - 1] }} {{ first.year }}</small></h1></div>
  <div class="actions no-print">
    <a class="btn" href="?monat={{ prev_m }}">← {{ MONTHS[(first.month - 2) % 12] }}</a>
    {% if next_m %}<a class="btn" href="?monat={{ next_m }}">{{ MONTHS[first.month % 12] }} →</a>{% endif %}
    <button type="button" onclick="window.print()">Drucken</button>
  </div>
</div>
<div class="print-only print-head">{{ praxis_name }} · Temperaturprotokoll {{ dev.name }}{{ ' (' ~ dev.location ~ ')' if dev.location }} · {{ MONTHS[first.month - 1] }} {{ first.year }} · Sollbereich {{ dev.temp_min|num }} bis {{ dev.temp_max|num }} °C</div>

<div class="stats">
  <div class="stat"><div class="num">{{ dev.temp_min|num }}–{{ dev.temp_max|num }}</div><div class="lbl">Sollbereich °C</div></div>
  <div class="stat {{ 'good' if stats.count }}"><div class="num">{{ stats.count }}</div><div class="lbl">Ablesungen</div></div>
  <div class="stat {{ 'bad' if stats.out else 'good' }}"><div class="num">{{ stats.out }}</div><div class="lbl">außerhalb</div></div>
  <div class="stat {{ 'warn' if stats.missing else 'good' }}"><div class="num">{{ stats.missing }}</div><div class="lbl">Praxistage ohne Ablesung</div></div>
  <div class="stat"><div class="num">{{ stats.min|num if stats.min is not none else '–' }} / {{ stats.max|num if stats.max is not none else '–' }}</div><div class="lbl">Min / Max °C</div></div>
</div>

{% if first.year == now.year and first.month == now.month %}
<div class="panel no-print" style="margin-bottom:1.1rem">
  <h2>Ablesung eintragen</h2>
  {% set p = dev %}{% set back = '/temperatur/' ~ dev.id %}{% include 'temperatur/_form.html' %}
</div>
{% endif %}

<div class="panel flush table-wrap">
  <table class="temp-table">
    <thead><tr><th>Tag</th><th>Zeit</th><th>Aktuell</th><th>Min</th><th>Max</th><th>Kürzel</th><th>Maßnahme / Bemerkung</th></tr></thead>
    <tbody>
    {% for d in days|reverse %}
      {% if d.readings %}
        {% for r in d.readings %}
        <tr class="{{ 'out' if not r.in_range }}">
          {% if loop.first %}<td rowspan="{{ d.readings|length }}" style="white-space:nowrap"><b>{{ WEEKDAYS[d.day.weekday()] }} {{ d.day.strftime('%d.%m.') }}</b></td>{% endif %}
          <td>{{ r.ts.strftime('%H:%M') }}</td>
          <td><b>{{ r.current|num }}</b></td>
          <td>{{ r.min_value|num if r.min_value is not none else '' }}</td>
          <td>{{ r.max_value|num if r.max_value is not none else '' }}</td>
          <td title="{{ r.user.full_name if r.user else '' }}">{{ r.user.initials if r.user else '–' }}</td>
          <td>{% if not r.in_range %}<span class="badge bad">außerhalb</span> {% endif %}{{ r.action or '' }}{% if r.action and r.note %} · {% endif %}{{ r.note or '' }}{% if r.created_at and (r.created_at - r.ts).total_seconds() > 3600 %} <small class="muted">(nachgetragen {{ r.created_at.strftime('%d.%m. %H:%M') }})</small>{% endif %}</td>
        </tr>
        {% endfor %}
      {% else %}
        <tr class="{{ 'missing' if d.expected else 'free' }}"><td style="white-space:nowrap"><b>{{ WEEKDAYS[d.day.weekday()] }} {{ d.day.strftime('%d.%m.') }}</b></td>
          <td colspan="6">{% if d.free %}<small class="muted">{{ d.free }}</small>{% elif d.expected %}<span class="badge warn">keine Ablesung</span>{% else %}<small class="muted">–</small>{% endif %}</td></tr>
      {% endif %}
    {% else %}
      <tr><td colspan="7"><div class="empty">Keine Tage in diesem Monat.</div></td></tr>
    {% endfor %}
    </tbody>
  </table>
</div>
<div class="print-only" style="margin-top:2rem">Geprüft: ______________________ (Datum, Unterschrift)</div>
<script src="/static/temperatur.js" defer></script>
{% endblock %}