
<?php $__env->startSection('pageTitle', $pageTitle); ?>
<?php $__env->startSection('meta_tags'); ?> <?php echo SEO::generate(); ?> <?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<section class="section py-5">
    <div class="container">
        <!-- Header -->
        <div class="row mb-4">
            <div class="col-12">
                <div class="d-flex justify-content-between align-items-center flex-wrap">
                    <h3 class="mb-0"><?php echo e($album->title); ?></h3>
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb bg-transparent mb-0 px-0">
                            <li class="breadcrumb-item"><a href="<?php echo e(url('/')); ?>">Home</a></li>
                            <li class="breadcrumb-item"><a href="<?php echo e(route('photo_gallery')); ?>">Photo Gallery</a></li>
                            <li class="breadcrumb-item active" aria-current="page"><?php echo e($album->title); ?></li>
                        </ol>
                    </nav>
                </div>
                <hr>
            </div>
        </div>

        <div id="photo-loading" class="text-center py-5">
            <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
                <span class="visually-hidden">Loading...</span>
            </div>
        </div>
        <!-- Photo Grid -->
        <?php if($photos->count()): ?>
        <!-- Photo Grid -->
        <div id="photo-grid" class="row" data-masonry='{"itemSelector": ".masonry-item", "percentPosition": true }'>
            <?php $__currentLoopData = $photos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $photo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="col-6 col-md-4 col-lg-3 mb-4 masonry-item">
                <a href="<?php echo e(asset('images/albums/' . $photo->photo_path)); ?>" class="glightbox" data-gallery="album-gallery">
                    <img src="<?php echo e(asset('images/albums/' . $photo->photo_path)); ?>" class="img-fluid card-radius w-100" alt="Photo">
                </a>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>


        <?php else: ?>
        <div class="text-center py-5">
            <p class="text-muted">No photos found in this album.</p>
        </div>
        <?php endif; ?>
    </div>
</section>

<?php $__env->stopSection(); ?>
<?php $__env->startPush('scripts'); ?>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        const loader = document.getElementById('photo-loading');
        const gridContainer = document.getElementById('photo-grid-container');
        const grid = document.getElementById('photo-grid');

        if (!grid || grid.children.length === 0) {
            // No photos — hide loader and show empty state if any
            loader.style.display = 'none';
            return;
        }

        imagesLoaded(grid, function () {
            new Masonry(grid, {
                itemSelector: '.masonry-item',
                percentPosition: true,
                columnWidth: '.masonry-item'
            });

            GLightbox({ selector: '.glightbox' });

            loader.style.display = 'none';
            gridContainer.style.display = 'block';
        });
    });
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('front.layout.pages-layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\larablog\resources\views/front/pages/photo-gallery/album-view.blade.php ENDPATH**/ ?>