<?php $__env->startSection('title', 'Select Flash Sale Products'); ?>

<?php $__env->startSection('content'); ?>
<div class="flex items-center justify-between gap-6 mb-8">
    <div>
        <h1 class="text-3xl font-bold text-gray-900 tracking-tight">Select Products</h1>
        <p class="text-gray-500 text-sm">Choose products from your catalog to add into Flash Sale.</p>
    </div>
    <a href="<?php echo e(route('admin.products.flash_sale')); ?>" class="inline-flex items-center px-5 py-3 bg-white border border-gray-200 hover:bg-gray-50 text-gray-700 text-xs font-bold rounded-xl shadow-sm transition-all">
        <i class="fas fa-arrow-left mr-2"></i>
        Back to Flash Sale
    </a>
    </div>

<div class="bg-white rounded-3xl shadow-sm border border-gray-100 overflow-hidden">
    <div class="px-6 py-5 border-b border-gray-100 bg-gray-50/60">
        <form method="GET" class="grid grid-cols-1 md:grid-cols-3 gap-3">
            <div class="col-span-2">
                <input type="text" name="search" value="<?php echo e(request('search')); ?>" class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-emerald-300 focus:ring-0 text-sm" placeholder="Search by name or SKU">
            </div>
            <div class="flex gap-3">
                <select name="category_id" class="flex-1 px-4 py-3 rounded-xl border border-gray-200 focus:border-emerald-300 focus:ring-0 text-sm">
                    <option value="">All Categories</option>
                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($cat->id); ?>" <?php if(request('category_id') == $cat->id): echo 'selected'; endif; ?>><?php echo e($cat->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
                <button class="px-5 py-3 rounded-xl bg-gray-900 hover:bg-black text-white text-xs font-bold">Filter</button>
            </div>
        </form>
    </div>

    <form method="POST" action="<?php echo e(route('admin.products.flash_sale.attach')); ?>" x-data="{ allChecked: false }">
        <?php echo csrf_field(); ?>
        <div class="p-6">
            <div class="flex items-center justify-between mb-4">
                <div class="flex items-center gap-3">
                    <label class="inline-flex items-center gap-2 text-sm text-gray-600">
                        <input type="checkbox" @change="allChecked = !allChecked; document.querySelectorAll('.row-check').forEach(cb => cb.checked = allChecked)" class="rounded border-gray-300 text-brand focus:ring-brand">
                        Select All (page)
                    </label>
                </div>
                <div class="flex items-center gap-3">
                    <button type="submit" class="inline-flex items-center px-5 py-3 btn-brand text-white text-xs font-bold rounded-xl shadow-md shadow-brand/20">
                        <i class="fas fa-plus mr-2 text-[10px]"></i>
                        Add Selected to Flash Sale
                    </button>
                </div>
            </div>

            <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5">
                <?php $__empty_1 = true; $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <label class="group relative border border-gray-100 rounded-2xl overflow-hidden bg-white hover:shadow-md transition-all cursor-pointer">
                    <input type="checkbox" name="product_ids[]" value="<?php echo e($p->id); ?>" class="row-check absolute top-3 left-3 h-5 w-5 rounded border-gray-300 text-brand focus:ring-brand z-10">
                    <div class="aspect-square bg-gray-50 flex items-center justify-center overflow-hidden">
                        <?php if($p->image): ?>
                            <img src="<?php echo e(Str::startsWith($p->image, ['http://', 'https://']) ? $p->image : Storage::url($p->image)); ?>" alt="<?php echo e($p->name); ?>" class="h-full w-full object-cover group-hover:scale-105 transition-transform duration-500">
                        <?php else: ?>
                            <i class="fas fa-box text-4xl text-gray-200"></i>
                        <?php endif; ?>
                    </div>
                    <div class="p-4">
                        <div class="text-sm font-semibold text-gray-900 line-clamp-2"><?php echo e($p->name); ?></div>
                        <div class="mt-1 text-xs text-gray-500"><?php echo e(optional($p->category)->name ?? 'Uncategorized'); ?></div>
                        <div class="mt-2 text-sm font-semibold text-emerald-600"><?php echo e($currencySymbol); ?><?php echo e(number_format($p->discount_price > 0 ? $p->discount_price : $p->price, 2)); ?></div>
                    </div>
                </label>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <div class="col-span-full py-16 text-center">
                    <div class="max-w-md mx-auto">
                        <div class="h-20 w-20 bg-gray-50 rounded-2xl flex items-center justify-center mb-6 border border-gray-100 mx-auto">
                            <i class="fas fa-search text-2xl text-gray-300"></i>
                        </div>
                        <h3 class="text-lg font-semibold text-gray-900">No products found</h3>
                        <p class="text-sm text-gray-500 mt-1">Try adjusting your search or filters.</p>
                    </div>
                </div>
                <?php endif; ?>
            </div>

            <?php if($products->hasPages()): ?>
                <div class="mt-6">
                    <?php echo e($products->links()); ?>

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


<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/burhjijr/adminprovendorx.burhanstore.online/resources/views/admin/products/flash-sale-select.blade.php ENDPATH**/ ?>