141 lines
5.9 KiB
PHP
141 lines
5.9 KiB
PHP
<section class="admin-section">
|
|
<div class="section-header">
|
|
<div>
|
|
<p class="eyebrow">Dashboard</p>
|
|
<h1>Verwaltung für Anfragen, Buchungen und Rechnungen</h1>
|
|
</div>
|
|
<div class="section-actions">
|
|
<a class="button-secondary" href="<?= h(url('admin/anfragen')) ?>">Offene Anfragen</a>
|
|
<a class="button-primary" href="<?= h(url('admin/create')) ?>">Buchung für Kunden anlegen</a>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($flashSuccess)): ?>
|
|
<div class="flash flash-success"><?= h((string) $flashSuccess) ?></div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($flashError)): ?>
|
|
<div class="flash flash-error"><?= h((string) $flashError) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<div class="stats-grid">
|
|
<article class="stat-card">
|
|
<span>Alle Aufträge</span>
|
|
<strong><?= h((string) $stats['bookings_total']) ?></strong>
|
|
</article>
|
|
<article class="stat-card">
|
|
<span>Offene Anfragen</span>
|
|
<strong><?= h((string) $stats['open_requests']) ?></strong>
|
|
</article>
|
|
<article class="stat-card">
|
|
<span>Bestätigte Buchungen</span>
|
|
<strong><?= h((string) $stats['confirmed_bookings']) ?></strong>
|
|
</article>
|
|
<article class="stat-card">
|
|
<span>Planumsatz</span>
|
|
<strong><?= h(formatCurrency((int) $stats['revenue_cents'])) ?></strong>
|
|
</article>
|
|
<article class="stat-card">
|
|
<span>Rechnungen</span>
|
|
<strong><?= h((string) $stats['invoice_total']) ?></strong>
|
|
</article>
|
|
<article class="stat-card">
|
|
<span>Offene Rechnungen</span>
|
|
<strong><?= h((string) $stats['invoice_open']) ?></strong>
|
|
</article>
|
|
</div>
|
|
|
|
<div class="admin-grid">
|
|
<section class="table-card">
|
|
<div class="table-card-header">
|
|
<h2>Offene oder reservierte Anfragen</h2>
|
|
<a href="<?= h(url('admin/anfragen')) ?>">Alle ansehen</a>
|
|
</div>
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Referenz</th>
|
|
<th>Kunde</th>
|
|
<th>Zeitraum</th>
|
|
<th>Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($requests as $booking): ?>
|
|
<tr>
|
|
<td><a href="<?= h(url('admin/order?id=' . urlencode($booking['id']))) ?>"><?= h($booking['reference']) ?></a></td>
|
|
<td><?= h($booking['customer']['name']) ?></td>
|
|
<td><?= h(formatDate($booking['start_date'])) ?> bis <?= h(formatDate($booking['end_date'])) ?></td>
|
|
<td><span class="<?= h(statusPillClass((string) $booking['status'])) ?>"><?= h($booking['status_label']) ?></span></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php if ($requests === []): ?>
|
|
<tr>
|
|
<td colspan="4">Aktuell gibt es keine offenen Anfragen.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="table-card">
|
|
<div class="table-card-header">
|
|
<h2>Nächste Einsätze</h2>
|
|
<a href="<?= h(url('admin/kalender')) ?>">Zum Kalender</a>
|
|
</div>
|
|
<div class="stack-list">
|
|
<?php foreach ($upcomingBookings as $booking): ?>
|
|
<article class="stack-item">
|
|
<div>
|
|
<strong><?= h($booking['reference']) ?></strong>
|
|
<span><?= h($booking['customer']['name']) ?> · <?= h(formatDate($booking['start_date'])) ?> bis <?= h(formatDate($booking['end_date'])) ?></span>
|
|
</div>
|
|
<span class="<?= h(statusPillClass((string) $booking['status'])) ?>"><?= h($booking['status_label']) ?></span>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
<?php if ($upcomingBookings === []): ?>
|
|
<p class="empty-state">Noch keine Termine geplant.</p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<section class="table-card">
|
|
<div class="table-card-header">
|
|
<h2>Zuletzt erstellte Rechnungen</h2>
|
|
<a href="<?= h(url('admin/rechnungen')) ?>">Alle Rechnungen</a>
|
|
</div>
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Nummer</th>
|
|
<th>Auftrag</th>
|
|
<th>Fällig</th>
|
|
<th>Zahlungsart</th>
|
|
<th>Gesamt</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($invoices as $invoice): ?>
|
|
<tr>
|
|
<td><a href="<?= h(url('admin/invoice/pdf?id=' . urlencode($invoice['id']))) ?>" target="_blank"><?= h($invoice['invoice_number']) ?></a></td>
|
|
<td><?= h($invoice['booking_id']) ?></td>
|
|
<td><?= h(formatDate($invoice['due_date'])) ?></td>
|
|
<td><?= h($invoice['payment_method_label']) ?></td>
|
|
<td><?= h(formatCurrency((int) $invoice['total_cents'])) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php if ($invoices === []): ?>
|
|
<tr>
|
|
<td colspan="5">Noch keine Rechnungen vorhanden.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
|