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

<?php $__env->startSection('titulo'); ?>
  SGP - <?php echo e(Auth::user()->Unidade->getNome()); ?></b> - <i class="fas fa-user"></i> Usuário
<?php $__env->stopSection(); ?>

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

<div class="content-wrapper">
    <input type="hidden" id="hdnUsuario" name="idusuario" data="<?php echo e(Auth::user()->getId()); ?>"/>
    <input type="hidden" id="hdnId" name="id" data=""/>
    <input type="hidden" id="hdnUnidade" name="unidade" data="<?php echo e(Auth::user()->getUnidade()); ?>"/>
    
    <div class="container-fluid mt-2">
        
        <div id="cadastro" class="card mt-2" style="display: none; background-color:#fff; color:#056367; border-radius: 20px 0px 20px 0px;">
            
            <?php echo csrf_field(); ?>
            
            <div class="card-body">
                <div class="row" style="padding-right: 2px;">
                    <div class="col-md-2">
                        <!-- <h5 style="color:#056367;"><i class="fas fa-user"></i> Usuário</h5> -->
                    </div>
                    <div class="col-md-10">
                        <div class="col text-right">
                            
                            <button id="btnVoltar" type="button" class="btn btn-secondary" aria-label="Left Align" >
                                <i class="fas fa-arrow-left"></i> Voltar
                            </button>

                            <button id="btnSalvar" type="button" data="" class="btn btn-success" aria-label="Left Align" >
                                <i class="fas fa-save"></i> Salvar
                            </button>
                          
                            
                        </div>
                    </div>
                    
                </div>
                <hr></hr>
                <div class="row" >
                    
                    <div class="col-md-3">
                        <label id="txtLogin_label" for="txtLogin"  class="col-form-label text-md-left">Login <span style="color: #ff0000;">*</span></label>
                        <input id="txtLogin" class="form-control" name="login" type="text" maxlength="50" value="" required/>
                    </div>
                    <div class="col col-lg-2 col-12 text-left">
                        <label for="btnValidar1" class="col-form-label text-md-left">&nbsp;</label>
                        <br/>
                        <button id="btnValidar1"  class="btn btn-success btn-group-right"><i class="fas fa-check"></i> Validar Login</button>
                        <button id="btnTentativa"  class="btn btn-info btn-group-right"><i class="fas fa-arrow-left"></i> Tentar Novamente</button>
                    </div>

                </div>
                <div id="cadusuario">
                    <div class="row" >
                        <div class="col-md-6">
                            <label id="txtNome_label" for="txtNome"  class="col-form-label text-md-left">Nome <span style="color: #ff0000;">*</span></label>
                            <input id="txtNome" class="form-control" name="nome" type="text" maxlength="50" value="" required/>
                        </div>
                        <div class="col-md-2">
                            <label id="txtPessoa_label" for="txtPessoa"  class="col-form-label text-md-left">Nível de Acesso <span style="color: #ff0000;">*</span></label>
                            <br/>
                            <select id="cbClasse" class="form-control">
                                
                            </select>
                        </div>
                        <div class="col-md-1">
                            <label id="txtAtivo_label" for="txtAtivo"  class="col-form-label text-md-left">Cancelar?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbCancelar"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0" title="Permite cancelar estadia">
                                <span class="slider round"></span>
                            </label>
                        </div>
                        <div class="col-md-1">
                            <label id="txtAtivo_label" for="txtAtivo"  class="col-form-label text-md-left">Bloquear?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbBloquear"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0" title="Permite bloquear estadia">
                                <span class="slider round"></span>
                            </label>
                        </div>
                        <div class="col-md-1">
                            <label id="txtAtivo_label" for="txtAtivo"  class="col-form-label text-md-left">Ocorrência?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbOcorrencia"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0" title="Permite criar ocorrência para estadia">
                                <span class="slider round"></span>
                            </label>
                        </div>
                        <div class="col-md-1">
                            <label id="txtAtivo_label" for="txtAtivo"  class="col-form-label text-md-left">Prioridade?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbPrioridade"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0" title="Permite priorizar a limpeza/inspeção">
                                <span class="slider round"></span>
                            </label>
                        </div>
                        
                    </div>
                    <div class="row" >
                        <div class="col-md-4">
                            <label id="txtEmail_label" for="txtEmail"  class="col-form-label text-md-left">Email <span style="color: #ff0000;">*</span></label>
                            <input id="txtEmail" class="form-control" name="email" type="text" maxlength="100" value="" required/>
                        </div>
                        
                        <div class="col-md-2">
                            <label id="txtCelular_label" for="txtCelular"  class="col-form-label text-md-left">Celular</label>
                            <input id="txtCelular" class="form-control" name="celular" type="text" onkeydown="javascript: fMasc( this, mTel );" maxlength="14" value="" required/>
                        </div>

                        <div class="col-md-3">
                            <label id="txtCliente_label" for="txtCliente"  class="col-form-label text-md-left">Assoc. Cliente/Base</label>
                            <br/>
                            <select id="cbCliente" class="form-control">
                                
                            </select>
                        </div>
                        <div class="col-md-2">
                            <label id="txtCliente_label" for="txtCliente"  class="col-form-label text-md-left">Assoc. Destino/Base?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbDestino"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0">
                                <span class="slider round"></span>
                            </label>
                        </div>
                        <div class="col-md-1">
                            <label id="txtAtivo_label" for="txtAtivo"  class="col-form-label text-md-left">Ativo?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbAtivo"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0" title="Coloca usuário ativo/inativo">
                                <span class="slider round"></span>
                            </label>
                        </div>

                        

                    </div>
                    <div class="row" >
                        <div class="col-md-3">
                            <label id="txtSenha_label" for="txtSenha"  class="col-form-label text-md-left">Senha</label>
                            <div class="input-group mb-4">
                                <input id="txtSenha" type="password" class="form-control" maxlength="20" placeholder="">
                                <div class="input-group-append">
                                    <div class="input-group-text">
                                    <span class="fas fa-lock"></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <label id="txtConfirmacao_label" for="txtConfirmacao"  class="col-form-label text-md-left">Confirme a Senha</label>
                            <div class="input-group mb-4">
                                <input id="txtConfirmacao" type="password" class="form-control" maxlength="20" placeholder="">
                                <div class="input-group-append">
                                    <div class="input-group-text">
                                    <span class="fas fa-lock"></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <label id="txtCliente_label" for="txtCliente"  class="col-form-label text-md-left">Associado ao Transportador</label>
                            <br/>
                            <select id="cbTransportador" class="form-control">
                                
                            </select>
                        </div>

                        <div class="col-md-1">
                            <label id="cbVisto_label" for="txtAtivo"  class="col-form-label text-md-left">Visto Financ?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbVisto"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0">
                                <span class="slider round"></span>
                            </label>
                        </div>
                        <div class="col-md-1">
                            <label id="cbAprovador_label" for="txtAtivo"  class="col-form-label text-md-left">Aprovador?</label>
                            <br/>
                            <label class="switch">
                                <input id="cbAprovador"  type="checkbox" data-off-color="danger" data-on-text="1" data-off-text="0">
                                <span class="slider round"></span>
                            </label>
                        </div>

                    </div>

                    <div class="row" style="padding-right: 2px;">
                        
                        <div class="col-md-12">
                            <div class="col text-right">
                                
                                <button id="btnVoltarB" type="button" class="btn btn-secondary" aria-label="Left Align" >
                                    <i class="fas fa-arrow-left"></i> Voltar
                                </button>

                                <button id="btnSalvarB" type="button" data="" class="btn btn-success" aria-label="Left Align" >
                                    <i class="fas fa-save"></i> Salvar
                                </button>
                            
                                
                            </div>
                        </div>
                        
                    </div>
                </div>
            </div>
            
        </div>

        <div id="lista" class="card mt-2" style="background-color:#fff; color:#056367; border-radius: 20px 0px 20px 0px;">
            <div class="card-body">
                <div class="row" style="padding-bottom: 5px; padding-right: 2px;">
                
                    <div class="col-md-3">
                        <label id="txtCliente_label" for="txtCliente"  class="col-form-label text-md-left">Cliente/Base</label>
                        <br/>
                        <select id="cbClienteSel" class="form-control">
                            
                        </select>
                    </div>
                    
                    <div class="col col-md-2 text-left">
                        <label for="cbStatus" class="col-form-label text-md-left">Status</label>
                        <br/>
                        <select id="cbStatus" class="form-control">
                            <option value="">TODOS</option>
                            <option value="1" selected>ATIVOS</option>
                            <option value="0">INATIVOS</option>
                        </select>
                    </div>
                    <div class="col-md-2">
                        <label id="txtPalavra_label" for="txtLogin"  class="col-form-label text-md-left">Palavra</label>
                        <input id="txtPalavra" class="form-control" name="palavra" type="text" maxlength="50" value=""/>
                    </div>
                    
                    <div class="col-md-5 text-right">
                        <label for="cbStatus" class="col-form-label text-md-left">&nbsp;</label>
                        <br/>
                        <button id="btnPesquisar" type="button" class="btn btn-secondary" aria-label="Left Align" >
                            <i class="fas fa-search"></i> Pesquisar
                        </button>
                        <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 class="row" >
                    <div class="col panel panel-primary table-responsive">

                        <table id="tbUsuarios" class="table table-striped table-bordered text-left ">
                            <thead  style="background-color:#404040; color: #ccc; font-weight: bold;">
                                <tr>
                                    <th>Dados do Usuário</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                

                            </tbody>
                        </table>

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

