<?php $__env->startSection('title', 'Products'); ?>
<?php $__env->startSection('content'); ?>
    <div class="product-list-container p-4">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h2 class="h4">Product List</h2>
            <a href="<?php echo e(route('admin.product.create')); ?>" class="btn btn-success">
                <i class="fas fa-plus-circle me-2"></i> Add Product
            </a>
        </div>

        <div class="table-responsive bg-white p-3">
            <table id="productTable" class="table table-hover">
                <thead>
                    <tr>
                        <th>Image</th>
                        <th>Product Name</th>
                        <th>Product cate</th>
                        <th>Price</th>
                        <th>Stock</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    
                    <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td>
                                
                                <?php if($product->image): ?>
                                    <img src="<?php echo e(asset($product->image)); ?>" alt="<?php echo e($product->name); ?>" class="product-image-small">
                                <?php else: ?>
                                    <img src="[https://via.placeholder.com/50](https://via.placeholder.com/50)" alt="No Image" class="product-image-small">
                                <?php endif; ?>
                            </td>
                            <td><?php echo e($product->name); ?></td>
                            <td><?php echo e($product->category->name ?? 'N/A'); ?></td> 
                            <td>₹ <?php echo e(number_format($product->price, 2)); ?></td>
                            <td><?php echo e($product->stock); ?></td>
                            <td class="">
                                <a href="<?php echo e(route('admin.product.edit', $product->id)); ?>" class="btn btn-primary btn-sm me-2">
                                    <i class="fas fa-edit"></i>
                                </a>
                                <form action="<?php echo e(route('admin.product.delete', $product->id)); ?>" method="POST" class="d-inline">
                                   <?php echo csrf_field(); ?>
                                    <button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this product?');">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </form>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\Kuldeep Vishwakarma\OneDrive\Desktop\ecom_webportal\resources\views/admin/product/index.blade.php ENDPATH**/ ?>