

<?php $__env->startSection('content'); ?>
<div class="container">
    <h1 class="mb-4"><?php echo e(isset($gallery) ? 'Edit Gallery' : 'Add New Gallery'); ?></h1>

    <a href="<?php echo e(route('galleries.index')); ?>" class="btn btn-secondary mb-3">Back to List</a>

    <?php if($errors->any()): ?>
        <div class="alert alert-danger">
            <ul>
                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><?php echo e($error); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    <?php endif; ?>

    <form action="<?php echo e(isset($gallery) ? route('galleries.update', $gallery->id) : route('galleries.store')); ?>" method="POST" enctype="multipart/form-data">
        <?php echo csrf_field(); ?>
        <?php if(isset($gallery)): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>

        <div class="mb-3">
            <label for="floor_id" class="form-label">Select Floor</label>
            <select name="floor_id" class="form-control" required>
                <option value="">-- Select Floor --</option>
                <?php $__currentLoopData = $floors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $floor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($floor->id); ?>" <?php echo e(isset($gallery) && $gallery->floor_id == $floor->id ? 'selected' : ''); ?>>
                        <?php echo e($floor->floor_name); ?>

                    </option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>

        <div class="mb-3">
            <label for="gallery_name" class="form-label">Gallery Name</label>
            <input type="text" name="gallery_name" class="form-control" value="<?php echo e($gallery->gallery_name ?? old('gallery_name')); ?>" required>
        </div>

        <div class="mb-3">
            <label for="language" class="form-label">Language</label>
            <select name="language" class="form-control" required>
                <option value="English" <?php echo e(isset($gallery) && $gallery->language == 'English' ? 'selected' : ''); ?>>English</option>
                <option value="Malayalam" <?php echo e(isset($gallery) && $gallery->language == 'Malayalam' ? 'selected' : ''); ?>>Malayalam</option>
                <option value="Hindi" <?php echo e(isset($gallery) && $gallery->language == 'Hindi' ? 'selected' : ''); ?>>Hindi</option>
                <option value="Tamil" <?php echo e(isset($gallery) && $gallery->language == 'Tamil' ? 'selected' : ''); ?>>Tamil</option>
            </select>
        </div>

        <div class="mb-3">
            <label for="short_description" class="form-label">Short Description</label>
            <textarea name="short_description" class="form-control" rows="3"><?php echo e($gallery->short_description ?? old('short_description')); ?></textarea>
        </div>

        <div class="mb-3">
            <label for="gallery_icon_path" class="form-label">Gallery Icon (optional)</label>
            <input type="file" name="gallery_icon_path" class="form-control">
            <?php if(isset($gallery) && $gallery->gallery_icon_path): ?>
                <img src="<?php echo e(asset('storage/' . $gallery->gallery_icon_path)); ?>" width="50" class="mt-2">
            <?php endif; ?>
        </div>

        <div class="mb-3">
            <label for="next_gallery_id" class="form-label">Next Gallery</label>
            <select name="next_gallery_id" class="form-control">
                <option value="">-- Select Next Gallery --</option>
                <?php $__currentLoopData = $galleries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $g): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($g->id); ?>" <?php echo e(isset($gallery) && $gallery->next_gallery_id == $g->id ? 'selected' : ''); ?>>
                        <?php echo e($g->gallery_name); ?>

                    </option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>

        <button type="submit" class="btn btn-success"><?php echo e(isset($gallery) ? 'Update' : 'Create'); ?></button>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/museum-app/resources/views/galleries/create.blade.php ENDPATH**/ ?>