<?php $__env->startSection('title', 'Personal'); ?>
<?php $__env->startSection('page-title', 'Gestión de Personal'); ?>

<?php $__env->startSection('content'); ?>

<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;">
    <p style="color:var(--muted);font-size:13px;"><?php echo e($personal->total()); ?> registros encontrados</p>
    <a href="<?php echo e(route('personal.create')); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Nuevo Personal</a>
</div>


<div class="card" style="margin-bottom:20px;">
    <div class="card-body" style="padding:16px 22px;">
        <form method="GET" style="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;">
            <div style="flex:1;min-width:200px;">
                <input type="text" name="buscar" class="form-control"
                    placeholder="Nombre, apellido o DNI..." value="<?php echo e(request('buscar')); ?>">
            </div>
            <select name="tipo" class="form-control" style="min-width:160px;">
                <option value="">Todos los tipos</option>
                <option value="docente"        <?php echo e(request('tipo')=='docente'        ? 'selected':''); ?>>Docente</option>
                <option value="administrativo" <?php echo e(request('tipo')=='administrativo' ? 'selected':''); ?>>Administrativo</option>
                <option value="directivo"      <?php echo e(request('tipo')=='directivo'      ? 'selected':''); ?>>Directivo</option>
                <option value="auxiliar"       <?php echo e(request('tipo')=='auxiliar'       ? 'selected':''); ?>>Auxiliar</option>
            </select>
            <select name="estado" class="form-control" style="min-width:140px;">
                <option value="">Todos los estados</option>
                <option value="activo"   <?php echo e(request('estado')=='activo'   ? 'selected':''); ?>>Activo</option>
                <option value="inactivo" <?php echo e(request('estado')=='inactivo' ? 'selected':''); ?>>Inactivo</option>
                <option value="licencia" <?php echo e(request('estado')=='licencia' ? 'selected':''); ?>>Licencia</option>
            </select>
            <button type="submit" class="btn btn-primary"><i class="fas fa-filter"></i> Filtrar</button>
            <a href="<?php echo e(route('personal.index')); ?>" class="btn btn-secondary"><i class="fas fa-times"></i></a>
        </form>
    </div>
</div>

<div class="card">
    <div class="table-wrapper">
        <table>
            <thead>
                <tr>
                    <th>Personal</th>
                    <th>DNI</th>
                    <th>Tipo</th>
                    <th>Especialidad</th>
                    <th>Teléfono</th>
                    <th>Ingreso</th>
                    <th>Salario</th>
                    <th>Estado</th>
                    <th style="text-align:center;">Acciones</th>
                </tr>
            </thead>
            <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $personal; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr>
                    <td>
                        <div style="display:flex;align-items:center;gap:10px;">
                            <div style="width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,#065f46,#10b981);display:flex;align-items:center;justify-content:center;color:white;font-weight:700;font-size:13px;flex-shrink:0;">
                                <?php echo e(strtoupper(substr($p->nombres,0,1))); ?><?php echo e(strtoupper(substr($p->apellidos,0,1))); ?>

                            </div>
                            <div>
                                <div style="font-weight:600;"><?php echo e($p->nombre_completo); ?></div>
                                <div style="font-size:11px;color:var(--muted);"><?php echo e($p->email ?? ''); ?></div>
                            </div>
                        </div>
                    </td>
                    <td style="font-family:monospace;"><?php echo e($p->dni); ?></td>
                    <td><span class="badge badge-<?php echo e($p->tipo_badge); ?>"><?php echo e(ucfirst($p->tipo)); ?></span></td>
                    <td style="font-size:13px;color:var(--muted);"><?php echo e($p->especialidad ?? '—'); ?></td>
                    <td><?php echo e($p->telefono ?? '—'); ?></td>
                    <td style="font-size:13px;"><?php echo e($p->fecha_ingreso?->format('d/m/Y')); ?></td>
                    <td style="font-weight:700;">S/. <?php echo e(number_format($p->salario, 2)); ?></td>
                    <td>
                        <?php $ec = $p->estado === 'activo' ? 'badge-success' : ($p->estado === 'licencia' ? 'badge-warning' : 'badge-secondary'); ?>
                        <span class="badge <?php echo e($ec); ?>"><?php echo e(ucfirst($p->estado)); ?></span>
                    </td>
                    <td>
                        <div style="display:flex;gap:6px;justify-content:center;">
                            <a href="<?php echo e(route('personal.show', $p)); ?>" class="btn btn-sm btn-secondary btn-icon"><i class="fas fa-eye"></i></a>
                            <a href="<?php echo e(route('personal.edit', $p)); ?>" class="btn btn-sm btn-secondary btn-icon"><i class="fas fa-edit"></i></a>
                            <form method="POST" action="<?php echo e(route('personal.destroy', $p)); ?>" onsubmit="return confirm('¿Desactivar?')">
                                <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="btn btn-sm btn-danger btn-icon"><i class="fas fa-user-slash"></i></button>
                            </form>
                        </div>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr>
                    <td colspan="9" style="text-align:center;padding:48px;color:var(--muted);">
                        <i class="fas fa-users" style="font-size:36px;margin-bottom:12px;display:block;opacity:.3;"></i>
                        No se encontró personal registrado.
                    </td>
                </tr>
            <?php endif; ?>
            </tbody>
        </table>
    </div>
    <?php if($personal->hasPages()): ?>
    <div style="padding:16px 22px;border-top:1px solid var(--border);">
        <?php echo e($personal->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:\CRMyERP\crm-colegio\resources\views/staff/index.blade.php ENDPATH**/ ?>