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

<?php $__env->startSection('content'); ?>
<h1 class="text-4xl font-bold mb-6 text-center">Our Products</h1>

<!-- Filter by category -->
<div class="mb-6 flex justify-center gap-4">
    <a href="<?php echo e(route('frontend.products')); ?>" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">All</a>
    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <a href="<?php echo e(route('frontend.products',['category'=>$cat->id])); ?>" class="px-4 py-2 bg-green-100 text-green-700 rounded hover:bg-green-200"><?php echo e($cat->name); ?></a>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-8">
    <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <div class="bg-white shadow hover:shadow-lg rounded-lg overflow-hidden">
        <?php if($product->images->first()): ?>
        <img src="<?php echo e(asset('storage/'.$product->images->first()->image_path)); ?>" class="w-full h-48 object-cover">
        <?php endif; ?>
        <div class="p-4">
            <h3 class="text-lg font-semibold"><?php echo e($product->name); ?></h3>
            <p class="text-green-700 font-bold">$<?php echo e($product->price); ?></p>
            <a href="<?php echo e(route('frontend.product_detail',$product->id)); ?>" class="mt-2 inline-block bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700">View Details</a>
        </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

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

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

<?php echo $__env->make('frontend.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /usr/local/var/www/memafarms/resources/views/frontend/products.blade.php ENDPATH**/ ?>