<?= $this->extend('admin/layout/main') ?>
<?= $this->section('content') ?>
<div class="d-flex justify-content-between align-items-center mb-3">
    <h3><?= lang('App.exchange_rates') ?></h3>
    <a href="/admin/exchange-rates/create" class="btn btn-dark btn-sm"><?= lang('App.add_new') ?></a>
</div>
<div class="card p-3">
<table class="table">
    <thead><tr><th>من</th><th>إلى</th><th>السعر</th><th>التاريخ</th><th><?= lang('App.actions') ?></th></tr></thead>
    <tbody>
    <?php foreach ($rates as $r): ?>
        <tr>
            <td><?= esc($r['currency_from']) ?></td>
            <td><?= esc($r['currency_to']) ?></td>
            <td><?= esc($r['rate']) ?></td>
            <td><?= esc($r['date']) ?></td>
            <td>
                <a href="/admin/exchange-rates/<?= $r['id'] ?>/edit" class="btn btn-sm btn-outline-primary"><?= lang('App.edit') ?></a>
                <form method="post" action="/admin/exchange-rates/<?= $r['id'] ?>/delete" class="d-inline" onsubmit="return confirm('?')">
                    <?= csrf_field() ?><button class="btn btn-sm btn-outline-danger"><?= lang('App.delete') ?></button>
                </form>
            </td>
        </tr>
    <?php endforeach; ?>
    </tbody>
</table>
<?= $pager->links() ?>
</div>
<?= $this->endSection() ?>
