<div>
    <?php $__env->startComponent('common.breadcrumb', ['addBtn' => true, 'permission_create' => 'User_create','breadcrumb_show' => $breadcrumb_show]); ?>
        <?php $__env->slot('breadcrumb_title'); ?>
            <h3><?php echo e($componentName); ?> | <?php echo e($pageTitle); ?></h3>
        <?php $__env->endSlot(); ?>
        <li class="breadcrumb-item">Usuarios</li>
        <li class="breadcrumb-item active">Roles</li>
    <?php if (isset($__componentOriginal96f5b8f7cb2e3bbc8f06cfd8ecfbc87428561469)): ?>
<?php $component = $__componentOriginal96f5b8f7cb2e3bbc8f06cfd8ecfbc87428561469; ?>
<?php unset($__componentOriginal96f5b8f7cb2e3bbc8f06cfd8ecfbc87428561469); ?>
<?php endif; ?>
<?php echo $__env->renderComponent(); ?>
    <?php echo $__env->make('common.searchbox', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="container-fluid">
        <div class="row layout-top-spacing">
            <div class="col-sm-12">
                <div class="card">
                    <div class="table-responsive">
                        <table class="table">
                        <?php if($data->count()): ?>
                            <thead class="bg-primary">
                                <tr>
                                    <th scope="col">DOCUMENTO <?php echo $__env->make('common.orderby', ['column' => 'document'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></th>
                                    <th scope="col">NOMBRE <?php echo $__env->make('common.orderby', ['column' => 'first_name'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></th>
                                    <th scope="col">EMPRESA</th>
                                    <th scope="col">EMAIL</th>
                                    <th scope="col">PERFIL</th>
                                    <th scope="col">ESTADO <?php echo $__env->make('common.orderby', ['column' => 'status'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></th>
                                    <th scope="col">IMAGEN</th>
                                    <th scope="col" class="text-center">ACCIONES</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr class="middle">
                                    <td><?php echo e($item->document); ?></td>
                                    <td><?php echo e($item->first_name); ?> <?php echo e($item->last_name); ?></td>
                                    <td><?php echo e($company = CompanyUser($item->id)); ?></td>
                                    <td><?php echo e($item->email); ?></td>
                                    <td>
                                        <?php if(!empty($item->getRoleNames())): ?>
                                        <?php $__currentLoopData = $item->getRoleNames(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <strong class="text-secondary"><?php echo e($val); ?></strong>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                    </td>
                                    <td>
                                        <span class="badge <?php echo e($item->status  == 'ACTIVO' ? 'badge-success' : 'badge-danger'); ?> text-uppercase">
                                            <?php echo e($item->status); ?>

                                        </span>
                                    </td>
                                    <td class="text-center">
                                        <img src="<?php echo e(asset('storage/users/' .$item->imagen)); ?>" alt="imagen"  class="rounded img-h-50">
                                    </td>
                                    <td class="text-center">
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('User_update')): ?>
                                        <a href="javascript:void(0)" wire:click="Edit(<?php echo e($item->id); ?>, '<?php echo e($company); ?>')"
                                            class="btn btn-outline-primary" title="Editar">
                                            <i class="fas fa-edit"></i>
                                        </a>
                                        <?php endif; ?>
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('User_delete')): ?>
                                        <a href="javascript:void(0)" onclick="Confirm('<?php echo e($item->id); ?>')"
                                            class="btn btn-outline-danger " title="Eliminar">
                                            <i class="fas fa-trash"></i>
                                        </a>
                                        <?php endif; ?>
                                        <a href="javascript:void(0)" onclick="SenEmailinfoAccount(<?php echo e($item->id); ?>)"
                                            class="btn btn-outline-info " title="Enviar correo informativo">
                                            <i class="fa fa-envelope"></i>
                                        </a>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                            <?php else: ?>
                                <tr>
                                    <td colspan="8" class="text-center alert alert-danger"><strong>No se encuentran registos </strong></td>
                                </tr>
                            <?php endif; ?>
                        </table>
                        <?php echo e($data->links()); ?>

                    </div>
                </div>
            </div>
        </div>
        <?php echo $__env->make('livewire.users.form', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>
</div>
<?php echo $__env->make('common.scriptsCompStandar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        window.livewire.on('user-withCompanies', msg => {
            noty(msg)
        })
    });
    function SenEmailinfoAccount(id)
    {
        swal.fire({
            title: 'CONFIRMAR',
            text: '¿Confirmas enviar un correo con la información de la cuenta?. Se generará una contraseña nueva para este usuario.',
            icon: 'warning',
            showCancelButton: true,
            cancelButtonText: 'CERRAR',
            customClass: {
                confirmButton: 'btn btn-success',
                cancelButton: 'btn btn-danger'
        },

            confirmButtonText: 'ACEPTAR',
        }).then(function(result){
            if(result.value)
            {
                window.livewire.emit('send_email_info_account',id)
                swal.close()
            }
        })
    }
</script>
<?php /**PATH /var/www/html/resources/views/livewire/users/component.blade.php ENDPATH**/ ?>