This commit is contained in:
2026-07-12 19:21:35 +02:00
parent f2d944b117
commit 41cb412cb0
49 changed files with 3170 additions and 52 deletions
+59
View File
@@ -0,0 +1,59 @@
<?= $this->extend('layout/main') ?>
<?= $this->section('content') ?>
<?php
$fmt = static fn ($v) => number_format((float) $v, 2, ',', ' ') . ' zł';
$badges = [
'parsing' => 'secondary',
'parsed' => 'info',
'failed' => 'danger',
'imported' => 'success',
];
?>
<div class="d-flex justify-content-between align-items-center 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">
<thead class="table-light">
<tr>
<th>Data</th>
<th>Sprzedawca</th>
<th class="text-end">Suma</th>
<th class="text-center">Pozycje</th>
<th class="text-center">Operacje</th>
<th>Status</th>
<th class="text-end">Akcje</th>
</tr>
</thead>
<tbody>
<?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">
<?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: ?>
<a href="<?= site_url('receipts/' . $r['id']) ?>" class="btn btn-sm btn-outline-secondary">Podgląd</a>
<?php endif; ?>
<a href="<?= site_url('receipts/' . $r['id'] . '/delete') ?>" class="btn btn-sm btn-outline-danger"
onclick="return confirm('Usunąć import?')">Usuń</a>
</td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
</div>
<?= $this->endSection() ?>