<?= $this->extend('admin/layout/main') ?>
<?= $this->section('content') ?>
<h3 class="mb-3"><?= $currency ? lang('App.edit') : lang('App.add_new') ?> - <?= lang('App.currencies') ?></h3>
<div class="card p-4" style="max-width:450px;">
<form method="post" action="<?= $currency ? '/admin/currencies/' . $currency['id'] : '/admin/currencies' ?>">
    <?= csrf_field() ?>
    <div class="mb-3">
        <label class="form-label">كود العملة (3 أحرف)</label>
        <input type="text" name="code" class="form-control" maxlength="3" style="text-transform:uppercase;" placeholder="USD" value="<?= esc($currency['code'] ?? '') ?>" required>
    </div>
    <div class="mb-3">
        <label class="form-label">اسم العملة</label>
        <input type="text" name="name" class="form-control" placeholder="دولار أمريكي" value="<?= esc($currency['name'] ?? '') ?>" required>
    </div>
    <div class="mb-3">
        <label class="form-label">الرمز (اختياري)</label>
        <input type="text" name="symbol" class="form-control" placeholder="$" value="<?= esc($currency['symbol'] ?? '') ?>">
    </div>
    <div class="form-check mb-3">
        <input type="checkbox" name="is_default" class="form-check-input" value="1" <?= ($currency['is_default'] ?? 0) ? 'checked' : '' ?>>
        <label class="form-check-label">العملة الافتراضية (تظهر مختارة تلقائياً بالفورمات)</label>
    </div>
    <div class="form-check mb-3">
        <input type="checkbox" name="is_active" class="form-check-input" value="1" <?= ($currency['is_active'] ?? 1) ? 'checked' : '' ?>>
        <label class="form-check-label"><?= lang('App.status') ?></label>
    </div>
    <button class="btn btn-dark"><?= lang('App.save') ?></button>
    <a href="/admin/currencies" class="btn btn-light"><?= lang('App.cancel') ?></a>
</form>
</div>
<?= $this->endSection() ?>
