Files
finansePRO/app/Views/valuations/index.php
T
2026-07-06 20:16:00 +02:00

63 lines
2.7 KiB
PHP

<?= $this->extend('layout/main') ?>
<?= $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">
<h1 class="h4 mb-0">Wyceny</h1>
<a href="<?= site_url('investments/valuations/new') ?>" class="btn btn-primary">+ Nowa wycena</a>
</div>
<div class="card shadow-sm mb-3">
<div class="card-body">
<?= form_open('investments/valuations', ['method' => 'get', 'class' => 'row g-2 align-items-end']) ?>
<div class="col-8 col-md-4">
<label class="form-label small mb-1">Instrument</label>
<select name="instrument_id" class="form-select">
<option value="">— wszystkie —</option>
<?php foreach ($instruments as $i): ?>
<option value="<?= $i['id'] ?>" <?= (string) ($filter['instrument_id'] ?? '') === (string) $i['id'] ? 'selected' : '' ?>>
<?= esc($i['name']) ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="col-4 col-md-2">
<button class="btn btn-outline-primary w-100">Filtruj</button>
</div>
<?= form_close() ?>
</div>
</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>Instrument</th>
<th class="text-end">Wartość</th>
<th class="text-end">Akcje</th>
</tr>
</thead>
<tbody>
<?php if (empty($valuations)): ?>
<tr><td colspan="4" class="text-center text-muted py-4">Brak wycen.</td></tr>
<?php else: foreach ($valuations as $v): ?>
<tr>
<td><?= esc($v['date']) ?></td>
<td><?= esc($v['instrument_name'] ?? '—') ?></td>
<td class="text-end"><?= $fmt($v['value']) ?></td>
<td class="text-end">
<a href="<?= site_url('investments/valuations/' . $v['id'] . '/edit') ?>" class="btn btn-sm btn-outline-secondary">Edytuj</a>
<a href="<?= site_url('investments/valuations/' . $v['id'] . '/delete') ?>" class="btn btn-sm btn-outline-danger"
onclick="return confirm('Usunąć wycenę?')">Usuń</a>
</td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
</div>
<?= $this->endSection() ?>