<?php $__env->startSection('titulo','Repuestos'); ?>
<?php $__env->startSection('contenido'); ?>
<div class="d-flex flex-wrap justify-content-between align-items-center mb-3">
  <h4><i class="fa fa-box"></i> Repuestos / inventario</h4>
  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('repuestos.gestionar')): ?><a href="<?php echo e(route('repuestos.create')); ?>" class="btn btn-primario"><i class="fa fa-plus"></i> Nuevo</a><?php endif; ?>
</div>
<form method="GET" class="mb-3"><div class="input-group">
  <input name="q" value="<?php echo e($busqueda); ?>" class="form-control" placeholder="Buscar por código o nombre">
  <button class="btn btn-outline-primary"><i class="fa fa-search"></i></button>
</div></form>
<div class="card"><div class="table-responsive"><table class="table table-hover mb-0">
<thead><tr><th>Código</th><th>Nombre</th><th>Unidad</th><th class="text-end">Stock</th><th class="text-end">Mínimo</th><th class="text-end">Costo</th><th>Activo</th><th></th></tr></thead><tbody>
<?php $__empty_1 = true; $__currentLoopData = $registros; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr class="<?php echo e($rp->stock < $rp->stock_minimo ? 'table-warning' : ''); ?>">
  <td><strong><?php echo e($rp->codigo); ?></strong></td>
  <td><?php echo e($rp->nombre); ?></td>
  <td><?php echo e(optional($rp->unidad)->codigo); ?></td>
  <td class="text-end"><?php echo e($rp->stock); ?></td>
  <td class="text-end"><?php echo e($rp->stock_minimo); ?></td>
  <td class="text-end"><?php echo e(number_format($rp->costo_unitario,2)); ?></td>
  <td><span class="badge text-bg-<?php echo e($rp->activo?'success':'secondary'); ?>"><?php echo e($rp->activo?'Sí':'No'); ?></span></td>
  <td class="text-end">
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('repuestos.gestionar')): ?>
    <a href="<?php echo e(route('repuestos.edit',$rp)); ?>" class="btn btn-sm btn-outline-primary"><i class="fa fa-pen"></i></a>
    <form method="POST" action="<?php echo e(route('repuestos.destroy',$rp)); ?>" class="d-inline" onsubmit="return confirm('¿Eliminar?');">
      <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?><button class="btn btn-sm btn-outline-danger"><i class="fa fa-trash"></i></button></form>
    <?php endif; ?>
  </td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> <tr><td colspan="8" class="text-muted text-center py-4">Sin repuestos</td></tr> <?php endif; ?>
</tbody></table></div></div>
<div class="mt-2"><?php echo e($registros->links()); ?></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\mto\resources\views/repuestos/index.blade.php ENDPATH**/ ?>