feat: Zentrale per Durchwahl selbst besetzen

Das Busylight im Empfangsbereich wird wechselnd besetzt. Mitarbeiter
koennen sich jetzt selbst darauf setzen, ohne Admin-Passwort.

- Neue Seite /zentrale (Durchwahl eingeben) und /zentrale/{durchwahl}
  als Direktlink fuer QR-Codes. Der Direktlink zeigt nur an und aendert
  nichts, damit Link-Vorschau und Prefetch niemanden versetzen.
- Neue Tabelle home_assignments merkt das eigene Tuerschild, solange der
  Mitarbeiter in der Zentrale sitzt. Beim Verlassen wird es
  wiederhergestellt, das Zentral-Segment wird freigegeben.
- Der Vorgaenger bleibt ohne Zuordnung - er ist nicht da. Sein gemerkter
  Heimatplatz bleibt erhalten, er kann jederzeit zurueckkehren.
- Ist der Heimatplatz inzwischen belegt, wird die Rueckkehr abgelehnt
  und nichts geaendert.
- Eine ausdrueckliche Admin-Zuordnung verwirft den gemerkten Heimatplatz.
  Ein reines Loeschen der Zuordnung nicht, sonst kaeme niemand mehr von
  der Zentrale zurueck.
- Farbe wird sofort ans Geraet geschickt (scheduler.push_user_light).
  Das Polling allein reicht nicht: _process_user sendet nur bei einer
  Statusaenderung, und beim Platzwechsel bleibt der Status gleich.
- Neue Settings selfservice_device_id und selfservice_segment,
  einstellbar unter Einstellungen.
- Jeder Wechsel landet im Protokoll (zentrale / zentrale_frei).

Die Durchwahl ist eine Kennung, kein Geheimnis - im README dokumentiert.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-21 08:12:42 +00:00
co-authored by Claude Opus 5
parent 65314f2338
commit 086b21dc2b
6 changed files with 554 additions and 3 deletions
+36 -1
View File
@@ -127,7 +127,7 @@
</div>
</div>
<div class="card">
<div class="card mb-4">
<div class="card-header">
<h6 class="mb-0"><i class="bi bi-file-earmark-spreadsheet"></i> Zeiterfassung (CSV)</h6>
</div>
@@ -167,6 +167,41 @@
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h6 class="mb-0"><i class="bi bi-headset"></i> Zentrale (Self-Service)</h6>
</div>
<div class="card-body">
<div class="mb-3">
<label class="form-label">Busylight der Zentrale</label>
<select name="selfservice_device_id" class="form-select">
<option value="">-- nicht eingerichtet --</option>
{% for d in devices %}
<option value="{{ d.id }}" {% if settings.selfservice_device_id == d.id|string %}selected{% endif %}>
{{ d.name or d.hostname }} ({{ d.hostname }})
</option>
{% endfor %}
</select>
<small class="text-muted">Das Busylight im Empfangsbereich, das wechselnd besetzt wird.</small>
</div>
<div class="mb-3">
<label class="form-label">Segment</label>
<input type="number" name="selfservice_segment" class="form-control"
min="0" step="1" value="{{ settings.selfservice_segment or '0' }}">
<small class="text-muted">0 = unten, 1 = oben</small>
</div>
<div class="border rounded p-3 bg-light">
<small class="text-muted">
<strong>Self-Service-Seite</strong><br>
Mitarbeiter melden sich per Durchwahl an, ohne Admin-Passwort:<br>
<code>/zentrale</code><br>
Direktlink bzw. QR-Code pro Person:<br>
<code>/zentrale/{durchwahl}</code>
</small>
</div>
</div>
</div>
</div>
</div>
+125
View File
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zentrale - Busylight</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container">
<div class="row justify-content-center mt-4 mb-5">
<div class="col-md-5">
<div class="card shadow-sm">
<div class="card-body p-4">
<div class="text-center mb-4">
<img src="/static/logo.png" alt="cynfo" style="height: 40px;" class="mb-2">
<h5 class="mb-0">Zentrale besetzen</h5>
</div>
{% if message %}
<div class="alert alert-success py-2">
<small><i class="bi bi-check-circle"></i> {{ message }}</small>
</div>
{% endif %}
{% if error %}
<div class="alert alert-danger py-2">
<small><i class="bi bi-exclamation-triangle"></i> {{ error }}</small>
</div>
{% endif %}
{% if not target %}
<div class="alert alert-warning py-2 mb-0">
<small>
<i class="bi bi-gear"></i>
Die Zentrale ist noch nicht eingerichtet. Unter
<strong>Einstellungen &gt; Zentrale</strong> muss ein Busylight
und ein Segment ausgewaehlt werden.
</small>
</div>
{% else %}
<div class="border rounded p-3 mb-4 bg-white">
<div class="d-flex justify-content-between align-items-center">
<div>
<small class="text-muted d-block">Busylight der Zentrale</small>
<strong>{{ target.name }}</strong>
<small class="text-muted">(Segment {{ target.segment }})</small>
</div>
</div>
<hr class="my-2">
<small class="text-muted d-block">Aktuell besetzt von</small>
{% if occupant %}
<strong class="text-success"><i class="bi bi-person-fill"></i> {{ occupant }}</strong>
{% else %}
<span class="text-muted"><i class="bi bi-person-dash"></i> niemand</span>
{% endif %}
</div>
{% if user %}
<div class="text-center mb-3">
<small class="text-muted d-block">Durchwahl {{ user.phone_extension }}</small>
<strong>{{ user.display_name }}</strong>
</div>
{% if is_here %}
<div class="alert alert-info py-2">
<small><i class="bi bi-info-circle"></i> Du sitzt derzeit auf der Zentrale.</small>
</div>
{% endif %}
<form method="post" action="/api/zentrale/uebernehmen" class="mb-2">
<input type="hidden" name="extension" value="{{ user.phone_extension }}">
<button type="submit" class="btn btn-primary w-100" {% if is_here %}disabled{% endif %}>
<i class="bi bi-box-arrow-in-right"></i> Zentrale uebernehmen
</button>
</form>
<form method="post" action="/api/zentrale/verlassen">
<input type="hidden" name="extension" value="{{ user.phone_extension }}">
<button type="submit" class="btn btn-outline-secondary w-100">
<i class="bi bi-box-arrow-left"></i> Zurueck auf mein Tuerschild
</button>
</form>
{% if home %}
<div class="text-center mt-3">
<small class="text-muted">
Gemerktes Tuerschild: {{ home.name or home.hostname }} (Segment {{ home.segment }})
</small>
</div>
{% endif %}
<div class="text-center mt-3">
<a href="/zentrale" class="text-muted small">Andere Durchwahl</a>
</div>
{% else %}
<form method="post" action="/api/zentrale/uebernehmen">
<div class="mb-3">
<label class="form-label">Eigene Telefon-Durchwahl</label>
<input type="text" name="extension" class="form-control form-control-lg text-center"
inputmode="numeric" autocomplete="off" autofocus required
value="{{ extension }}" placeholder="z.B. 123">
<small class="text-muted">
Damit wird die eigene Person auf das Busylight der Zentrale gesetzt.
</small>
</div>
<button type="submit" class="btn btn-primary w-100">
<i class="bi bi-box-arrow-in-right"></i> Zentrale uebernehmen
</button>
</form>
{% endif %}
{% endif %}
<div class="text-center mt-4">
<small class="text-secondary" style="font-size:0.65rem">&copy; cynfo GmbH</small>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>