78 lines
3.7 KiB
PHP
78 lines
3.7 KiB
PHP
<?php use Steuerkram\View; $h = fn($v) => View::h($v); ?>
|
||
|
||
<div class="toolbar">
|
||
<div class="toolbar-left">
|
||
<form method="get" style="display:flex;gap:.5rem;align-items:center">
|
||
<input type="search" name="search" placeholder="Suche Kto.-Nr. oder Bezeichnung…"
|
||
value="<?= $h($filter['search'] ?? '') ?>" style="width:260px">
|
||
<select name="kontenart">
|
||
<option value="">Alle Kontenarten</option>
|
||
<?php foreach (['Betriebseinnahme','Betriebsausgabe','Zahlungskonto','Verbindlichkeit','Privat'] as $art): ?>
|
||
<option value="<?= $h($art) ?>"<?= ($filter['kontenart'] ?? '') === $art ? ' selected' : '' ?>><?= $h($art) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<button type="submit" class="btn btn-secondary">Filtern</button>
|
||
<?php if (!empty($filter['search']) || !empty($filter['kontenart'])): ?>
|
||
<a href="/accounts" class="btn btn-secondary">✕ Reset</a>
|
||
<?php endif; ?>
|
||
</form>
|
||
</div>
|
||
<div class="toolbar-right">
|
||
<span class="text-muted text-sm"><?= count($accounts) ?> Konten</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<div class="table-wrap">
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Kontonummer</th>
|
||
<th>Bezeichnung</th>
|
||
<th>Kontenart</th>
|
||
<th>Steuercode</th>
|
||
<th>UStVA Kz</th>
|
||
<th>EÜR-Zeile</th>
|
||
<th>Beschreibung</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($accounts as $acc): ?>
|
||
<tr>
|
||
<td class="td-mono font-bold"><?= $h($acc['kontonummer']) ?></td>
|
||
<td><?= $h($acc['bezeichnung']) ?></td>
|
||
<td>
|
||
<?php
|
||
$badgeClass = match($acc['kontenart']) {
|
||
'Betriebseinnahme' => 'badge-green',
|
||
'Betriebsausgabe' => 'badge-red',
|
||
'Zahlungskonto' => 'badge-blue',
|
||
'Verbindlichkeit' => 'badge-yellow',
|
||
default => 'badge-gray',
|
||
};
|
||
?>
|
||
<span class="badge <?= $badgeClass ?>"><?= $h($acc['kontenart']) ?></span>
|
||
</td>
|
||
<td class="td-muted"><?= $h($acc['steuercode'] ?? '–') ?></td>
|
||
<td class="td-muted"><?= $h($acc['ustva_kz'] ?? '–') ?></td>
|
||
<td class="td-muted"><?= $h($acc['euer_zeile'] ?? '–') ?></td>
|
||
<td class="td-muted text-sm"><?= $h(mb_strimwidth($acc['beschreibung'] ?? '', 0, 60, '…')) ?></td>
|
||
<td>
|
||
<div style="display:flex;gap:.5rem">
|
||
<a href="/accounts/<?= $h($acc['id']) ?>/edit" class="btn btn-secondary btn-sm">Bearbeiten</a>
|
||
<form method="post" action="/accounts/<?= $h($acc['id']) ?>/delete"
|
||
data-confirm="Konto '<?= $h($acc['kontonummer']) ?>' wirklich löschen?">
|
||
<button type="submit" class="btn btn-danger btn-sm">Löschen</button>
|
||
</form>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
<?php if (empty($accounts)): ?>
|
||
<tr><td colspan="8" class="text-center text-muted" style="padding:2rem">Keine Konten gefunden.</td></tr>
|
||
<?php endif; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|