Tablett zuornung update
Build und Push Docker Image / build-and-push (push) Successful in 11s

This commit is contained in:
2026-11-05 08:53:55 +01:00
parent 4f6a4952d9
commit c954696d56
9 changed files with 291 additions and 62 deletions
+37 -6
View File
@@ -2,6 +2,7 @@
{% block content %}
<div class="back-row top">
<a class="big-btn small neutral" href="{{ url_for('leitstand_home') }}">&#8592; Zur&uuml;ck</a>
<a class="big-btn small neutral" href="{{ url_for('tablets_verlauf') }}" style="margin-top:10px;">&Auml;nderungsverlauf ansehen</a>
</div>
<div class="card">
@@ -9,11 +10,11 @@
Auf allen Tablets diese Adresse &ouml;ffnen: <strong>{{ tablet_url }}</strong><br>
Neue Tablets erscheinen hier automatisch als &bdquo;nicht zugeordnet&ldquo; (die Kennung steht auch auf dem Tablet).
Ein Link f&uuml;r alle Ger&auml;te gen&uuml;gt &ndash; jedes Tablet merkt sich seine Kennung selbst.
Nach dem Speichern wechselt das Tablet innerhalb von ca. 20 Sekunden auf die gew&auml;hlte Seite.
Nach dem Speichern wechselt das Tablet innerhalb von ca. {{ abfrage_sekunden }} Sekunden auf die gew&auml;hlte Seite (online = Meldung in den letzten {{ online_sekunden }} Sekunden).
</p>
</div>
<div class="card {{ 'learn-on' if lernmodus else '' }}">
<div class="card {{ 'learn-on' if lernmodus else '' }}" id="lernmodus">
<form method="post" action="{{ url_for('tablets_lernmodus') }}" class="learn-form">
<div>
<strong>Lernmodus: {{ 'AN' if lernmodus else 'AUS' }}</strong><br>
@@ -33,14 +34,14 @@
<div class="empty-state">Noch kein Tablet registriert.</div>
{% else %}
<div class="list-meta">{{ tablets|length }} Tablets</div>
<div class="table-wrap">
<div class="table-wrap" id="tablet-liste">
<table class="data-table tablet-table">
<thead>
<tr><th>Status</th><th>Zuletzt gemeldet</th><th>Kennung</th><th colspan="3">Name &nbsp;/&nbsp; Ziel &nbsp;/&nbsp; Maschine</th><th class="col-actions"></th></tr>
</thead>
<tbody>
{% for t in tablets %}
<tr>
<tr id="tablet-{{ t.id }}" class="{{ 'tablet-unassigned' if not t.ziel_typ else '' }} {{ 'tablet-saved' if gespeichert_id == t.id else '' }}">
<td><span class="tablet-dot {{ 'on' if t.online else 'off' }}"></span>{{ 'online' if t.online else 'offline' }}</td>
<td>
{{ t.gesehen_relativ }}
@@ -48,7 +49,7 @@
</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 }}">
<form method="post" action="{{ url_for('tablets_speichern', tablet_id=t.id) }}#tablet-{{ 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 %}>&ndash; nicht zugeordnet &ndash;</option>
@@ -71,23 +72,53 @@
</select>
{% endif %}
</form>
{% if fehler_id == t.id and zeilenfehler %}<div class="tablet-row-error">{{ zeilenfehler }}</div>{% endif %}
</td>
<td class="col-actions">
<div class="row-actions">
<button type="submit" form="tf{{ t.id }}" class="icon-btn">Speichern</button>
<a class="icon-btn" href="{{ url_for('tablets_verlauf', tablet=t.id) }}">Verlauf</a>
<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>
{% if gespeichert_id == t.id %}<div class="tablet-row-ok">&#10003; Gespeichert</div>{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="hint">Die Maschine wird nur bei &bdquo;Maschinenseite&ldquo; und &bdquo;Anzeige (Show)&ldquo; verwendet.</p>
<p class="hint"><span class="tablet-legend"></span> Gelb markiert: noch nicht zugeordnet. Die Maschine wird nur bei &bdquo;Maschinenseite&ldquo; und &bdquo;Anzeige (Show)&ldquo; verwendet.</p>
{% endif %}
<script>
(function () {
// Scroll-Position (Seite und Tabellenfenster) beim Speichern/Entfernen merken und
// danach exakt wiederherstellen, damit nichts springt (ohne JavaScript greift der
// Anker auf die Zeile).
var KEY = 'hbh_tablets_scroll';
try {
var liste = document.getElementById('tablet-liste');
var forms = document.querySelectorAll('form');
for (var f = 0; f < forms.length; f++) {
forms[f].addEventListener('submit', function () {
sessionStorage.setItem(KEY, JSON.stringify({ w: window.pageYOffset, t: liste ? liste.scrollTop : 0 }));
});
}
var roh = sessionStorage.getItem(KEY);
if (roh !== null) {
sessionStorage.removeItem(KEY);
var pos = JSON.parse(roh);
// erst nach dem Anker-Sprung des Browsers, damit die alte Position gewinnt
window.addEventListener('load', function () {
setTimeout(function () {
if (liste) liste.scrollTop = pos.t || 0;
window.scrollTo(0, pos.w || 0);
}, 0);
});
}
} catch (e) { /* Speicher gesperrt: Anker-Sprung genügt */ }
})();
(function () {
function z2(n) { return (n < 10 ? '0' : '') + n; }
var els = document.querySelectorAll('time[data-ts]');