<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <style>
            .products-header-title {
                font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
                font-weight: 800;
                font-size: 1.75rem;
                letter-spacing: -0.02em;
                background: linear-gradient(135deg, #1e1e2f 0%, #4f46e5 100%);
                -webkit-background-clip: text;
                -webkit-text-fill-color: transparent;
                background-clip: text;
            }
        </style>
        <h2 class="products-header-title">Koleksi Produk</h2>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-7xl mx-auto px-4">
            
            
            <?php if(request('search')): ?>
                <div class="mb-6 bg-blue-50 border-l-4 border-blue-400 p-4 flex justify-between items-center rounded-r shadow-sm">
                    <div class="flex items-center">
                        <p class="text-sm text-blue-700">
                            Menampilkan hasil pencarian untuk: <strong>"<?php echo e(request('search')); ?>"</strong>
                        </p>
                    </div>
                    <a href="<?php echo e(route('products.index')); ?>" class="text-sm font-bold text-blue-600 hover:text-blue-800 hover:underline">
                        &times; Hapus Pencarian
                    </a>
                </div>
            <?php endif; ?>

            
            <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
                <?php $__empty_1 = true; $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <div class="bg-white rounded-lg shadow hover:shadow-lg transition overflow-hidden group">
                    <a href="<?php echo e(route('products.show', $product->id)); ?>">
                        <div class="relative h-64 overflow-hidden">
                            <?php if($product->images && $product->images->count() > 0): ?>
                                <img src="<?php echo e(asset('storage/' . $product->images->first()->image_path)); ?>" 
                                     alt="<?php echo e($product->name); ?>" 
                                     class="w-full h-full object-cover group-hover:scale-110 transition duration-500">
                            <?php else: ?>
                                <img src="https://via.placeholder.com/400x300?text=No+Image" 
                                     alt="<?php echo e($product->name); ?>" 
                                     class="w-full h-full object-cover group-hover:scale-110 transition duration-500">
                            <?php endif; ?>
                            
                            <?php if($product->stock == 0): ?>
                                <div class="absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center text-white font-bold">HABIS</div>
                            <?php endif; ?>
                        </div>
                    </a>

                    <div class="p-4">
                        <div class="text-xs text-gray-500 mb-1 font-semibold"><?php echo e($product->category->name ?? 'Umum'); ?></div>
                        
                        <h3 class="text-lg font-extrabold text-gray-900 truncate">
                            <a href="<?php echo e(route('products.show', $product->id)); ?>" class="hover:text-indigo-600 transition">
                                <?php echo e($product->name); ?>

                            </a>
                        </h3>
                        
                        
                        <div class="flex items-center justify-between mt-3">
                            <div>
                                <?php
                                    $minPrice = $product->variants->min('additional_price') ?? 0;
                                    $maxPrice = $product->variants->max('additional_price') ?? 0;
                                ?>
                                
                                <?php if($minPrice == $maxPrice): ?>
                                    <span class="text-indigo-600 font-extrabold text-lg">
                                        Rp <?php echo e(number_format($minPrice, 0, ',', '.')); ?>

                                    </span>
                                <?php else: ?>
                                    <span class="text-indigo-600 font-extrabold text-lg">
                                        Rp <?php echo e(number_format($minPrice, 0, ',', '.')); ?>

                                    </span>
                                    <span class="text-xs text-gray-400"> - <?php echo e(number_format($maxPrice, 0, ',', '.')); ?></span>
                                <?php endif; ?>
                            </div>
                            
                            
                            <span class="text-xs font-bold <?php echo e($product->stock > 0 ? 'text-green-600' : 'text-red-600'); ?>">
                                <?php echo e($product->stock); ?> item
                            </span>
                            
                           
                        </div>
                    </div>
                </div>

                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <div class="col-span-4 text-center text-gray-500 py-10">
                    <div class="text-gray-400 mb-3">
                        <svg class="mx-auto h-12 w-12" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path>
                        </svg>
                    </div>
                    <p class="text-lg font-bold">Produk belum tersedia.</p>
                    <p class="text-sm text-gray-400 mt-1">Silakan cek kembali nanti.</p>
                </div>
                <?php endif; ?>
            </div>

            
            <div class="mt-8">
                <?php echo e($products->withQueryString()->links()); ?>

            </div>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH C:\laragon\www\toko\resources\views/customer/products/index.blade.php ENDPATH**/ ?>