<?php $__env->startSection('titulo'); ?>
    <i class="fas fa-user"></i> Cadastro de Usuários
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script src="<?php echo e(URL::asset('js/views/adm/usuario.js')); ?>"></script>
<?php $__env->stopSection(); ?>

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


    <div class="container-fluid">
        <div class="card rounded text-left">
            <div class="card-body">
                <div class="row" >
                    <div class="col col-sm-3 text-left">
                        <label for="cbEmpresaPesq" class="col-form-label text-md-left">Empresa</label>
                        <br/>
                        <select id="cbEmpresaPesq" class="form-control">
                            <option value="">Todas...</option>
                        </select>
                    </div>
                    <div class="col col-sm-2 text-left">
                        <label for="cbStatusPesq" class="col-form-label text-md-left">Status</label>
                        <br/>
                        <select id="cbStatusPesq" class="form-control">
                            <option value="">Todos...</option>
                            <option value="1" selected>ATIVOS</option>
                            <option value="0">INATIVOS</option>
                        </select>
                    </div>
                    <div class="col col-sm-2 text-left">
                        <label for="txtPesquisa" class="col-form-label text-md-left">&nbsp;</label>
                        <br/>
                        <button id="btnPesquisa"  class="btn btn-secondary btn-group-justified"><i class="fas fa-search"></i> Pesquisar</button>
                    </div>

                    <div class="col text-left text-right">
                        <label for="txtPesquisa" class="col-form-label text-md-left">&nbsp;</label>
                        <br/>
                        <button id="btnNovoUsuario" type="button" class="btn btn-primary" aria-label="Left Align" >
                            <i class="fas fa-plus-circle"></i> Novo Usuário
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="card mt-2">
            <div class="card-body">
                <div class="row" >
                    <div class="col panel panel-primary table-responsive">

                        <table id="tbUsuarios" class="table table-hover text-left">
                            <thead>
                                <tr>
                                    <th>Nome</th>
                                    <th>Login</th>
                                    <th>CPF</th>
                                    <th>Empresa</th>
                                    <th>E-mail</th>
                                    <th>Telefone</th>
                                    <th>Celular</th>
                                    <th>Status</th>
                                    <th>Ações</th>
                                </tr>
                            </thead>
                            <tbody>

                               <!--  <?php $__currentLoopData = $usuarios; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $usu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td id="<?php echo e($usu->getId()); ?>_nome"><?php echo e($usu->getNome()); ?></td>
                                        <td id="<?php echo e($usu->getId()); ?>_login"><?php echo e($usu->getLogin()); ?></td>
                                        <td id="<?php echo e($usu->getId()); ?>_cpf"><?php echo e($usu->getCpf()); ?></td>
                                        <td id="<?php echo e($usu->getId()); ?>_email"><?php echo e($usu->getEmail()); ?></td>
                                        <td id="<?php echo e($usu->getId()); ?>_telefone"><?php echo e($usu->getTelefone()); ?></td>
                                        <td id="<?php echo e($usu->getId()); ?>_celular"><?php echo e($usu->getCelular()); ?></td>
                                        
                                        <input type="hidden" id="<?php echo e($usu->getId()); ?>_classe" value="<?php echo e((!empty($usu->Classe->first()) ? $usu->Classe->first()->getId() : '')); ?>" />
                                        
                                        <td id="<?php echo e($usu->getId()); ?>_ativo" data="<?php echo e($usu->getAtivo()); ?>">
                                            <?php if($usu->getAtivo()): ?>
                                                <span class="badge badge-success">ATIVO</span>
                                            <?php else: ?>
                                                <span class="badge badge-danger">INATIVO</span>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <span name="editBtn" class="cursor-pointer fas fa-edit fa-lg" data="<?php echo e($usu->getId()); ?>" style="color: #009933;" title="Editar"></span>
                                            <span name="delBtn" class="cursor-pointer fas fa-trash-alt fa-lg" data="<?php echo e($usu->getId()); ?>" style="color: #ff0000;" title="Excluir"></span>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> -->

                            </tbody>
                        </table>

                    </div>
                </div>
            </div>
        </div>

    </div>

    <!-- Inclui formulário modal -->
    <?php echo $__env->make('partials._modal_form',
    [
        'titulo'=> 'Novo Usuário',
        'rota' => 'adm.usuario.salvar',
        'icone' => 'fa-user',
        'largura'=>700,
        'campos'=>
        [
            [
                'tipo'=>'array',
                'campos'=>
                [
                    [
                        'largura'=>'6',
                        'id' =>'txtLogin',
                        'label'=>'Login',
                        'nome'=>'login',
                        'tamanho'=>'20',
                        'tipo'=>'txt',
                        'required'=> true,
                        'autofocus'=> true,
                        'disabled'=>false
                    ],
                    [
                        'largura'=>'4',
                        'padding'=>'50',
                        'id' =>'txtCpf',
                        'label'=>'CPF',
                        'nome'=>'cpf',
                        'classe'=>'mask_cpf',
                        'tamanho'=>'11',
                        'tipo'=>'txt',
                        'required'=> true,
                        'autofocus'=> true
                    ],
                    [
                        'largura'=>'2',
                        'id' =>'cbAtivo',
                        'label'=>'Ativo',
                        'nome'=>'ativo',
                        'tipo'=>'slider',
                        'required'=> true
                    ],
                ]
            ],
            [
                'id' =>'txtNome',
                'label'=>'Nome',
                'nome'=>'nome',
                'tamanho'=>'50',
                'tipo'=>'txt',
                'required'=> true,
                'autofocus'=> true,
                'disabled'=>false
            ],
            
            [
                'tipo'=>'array',
                'campos'=>
                [
                    [
                        'largura'=>'8',
                        'id' =>'txtEmail',
                        'label'=>'E-mail',
                        'nome'=>'email',
                        'tamanho'=>'100',
                        'tipo'=>'email',
                        'required'=> true,
                        'autofocus'=> true,
                        'disabled'=>false
                    ],
                    [
                        'largura'=>'4',
                        'id' =>'cbEmpresa',
                        'label'=>'Empresa',
                        'nome'=>'empresa',
                        'tipo'=>'combo',
                        'opcoes'=>[],
                        'required'=> true,
                        'disabled'=>false
                    ]
                ]
            ],

            [
                'tipo'=>'array',
                'campos'=>
                [
                    [
                        'largura'=>'4',
                        'id' =>'txtTelefonne',
                        'label'=>'Telefone',
                        'nome'=>'telefone',
                        'classe'=>'mask_telefone',
                        'tamanho'=>'15',
                        'tipo'=>'txt',
                        'autocomplete'=>'off',
                        'required'=> false,
                        'disabled'=>false
                    ],
                    [
                        'largura'=>'4',
                        'id' =>'txtCelular',
                        'label'=>'Celular',
                        'nome'=>'celular',
                        'classe'=>'mask_celular',
                        'tamanho'=>'10',
                        'tipo'=>'txt',
                        'autocomplete'=>'off',
                        'required'=> false,
                        'disabled'=>false
                    ],
                    [
                        'largura'=>'4',
                        'id' =>'cbClasse',
                        'label'=>'Nível de acesso',
                        'nome'=>'classe',
                        'tipo'=>'combo',
                        'opcoes'=>$classes,
                        'default'=>'Sem Acesso',
                        'required'=> true,
                        'disabled'=>false
                    ]
                ]
            ],
            
           
            [
                'tipo'=>'array',
                'campos'=>
                [
                    [
                        'largura'=>'6',
                        'id' =>'txtSenha',
                        'label'=>'Senha',
                        'nome'=>'senha',
                        'tamanho'=>'30',
                        'tipo'=>'password',
                        'required'=> true,
                        'disabled'=>false
                    ],
                    [
                        'largura'=>'6',
                        'id' =>'txtConfirmSenha',
                        'label'=>'Confirmar senha',
                        'nome'=>'confirma_senha',
                        'tamanho'=>'30',
                        'tipo'=>'password',
                        'required'=> true,
                        'disabled'=>false
                    ]
                ]
            ]
        ]
    ], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

    <?php echo $__env->make('partials._modal_delete',
    [
        'rota'=>'adm.usuario.delete',
        'titulo'=>'Confirma Exclusão',
        'mensagem_delete'=>'Tem certeza que deseja excluir o Usuário'
    ], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>