120 lines
4.9 KiB
PHP
120 lines
4.9 KiB
PHP
<section class="admin-section">
|
|
<div class="section-header">
|
|
<div>
|
|
<p class="eyebrow">Dashboard</p>
|
|
<h1>Anfragen, Buchungen und Rechnungen</h1>
|
|
</div>
|
|
<a class="button-primary" href="<?= h(url('admin/create')) ?>">Bestellung fuer Kunden anlegen</a>
|
|
</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 Auftraege</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>Bestaetigte 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>Auftraege</h2>
|
|
<span><?= h((string) count($bookings)) ?> Eintraege</span>
|
|
</div>
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Referenz</th>
|
|
<th>Kunde</th>
|
|
<th>Termin</th>
|
|
<th>Status</th>
|
|
<th>Zahlung</th>
|
|
<th>Preis</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($bookings 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'])) ?> - <?= h(formatDate($booking['end_date'])) ?></td>
|
|
<td><?= h($booking['status_label']) ?></td>
|
|
<td><?= h($booking['payment_status_label']) ?></td>
|
|
<td><?= h(formatCurrency((int) $booking['subtotal_cents'])) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php if ($bookings === []): ?>
|
|
<tr>
|
|
<td colspan="6">Noch keine Auftraege vorhanden.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="table-card">
|
|
<div class="table-card-header">
|
|
<h2>Rechnungen</h2>
|
|
<span><?= h((string) count($invoices)) ?> Eintraege</span>
|
|
</div>
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Nummer</th>
|
|
<th>Auftrag</th>
|
|
<th>Faellig</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 erstellt.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</section>
|