58 lines
3.2 KiB
PHP
58 lines
3.2 KiB
PHP
<?php use Steuerkram\View; $h = fn($v) => View::h($v); ?>
|
||
|
||
<div style="display:grid;grid-template-columns:340px 1fr;gap:1.5rem;align-items:start">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<div class="card-title">Kundendaten</div>
|
||
<a href="/customers/<?= $h($customer['id']) ?>/edit" class="btn btn-secondary btn-sm">Bearbeiten</a>
|
||
</div>
|
||
<div class="card-body">
|
||
<table style="width:100%;border-collapse:collapse;font-size:.875rem">
|
||
<?php $row = fn($label, $val) => "<tr><td style='color:var(--color-muted);padding:.35rem 0;width:120px'>{$label}</td><td>{$val}</td></tr>"; ?>
|
||
<?= $row('Kundennr.', $h($customer['kundennummer'])) ?>
|
||
<?= $row('Name', $h(\Steuerkram\Models\Customer::displayName($customer))) ?>
|
||
<?php if ($customer['firma']): ?><?= $row('Firma', $h($customer['firma'])) ?><?php endif; ?>
|
||
<?= $row('Adresse', $h($customer['strasse']) . '<br>' . $h($customer['plz'] . ' ' . $customer['ort'])) ?>
|
||
<?= $row('E-Mail', $customer['email'] ? '<a href="mailto:'.$h($customer['email']).'">'.$h($customer['email']).'</a>' : '–') ?>
|
||
<?= $row('Telefon', $h($customer['telefon'] ?? '–')) ?>
|
||
<?= $row('USt-ID', $h($customer['ust_id'] ?? '–')) ?>
|
||
<?= $row('Zahlungsziel', $h($customer['payment_days']) . ' Tage') ?>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<div class="card-title">Rechnungen</div>
|
||
<a href="/invoices/new?customer_id=<?= $h($customer['id']) ?>" class="btn btn-primary btn-sm">+ Neue Rechnung</a>
|
||
</div>
|
||
<div class="table-wrap">
|
||
<table>
|
||
<thead>
|
||
<tr><th>Rechnungsnr.</th><th>Datum</th><th>Betreff</th><th class="td-right">Brutto</th><th>Status</th></tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($invoices as $inv): ?>
|
||
<tr>
|
||
<td><a href="/invoices/<?= $h($inv['id']) ?>"><?= $h($inv['rechnungs_nr'] ?? 'Entwurf') ?></a></td>
|
||
<td class="td-muted"><?= View::formatDate($inv['rechnungs_datum']) ?></td>
|
||
<td><?= $h(mb_strimwidth($inv['betreff'], 0, 40, '…')) ?></td>
|
||
<td class="td-right td-mono"><?= View::formatMoney($inv['betrag_brutto']) ?></td>
|
||
<td><?php
|
||
$bc = match($inv['status']) {
|
||
'Bezahlt' => 'badge-green',
|
||
'Storniert' => 'badge-red',
|
||
'Gesendet' => 'badge-yellow',
|
||
default => 'badge-gray',
|
||
};
|
||
?><span class="badge <?= $bc ?>"><?= $h($inv['status']) ?></span></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
<?php if (empty($invoices)): ?>
|
||
<tr><td colspan="5" class="text-center text-muted" style="padding:1.5rem">Noch keine Rechnungen.</td></tr>
|
||
<?php endif; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|