This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="back-row top">
|
||||
<a class="big-btn small neutral" href="{{ url_for('leitstand_home') }}">← Zurück</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<p class="hint">
|
||||
Auf allen Tablets diese Adresse öffnen: <strong>{{ tablet_url }}</strong><br>
|
||||
Neue Tablets erscheinen hier automatisch als „nicht zugeordnet“ (die Kennung steht auch auf dem Tablet).
|
||||
Ein Link für alle Geräte genügt – jedes Tablet merkt sich seine Kennung selbst.
|
||||
Nach dem Speichern wechselt das Tablet innerhalb von ca. 20 Sekunden auf die gewählte Seite.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="card {{ 'learn-on' if lernmodus else '' }}">
|
||||
<form method="post" action="{{ url_for('tablets_lernmodus') }}" class="learn-form">
|
||||
<div>
|
||||
<strong>Lernmodus: {{ 'AN' if lernmodus else 'AUS' }}</strong><br>
|
||||
<span class="hint">
|
||||
Solange er an ist, werden Geräte, die noch über einen einzelnen Link (<code>/m<N></code> oder
|
||||
<code>/m<N>_show</code>) kommen, automatisch gespeichert und genau dieser Seite zugeordnet.
|
||||
Beim nächsten Besuch über <code>/tablet</code> werden sie erkannt. Nach der Umstellung bitte ausschalten,
|
||||
sonst wird auch z. B. ein PC registriert, der eine Maschinenseite öffnet.
|
||||
</span>
|
||||
</div>
|
||||
<input type="hidden" name="an" value="{{ '0' if lernmodus else '1' }}">
|
||||
<button type="submit" class="big-btn small {{ 'neutral' if lernmodus else 'primary' }}">{{ 'Lernmodus ausschalten' if lernmodus else 'Lernmodus einschalten' }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if not tablets %}
|
||||
<div class="empty-state">Noch kein Tablet registriert.</div>
|
||||
{% else %}
|
||||
<div class="list-meta">{{ tablets|length }} Tablets</div>
|
||||
<div class="table-wrap">
|
||||
<table class="data-table tablet-table">
|
||||
<thead>
|
||||
<tr><th>Status</th><th>Zuletzt gemeldet</th><th>Kennung</th><th colspan="3">Name / Ziel / Maschine</th><th class="col-actions"></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in tablets %}
|
||||
<tr>
|
||||
<td><span class="tablet-dot {{ 'on' if t.online else 'off' }}"></span>{{ 'online' if t.online else 'offline' }}</td>
|
||||
<td>
|
||||
{{ t.gesehen_relativ }}
|
||||
<small class="tablet-seen">{% if t.gesehen_ts %}<time data-ts="{{ t.gesehen_ts }}"></time>{% else %} {% endif %}</small>
|
||||
</td>
|
||||
<td>{{ t.kurz }}</td>
|
||||
<td colspan="3">
|
||||
<form method="post" action="{{ url_for('tablets_speichern', tablet_id=t.id) }}" class="tablet-form" id="tf{{ t.id }}">
|
||||
<input type="text" name="name" value="{{ t.name or '' }}" maxlength="60" aria-label="Name">
|
||||
<select name="ziel_typ" aria-label="Ziel">
|
||||
<option value="" {% if not t.ziel_typ %}selected{% endif %}>– nicht zugeordnet –</option>
|
||||
{% for wert, label in ziele.items() %}
|
||||
<option value="{{ wert }}" {% if t.ziel_typ == wert %}selected{% endif %}>{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="maschine_id" aria-label="Maschine">
|
||||
<option value="">–</option>
|
||||
{% for m in maschinen %}
|
||||
<option value="{{ m.id }}" {% if t.maschine_id == m.id %}selected{% endif %}>{{ m.name or ('Maschine ' ~ m.id) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if not t.ziel_typ and tablets|length > 1 %}
|
||||
<select name="ersetzt_id" aria-label="Zuordnung übernehmen von" title="Ersetzt dieses Tablet ein altes (z. B. nach gelöschten Browserdaten)? Dann dessen Zuordnung übernehmen.">
|
||||
<option value="">Ersetzt Tablet … (optional)</option>
|
||||
{% for o in tablets if o.id != t.id and not o.online %}
|
||||
<option value="{{ o.id }}">{{ o.name }} ({{ o.kurz }})</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
</form>
|
||||
</td>
|
||||
<td class="col-actions">
|
||||
<div class="row-actions">
|
||||
<button type="submit" form="tf{{ t.id }}" class="icon-btn">Speichern</button>
|
||||
<form method="post" action="{{ url_for('tablets_loeschen', tablet_id=t.id) }}" class="order-form">
|
||||
<button type="submit" class="icon-btn danger">Entfernen</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="hint">Die Maschine wird nur bei „Maschinenseite“ und „Anzeige (Show)“ verwendet.</p>
|
||||
{% endif %}
|
||||
<script>
|
||||
(function () {
|
||||
function z2(n) { return (n < 10 ? '0' : '') + n; }
|
||||
var els = document.querySelectorAll('time[data-ts]');
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var d = new Date(parseInt(els[i].getAttribute('data-ts'), 10) * 1000);
|
||||
els[i].textContent = z2(d.getDate()) + '.' + z2(d.getMonth() + 1) + '. ' + z2(d.getHours()) + ':' + z2(d.getMinutes()) + ':' + z2(d.getSeconds());
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user