first commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?= $this->extend('layout/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
<h1 class="h4 mb-3"><?= esc($title) ?></h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<?php $action = $instrument ? site_url('instruments/' . $instrument['id']) : site_url('instruments'); ?>
|
||||
<?= form_open($action, ['class' => 'row g-3']) ?>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Nazwa instrumentu</label>
|
||||
<input type="text" name="name" class="form-control" required maxlength="120"
|
||||
value="<?= esc(old('name', $instrument['name'] ?? '')) ?>"
|
||||
placeholder="np. Obligacje, ETF">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary">Zapisz</button>
|
||||
<a href="<?= site_url('instruments') ?>" class="btn btn-link">Anuluj</a>
|
||||
</div>
|
||||
<?= form_close() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?= $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">Instrumenty</h1>
|
||||
<a href="<?= site_url('instruments/new') ?>" class="btn btn-primary">+ Nowy instrument</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>Instrument</th>
|
||||
<th class="text-end">Wpłacono netto</th>
|
||||
<th class="text-end">Wartość</th>
|
||||
<th class="text-end">Zarobek</th>
|
||||
<th class="text-end">%</th>
|
||||
<th class="text-end">Akcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($instruments)): ?>
|
||||
<tr><td colspan="6" class="text-center text-muted py-4">Brak instrumentów.</td></tr>
|
||||
<?php else: foreach ($instruments as $i): ?>
|
||||
<tr>
|
||||
<td><?= esc($i['name']) ?></td>
|
||||
<td class="text-end"><?= $fmt($i['net_invested']) ?></td>
|
||||
<td class="text-end"><?= $i['has_value'] ? $fmt($i['value']) : '<span class="text-muted">brak wyceny</span>' ?></td>
|
||||
<td class="text-end <?= $i['profit'] >= 0 ? 'amount-income' : 'amount-expense' ?>">
|
||||
<?= $i['has_value'] ? $fmt($i['profit']) : '—' ?>
|
||||
</td>
|
||||
<td class="text-end <?= $i['profit'] >= 0 ? 'amount-income' : 'amount-expense' ?>">
|
||||
<?= $i['percent'] !== null && $i['has_value'] ? number_format($i['percent'], 2, ',', ' ') . '%' : '—' ?>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<a href="<?= site_url('instruments/' . $i['id'] . '/edit') ?>" class="btn btn-sm btn-outline-secondary">Edytuj</a>
|
||||
<a href="<?= site_url('instruments/' . $i['id'] . '/delete') ?>" class="btn btn-sm btn-outline-danger"
|
||||
onclick="return confirm('Usunąć instrument?')">Usuń</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user