<?php $__env->startSection('titulo','Planes '.$clase); ?>
<?php $__env->startSection('contenido'); ?>
<div class="d-flex flex-wrap justify-content-between align-items-center mb-3">
  <h4><i class="fa fa-clipboard-list"></i> Planes maestros — <?php echo e(ucfirst($clase)); ?></h4>
  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('planes.crear')): ?>
    <a href="<?php echo e(route('planes.create', ['clase'=>$clase])); ?>" class="btn btn-primario"><i class="fa fa-plus"></i> Nuevo plan</a>
  <?php endif; ?>
</div>
<form method="GET" class="row g-2 mb-3">
  <input type="hidden" name="clase" value="<?php echo e($clase); ?>">
  <div class="col-md-4"><input name="q" value="<?php echo e($busqueda); ?>" class="form-control" placeholder="Código o nombre..."></div>
  <div class="col-md-3"><select name="area_id" class="form-select"><option value="">— Área —</option>
    <?php $__currentLoopData = $areas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($a->id); ?>" <?php if($area_id==$a->id): echo 'selected'; endif; ?>><?php echo e($a->nombre); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
  </select></div>
  <div class="col-md-2"><button class="btn btn-outline-primary w-100"><i class="fa fa-filter"></i> Filtrar</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>Área</th><th>Equipo</th><th>Vigencia</th><th>Ítems</th><th>Activo</th><th></th></tr></thead><tbody>
<?php $__empty_1 = true; $__currentLoopData = $registros; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr>
  <td><strong><?php echo e($p->codigo); ?></strong></td>
  <td><?php echo e($p->nombre); ?></td>
  <td><?php echo e(optional($p->area)->nombre); ?></td>
  <td><?php echo e(optional($p->equipo)->nombre); ?></td>
  <td><small><?php echo e($p->fecha_inicio?->format('d/m/Y')); ?> → <?php echo e($p->fecha_fin?->format('d/m/Y')); ?></small></td>
  <td><?php echo e($p->items_count); ?></td>
  <td><span class="badge text-bg-<?php echo e($p->activo?'success':'secondary'); ?>"><?php echo e($p->activo?'Sí':'No'); ?></span></td>
  <td class="text-end">
    <a href="<?php echo e(route('planes.show',$p)); ?>" class="btn btn-sm btn-outline-info"><i class="fa fa-eye"></i></a>
    <a href="<?php echo e(route('planes.edit',$p)); ?>" class="btn btn-sm btn-outline-primary"><i class="fa fa-pen"></i></a>
    <a href="<?php echo e(route('planes.pdf',$p)); ?>" target="_blank" class="btn btn-sm btn-outline-danger"><i class="fa fa-file-pdf"></i></a>
    <form method="POST" action="<?php echo e(route('planes.destroy',$p)); ?>" class="d-inline" onsubmit="return confirm('¿Eliminar plan?');">
      <?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>
  </td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> <tr><td colspan="8" class="text-muted text-center py-4">Sin planes</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/planes/index.blade.php ENDPATH**/ ?>