<div class="row">
    <div class="col-lg-12">
        <div class="card card-outline-info">
            <div class="card-header">
                <h4 class="m-b-0 text-white">Cadastro de Usuário</h4>
            </div>
            <div class="card-block">
                <form action="<?php echo current_url(); ?>" method="post" name="formUsuario" id="formUsuario"
                      class="floating-labels m-t-40">
                    <div class="form-body">
                        <h3 class="card-title">Informações Pessoais</h3>
                        <hr>

                        <div class="row p-t-20 ">
                            <div class="form-group col-lg-6">
                                <input type="text" class="form-control" id="nome" name="nome"
                                       required>
                                <span class="bar"></span>
                                <label for="input1">Nome</label>
                            </div>

                            <div class="form-group col-lg-6">
                                <input type="text" class="form-control" id="sobreNomeUsuario" name="sobreNomeUsuario"
                                       required>
                                <span class="bar"></span>
                                <label for="input1">sobrenome</label>
                            </div>
                        </div>

                        <div class="row p-t-20 ">
                            <div class="form-group col-lg-6">
                                <input type="text" class="form-control" id="endereco"
                                       name="endereco"
                                       required>
                                <span class="bar"></span>
                                <label for="input1">Endereço</label>
                            </div>
                            <div class="form-group col-lg-6">
                                <input type="text" class="form-control inputmask" id="celular"
                                       name="celular"
                                       data-inputmask="'mask': '(99) 9 9999-9999'"
                                       required>
                                <span class="bar"></span>
                                <label for="input1">Telefone Celular</label>
                            </div>

                        </div>

                        <h3 class="box-title m-t-40">Dados de Acesso</h3>
                        <hr>

                        <div class="row p-t-20 ">
                            <div class="form-group col-lg-4">
                                <select name="funcaoUsuario" id="funcaoUsuario" class="form-control" required>
                                    <option value=""></option>
                                    <option value="Técnico">Técnico</option>
                                    <option value="Adminstração">Adminstração</option>
                                    <option value="cliente">Cliente</option>
                                </select>
                                <span class="bar"></span>
                                <label for="input1">Função</label>
                            </div>

                            <div class="form-group col-lg-4">
                                <select name="nivel" id="nivel" class="form-control" required>
                                    <option value=""></option>
                                    <option value="1">Administrador</option>
                                    <option value="2">Operacional</option>
                                    <option value="3">Administrativo</option>
                                    <option value="4">Técnico</option>
                                </select>
                                <span class="bar"></span>
                                <label for="input1">Nível</label>
                            </div>




                            <div class="form-group col-lg-4" id="funcionarios">
                                <select name="funcionario_id" id="funcionario_id" class="form-control m-b">
                                    <option value="">Vincular Funcionário ?</option>
                                    <?php
                                    foreach ($resultscomboFuncionarios as $r) {
                                        ?>
                                        <option value="<?php echo $r->idFuncionario ?>"><?php echo $r->nomeFuncionario . ' | ' . $r->funcao ?></option>
                                    <?php } ?>
                                </select>
                                <span class="bar"></span>
<!--                                <label for="input1">Funcionário</label>-->
                            </div>
                        </div>

                        <div class="row p-t-20 ">
                            <div class="form-group col-lg-6">
                                <input type="email" class="form-control" id="email"
                                       name="email"
                                       required>
                                <span class="bar"></span>
                                <label for="input1">Email/Login</label>
                            </div>
                            <!--/span-->
                            <div class="form-group col-lg-6">
                                <input type="password" class="form-control" id="senha"
                                       name="senha"
                                       required>
                                <span class="bar"></span>
                                <label for="input1">Senha</label>
                            </div>

                        </div>

                    </div>
                    <div class="form-actions text-right">
                        <a href="<?php echo base_url() ?>usuarios" id="" class="btn btn-dark"><i
                                    class="icon-arrow-left"></i> Voltar</a>
                        <button type="submit" class="btn btn-success"><i class="fa fa-save"></i> Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function () {
        $('#formUsuario').validate({
            rules: {
                nome: {required: true},
                cpf: {required: true},
                celular: {required: true},
                email: {required: true},
                senha: {required: true},
                endereco: {required: true},
                cidade: {required: true},
                funcaoUsuario: {required: true},
                nivel: {required: true},
                estado: {required: true},
                cep: {required: true}
            },
            messages: {
                nome: {required: 'Campo Requerido.'},
                cpf: {required: 'Campo Requerido.'},
                celular: {required: 'Campo Requerido.'},
                email: {required: 'Campo Requerido.'},
                senha: {required: 'Campo Requerido.'},
                endereco: {required: 'Campo Requerido.'},
                cidade: {required: 'Campo Requerido.'},
                estado: {required: 'Campo Requerido.'},
                funcaoUsuario: {required: 'Campo Requerido.'},
                nivel: {required: 'Campo Requerido.'},
                cep: {required: 'Campo Requerido.'}

            },
            errorClass: "help-inline",
            errorElement: "span",
            highlight: function (element, errorClass, validClass) {
                $(element).parents('.control-group').addClass('error');
            },
            unhighlight: function (element, errorClass, validClass) {
                $(element).parents('.control-group').removeClass('error');
                $(element).parents('.control-group').addClass('success');
            }
        });
        $("#funcionarios").prop("disabled", false);
    });

</script>






