<?php $__env->startSection('title', 'Stock Management'); ?>
<?php $__env->startSection('header_title', 'Stock & Product Visibility'); ?>

<?php $__env->startSection('content'); ?>
    <?php $__currentLoopData = [['title' => 'Frames', 'type' => 'frame', 'items' => $frames], ['title' => 'Contact Lenses', 'type' => 'lens', 'items' => $lenses]]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="card">
            <h3><i class="fa-solid fa-boxes-stacked" style="color: var(--primary);"></i> <?php echo e($group['title']); ?></h3>
            <table>
                <thead><tr><th>Product</th><th>Current Stock</th><th>Low Stock At</th><th>Visibility</th><th>Actions</th></tr></thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $group['items']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><strong><?php echo e($item->name); ?></strong><div style="color: var(--text-muted); font-size: 0.8rem;">₹<?php echo e(number_format($item->price, 2)); ?></div></td>
                            <td><span class="badge <?php echo e($item->stock_quantity <= $item->low_stock_threshold ? 'badge-danger' : 'badge-success'); ?>"><?php echo e($item->stock_quantity); ?> units</span></td>
                            <td><?php echo e($item->low_stock_threshold); ?></td>
                            <td><span class="badge <?php echo e($item->is_active ? 'badge-success' : 'badge-danger'); ?>"><?php echo e($item->is_active ? 'Enabled' : 'Disabled'); ?></span></td>
                            <td style="display: flex; gap: 0.75rem; align-items: center;">
                                <form method="POST" action="<?php echo e(route('vendor.stock.update', [$group['type'], $item->id])); ?>" style="display: flex; gap: 0.5rem; align-items: center;">
                                    <?php echo csrf_field(); ?> <?php echo method_field('PATCH'); ?>
                                    <input type="number" name="stock_quantity" value="<?php echo e($item->stock_quantity); ?>" min="0" style="width: 85px; margin: 0;">
                                    <input type="number" name="low_stock_threshold" value="<?php echo e($item->low_stock_threshold); ?>" min="0" style="width: 75px; margin: 0;">
                                    <button class="btn btn-primary" type="submit">Update</button>
                                </form>
                                <form method="POST" action="<?php echo e(route('vendor.stock.toggle', [$group['type'], $item->id])); ?>"><?php echo csrf_field(); ?><button class="btn <?php echo e($item->is_active ? 'btn-danger' : 'btn-primary'); ?>" type="submit"><?php echo e($item->is_active ? 'Disable' : 'Enable'); ?></button></form>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr><td colspan="5" style="text-align: center; color: var(--text-muted); padding: 2rem;">No <?php echo e(strtolower($group['title'])); ?> found.</td></tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.vendor', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\Clients\MInfosoftware\LiveApp\MyOpticals\backend\resources\views/vendor/stock.blade.php ENDPATH**/ ?>