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

<div class="d-flex justify-content-between align-items-center mb-3">
    <h5 class="mb-0"><i class="bi bi-people me-2"></i>Empleados y Usuarios</h5>
    <a href="<?php echo e(route('empleados.create')); ?>" class="btn btn-primary btn-sm">
        <i class="bi bi-person-plus me-1"></i> Nuevo Empleado
    </a>
</div>

<div class="card">
    <div class="card-header d-flex justify-content-between align-items-center">
        <span><i class="bi bi-list-ul me-1"></i> Personal Gessig</span>
        <span class="badge bg-light text-dark"><?php echo e($empleados->total()); ?> empleados</span>
    </div>
    <div class="table-responsive">
        <table class="table table-hover align-middle mb-0">
            <thead class="table-light">
                <tr>
                    <th>Empleado</th>
                    <th>Cargo</th>
                    <th class="text-end">Salario base</th>
                    <th class="text-end">Costo real/mes</th>
                    <th class="text-end">Valor hora</th>
                    <th class="text-center">Acceso</th>
                    <th class="text-center">CC asignados</th>
                    <th class="text-center">Estado</th>
                    <th class="text-center">Acciones</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $empleados; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr class="<?php echo e(!$emp->activo ? 'table-secondary opacity-75' : ''); ?>">
                    <td>
                        <div class="fw-semibold"><?php echo e($emp->nombre); ?></div>
                        <small class="text-muted">C.C: <?php echo e($emp->cedula); ?></small>
                    </td>
                    <td class="text-muted small"><?php echo e($emp->cargo ?: '—'); ?></td>
                    <td class="text-end">$ <?php echo e(number_format($emp->salario, 0, ',', '.')); ?></td>
                    <td class="text-end fw-semibold text-primary">
                        $ <?php echo e(number_format($emp->costo_real_mensual, 0, ',', '.')); ?>

                    </td>
                    <td class="text-end text-success small">
                        $ <?php echo e(number_format($emp->valor_hora_real, 0, ',', '.')); ?>

                    </td>
                    <td class="text-center">
                        <?php if($emp->user): ?>
                            <span class="badge bg-success" title="<?php echo e($emp->user->email); ?>">
                                <i class="bi bi-check-circle me-1"></i><?php echo e(ucfirst($emp->user->rol)); ?>

                            </span>
                        <?php else: ?>
                            <span class="badge bg-light text-muted">Sin acceso</span>
                        <?php endif; ?>
                    </td>
                    <td class="text-center">
                        <span class="badge bg-light text-dark">
                            <?php echo e($emp->centrosCosto->count()); ?> CC
                        </span>
                    </td>
                    <td class="text-center">
                        <form action="<?php echo e(route('empleados.toggle-activo', $emp)); ?>" method="POST" class="d-inline">
                            <?php echo csrf_field(); ?> <?php echo method_field('PATCH'); ?>
                            <button class="btn btn-sm <?php echo e($emp->activo ? 'btn-success' : 'btn-outline-secondary'); ?>"
                                    style="padding:2px 8px;font-size:11px">
                                <?php echo e($emp->activo ? 'Activo' : 'Inactivo'); ?>

                            </button>
                        </form>
                    </td>
                    <td class="text-center">
                        <a href="<?php echo e(route('empleados.edit', $emp)); ?>" class="btn btn-sm btn-outline-primary">
                            <i class="bi bi-pencil"></i>
                        </a>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr><td colspan="9" class="text-center text-muted py-4">No hay empleados registrados.</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
    <?php if($empleados->hasPages()): ?>
    <div class="card-footer"><?php echo e($empleados->links()); ?></div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/evolucionamos/public_html/ges-chronos/app/hoja-tiempo/resources/views/empleados/index.blade.php ENDPATH**/ ?>