<?php $__env->startSection('title', 'Data Galeri Foto'); ?>

<?php $__env->startSection('content'); ?>
    <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 active" aria-current="page">Data Gallery</li>
            </ol>
        </nav>
        <div class="row">
            <div class="col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <div class="panel-heading mb-3 d-flex justify-content-between align-items-center">
                            <h1 class="card-title">Data Gallery</h1>
                            <a href="<?php echo e(route('gallery.create')); ?>" class="btn btn-primary">
                                <i class="fa fa-plus fa-fw"></i> Tambah Foto
                            </a>
                        </div>
                        <div class="panel-body">
                            <?php if(session('success')): ?>
                                <div class="alert alert-success alert-dismissible fade show" role="alert">
                                    <?php echo e(session('success')); ?>

                                    <button type="button" class="btn-close" data-bs-dismiss="alert"
                                        aria-label="Close"></button>
                                </div>
                            <?php endif; ?>
                            <div class="table-responsive">
                                <table class="table table-bordered table-striped">
                                    <thead>
                                        <tr>
                                            <th>No</th>
                                            <th>Kategori</th>
                                            <th>File</th>
                                            <th>Aktif</th>
                                            <th>Dibuat Pada</th>
                                            <th>Aksi</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__empty_1 = true; $__currentLoopData = $image; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                            <tr>
                                                <td><?php echo e(($image->currentPage() - 1) * $image->perPage() + $index + 1); ?>

                                                </td>
                                                <td><?php echo e($item->kategori); ?></td>
                                                <td>
                                                    <?php if($item->file): ?>
                                                        <img src="<?php echo e(asset('storage/galleryFoto/' . $item->file)); ?>"
                                                            alt="gambar"
                                                            style="width: 50px; height: 50px; object-fit: cover;">
                                                    <?php else: ?>
                                                        <span class="text-muted">Tidak Ada</span>
                                                    <?php endif; ?>
                                                </td>
                                                <td><?php echo e($item->active ? 'Aktif' : 'Tidak Aktif'); ?></td>
                                                <td><?php echo e($item->created_at); ?></td>
                                                <td>
                                                    <div class="d-flex flex-wrap gap-2">
                                                        <a href="<?php echo e(route('gallery.edit', $item->image_id)); ?>"
                                                            class="btn btn-warning btn-sm">Edit</a>
                                                        <form action="<?php echo e(route('gallery.delete', $item->image_id)); ?>"
                                                            method="POST" style="display:inline-block;">
                                                            <?php echo csrf_field(); ?>
                                                            <?php echo method_field('DELETE'); ?>
                                                            <button type="submit" class="btn btn-danger btn-sm"
                                                                onclick="return confirm('Yakin ingin menghapus?')">Hapus</button>
                                                        </form>
                                                    </div>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                            <tr>
                                                <td colspan="6" class="text-center">Tidak ada foto di galeri</td>
                                            </tr>
                                        <?php endif; ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="mt-3">
                            <?php echo e($image->links('vendor.pagination.simple-bootstrap-5')); ?>

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

<?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/index.blade.php ENDPATH**/ ?>