<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<form class="panel" method="post" enctype="multipart/form-data" action="<?= base_url('admin/galeri/' . $item['id']) ?>">
    <?= csrf_field() ?>
    <input type="hidden" name="_method" value="PUT">
    <div class="row g-4">
        <div class="col-md-4">
            <img class="gallery-thumb" src="<?= base_url($item['foto']) ?>" alt="<?= esc($item['caption'] ?: 'Foto galeri') ?>">
        </div>
        <div class="col-md-8">
            <div class="mb-3">
                <label class="form-label">Ganti Foto</label>
                <input class="form-control" type="file" name="foto" accept=".jpg,.jpeg,.png,.webp">
                <div class="form-text">Opsional. Maksimal 5 MB.</div>
            </div>
            <div class="mb-3">
                <label class="form-label">Caption</label>
                <input class="form-control" name="caption" maxlength="180" value="<?= esc(old('caption', $item['caption'])) ?>">
            </div>
            <div class="mb-3">
                <label class="form-label">Urutan</label>
                <input class="form-control" type="number" name="urutan" value="<?= esc(old('urutan', $item['urutan'])) ?>">
            </div>
            <button class="btn btn-emerald"><i class="bi bi-save me-1"></i>Simpan</button>
            <a class="btn btn-light" href="<?= base_url('admin/galeri') ?>">Batal</a>
        </div>
    </div>
</form>
<?= $this->endSection() ?>
