<?= $this->extend('admin/layout') ?>

<?= $this->section('content') ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <h1 class="h3 text-gray-800">Edit Certification</h1>
    <a href="<?= base_url('admin/certifications') ?>" class="btn btn-secondary">Back to List</a>
</div>

<div class="card shadow mb-4">
    <div class="card-body">
        <form action="<?= base_url('admin/certifications/edit/' . $certification['id']) ?>" method="POST" enctype="multipart/form-data">
            <div class="mb-3">
                <label for="title" class="form-label">Title (Optional)</label>
                <input type="text" class="form-control" id="title" name="title" value="<?= $certification['title'] ?>">
            </div>
            
            <div class="mb-3">
                <label for="image" class="form-label">Certification Image</label>
                <input type="file" class="form-control" id="image" name="image" accept="image/*">
                <?php if ($certification['image']): ?>
                    <div class="mt-2">
                        <img src="<?= base_url('uploads/certifications/' . $certification['image']) ?>" width="150" alt="Current Image">
                    </div>
                <?php endif; ?>
            </div>

            <div class="mb-3">
                <label for="sort_order" class="form-label">Sort Order</label>
                <input type="number" class="form-control" id="sort_order" name="sort_order" value="<?= $certification['sort_order'] ?>">
            </div>

            <div class="mb-3">
                <label for="status" class="form-label">Status</label>
                <select class="form-control" id="status" name="status">
                    <option value="1" <?= $certification['status'] == 1 ? 'selected' : '' ?>>Active</option>
                    <option value="0" <?= $certification['status'] == 0 ? 'selected' : '' ?>>Inactive</option>
                </select>
            </div>

            <button type="submit" class="btn btn-primary">Update</button>
        </form>
    </div>
</div>
<?= $this->endSection() ?>
