Files
kaffeekasse-saas/resources/views/tenant/rfid.php
T
2026-06-15 18:36:57 +02:00

154 lines
5.7 KiB
PHP

<?php require __DIR__ . '/../partials/layout-top.php'; ?>
<section class="page-head">
<span class="eyebrow">Pilot & Integration</span>
<h1>RFID-Roadmap und Event-Inbox</h1>
<p>Das MVP speichert Geraete, Karten und rohe Events bereits produktionsnah, ohne die spaetere Hardwareentscheidung vorwegzunehmen. Dieser Bereich bleibt klar beim Standortteam und der Pilotbetreuung.</p>
</section>
<section class="card">
<span class="eyebrow">Export & Korrekturen</span>
<ul class="feature-list">
<li>Event-Export oder Inbox-Download: Platzhalter fuer spaetere Support-Links</li>
<li>Karten- und Geraetekorrekturen: Platzhalter fuer Hinweise direkt an den Tabellen</li>
<li>Member-Self-Service blendet RFID-Setup bewusst aus, bis der Pilot weiter ist</li>
</ul>
</section>
<div class="grid-three">
<form class="card form-card" method="post" action="<?= e(tenant_url($tenant['slug'], 'rfid')) ?>">
<?= csrf_field($csrf) ?>
<input type="hidden" name="action" value="create_device">
<label>
<span>Geraetename</span>
<input type="text" name="name" value="<?= e((string) old('name')) ?>" required>
</label>
<label>
<span>Standort</span>
<input type="text" name="location_label" value="<?= e((string) old('location_label')) ?>">
</label>
<button class="button button-primary" type="submit">RFID-Geraet vorbereiten</button>
</form>
<form class="card form-card" method="post" action="<?= e(tenant_url($tenant['slug'], 'rfid')) ?>">
<?= csrf_field($csrf) ?>
<input type="hidden" name="action" value="assign_tag">
<label>
<span>Mitglied</span>
<select name="member_id" required>
<?php foreach ($members as $member): ?>
<option value="<?= e((string) $member['id']) ?>"><?= e($member['display_name']) ?></option>
<?php endforeach; ?>
</select>
</label>
<label>
<span>Karten-UID</span>
<input type="text" name="uid" value="<?= e((string) old('uid')) ?>" required>
</label>
<label>
<span>Label</span>
<input type="text" name="label" value="<?= e((string) old('label')) ?>">
</label>
<button class="button button-primary" type="submit">Karte zuweisen</button>
</form>
<section class="card">
<span class="eyebrow">API</span>
<p class="muted">POST `/api/rfid/intake` mit JSON-Body:</p>
<pre class="code-block">{
"device_token": "...",
"uid": "04AABBCCDD",
"event_id": "reader-0001",
"ts": "2026-06-15T09:30:00Z"
}</pre>
<p class="muted">Events werden tenant-scharf gespeichert und spaeter in Buchungsregeln ueberfuehrt.</p>
</section>
</div>
<div class="two-column">
<section class="table-card">
<table>
<thead>
<tr>
<th>Geraet</th>
<th>Standort</th>
<th>Status</th>
<th>Token</th>
</tr>
</thead>
<tbody>
<?php if ($devices === []): ?>
<tr>
<td colspan="4">Noch keine RFID-Geraete vorbereitet.</td>
</tr>
<?php endif; ?>
<?php foreach ($devices as $device): ?>
<tr>
<td><?= e($device['name']) ?></td>
<td><?= e((string) $device['location_label']) ?></td>
<td><?= e($device['status']) ?></td>
<td><code><?= e(substr($device['device_token'], 0, 16)) ?>...</code></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
<section class="table-card">
<table>
<thead>
<tr>
<th>Karte</th>
<th>Mitglied</th>
<th>Status</th>
<th>Zuletzt</th>
</tr>
</thead>
<tbody>
<?php if ($tags === []): ?>
<tr>
<td colspan="4">Noch keine RFID-Karten zugewiesen.</td>
</tr>
<?php endif; ?>
<?php foreach ($tags as $tag): ?>
<tr>
<td><?= e((string) ($tag['label'] ?: 'ohne Label')) ?></td>
<td><?= e((string) $tag['member_name']) ?></td>
<td><?= e($tag['status']) ?></td>
<td><?= e((string) ($tag['last_seen_at'] ?? 'noch nie')) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
</div>
<section class="table-card">
<table>
<thead>
<tr>
<th>Zeit</th>
<th>Geraet</th>
<th>Status</th>
<th>Event-ID</th>
</tr>
</thead>
<tbody>
<?php if ($events === []): ?>
<tr>
<td colspan="4">Noch keine RFID-Events empfangen.</td>
</tr>
<?php endif; ?>
<?php foreach ($events as $event): ?>
<tr>
<td><?= e($event['received_at']) ?></td>
<td><?= e((string) $event['device_name']) ?></td>
<td><?= e($event['status']) ?></td>
<td><?= e((string) $event['external_event_id']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
<?php require __DIR__ . '/../partials/layout-bottom.php'; ?>