

<?php $__env->startSection('title', $collectionName . ' - ' . \App\Models\Setting::get('site_name', 'KiyoKart')); ?>

<?php $__env->startPush('styles'); ?>
<link rel="stylesheet" href="<?php echo e(asset('css/homepage.css')); ?>">
<style>
    .select2-results__option--highlighted {
        background-color: var(--color-primary) !important;
        color: white !important;
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('head'); ?>
<link rel="canonical" href="<?php echo e(route('collections.show', $collectionSlug)); ?>">
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<!-- Page Header -->
<section class="page-header py-4">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-md-8">
                <h1 class="mb-2"><?php echo e(strtoupper($collectionName)); ?></h1>
                <?php if($collectionType === 'category' && $category && $category->description): ?>
                    <p class="mb-0"><?php echo e($category->description); ?></p>
                <?php elseif($collectionType === 'special'): ?>
                    <p class="mb-0">
                        <?php if($collectionSlug === 'best-sellers'): ?>
                            Our most popular products loved by customers
                        <?php elseif($collectionSlug === 'new-arrivals'): ?>
                            Discover our latest products just added to the collection
                        <?php endif; ?>
                    </p>
                <?php else: ?>
                    <p class="mb-0">Shop our curated collection</p>
                <?php endif; ?>
            </div>
            <div class="col-md-4 text-end">
                <!-- Breadcrumb Navigation -->
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb justify-content-end mb-0">
                        <li class="breadcrumb-item">
                            <a href="<?php echo e(route('home')); ?>">Home</a>
                        </li>
                        <li class="breadcrumb-item">
                            <a href="<?php echo e(route('collections.show', 'best-sellers')); ?>">Collections</a>
                        </li>
                        <li class="breadcrumb-item active"><?php echo e($collectionName); ?></li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>
</section>



<!-- Filter & Count Section -->
<section class="filter-section py-3 mb-4">
    <div class="container">
        <div class="row align-items-center g-3">
            <div class="col-md-8">
                <p class="mb-0 text-muted">
                    Showing <strong><?php echo e($products->firstItem() ?? 0); ?></strong> to <strong><?php echo e($products->lastItem() ?? 0); ?></strong> 
                    of <strong><?php echo e($products->total()); ?></strong> 
                    <?php if($collectionType === 'category'): ?>
                        <?php if(isset($isParentCategory) && $isParentCategory): ?>
                            products in <?php echo e($collectionName); ?> and subcategories
                        <?php else: ?>
                            products in <?php echo e($collectionName); ?>

                        <?php endif; ?>
                    <?php else: ?>
                        product<?php echo e($products->total() !== 1 ? 's' : ''); ?>

                    <?php endif; ?>
                </p>
            </div>
            <div class="col-md-4 d-flex justify-content-md-end">
                <?php ($currentSort = request('sort')); ?>
                <form method="GET" action="<?php echo e(route('collections.show', $collectionSlug)); ?>" class="d-flex align-items-center gap-2 w-100">
                    <?php $__currentLoopData = request()->except('sort', 'page'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if(is_array($value)): ?>
                            <?php $__currentLoopData = $value; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <input type="hidden" name="<?php echo e($key); ?>[]" value="<?php echo e($item); ?>">
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php else: ?>
                            <input type="hidden" name="<?php echo e($key); ?>" value="<?php echo e($value); ?>">
                        <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <label for="sortSelect" class="mb-0 text-muted text-nowrap">Sort by:</label>
                    <select id="sortSelect" name="sort" class="form-select selectpicker" data-style="btn-primary" onchange="this.form.submit()">
                        <option value="" <?php echo e($currentSort === null || $currentSort === 'newest' ? 'selected' : ''); ?>>Newest</option>
                        <option value="price_asc" <?php echo e($currentSort === 'price_asc' ? 'selected' : ''); ?>>Low to High</option>
                        <option value="price_desc" <?php echo e($currentSort === 'price_desc' ? 'selected' : ''); ?>>High to Low</option>
                        <option value="most_sale" <?php echo e($currentSort === 'most_sale' ? 'selected' : ''); ?>>Popular Products</option>
                    </select>
                </form>
            </div>
        </div>
    </div>
</section>

<!-- Products Grid -->
<section class="products-section">
    <div class="container product-page-wrapper">
        <div class="products-with-sidebar">
            <!-- Category Filter Sidebar -->
            <?php echo $__env->make('partials.category-filter-sidebar', [
                'categoriesWithCounts' => $categoriesWithCounts,
                'selectedCategoryIds' => $selectedCategoryIds ?? [],
                'formAction' => route('collections.show', $collectionSlug)
            ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <!-- Products Content -->
            <div class="products-content">
                <?php if($products->count() > 0): ?>
                    <div class="row g-4">
                        <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-6 col-md-6 col-lg-3">
                                <?php echo $__env->make('partials.product-card', ['product' => $product], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>

                    <!-- Pagination -->
                    <?php if($products->hasPages()): ?>
                        <div class="row mt-5">
                            <div class="col-12 d-flex justify-content-center">
                                <?php echo e($products->links('vendor.pagination.collection')); ?>

                            </div>
                        </div>
                    <?php endif; ?>
                <?php else: ?>
                    <div class="text-center py-5">
                        <i class="bi bi-box-seam empty-products-icon"></i>
                        <h3 class="mt-3 text-muted">No Products Found</h3>
                        <p class="text-muted">
                            <?php if($collectionType === 'category'): ?>
                                There are no products in this category yet.
                            <?php else: ?>
                                No products available in this collection at the moment.
                            <?php endif; ?>
                        </p>
                        <a href="<?php echo e(route('home')); ?>" class="btn btn-primary mt-3">Back to Home</a>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script src="<?php echo e(asset('js/category-filter.js')); ?>"></script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/sudheerkt_uat/resources/views/collection/show.blade.php ENDPATH**/ ?>