This commit is contained in:
2026-07-13 21:46:29 +02:00
parent 41cb412cb0
commit 9d96ecadfb
17 changed files with 638 additions and 124 deletions
+36 -10
View File
@@ -11,14 +11,14 @@ $badges = [
];
?>
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="d-flex flex-column flex-sm-row justify-content-between align-items-sm-center gap-2 mb-3">
<h1 class="h4 mb-0">Import paragonów</h1>
<a href="<?= site_url('receipts/new') ?>" class="btn btn-primary">+ Nowy import</a>
</div>
<div class="card shadow-sm">
<div class="table-responsive">
<table class="table table-hover mb-0 align-middle">
<table class="table table-hover mb-0 align-middle receipt-history">
<thead class="table-light">
<tr>
<th>Data</th>
@@ -34,14 +34,14 @@ $badges = [
<?php if (empty($receipts)): ?>
<tr><td colspan="7" class="text-center text-muted py-4">Brak zaimportowanych paragonów.</td></tr>
<?php else: foreach ($receipts as $r): ?>
<tr>
<td><?= esc($r['receipt_date'] ?: mb_substr((string) $r['created_at'], 0, 10)) ?></td>
<td><?= esc($r['merchant'] ?: '—') ?></td>
<td class="text-end"><?= $r['total'] !== null ? $fmt($r['total']) : '—' ?></td>
<td class="text-center"><?= (int) $r['items_count'] ?></td>
<td class="text-center"><?= (int) $r['operations_count'] ?></td>
<td><span class="badge bg-<?= $badges[$r['status']] ?? 'secondary' ?>"><?= esc($r['status']) ?></span></td>
<td class="text-end">
<tr class="receipt-row">
<td data-label="Data"><?= esc($r['receipt_date'] ?: mb_substr((string) $r['created_at'], 0, 10)) ?></td>
<td data-label="Sprzedawca"><?= esc($r['merchant'] ?: '—') ?></td>
<td data-label="Suma" class="text-end"><?= $r['total'] !== null ? $fmt($r['total']) : '—' ?></td>
<td data-label="Pozycje" class="text-center"><?= (int) $r['items_count'] ?></td>
<td data-label="Operacje" class="text-center"><?= (int) $r['operations_count'] ?></td>
<td data-label="Status"><span class="badge bg-<?= $badges[$r['status']] ?? 'secondary' ?>"><?= esc($r['status']) ?></span></td>
<td data-label="Akcje" class="text-end receipt-actions">
<?php if ($r['status'] === 'parsed'): ?>
<a href="<?= site_url('receipts/' . $r['id'] . '/review') ?>" class="btn btn-sm btn-outline-primary">Przegląd</a>
<?php else: ?>
@@ -56,4 +56,30 @@ $badges = [
</table>
</div>
</div>
<style>
@media (max-width: 767.98px) {
.receipt-history thead { display: none; }
.receipt-history, .receipt-history tbody, .receipt-history .receipt-row, .receipt-history .receipt-row td {
display: block;
width: 100%;
}
.receipt-history .receipt-row { padding: .75rem; border-bottom: 1px solid var(--bs-border-color); }
.receipt-history .receipt-row td {
display: flex;
justify-content: space-between;
gap: 1rem;
padding: .3rem 0;
border: 0;
text-align: right !important;
}
.receipt-history .receipt-row td::before {
content: attr(data-label);
color: var(--bs-secondary-color);
font-size: .875em;
text-align: left;
}
.receipt-history .receipt-actions { align-items: center; flex-wrap: wrap; }
}
</style>
<?= $this->endSection() ?>