Merge remote-tracking branch 'origin/main' into beta
Build und Push Docker Image / build-and-push (push) Successful in 29s

This commit is contained in:
2026-11-05 12:58:46 +01:00
18 changed files with 1462 additions and 86 deletions
+802 -59
View File
File diff suppressed because it is too large Load Diff
+27
View File
@@ -88,4 +88,31 @@ def migrate():
stattdessen hier beim App-Start nachgerüstet."""
with get_cursor() as cur:
cur.execute('ALTER TABLE "Auftraege" ADD COLUMN IF NOT EXISTS "artikel" text')
# Tablets: Geräte-Kennung (Cookie) -> zugeordnete Zielseite
cur.execute(
'CREATE TABLE IF NOT EXISTS "Tablets" ('
'"id" serial PRIMARY KEY, '
'"kennung" text NOT NULL UNIQUE, '
'"name" text, '
'"ziel_typ" text, '
'"maschine_id" integer, '
'"erstellt_am" bigint, '
'"zuletzt_gesehen" bigint)'
)
# Änderungsverlauf der Tablet-Zuordnungen (wer/was/wann)
cur.execute(
'CREATE TABLE IF NOT EXISTS "Tablet_Verlauf" ('
'"id" serial PRIMARY KEY, "zeitpunkt" bigint NOT NULL, "tablet_id" integer, "kennung" text, '
'"tablet_name" text, "aktion" text NOT NULL, "details" text, "von_ip" text)'
)
# Ziel "Maschinen-Auswahl" wurde entfernt: betroffene Tablets sind wieder unzugeordnet.
cur.execute(
'INSERT INTO "Tablet_Verlauf" (zeitpunkt, tablet_id, kennung, tablet_name, aktion, details) '
"SELECT %s, id, kennung, name, 'Zuordnung entfernt', "
"'Ziel \"Maschinen-Auswahl\" gibt es nicht mehr: Tablet ist wieder nicht zugeordnet' "
'FROM "Tablets" WHERE ziel_typ = \'auswahl\'',
(int(time.time()),),
)
cur.execute('UPDATE "Tablets" SET ziel_typ = NULL, maschine_id = NULL WHERE ziel_typ = \'auswahl\'')
cur.execute('CREATE TABLE IF NOT EXISTS "Einstellungen" ("schluessel" text PRIMARY KEY, "wert" text)')
log.info("Schema-Migration geprüft/angewendet.")
+100
View File
@@ -125,6 +125,18 @@ form.btn-form { display: contents; }
margin-bottom: 22px;
}
/* Kopfzeile der Admin-Seiten: Zurück (links, breit) ... weitere Aktionen ... Abmelden (rechts) */
.top-actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
align-items: stretch;
margin-bottom: 22px;
}
.top-actions > a.big-btn { width: auto; flex: 1 1 200px; }
.top-actions > form { margin: 0; flex: 0 0 auto; display: flex; width: auto; }
.top-actions > form .big-btn { width: auto; min-width: 170px; }
.machine-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
@@ -332,6 +344,8 @@ table.data-table td.col-actions { white-space: nowrap; }
.filter-row { display: flex; gap: 14px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.filter-row select { padding: 10px; font-size: 1em; border-radius: 8px; border: 2px solid var(--border); background: var(--bg); color: var(--text); }
.filter-row input[type="search"] { padding: 10px; font-size: 1em; border-radius: 8px; border: 2px solid var(--border); background: var(--bg); color: var(--text); min-width: 240px; font-family: inherit; user-select: text; }
.filter-row .filter-reset { color: var(--text-dim); text-decoration: underline; font-size: 0.95em; }
.filter-row button { padding: 10px 18px; font-size: 1em; border-radius: 8px; border: 2px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer; font-family: inherit; }
.confirm-box {
@@ -486,6 +500,23 @@ table.data-table td.col-actions { white-space: nowrap; }
/* Kleine, dezente Maschinen-ID-Markierung unten rechts auf allen
Maschinenseiten - zur eindeutigen Zuordnung, welches Tablet/Display an
welcher Maschine hängt. */
/* Kennung des Tablets (nur auf Geräten mit Tablet-Cookie), links unten */
.tablet-id-badge {
position: fixed;
left: 12px;
bottom: 10px;
color: var(--text-dim);
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
padding: 3px 9px;
font-size: 0.85em;
letter-spacing: 0.08em;
opacity: 0.75;
z-index: 10;
pointer-events: none;
}
.machine-id-badge {
position: fixed;
right: 12px;
@@ -521,6 +552,75 @@ table.data-table td.col-actions { white-space: nowrap; }
font-weight: 600;
}
<<<<<<< HEAD
=======
/* Import: Maschinen-Abweichungen entscheiden */
.import-choice { display: flex; flex-direction: column; gap: 8px; }
.import-choice label {
display: flex; gap: 10px; align-items: flex-start;
padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px;
cursor: pointer; background: var(--bg);
}
.import-choice label:has(input:checked) { border-color: var(--primary); background: rgba(47, 125, 255, 0.12); }
.import-choice input { margin-top: 4px; transform: scale(1.3); }
.import-choice small { display: block; color: var(--text-dim); }
.import-bulk { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.import-bulk .big-btn { flex: 1; width: auto; min-width: 260px; }
.warn-box ul { margin: 8px 0 0; padding-left: 20px; font-weight: 400; }
/* Tablets */
.tablet-wait { text-align: center; padding: 30px 20px; }
.tablet-wait-title { font-size: 1.6em; font-weight: 700; }
.tablet-code { font-size: 3.2em; font-weight: 800; letter-spacing: 0.12em; margin: 18px 0 6px; color: var(--amber); }
/* Tablet-Verwaltung wird nur am PC benutzt: breiter Bereich, größere Schrift */
.tablet-table { font-size: 1.15rem; }
.tablet-table th { font-size: 1rem; }
.tablet-table td { padding-top: 14px; padding-bottom: 14px; }
.tablet-table .icon-btn { font-size: 1rem; padding: 9px 14px; }
.tablet-form { display: flex; gap: 10px; flex-wrap: wrap; }
.tablet-table .row-actions { flex-wrap: nowrap; }
.tablet-table .row-actions .icon-btn, .tablet-table .row-actions form { flex: none; white-space: nowrap; width: auto; }
@media (max-width: 1000px) { .tablet-table .row-actions { flex-wrap: wrap; max-width: 330px; } }
.tablet-table td.col-actions { white-space: nowrap; }
.tablet-form input, .tablet-form select {
flex: 1 1 150px; min-width: 130px; padding: 10px 12px; font-size: 1em;
background: var(--bg); color: var(--text); border: 2px solid var(--border); border-radius: 8px;
}
.tablet-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; }
.tablet-dot.on { background: var(--green); }
.tablet-dot.off { background: var(--red); }
.tablet-seen { display: block; color: var(--text-dim); }
.tablet-table tr { scroll-margin-top: 16px; }
.tablet-table tr.tablet-unassigned td:first-child { border-left: 5px solid var(--amber); }
.tablet-table tr.tablet-saved td { background: rgba(47, 184, 114, 0.12); }
.tablet-row-ok { color: var(--green); font-weight: 700; margin-top: 6px; }
.tablet-row-error { color: #ff9a94; font-weight: 600; margin-top: 8px; }
.tablet-legend { display: inline-block; width: 5px; height: 1em; background: var(--amber); vertical-align: middle; margin-right: 4px; }
#lernmodus, #tablet-liste { scroll-margin-top: 16px; }
.dash-body .tablet-id-badge { color: #ffffff; background: var(--d-panel); border-color: var(--d-border); opacity: 1; }
.learn-bar { margin: 10px 0; padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 0.92em; }
.learn-bar.learn-on { border-color: var(--amber); }
.learn-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.learn-form .icon-btn { padding: 4px 12px; }
.learn-help[open] { flex-basis: 100%; }
.learn-help summary { cursor: pointer; color: var(--text-dim); }
.learn-help p { margin: 6px 0 2px; }
/* Import: auffälliger gelber Hinweis, wenn etwas nicht automatisch geht */
.attention-banner {
display: flex; gap: 16px; align-items: center;
background: #ffd23f; color: #1a1400;
border-radius: 10px; padding: 16px 20px; margin-bottom: 14px;
box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.35);
}
.attention-icon { font-size: 2.4em; line-height: 1; }
.attention-title { font-size: 1.5em; font-weight: 800; line-height: 1.2; }
.attention-sub { margin-top: 4px; font-size: 1.05em; font-weight: 500; }
.import-help { margin: 6px 0 14px; }
.import-help summary { color: var(--text-dim); font-weight: 500; }
.import-help ul { font-size: 0.95em; color: var(--text-dim); }
>>>>>>> origin/main
/* ------------------------------------------------------------------
Anzeige-Dashboard (/m<N>_show) - reine Anzeige für einen großen TV.
Alle Größen sind in em und hängen an EINER Basisschrift, die mit der
+27
View File
@@ -0,0 +1,27 @@
/* Tablet-Zuordnung: fragt regelmaessig (data-intervall, Sekunden) die aktuell zugeordnete Zielseite ab
(zugleich Lebenszeichen fuer die Admin-Liste). Hat der Admin dem Tablet
eine andere Seite zugeordnet, wechselt das Tablet dorthin. Absichtlich
ES5/XMLHttpRequest, damit es auch auf aelteren Tablet-Browsern laeuft. */
(function () {
var el = document.querySelector('script[data-abfrage]');
if (!el) return;
var aktuell = el.getAttribute('data-ziel');
var url = el.getAttribute('data-abfrage');
var sekunden = parseInt(el.getAttribute('data-intervall'), 10);
if (!(sekunden >= 10)) sekunden = 60;
var timer = null;
function pruefen() {
var x = new XMLHttpRequest();
x.open('GET', url + '?t=' + new Date().getTime(), true);
x.onload = function () {
if (x.status !== 200) return;
var d;
try { d = JSON.parse(x.responseText); } catch (e) { return; }
if (d.ziel === null) { clearInterval(timer); return; } /* Tablet wurde entfernt */
if (d.ziel && d.ziel !== aktuell) { window.location.href = d.ziel; }
};
x.send();
}
timer = setInterval(pruefen, sekunden * 1000);
})();
+3
View File
@@ -6,6 +6,7 @@
<title>{{ title }} – 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') }}">
{% block head_extra %}{% endblock %}
</head>
<body>
<div id="app">
@@ -21,5 +22,7 @@
</div>
</div>
{% if maschine_badge_id %}<div class="machine-id-badge">M{{ maschine_badge_id }}</div>{% endif %}
{% if tablet_code %}<div class="tablet-id-badge" title="Kennung dieses Tablets">{{ tablet_code }}</div>{% endif %}
{% if tablet_ziel %}<script src="{{ url_for('static', filename='tablet.js') }}" data-ziel="{{ tablet_ziel }}" data-abfrage="{{ url_for('tablet_ziel') }}" data-intervall="{{ tablet_intervall }}" defer></script>{% endif %}
</body>
</html>
+2
View File
@@ -7,6 +7,8 @@
<a class="big-btn amber" href="{{ url_for('leitstand_korrektur') }}">&#128295; Buchungskorrektur</a>
<a class="big-btn neutral" href="{{ url_for('leitstand_prioritaet') }}">&#8597; Auftragspriorit&auml;t</a>
<a class="big-btn" href="{{ url_for('leitstand_maschinen') }}">&#128736; Zu Maschine springen</a>
<a class="big-btn" href="{{ url_for('leitstand_maschinen', ziel='show') }}">Zur Anzeige springen</a>
<a class="big-btn" href="{{ url_for('tablets_verwaltung') }}">&#128274; Tablets zuordnen</a>
<a class="big-btn" href="{{ url_for('maschinenverwaltung') }}">&#128274; Maschinenverwaltung</a>
</div>
<p class="version-info">Hour by Hour &ndash; Version {{ app_version }}</p>
+111 -10
View File
@@ -4,20 +4,98 @@
<a class="big-btn small neutral" href="{{ url_for('leitstand_home') }}">&#8592; Zur&uuml;ck</a>
</div>
{% if konflikte %}
<div class="card">
<div class="attention-banner">
<span class="attention-icon">&#9888;</span>
<div>
<div class="attention-title">Maschine weicht ab &ndash; bitte pr&uuml;fen und entscheiden</div>
<div class="attention-sub">
Bei {{ konflikte|length }} bereits vorhandenen {{ 'Auftrag' if konflikte|length == 1 else 'Auftr&auml;gen'|safe }} aus
<strong>{{ dateiname }}</strong> passt die Maschine nicht zum System.
Das kann nicht automatisch entschieden werden. Noch wurde <strong>nichts ver&auml;ndert</strong>.
</div>
</div>
</div>
<p class="hint">
&bdquo;&Uuml;bernehmen&ldquo;: Auftrag und alle seine Buchungen wechseln auf die Maschine aus dem Import.
</p>
{% if blockiert_vorab %}
<div class="warn-box">
Diese Auftr&auml;ge werden nicht importiert:
<ul>{% for z in blockiert_vorab %}<li>{{ z }}</li>{% endfor %}</ul>
</div>
{% endif %}
<form method="post" action="{{ url_for('leitstand_import') }}">
<input type="hidden" name="token" value="{{ token }}">
<div class="import-bulk">
<button type="button" class="big-btn small neutral" data-alle="uebernehmen">Bei allen: Maschine aus Import &uuml;bernehmen</button>
<button type="button" class="big-btn small neutral" data-alle="behalten">Bei allen: Bisherige Maschine beibehalten</button>
</div>
<div class="table-wrap">
<table class="data-table">
<thead>
<tr><th>Zeile</th><th>FA.-Nr.</th><th>Artikel</th><th>Bisher im System</th><th>Laut Import</th><th>Entscheidung</th></tr>
</thead>
<tbody>
{% for k in konflikte %}
<tr>
<td>{{ k.zeile }}</td>
<td>{{ k.auftragsnummer }}</td>
<td>{{ k.artikel or "-" }}</td>
<td>{{ k.alt }}</td>
<td>{{ k.neu }}</td>
<td>
<div class="import-choice">
<label>
<input type="radio" name="entscheidung_{{ k.zeile }}" value="uebernehmen" checked>
<span>Maschine aus Import &uuml;bernehmen<small>Auftrag und Buchungen wechseln zu &bdquo;{{ k.neu }}&ldquo;</small></span>
</label>
<label>
<input type="radio" name="entscheidung_{{ k.zeile }}" value="behalten">
<span>Bisherige Maschine beibehalten<small>Auftrag bleibt unver&auml;ndert an &bdquo;{{ k.alt }}&ldquo;</small></span>
</label>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="action-row">
<button type="submit" class="big-btn primary">&#10003; Import fortsetzen</button>
<button type="submit" name="aktion" value="abbrechen" class="big-btn neutral" formnovalidate>Gesamten Import abbrechen</button>
</div>
</form>
<script>
(function () {
document.querySelectorAll('[data-alle]').forEach(function (btn) {
btn.addEventListener('click', function () {
var wert = btn.getAttribute('data-alle');
document.querySelectorAll('input[type=radio][value=' + wert + ']').forEach(function (r) { r.checked = true; });
});
});
})();
</script>
</div>
{% else %}
<div class="card compact">
<p class="hint">
Excel- (.xlsx) oder CSV-Datei mit den Spalten <strong>Maschine</strong>, <strong>man. Prio</strong>,
<strong>FA.-Nr.</strong>, <strong>Rest-Menge</strong>, <strong>Ist-Menge</strong>,
<strong>Artikel</strong> und <strong>Soll-pro-Stunde</strong> hochladen (weitere Spalten
wie Bezeichnung/Auftrag/Lieferdatum/Bemerkung werden ignoriert). Bei CSV werden
Trennzeichen (Komma/Semikolon/Tab) und Zahlformat (1.234,56 oder 1234.56)
automatisch erkannt.<br>
Auftr&auml;ge f&uuml;r unbekannte Maschinen werden verworfen. Bereits vorhandene
FA.-Nrn. werden nicht neu angelegt oder &uuml;berschrieben &ndash; ist in der
Datei aber eine g&uuml;ltige Priorit&auml;t (man. Prio) angegeben, wird diese
bei bereits vorhandenen Auftr&auml;gen trotzdem &uuml;bernommen. Ist die
Rest-Menge 0, wird der Auftrag direkt als abgeschlossen angelegt.
<strong>Artikel</strong> und <strong>Soll-pro-Stunde</strong> hochladen.
</p>
<details class="import-help">
<summary>Weitere Hinweise zum Import</summary>
<ul>
<li>Weitere Spalten (Bezeichnung, Lieferdatum usw.) werden ignoriert. Bei CSV werden Trennzeichen und Zahlformat automatisch erkannt.</li>
<li>Auftr&auml;ge f&uuml;r unbekannte Maschinen werden verworfen.</li>
<li>Bereits vorhandene FA.-Nrn. werden nicht &uuml;berschrieben; eine g&uuml;ltige Priorit&auml;t aus der Datei wird aber &uuml;bernommen.</li>
<li>Weicht die Maschine eines vorhandenen Auftrags ab, wirst du vor dem Import gefragt.</li>
<li>Aktive Auftr&auml;ge werden nicht importiert &ndash; nur ihre Priorit&auml;t wird &uuml;bernommen (bei passender Maschine).</li>
<li>Rest-Menge 0: Auftrag wird direkt als abgeschlossen angelegt.</li>
</ul>
</details>
<form method="post" action="{{ url_for('leitstand_import') }}" enctype="multipart/form-data" class="compact-form">
<div class="form-group">
<label for="datei">Excel- oder CSV-Datei</label>
@@ -68,14 +146,25 @@
</script>
</div>
{% endif %}
{% if ergebnis %}
<div class="card">
<h3>Ergebnis</h3>
{% if ergebnis.blockiert_aktiv %}
<div class="warn-box">
Nicht importiert, weil gerade aktiv ({{ ergebnis.blockiert_aktiv|length }}):
<ul>{% for z in ergebnis.blockiert_aktiv %}<li>{{ z }}</li>{% endfor %}</ul>
</div>
{% endif %}
<p>
{{ ergebnis.importiert|length }} importiert,
{{ ergebnis.uebersprungen_vorhanden|length }} bereits vorhanden (&uuml;bersprungen){% if ergebnis.prioritaet_aktualisiert %},
{{ ergebnis.prioritaet_aktualisiert|length }} davon mit aktualisierter Priorit&auml;t{% endif %},
{{ ergebnis.verworfen_maschine|length }} wegen unbekannter Maschine verworfen{% if ergebnis.fehlerhafte_zeilen %},
{% if ergebnis.maschine_gewechselt %}{{ ergebnis.maschine_gewechselt|length }} auf eine andere Maschine verschoben,
{% endif %}{% if ergebnis.maschine_behalten %}{{ ergebnis.maschine_behalten|length }} mit beibehaltener Maschine,
{% endif %}{% if ergebnis.blockiert_aktiv %}{{ ergebnis.blockiert_aktiv|length }} wegen aktivem Auftrag nicht importiert,
{% endif %}{{ ergebnis.verworfen_maschine|length }} wegen unbekannter Maschine verworfen{% if ergebnis.fehlerhafte_zeilen %},
{{ ergebnis.fehlerhafte_zeilen|length }} fehlerhaft{% endif %}.
</p>
@@ -91,6 +180,18 @@
<ul>{% for z in ergebnis.prioritaet_aktualisiert %}<li>{{ z }}</li>{% endfor %}</ul>
</details>
{% endif %}
{% if ergebnis.maschine_gewechselt %}
<details open>
<summary>Maschine aus Import &uuml;bernommen ({{ ergebnis.maschine_gewechselt|length }})</summary>
<ul>{% for z in ergebnis.maschine_gewechselt %}<li>{{ z }}</li>{% endfor %}</ul>
</details>
{% endif %}
{% if ergebnis.maschine_behalten %}
<details open>
<summary>Bisherige Maschine beibehalten ({{ ergebnis.maschine_behalten|length }})</summary>
<ul>{% for z in ergebnis.maschine_behalten %}<li>{{ z }}</li>{% endfor %}</ul>
</details>
{% endif %}
{% if ergebnis.uebersprungen_vorhanden %}
<details>
<summary>Bereits vorhanden &ndash; &uuml;bersprungen ({{ ergebnis.uebersprungen_vorhanden|length }})</summary>
+11 -4
View File
@@ -12,17 +12,22 @@
<option value="{{ m.id }}" {% if filter_maschine_id|string == m.id|string %}selected{% endif %}>{{ m.name or ('Maschine ' ~ m.id) }}</option>
{% endfor %}
</select>
<button type="submit">Filtern</button>
<span>Suche:</span>
<input type="search" name="q" value="{{ suchbegriff }}" placeholder="Auftragsnr. oder Artikel" autocomplete="off">
<button type="submit">Suchen</button>
{% if suchbegriff %}
<a class="filter-reset" href="{{ url_for('leitstand_korrektur', maschine_id=filter_maschine_id or None) }}">Suche zur&uuml;cksetzen</a>
{% endif %}
</form>
{% if not eintraege %}
<div class="empty-state">Keine Eintr&auml;ge gefunden.</div>
{% else %}
<div class="list-meta">{{ eintraege|length }} Buchungen (neueste zuerst)</div>
<div class="list-meta">{{ eintraege|length }} Buchungen (neueste zuerst){% if suchbegriff %} f&uuml;r &bdquo;{{ suchbegriff }}&ldquo;{% endif %}</div>
<div class="table-wrap">
<table class="data-table">
<thead>
<tr><th>ID</th><th>Maschine</th><th>Zeit</th><th>Auftrag</th><th>Produziert</th><th>Status</th><th>&Oslash;/h</th><th>Grund</th><th class="col-actions"></th></tr>
<tr><th>ID</th><th>Maschine</th><th>Zeit</th><th>Auftrag</th><th>Artikel</th><th>Produziert</th><th>Status</th><th>&Oslash;/h</th><th>Grund</th><th class="col-actions"></th></tr>
</thead>
<tbody>
{% for m in eintraege %}
@@ -31,15 +36,17 @@
<td>{{ m.maschine_id|int }}</td>
<td>{{ m.zeit_fmt }}</td>
<td>{{ m.order }}</td>
<td>{{ m.artikel or '-' }}</td>
<td>{{ m.produziert_fmt }}</td>
<td>{{ m.status }}</td>
<td>{{ m.h_avg_fmt }}</td>
<td>{{ m.p_grund or '' }}</td>
<td class="col-actions">
<div class="row-actions">
<a class="icon-btn" href="{{ url_for('leitstand_korrektur_bearbeiten', mde_id=m.id, maschine_id=filter_maschine_id) }}">Bearbeiten</a>
<a class="icon-btn" href="{{ url_for('leitstand_korrektur_bearbeiten', mde_id=m.id, maschine_id=filter_maschine_id, q=suchbegriff or None) }}">Bearbeiten</a>
<form method="post" action="{{ url_for('leitstand_korrektur_loeschen', mde_id=m.id) }}" class="order-form">
<input type="hidden" name="maschine_id" value="{{ filter_maschine_id or '' }}">
<input type="hidden" name="q" value="{{ suchbegriff }}">
<button type="submit" class="icon-btn danger">L&ouml;schen</button>
</form>
</div>
@@ -1,10 +1,11 @@
{% extends "base.html" %}
{% block content %}
<div class="back-row top">
<a class="big-btn small neutral" href="{{ url_for('leitstand_korrektur', maschine_id=filter_maschine_id) }}">&#8592; Zur&uuml;ck</a>
<a class="big-btn small neutral" href="{{ url_for('leitstand_korrektur', maschine_id=filter_maschine_id, q=suchbegriff or None) }}">&#8592; Zur&uuml;ck</a>
</div>
<form method="post" action="{{ url_for('leitstand_korrektur_bearbeiten', mde_id=eintrag.id) }}">
<input type="hidden" name="maschine_id_filter" value="{{ filter_maschine_id or '' }}">
<input type="hidden" name="q_filter" value="{{ suchbegriff or '' }}">
<div class="card">
<div class="form-group">
<label for="order">Auftragsnummer</label>
+1 -1
View File
@@ -5,7 +5,7 @@
</div>
<div class="machine-grid">
{% for m in maschinen %}
<a class="machine-link {{ 'aktiv' if m.hat_aktiven_auftrag else '' }}" href="{{ url_for('machine_main', maschine_id=m.id) }}">
<a class="machine-link {{ 'aktiv' if m.hat_aktiven_auftrag else '' }}" href="{{ url_for('machine_show' if ziel_show else 'machine_main', maschine_id=m.id) }}">
<span class="machine-link-name">{{ m.name or ('Maschine ' ~ m.id) }}</span>
{% if m.aktiver_artikel %}<span class="machine-link-artikel">{{ m.aktiver_artikel }}</span>{% endif %}
<span class="machine-link-status">{{ "l\u00e4uft" if m.hat_aktiven_auftrag else "frei" }}</span>
+15 -4
View File
@@ -17,13 +17,23 @@
<option value="offen_pause" {% if filter_status == "offen_pause" %}selected{% endif %}>Offen/Pausiert/Aktiv</option>
<option value="alle" {% if filter_status == "alle" %}selected{% endif %}>Alle</option>
</select>
<button type="submit">Filtern</button>
<span>Suche:</span>
<input type="search" name="q" value="{{ suchbegriff }}" placeholder="Auftragsnr. oder Artikel" autocomplete="off">
<button type="submit">Suchen</button>
{% if suchbegriff %}
<a class="filter-reset" href="{{ url_for('leitstand_uebersicht', maschine_id=filter_maschine_id or None, status=filter_status) }}">Suche zur&uuml;cksetzen</a>
{% endif %}
</form>
{% if not auftraege %}
<div class="empty-state">Keine Auftr&auml;ge gefunden.</div>
<div class="empty-state">
Keine Auftr&auml;ge gefunden.
{% if suchbegriff and filter_status == "offen_pause" %}
<div class="hint" style="margin-top:8px;">Tipp: Status auf &bdquo;Alle&ldquo; stellen, um auch abgeschlossene Auftr&auml;ge zu durchsuchen.</div>
{% endif %}
</div>
{% else %}
<div class="list-meta">{{ auftraege|length }} Auftr&auml;ge</div>
<div class="list-meta">{{ auftraege|length }} Auftr&auml;ge{% if suchbegriff %} f&uuml;r &bdquo;{{ suchbegriff }}&ldquo;{% endif %}</div>
<div class="table-wrap">
<table class="data-table">
<thead>
@@ -46,10 +56,11 @@
<span style="color:var(--text-dim); font-size:0.85em;">gesperrt (aktiv an Maschine)</span>
{% else %}
<div class="row-actions">
<a class="icon-btn" href="{{ url_for('leitstand_uebersicht_bearbeiten', auftrag_id=a.id, maschine_id=filter_maschine_id, status=filter_status) }}">Bearbeiten</a>
<a class="icon-btn" href="{{ url_for('leitstand_uebersicht_bearbeiten', auftrag_id=a.id, maschine_id=filter_maschine_id, status=filter_status, q=suchbegriff or None) }}">Bearbeiten</a>
<form method="post" action="{{ url_for('leitstand_uebersicht_loeschen', auftrag_id=a.id) }}" class="order-form">
<input type="hidden" name="maschine_id" value="{{ filter_maschine_id or '' }}">
<input type="hidden" name="status" value="{{ filter_status }}">
<input type="hidden" name="q" value="{{ suchbegriff }}">
<button type="submit" class="icon-btn danger">L&ouml;schen</button>
</form>
</div>
@@ -1,11 +1,12 @@
{% extends "base.html" %}
{% block content %}
<div class="back-row top">
<a class="big-btn small neutral" href="{{ url_for('leitstand_uebersicht', maschine_id=filter_maschine_id, status=filter_status) }}">&#8592; Zur&uuml;ck</a>
<a class="big-btn small neutral" href="{{ url_for('leitstand_uebersicht', maschine_id=filter_maschine_id, status=filter_status, q=suchbegriff or None) }}">&#8592; Zur&uuml;ck</a>
</div>
<form method="post" action="{{ url_for('leitstand_uebersicht_bearbeiten', auftrag_id=auftrag.id) }}">
<input type="hidden" name="maschine_id_filter" value="{{ filter_maschine_id or '' }}">
<input type="hidden" name="status_filter" value="{{ filter_status or '' }}">
<input type="hidden" name="q_filter" value="{{ suchbegriff or '' }}">
<div class="card">
<div class="form-group">
<label for="maschine_id">Maschine</label>
+5
View File
@@ -129,5 +129,10 @@
setInterval(aktualisieren, 15000);
})();
</script>
<<<<<<< HEAD
=======
{% if tablet_code %}<div class="tablet-id-badge" title="Kennung dieses Tablets">{{ tablet_code }}</div>{% endif %}
{% if tablet_ziel %}<script src="{{ url_for('static', filename='tablet.js') }}" data-ziel="{{ tablet_ziel }}" data-abfrage="{{ url_for('tablet_ziel') }}" data-intervall="{{ tablet_intervall }}" defer></script>{% endif %}
>>>>>>> origin/main
</body>
</html>
+3 -3
View File
@@ -1,9 +1,9 @@
{% extends "base.html" %}
{% block content %}
<div class="back-row top">
<div class="top-actions">
<a class="big-btn small neutral" href="{{ url_for('leitstand_home') }}">&#8592; Zur&uuml;ck</a>
<form method="post" action="{{ url_for('maschinenverwaltung_logout') }}" class="order-form" style="display:inline-block;width:auto;margin-left:12px;">
<button type="submit" class="icon-btn">Abmelden</button>
<form method="post" action="{{ url_for('maschinenverwaltung_logout') }}">
<button type="submit" class="big-btn small neutral">&#128274; Abmelden</button>
</form>
</div>
+14
View File
@@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block head_extra %}<meta http-equiv="refresh" content="10;url={{ url_for('tablet_start') }}">{% endblock %}
{% block content %}
<div class="card tablet-wait">
<div class="tablet-wait-title">Dieses Tablet ist noch keiner Seite zugeordnet</div>
{% if ziel_war_ungueltig %}
<p class="hint">Die zugeordnete Maschine existiert nicht mehr. Bitte im Admin-Bereich neu zuordnen.</p>
{% else %}
<p class="hint">Bitte im Admin-Bereich unter &bdquo;Tablets zuordnen&ldquo; eine Seite f&uuml;r dieses Ger&auml;t ausw&auml;hlen.</p>
{% endif %}
<div class="tablet-code">{{ kurzkennung }}</div>
<p class="hint">Kennung dieses Tablets &ndash; die Seite aktualisiert sich automatisch, sobald eine Zuordnung vorliegt.</p>
</div>
{% endblock %}
+47
View File
@@ -0,0 +1,47 @@
{% extends "base.html" %}
{% block content %}
<div class="top-actions">
<a class="big-btn small neutral" href="{{ url_for('tablets_verwaltung') }}">&#8592; Zur&uuml;ck zu den Tablets</a>
{% if tablet_id %}<a class="big-btn small neutral" href="{{ url_for('tablets_verlauf') }}">Alle Tablets anzeigen</a>{% endif %}
<form method="post" action="{{ url_for('maschinenverwaltung_logout') }}">
<button type="submit" class="big-btn small neutral">&#128274; Abmelden</button>
</form>
</div>
{% if tablet_id %}<div class="list-meta">Verlauf f&uuml;r: <strong>{{ filter_name }}</strong></div>{% endif %}
{% if not eintraege %}
<div class="empty-state">Noch keine Eintr&auml;ge.</div>
{% else %}
<div class="list-meta">{{ eintraege|length }} Eintr&auml;ge (neueste zuerst, max. 500; Aufbewahrung 400 Tage)</div>
<div class="table-wrap">
<table class="data-table tablet-table">
<thead>
<tr><th>Zeit</th><th>Tablet</th><th>Aktion</th><th>Details</th><th>Von (IP)</th></tr>
</thead>
<tbody>
{% for e in eintraege %}
<tr>
<td><time data-ts="{{ e.zeitpunkt }}" title="{{ e.zeit_utc }}">{{ e.zeit_utc }}</time></td>
<td>{% if e.tablet_name %}{{ e.tablet_name }}<small class="tablet-seen">{{ e.kurz }}</small>{% else %}&ndash;{% endif %}</td>
<td>{{ e.aktion }}</td>
<td>{{ e.details or '' }}</td>
<td>{{ e.von_ip or '' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="hint">&bdquo;Von (IP)&ldquo; ist die Adresse des Ger&auml;ts, das die &Auml;nderung ausgel&ouml;st hat (Admin-PC oder das Tablet selbst).
Die Admin-Seite hat ein gemeinsames Passwort, daher gibt es keine Benutzernamen.</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) + '.' + d.getFullYear() + ' ' + z2(d.getHours()) + ':' + z2(d.getMinutes()) + ':' + z2(d.getSeconds());
}
})();
</script>
{% endblock %}
+147
View File
@@ -0,0 +1,147 @@
{% extends "base.html" %}
{% block content %}
<div class="top-actions">
<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') }}">&Auml;nderungsverlauf ansehen</a>
<form method="post" action="{{ url_for('maschinenverwaltung_logout') }}">
<button type="submit" class="big-btn small neutral">&#128274; Abmelden</button>
</form>
</div>
<div class="learn-bar link-bar">
<div class="learn-form">
<span class="learn-state">Link f&uuml;r alle Tablets: <strong>{{ tablet_url }}</strong></span>
<details class="learn-help">
<summary>Erkl&auml;rung</summary>
<p class="hint">
Auf allen Tablets diese Adresse &ouml;ffnen. 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. {{ abfrage_sekunden }} Sekunden auf die gew&auml;hlte Seite
(online = Meldung in den letzten {{ online_sekunden }} Sekunden).
</p>
</details>
</div>
</div>
<div class="learn-bar {{ 'learn-on' if lernmodus else '' }}" id="lernmodus">
<form method="post" action="{{ url_for('tablets_lernmodus') }}" class="learn-form">
<span class="learn-state">Lernmodus: <strong>{{ 'AN' if lernmodus else 'AUS' }}</strong></span>
<input type="hidden" name="an" value="{{ '0' if lernmodus else '1' }}">
<button type="submit" class="icon-btn">{{ 'Ausschalten' if lernmodus else 'Einschalten' }}</button>
<details class="learn-help">
<summary>Was ist das?</summary>
<p class="hint">
Solange der Lernmodus an ist, werden Ger&auml;te, die noch &uuml;ber einen einzelnen Link (<code>/m&lt;N&gt;</code> oder
<code>/m&lt;N&gt;_show</code>) kommen, automatisch gespeichert und genau dieser Seite zugeordnet.
Beim n&auml;chsten Besuch &uuml;ber <code>/tablet</code> werden sie erkannt. Nach der Umstellung ausschalten,
sonst wird auch z.&nbsp;B. ein PC registriert, der eine Maschinenseite &ouml;ffnet.
Neue Tablets ohne Lernen werden von Hand zugeordnet.
</p>
</details>
</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" 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 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 }}
<small class="tablet-seen">{% if t.gesehen_ts %}<time data-ts="{{ t.gesehen_ts }}"></time>{% else %}&nbsp;{% endif %}</small>
</td>
<td>{{ t.kurz }}</td>
<td colspan="3">
<form method="post" action="{{ url_for('tablets_speichern', tablet_id=t.id) }}#tablet-{{ t.id }}" class="tablet-form" id="tf{{ t.id }}" autocomplete="off">
<input type="text" name="name" value="{{ t.name or '' }}" maxlength="60" aria-label="Name" autocomplete="off">
<select name="ziel_typ" aria-label="Ziel" autocomplete="off">
<option value="" {% if not t.ziel_typ %}selected{% endif %}>&ndash; nicht zugeordnet &ndash;</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" autocomplete="off">
<option value="" {% if not t.maschine_id %}selected{% endif %}>&ndash;</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>
</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"><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 () {
// Felder immer auf den Stand der Datenbank zurücksetzen (nicht auf vom Browser gemerkte
// Eingaben): ein neues, unzugeordnetes Tablet muss mit leeren Einstellungen erscheinen.
function zuruecksetzen() {
var fs = document.querySelectorAll('.tablet-form');
for (var i = 0; i < fs.length; i++) { fs[i].reset(); }
}
window.addEventListener('pageshow', function () { zuruecksetzen(); setTimeout(zuruecksetzen, 100); });
})();
(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);
// Zeile hat die Gruppe gewechselt (nicht zugeordnet <-> zugeordnet): Anker-Sprung zur Zeile gilt
if (window.location.search.indexOf('umsortiert=1') !== -1) roh = null;
}
if (roh !== null) {
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]');
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 %}