This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard {{ maschine.name or ('Maschine ' ~ maschine.id) }} – Hour by Hour</title>
|
||||
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='logo.svg') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<noscript><meta http-equiv="refresh" content="30"></noscript>
|
||||
</head>
|
||||
<body class="dash-body">
|
||||
<main class="dash">
|
||||
|
||||
<section class="dash-top">
|
||||
<div class="dash-tile dash-wide" data-live="aktuell">
|
||||
<div class="dash-title">Aktueller Auftrag</div>
|
||||
<div class="dash-order">{% if auftrag %}{{ auftrag.auftragsnummer }}{% endif %}</div>
|
||||
<div class="dash-article">{% if auftrag and auftrag.artikel %}{{ auftrag.artikel }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile dash-wide" data-live="naechster">
|
||||
<div class="dash-title">Nächster Auftrag</div>
|
||||
<div class="dash-order">{% if naechster %}{{ naechster.auftragsnummer }}{% endif %}</div>
|
||||
<div class="dash-article">{% if naechster and naechster.artikel %}{{ naechster.artikel }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile dash-clock">
|
||||
<div class="dash-clock-date" id="dash-date"> </div>
|
||||
<div class="dash-clock-time" id="dash-time"> </div>
|
||||
</div>
|
||||
<div class="dash-tile dash-logo">
|
||||
<img src="{{ url_for('static', filename='logo.svg') }}" alt="Logo">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="dash-kpis">
|
||||
<div class="dash-tile">
|
||||
<div class="dash-title">Stückzahl (gesamt)</div>
|
||||
<div class="dash-value green" data-live="k-gesamt">{% if k %}{{ k.gesamt }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile">
|
||||
<div class="dash-title">Stückzahl (produziert)</div>
|
||||
<div class="dash-value green" data-live="k-produziert">{% if k %}{{ k.produziert }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile">
|
||||
<div class="dash-title">Stückzahl (offen)</div>
|
||||
<div class="dash-value green" data-live="k-offen">{% if k %}{{ k.offen }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile">
|
||||
<div class="dash-title">Soll pro Stunde</div>
|
||||
<div class="dash-value green" data-live="k-soll">{% if k %}{{ k.soll_h }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile dash-key">
|
||||
<div class="dash-title">Stück/h (Buchung)</div>
|
||||
<div class="dash-value" data-live="k-ist">{% if k %}{{ k.ist_h }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="dash-tile">
|
||||
<div class="dash-title">Abweichung</div>
|
||||
<div class="dash-value" data-live="k-abw">{% if k %}<span class="{{ 'green' if k.abweichung_positiv else 'red' }}">{{ k.abweichung }}</span>{% endif %}</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="dash-log">
|
||||
<div class="dash-title">Protokoll</div>
|
||||
<div class="dash-log-scroll">
|
||||
<table class="dash-table">
|
||||
<thead>
|
||||
<tr><th>Zeit</th><th>Status</th><th class="num">Produziert</th><th class="num">Teile/Stunde</th><th>Grund</th></tr>
|
||||
</thead>
|
||||
<tbody data-live="protokoll">
|
||||
{% for z in protokoll %}
|
||||
<tr>
|
||||
<td><time data-ts="{{ z.ts }}">{{ z.zeit }}</time></td>
|
||||
<td>{{ z.status }}</td>
|
||||
<td class="num">{{ z.produziert }}</td>
|
||||
<td class="num">{{ z.h_avg }}</td>
|
||||
<td>{{ z.grund }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
{% if maschine_badge_id %}<div class="machine-id-badge">M{{ maschine_badge_id }}</div>{% endif %}
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
function z2(n) { return (n < 10 ? '0' : '') + n; }
|
||||
|
||||
// Uhr (Browser-Zeit des Anzeigegeräts)
|
||||
function tick() {
|
||||
var d = new Date();
|
||||
document.getElementById('dash-date').textContent =
|
||||
z2(d.getDate()) + '.' + z2(d.getMonth() + 1) + '.' + d.getFullYear();
|
||||
document.getElementById('dash-time').textContent =
|
||||
z2(d.getHours()) + ':' + z2(d.getMinutes()) + ':' + z2(d.getSeconds());
|
||||
}
|
||||
tick();
|
||||
setInterval(tick, 1000);
|
||||
|
||||
// Protokollzeiten in der Zeitzone des Anzeigegeräts darstellen (der Server
|
||||
// läuft im Container meist in UTC).
|
||||
function zeiten() {
|
||||
document.querySelectorAll('time[data-ts]').forEach(function (el) {
|
||||
var ts = parseInt(el.getAttribute('data-ts'), 10);
|
||||
if (!ts) return;
|
||||
var d = new Date(ts * 1000);
|
||||
el.textContent = d.getFullYear() + '-' + z2(d.getMonth() + 1) + '-' + z2(d.getDate()) + ' ' +
|
||||
z2(d.getHours()) + ':' + z2(d.getMinutes()) + ':' + z2(d.getSeconds());
|
||||
});
|
||||
}
|
||||
zeiten();
|
||||
|
||||
// Daten alle 15 s ohne Neuladen der Seite aktualisieren. Schlägt ein Abruf
|
||||
// fehl (Netz/Server kurz weg), bleibt einfach der letzte Stand stehen.
|
||||
function aktualisieren() {
|
||||
fetch(window.location.href, { cache: 'no-store' })
|
||||
.then(function (r) { return r.ok ? r.text() : Promise.reject(); })
|
||||
.then(function (html) {
|
||||
var neu = new DOMParser().parseFromString(html, 'text/html');
|
||||
neu.querySelectorAll('[data-live]').forEach(function (n) {
|
||||
var ziel = document.querySelector('[data-live="' + n.getAttribute('data-live') + '"]');
|
||||
if (ziel && ziel.innerHTML !== n.innerHTML) ziel.innerHTML = n.innerHTML;
|
||||
});
|
||||
zeiten();
|
||||
})
|
||||
.catch(function () {});
|
||||
}
|
||||
setInterval(aktualisieren, 15000);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user