156 lines
6.5 KiB
PHP
156 lines
6.5 KiB
PHP
<?php require __DIR__ . '/../partials/layout-top.php'; ?>
|
|
|
|
<section class="page-head">
|
|
<span class="eyebrow">Papierlisten</span>
|
|
<h1>Papierliste nachtragen</h1>
|
|
<p>Übertragen Sie Strichlisten oder Thekenzettel in die Kaffeekasse. Erst beim Abschließen werden die Positionen als Buchungen gezählt.</p>
|
|
</section>
|
|
|
|
<div class="grid-three">
|
|
<form class="card form-card" method="post" action="<?= e(tenant_url($tenant['slug'], 'paper-sheets')) ?>">
|
|
<?= csrf_field($csrf) ?>
|
|
<input type="hidden" name="action" value="create_sheet">
|
|
<h2>Neue Papierliste</h2>
|
|
<label>
|
|
<span>Name der Liste</span>
|
|
<input type="text" name="title" value="<?= e((string) old('title', 'Wochenliste')) ?>" required>
|
|
</label>
|
|
<label>
|
|
<span>Zeitraum anzeigen als</span>
|
|
<input type="text" name="period_label" value="<?= e((string) old('period_label', 'KW ' . gmdate('W'))) ?>">
|
|
</label>
|
|
<label>
|
|
<span>Startdatum</span>
|
|
<input type="date" name="period_start" value="<?= e((string) old('period_start', gmdate('Y-m-01'))) ?>">
|
|
</label>
|
|
<label>
|
|
<span>Enddatum</span>
|
|
<input type="date" name="period_end" value="<?= e((string) old('period_end', gmdate('Y-m-t'))) ?>">
|
|
</label>
|
|
<label>
|
|
<span>Notiz</span>
|
|
<input type="text" name="notes" value="<?= e((string) old('notes')) ?>">
|
|
</label>
|
|
<button class="button button-primary" type="submit">Papierliste anlegen</button>
|
|
</form>
|
|
|
|
<form class="card form-card" method="post" action="<?= e(tenant_url($tenant['slug'], 'paper-sheets')) ?>">
|
|
<?= csrf_field($csrf) ?>
|
|
<input type="hidden" name="action" value="add_line">
|
|
<h2>Position von der Liste übernehmen</h2>
|
|
<label>
|
|
<span>Papierliste</span>
|
|
<select name="paper_sheet_id" required>
|
|
<?php foreach ($sheets as $sheet): ?>
|
|
<?php if ($sheet['status'] === 'draft'): ?>
|
|
<option value="<?= e((string) $sheet['id']) ?>"><?= e($sheet['title']) ?> (Entwurf)</option>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
<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>Produkt</span>
|
|
<select name="product_id" required>
|
|
<?php foreach ($products as $product): ?>
|
|
<option value="<?= e((string) $product['id']) ?>"><?= e($product['name']) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</label>
|
|
<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>Wann genommen?</span>
|
|
<input type="datetime-local" name="effective_at" value="<?= e((string) old('effective_at', gmdate('Y-m-d\TH:i'))) ?>">
|
|
</label>
|
|
<label>
|
|
<span>Notiz</span>
|
|
<input type="text" name="note" value="<?= e((string) old('note')) ?>">
|
|
</label>
|
|
<button class="button button-primary" type="submit">Position zur Papierliste hinzufügen</button>
|
|
</form>
|
|
|
|
<section class="card">
|
|
<span class="eyebrow">In Buchungen übernehmen</span>
|
|
<p class="muted">Prüfen Sie die Positionen. Nach dem Abschließen erscheinen sie als normale Buchungen in der Kaffeekasse.</p>
|
|
<?php foreach ($sheets as $sheet): ?>
|
|
<?php if ($sheet['status'] === 'draft'): ?>
|
|
<form class="inline-form" method="post" action="<?= e(tenant_url($tenant['slug'], 'paper-sheets')) ?>">
|
|
<?= csrf_field($csrf) ?>
|
|
<input type="hidden" name="action" value="post_sheet">
|
|
<input type="hidden" name="paper_sheet_id" value="<?= e((string) $sheet['id']) ?>">
|
|
<button class="button button-secondary" type="submit"><?= e($sheet['title']) ?> als Buchungen übernehmen</button>
|
|
</form>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</section>
|
|
</div>
|
|
|
|
<div class="two-column">
|
|
<section class="table-card">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Titel</th>
|
|
<th>Status</th>
|
|
<th>Positionen</th>
|
|
<th>Zeitraum</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($sheets === []): ?>
|
|
<tr>
|
|
<td class="table-empty" colspan="4">Noch keine Papierlisten. Legen Sie zuerst die erste Liste an.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php foreach ($sheets as $sheet): ?>
|
|
<tr>
|
|
<td><?= e($sheet['title']) ?></td>
|
|
<td><?= e($sheet['status']) ?></td>
|
|
<td><?= e((string) $sheet['line_count']) ?></td>
|
|
<td><?= e((string) $sheet['period_label']) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
<section class="table-card">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Liste</th>
|
|
<th>Mitglied</th>
|
|
<th>Produkt</th>
|
|
<th>Menge</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($sheetLines === []): ?>
|
|
<tr>
|
|
<td class="table-empty" colspan="4">Noch keine Striche oder Positionen übertragen.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php foreach ($sheetLines as $line): ?>
|
|
<tr>
|
|
<td>#<?= e((string) $line['paper_sheet_id']) ?></td>
|
|
<td><?= e($line['member_name']) ?></td>
|
|
<td><?= e($line['product_name']) ?></td>
|
|
<td><?= e((string) $line['quantity']) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
</div>
|
|
|
|
<?php require __DIR__ . '/../partials/layout-bottom.php'; ?>
|