<?php $__env->startSection('title','Current Stock'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1>Current stock</h1><p>Calculated from immutable stock movements; never edited directly.</p></div><div class="text-end"><small class="text-muted d-block">Total inventory value</small><strong class="fs-4 text-accent">SAR <?php echo e(number_format((float)$totalValue,2)); ?></strong></div></div><div class="card-erp"><div class="card-erp-body"><form class="row g-2 align-items-end"><div class="col-md-4"><label class="form-label">Warehouse</label><select name="warehouse_id" class="form-select"><option value="">All warehouses</option><?php $__currentLoopData = $warehouses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $w): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($w->id); ?>" <?php if(request('warehouse_id')==$w->id): echo 'selected'; endif; ?>><?php echo e($w->code); ?> · <?php echo e($w->name_en); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-3"><label class="form-label">Category</label><select name="category_id" class="form-select"><option value="">All categories</option><?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($c->id); ?>" <?php if(request('category_id')==$c->id): echo 'selected'; endif; ?>><?php echo e($c->name_en); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-3"><label class="form-label">Stock status</label><select name="stock_status" class="form-select"><option value="">All stock</option><option value="low" <?php if(request('stock_status')==='low'): echo 'selected'; endif; ?>>Low stock</option><option value="negative" <?php if(request('stock_status')==='negative'): echo 'selected'; endif; ?>>Negative</option></select></div><div class="col-md-2"><button class="btn btn-dark w-100">Filter</button></div></form></div><div class="table-responsive"><table class="table table-dense"><thead><tr><th>Code</th><th>Product</th><th>Arabic</th><th>Warehouse</th><th>Base unit</th><th class="text-end">Quantity</th><th class="text-end">Average cost</th><th class="text-end">Stock value</th><th></th></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $stocks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($s->product?->product_code); ?></td><td><b><?php echo e($s->product?->name_en); ?></b></td><td dir="rtl"><?php echo e($s->product?->name_ar); ?></td><td><?php echo e($s->warehouse?->code); ?></td><td><?php echo e($s->product?->baseUnit?->code); ?></td><td class="text-end fw-bold <?php echo e($s->qty<0?'text-danger':''); ?>"><?php echo e(number_format((float)$s->qty,4)); ?></td><td class="text-end"><?php echo e(number_format((float)$s->avg_cost,4)); ?></td><td class="text-end"><?php echo e(number_format((float)$s->qty*(float)$s->avg_cost,2)); ?></td><td><a class="btn btn-light border btn-dense" href="<?php echo e(route('stock-ledger.by-warehouse',$s->product_id)); ?>">Detail</a></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="9" class="text-center text-muted py-5">No stock records.</td></tr><?php endif; ?></tbody></table></div><?php if($stocks->hasPages()): ?><div class="card-erp-body border-top"><?php echo e($stocks->links()); ?></div><?php endif; ?></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\saudi\resources\views/inventory/current_stock/index.blade.php ENDPATH**/ ?>