134 lines
6.4 KiB
PHP
134 lines
6.4 KiB
PHP
<?php
|
|
$tenantRole = (string) ($authState['tenant_role'] ?? 'member');
|
|
$isSelfService = $tenantRole === 'member';
|
|
$selectedMemberId = (string) old('member_id');
|
|
$selectedProductId = (string) old('product_id');
|
|
$selectedSourceCode = (string) old('source_code', 'digital_self');
|
|
require __DIR__ . '/../partials/layout-top.php';
|
|
?>
|
|
|
|
<section class="page-head">
|
|
<span class="eyebrow"><?= e($isSelfService ? 'Selbstbuchung' : 'Digitale Erfassung') ?></span>
|
|
<h1><?= e($isSelfService ? 'Getraenke buchen' : 'Digitale Buchungen') ?></h1>
|
|
<?php if ($isSelfService): ?>
|
|
<p>Diese Seite ist auf taegliche Member-Self-Service-Buchungen zugeschnitten. Korrekturen, Sammelbuchungen und Exporte bleiben im Pilot vorerst beim Standortteam.</p>
|
|
<?php else: ?>
|
|
<p>Browser, Tablet und Kiosk landen im selben Ledger. Das Standortteam kann hier Selbstbuchung und Backoffice-Buchungen sichtbar trennen.</p>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<span class="eyebrow">Export & Korrekturen</span>
|
|
<p class="muted">
|
|
<?= e($isSelfService
|
|
? 'Hier ist bewusst Platz fuer persoenliche Exporte und klare Korrekturhinweise reserviert, ohne heute schon neue Backend-Logik vorwegzunehmen.'
|
|
: 'Hier ist bewusst Platz fuer CSV-Exporte, Sammelkorrekturen und Rueckfragen reserviert, ohne heute schon neue Controllerpfade vorwegzunehmen.') ?>
|
|
</p>
|
|
<ul class="feature-list">
|
|
<li>Download-Link fuer Buchungs-Export: Platzhalter fuer spaetere CSV- oder Monatsansicht</li>
|
|
<li>Storno- und Korrekturhinweise: Platzhalter fuer kuenftige Bedienhilfe direkt am Workflow</li>
|
|
<li><?= e($isSelfService ? 'Bis dahin bitte im Pilot nur den eigenen Namen waehlen; persoenliche Vorauswahl folgt.' : 'Sammelkorrekturen und Nachbuchungen bleiben vorerst beim Standortteam.') ?></li>
|
|
</ul>
|
|
</section>
|
|
|
|
<div class="two-column">
|
|
<form class="card form-card" method="post" action="<?= e(tenant_url($tenant['slug'], 'bookings')) ?>">
|
|
<?= csrf_field($csrf) ?>
|
|
<label>
|
|
<span><?= e($isSelfService ? 'Dein Mitgliedseintrag' : 'Mitglied') ?></span>
|
|
<select name="member_id" required>
|
|
<?php foreach ($members as $member): ?>
|
|
<option value="<?= e((string) $member['id']) ?>" <?= $selectedMemberId === (string) $member['id'] ? 'selected' : '' ?>><?= e($member['display_name']) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
<span>Produkt</span>
|
|
<select name="product_id" required>
|
|
<?php foreach ($products as $product): ?>
|
|
<option value="<?= e((string) $product['id']) ?>" <?= $selectedProductId === (string) $product['id'] ? 'selected' : '' ?>><?= e($product['name']) ?> (<?= e(money_from_cents((int) $product['price_cents'])) ?>)</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
<?php if ($isSelfService): ?>
|
|
<input type="hidden" name="source_code" value="digital_self">
|
|
<?php else: ?>
|
|
<label>
|
|
<span>Quelle</span>
|
|
<select name="source_code">
|
|
<option value="digital_self" <?= $selectedSourceCode === 'digital_self' ? 'selected' : '' ?>>Digitale Selbstbuchung</option>
|
|
<option value="admin_backoffice" <?= $selectedSourceCode === 'admin_backoffice' ? 'selected' : '' ?>>Backoffice-Buchung</option>
|
|
</select>
|
|
</label>
|
|
<?php endif; ?>
|
|
<label>
|
|
<span>Menge</span>
|
|
<input type="number" name="quantity" min="0.25" step="0.25" value="<?= e((string) old('quantity', '1')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Verbrauchszeitpunkt</span>
|
|
<input type="datetime-local" name="effective_at" value="<?= e((string) old('effective_at', gmdate('Y-m-d\TH:i'))) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Notiz</span>
|
|
<input type="text" name="notes" value="<?= e((string) old('notes')) ?>">
|
|
</label>
|
|
<button class="button button-primary" type="submit"><?= e($isSelfService ? 'Jetzt buchen' : 'Buchung speichern') ?></button>
|
|
<?php if ($isSelfService): ?>
|
|
<p class="muted">Wenn du mehrere Namen siehst, nutze im Pilot bitte nur deinen eigenen Eintrag. Falsche Buchungen korrigiert das Standortteam.</p>
|
|
<?php endif; ?>
|
|
</form>
|
|
|
|
<?php if ($isSelfService): ?>
|
|
<section class="card">
|
|
<span class="eyebrow">Pilot-Hinweis</span>
|
|
<ul class="stack-list">
|
|
<li>
|
|
<strong>Eigene Historie</strong>
|
|
<small>Ein persoenlicher Verlauf wird spaeter hier eingeblendet.</small>
|
|
</li>
|
|
<li>
|
|
<strong>Korrekturen</strong>
|
|
<small>Falsche Buchungen bitte direkt an das Standortteam melden.</small>
|
|
</li>
|
|
<li>
|
|
<strong>Exporte</strong>
|
|
<small>Downloads und Monatsauszuege folgen nach weiterem Pilotfeedback.</small>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<?php else: ?>
|
|
<section class="table-card">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Zeit</th>
|
|
<th>Mitglied</th>
|
|
<th>Produkt</th>
|
|
<th>Quelle</th>
|
|
<th>Betrag</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($bookings === []): ?>
|
|
<tr>
|
|
<td colspan="5">Noch keine Buchungen erfasst.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php foreach ($bookings as $booking): ?>
|
|
<tr>
|
|
<td><?= e($booking['recorded_at']) ?></td>
|
|
<td><?= e($booking['member_name']) ?></td>
|
|
<td><?= e($booking['product_name']) ?></td>
|
|
<td><?= e($booking['source_name']) ?></td>
|
|
<td><?= e(money_from_cents((int) $booking['total_cents'])) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php require __DIR__ . '/../partials/layout-bottom.php'; ?>
|