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
+38 -9
View File
@@ -3,7 +3,7 @@
<?= $this->section('content') ?>
<?php $fmt = static fn ($v) => number_format((float) $v, 2, ',', ' ') . ' zł'; ?>
<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">Operacje inwestycyjne</h1>
<a href="<?= site_url('investments/operations/new') ?>" class="btn btn-primary">+ Nowa operacja</a>
</div>
@@ -47,7 +47,7 @@
<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 inv-operation-history">
<thead class="table-light">
<tr>
<th>Data</th>
@@ -63,19 +63,19 @@
<tr><td colspan="6" class="text-center text-muted py-4">Brak operacji dla wybranych filtrów.</td></tr>
<?php else: foreach ($operations as $o): ?>
<?php $isDep = $o['type'] === 'deposit'; ?>
<tr>
<td><?= esc($o['date']) ?></td>
<td><?= esc($o['instrument_name'] ?? '—') ?></td>
<td>
<tr class="operation-row">
<td data-label="Data"><?= esc($o['date']) ?></td>
<td data-label="Instrument"><?= esc($o['instrument_name'] ?? '—') ?></td>
<td data-label="Typ">
<span class="badge <?= $isDep ? 'bg-success' : 'bg-secondary' ?>">
<?= $isDep ? 'Wpłata' : 'Wypłata' ?>
</span>
</td>
<td class="text-muted"><?= esc($o['description'] ?? '') ?></td>
<td class="text-end <?= $isDep ? 'amount-income' : 'amount-expense' ?>">
<td data-label="Opis" class="text-muted"><?= esc($o['description'] ?? '') ?></td>
<td data-label="Kwota" class="text-end <?= $isDep ? 'amount-income' : 'amount-expense' ?>">
<?= $isDep ? '+' : '' ?><?= $fmt($o['amount']) ?>
</td>
<td class="text-end">
<td data-label="Akcje" class="text-end operation-actions">
<a href="<?= site_url('investments/operations/' . $o['id'] . '/edit') ?>" class="btn btn-sm btn-outline-secondary">Edytuj</a>
<a href="<?= site_url('investments/operations/' . $o['id'] . '/delete') ?>" class="btn btn-sm btn-outline-danger"
onclick="return confirm('Usunąć operację?')">Usuń</a>
@@ -86,4 +86,33 @@
</table>
</div>
</div>
<style>
@media (max-width: 767.98px) {
.inv-operation-history thead { display: none; }
.inv-operation-history, .inv-operation-history tbody,
.inv-operation-history .operation-row, .inv-operation-history .operation-row td {
display: block;
width: 100%;
}
.inv-operation-history .operation-row { padding: .75rem; border-bottom: 1px solid var(--bs-border-color); }
.inv-operation-history .operation-row td {
display: flex;
justify-content: space-between;
gap: 1rem;
padding: .3rem 0;
border: 0;
text-align: right !important;
overflow-wrap: anywhere;
}
.inv-operation-history .operation-row td::before {
content: attr(data-label);
flex: 0 0 auto;
color: var(--bs-secondary-color);
font-size: .875em;
text-align: left;
}
.inv-operation-history .operation-actions { align-items: center; flex-wrap: wrap; }
}
</style>
<?= $this->endSection() ?>