<?php $__env->startSection('title', 'Edit Gambar Galeri'); ?>

<?php $__env->startSection('content'); ?>
    <?php $__env->startPush('style'); ?>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Dropify/0.2.2/css/dropify.min.css"
            integrity="sha512-EZSUkJWTjzDlspOoPSpUFR0o0Xy7jdzW//6qhUkoZ9c4StFkVsp9fbbd0O06p9ELS3H486m4wmrCELjza4JEog=="
            crossorigin="anonymous" referrerpolicy="no-referrer" />
    <?php $__env->stopPush(); ?>
    <div class="page-content">
        <nav class="page-breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Dashboard</a></li>
                <li class="breadcrumb-item"><a href="<?php echo e(route('gallery.index')); ?>">Data Gallery</a></li>
                <li class="breadcrumb-item active" aria-current="page">Edit Gambar</li>
            </ol>
        </nav>

        <div class="row">
            <div class="stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title">Edit Gambar Galeri</h4>

                        <?php if($errors->any()): ?>
                            <div id="error-alert" class="alert alert-danger">
                                <strong>Terjadi Kesalahan!</strong>
                                <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 Edit Gambar -->
                        <form action="<?php echo e(route('gallery.update', $images->image_id)); ?>" method="POST"
                            enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('PUT'); ?> <!-- Menggunakan metode PUT untuk update -->

                            <div class="form-group mb-4">
                                <label for="kategori" class="form-label">Kategori</label>
                                <select class="form-control <?php $__errorArgs = ['kategori'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="kategori"
                                    name="kategori">
                                    <option value="Event Kampus"
                                        <?php echo e(old('kategori', $images->kategori) == 'Event Kampus' ? 'selected' : ''); ?>>Event
                                        Kampus</option>
                                    <option value="Fasilitas Kampus"
                                        <?php echo e(old('kategori', $images->kategori) == 'Fasilitas Kampus' ? 'selected' : ''); ?>>
                                        Fasilitas Kampus</option>
                                    <option value="Kegiatan Mahasiswa"
                                        <?php echo e(old('kategori', $images->kategori) == 'Kegiatan Mahasiswa' ? 'selected' : ''); ?>>
                                        Kegiatan Mahasiswa</option>
                                </select>
                                <?php $__errorArgs = ['kategori'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="invalid-feedback"><?php echo e($message); ?></div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div class="mb-3">
                                <label for="file" class="form-label">gambar</label>
                                <input type="file" class="form-control dropify" id="file"
                                    data-default-file="<?php echo e($images->file ? asset('storage/galleryFoto/' . $images->file) : 'https://kuliahkaryawan.net/assets/images/logok2-shadow.png'); ?>"
                                    name="file">
                            </div>

                            <div class="form-check mb-4">
                                <input type="checkbox" class="form-check-input" id="active" name="active"
                                    <?php echo e(old('active', $images->active) == '1' ? 'checked' : ''); ?>>
                                <label class="form-check-label" for="active">Aktif</label>
                            </div>


                            <button type="submit" class="btn btn-primary mt-3">Simpan</button>
                            <a href="<?php echo e(route('gallery.index')); ?>" class="btn btn-secondary mt-3">Kembali</a>
                        </form>


                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Dropify/0.2.2/js/dropify.min.js"
        integrity="sha512-8QFTrG0oeOiyWo/VM9Y8kgxdlCryqhIxVeRpWSezdRRAvarxVtwLnGroJgnVW9/XBRduxO/z1GblzPrMQoeuew=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script>
        // Inisialisasi Dropify untuk file input
        $('.dropify').dropify();
    </script>
    <script>
        // Fungsi untuk menghilangkan alert error setelah 10 detik
        document.addEventListener("DOMContentLoaded", function() {
            const errorAlert = document.getElementById("error-alert");
            if (errorAlert) {
                setTimeout(() => {
                    errorAlert.style.display = "none";
                }, 10000); // 10 detik
            }
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('dashboard.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/u768956174/domains/stisipimambonjol.info/STISIP-IMAM-BONJOL/resources/views/admin/gallery/edit.blade.php ENDPATH**/ ?>