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

<?= $this->section('content') ?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <h2 class="h3 text-gray-800 mb-0">Edit Category: <?= esc($category['name']) ?></h2>
    <a href="<?= base_url('admin/categories') ?>" class="btn btn-secondary btn-sm"><i class="bi bi-arrow-left"></i> Back</a>
</div>

<div class="card shadow mb-4">
    <div class="card-body">
        <form action="<?= base_url('admin/categories/edit/' . $category['id']) ?>" method="post">
            <?= csrf_field() ?>
            
            <div class="mb-3">
                <label class="form-label">Category Name</label>
                <input type="text" class="form-control" name="name" value="<?= esc($category['name']) ?>" required>
            </div>

            <div class="mb-3">
                <label class="form-label">Description</label>
                <textarea class="form-control" name="description" rows="3"><?= esc($category['description']) ?></textarea>
            </div>

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

            <button type="submit" class="btn btn-primary" style="background-color: var(--primary-green); border-color: var(--primary-green);">Update Category</button>
        </form>
    </div>
</div>

<?= $this->endSection() ?>