<script type="text/javascript">
    function fMasc(objeto,mascara) {
        obj=objeto
        masc=mascara
        setTimeout("fMascEx()",1)
    }
    function fMascEx() {
        obj.value=masc(obj.value)
    }
    function mTel(tel) {
        tel=tel.replace(/\D/g,"")
        tel=tel.replace(/^(\d)/,"($1")
        tel=tel.replace(/(.{3})(\d)/,"$1)$2")
        if(tel.length == 9) {
            tel=tel.replace(/(.{1})$/,"-$1")
        } else if (tel.length == 10) {
            tel=tel.replace(/(.{2})$/,"-$1")
        } else if (tel.length == 11) {
            tel=tel.replace(/(.{3})$/,"-$1")
        } else if (tel.length == 12) {
            tel=tel.replace(/(.{4})$/,"-$1")
        } else if (tel.length > 12) {
            tel=tel.replace(/(.{4})$/,"-$1")
        }
        return tel;
    }
    function mCNPJ(cnpj){
        cnpj=cnpj.replace(/\D/g,"")
        cnpj=cnpj.replace(/^(\d{2})(\d)/,"$1.$2")
        cnpj=cnpj.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3")
        cnpj=cnpj.replace(/\.(\d{3})(\d)/,".$1/$2")
        cnpj=cnpj.replace(/(\d{4})(\d)/,"$1-$2")
        return cnpj
    }
    function mCPF(cpf){
        cpf=cpf.replace(/\D/g,"")
        cpf=cpf.replace(/(\d{3})(\d)/,"$1.$2")
        cpf=cpf.replace(/(\d{3})(\d)/,"$1.$2")
        cpf=cpf.replace(/(\d{3})(\d{1,2})$/,"$1-$2")
        return cpf
    }
    function mCEP(cep){
        cep=cep.replace(/\D/g,"")
        cep=cep.replace(/^(\d{2})(\d)/,"$1.$2")
        cep=cep.replace(/\.(\d{3})(\d)/,".$1-$2")
        return cep
    }
    function mNum(num){
        num=num.replace(/\D/g,"")
        return num
    }
</script>

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