feat: Kür-Hub mit Einladungen, Uploads und API
- PHP-App unter hub/ für rinkplanner-hub.programmschmiede.de - MariaDB-Schema, Argon2id, Sessions, CSRF und Ratenbegrenzung - Einladungscodes, Admin-Bereich und Kür-Pakete mit Audiodatei - JSON-API v1 mit Bearer-Tokens für die Godot-App - Deployment und Erstinstallation über tools/deploy_hub.sh - Doku und Credentials-Vorlage ergänzt
This commit is contained in:
parent
e79b477ee0
commit
055a2919c3
38 changed files with 5111 additions and 0 deletions
83
hub/views/admin_invites.php
Normal file
83
hub/views/admin_invites.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php /** @var array $invites */ ?>
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>Verwaltung</h1>
|
||||
<p class="muted">Einladungen für die geschlossene Beta.</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php $active = 'invites'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Neue Einladung</h2>
|
||||
<p class="muted">Der Code wird nach dem Anlegen genau einmal angezeigt. Er gilt für ein Konto.</p>
|
||||
<form method="post" action="<?= e(url('/admin/invites')) ?>" class="stack">
|
||||
<?= csrf_field() ?>
|
||||
<div class="grid-3">
|
||||
<label>
|
||||
Notiz (intern)
|
||||
<input type="text" name="note" maxlength="190" placeholder="z. B. Verein Nord">
|
||||
</label>
|
||||
<label>
|
||||
E-Mail binden (optional)
|
||||
<input type="email" name="email" maxlength="190">
|
||||
<span class="hint">Nur diese Adresse kann den Code nutzen.</span>
|
||||
</label>
|
||||
<label>
|
||||
Gültig (Tage)
|
||||
<input type="number" name="expires_days" min="0" max="365" value="30">
|
||||
<span class="hint">0 = unbegrenzt.</span>
|
||||
</label>
|
||||
</div>
|
||||
<button class="primary" type="submit">Einladung erzeugen</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Einladungen</h2>
|
||||
<?php if (!$invites): ?>
|
||||
<p class="muted">Noch keine Einladungen.</p>
|
||||
<?php else: ?>
|
||||
<div class="table-wrap">
|
||||
<table class="list compact">
|
||||
<thead>
|
||||
<tr><th>Erstellt</th><th>Notiz</th><th>E-Mail</th><th>Status</th><th>Von / an</th><th>Gültig bis</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($invites as $invite): ?>
|
||||
<?php
|
||||
$status = invite_status($invite);
|
||||
$statusClass = [
|
||||
'offen' => 'open',
|
||||
'eingelöst' => 'used',
|
||||
'abgelaufen' => 'expired',
|
||||
'widerrufen' => 'revoked',
|
||||
][$status] ?? 'expired';
|
||||
?>
|
||||
<tr>
|
||||
<td><?= e(fmt_dt($invite['created_at'])) ?></td>
|
||||
<td><?= e($invite['note'] ?: '–') ?></td>
|
||||
<td><?= e($invite['email'] ?: '–') ?></td>
|
||||
<td><span class="status status-<?= e($statusClass) ?>"><?= e($status) ?></span></td>
|
||||
<td>
|
||||
<?= e($invite['creator_name'] ?: '–') ?>
|
||||
<?php if (!empty($invite['used_name'])): ?>
|
||||
<span class="muted">→ <?= e($invite['used_name']) ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= e(fmt_dt($invite['expires_at'])) ?></td>
|
||||
<td>
|
||||
<?php if ($status === 'offen'): ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/admin/invites/revoke')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="invite_id" value="<?= (int) $invite['id'] ?>">
|
||||
<button class="link-button danger" type="submit">widerrufen</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
Loading…
Add table
Add a link
Reference in a new issue