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

<?= $this->section('content') ?>
<h1 class="h3 mb-4 text-gray-800">Upload Gallery Images</h1>

<div class="card shadow mb-4">
    <div class="card-body">
        <form action="<?= base_url('admin/gallery/create') ?>" method="post" enctype="multipart/form-data">
            <?= csrf_field() ?>
            <div class="mb-3">
                <label>Select Category</label>
                <select name="category_id" class="form-control mb-2">
                    <option value="">-- Select Category --</option>
                    <?php foreach ($categories as $cat): ?>
                        <option value="<?= $cat['id'] ?>"><?= $cat['name'] ?></option>
                    <?php endforeach; ?>
                </select>
                <label>Or Create New Category</label>
                <input type="text" name="new_category" class="form-control" placeholder="Enter new category name">
            </div>
            
            <div class="mb-3">
                <label>Images</label>
                <input type="file" name="images[]" class="form-control" required accept="image/*" multiple>
                <small class="text-muted">You can select multiple images</small>
            </div>
            
            <div class="mb-3">
                <label>Title (Optional)</label>
                <input type="text" name="title" class="form-control" placeholder="Applied to all selected images">
            </div>
            
            <button type="submit" class="btn btn-success">Upload Images</button>
            <a href="<?= base_url('admin/gallery') ?>" class="btn btn-secondary">Cancel</a>
        </form>
    </div>
</div>
<?= $this->endSection() ?>
