
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Aroeira - Login</title>
    <?php $this->load->view("sistema/temas/headcsssistema"); ?>
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/sistema/css/telaLogin/style.min.css">
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/sistema/css/telaLogin/animate.min.css">

    <?php $this->load->helper('javascriptssitemainicio_helper'); ?>

</head>

<body ng-app="target" style="margin-top: -20px;">

<div class="inner">
    <div class="sidebar slide-in one"></div>

    <div class="box-intro">
        <!--<div class="logo logo-gescon slide-in one">-->
        <!--    <img src="<?php echo base_url(); ?>assets/site/images/banner1.jpg" alt="Divisorias - Sistema de Gestão de Manutenção">-->
        <!--</div>-->

        <div class="title">
            <h1 class="slide-in two hidden-sm-down" style="color: white">Bem-vindo ao <span>Sistema de Gestão</span> <span>AROEIRA</span></h1>
            <hr class="slide-in five"/>
            <h3 class="slide-in three " style="color: yellow">Gestão Integrada de Vendas</h3>
<!--            <a href="--><?php //echo base_url(); ?><!--principal/gerenciarSite"><h3 class="slide-in three " style="color: blue">Voltar Site</h3></a>-->
            
        </div>


    </div>

    <div class="box-login slide-in five">
        <h2 style="color: yellow">Login</h2>

        <form class="login-form" id="formLogin" method="post">
            <div class="group">
                <input type="text" id="email" style="color: white" name="email" required>
                <span class="bar"></span>
                <label for="user">Usuário</label>
            </div>

            <div class="group">
                <input type="password" id="senha" style="color: white" name="senha" required>
                <span class="bar"></span>
                <label for="password">Senha</label>
            </div>

            <div class="password-options hidden-sm-down" >
                <div class="remember form-group" style=" visibility: hidden;">
                    <input type="checkbox" value="" class="checkbox" id="remember">
                    <label for="remember">Lembrar login</label>
                </div>
                <div class="forgot">
                    Esqueceu sua senha? <a href="#" onclick="mostrarInfo(event);">Clique aqui</a>.
                </div>
            </div>
            <div class="login-btn text-center">
                <button type="submit">
                    <span>Entrar</span>
                    <i class="icon-right-open-big"></i>
                </button>
            </div>
        </form>
        <div class="login-access" style=" display: none;">
            <a href="#">Acessar com Certificado Digital</a>
            <a href="#">Atualizar Certificados</a>
        </div>
    </div>
</div>

<div class="footer">
    <div>
        Sistema Versão<font id="versao-app"></font> (Build <em><font id="build-app"></font></em>) | <font id="ambiente-app"></font> | Copyright ɠ2018 | Todos os direitos reservados
    </div>
    <!--    <div>-->
    <!--        <img src="/gescon/login2/img/logo-gescon-azul.png" alt="GESCON - Sistema de Gestão Contratos">-->
    <!--        <span>um produto</span>-->
    <!--        <img src="/gescon/login2/img/logo-n2o.png" alt="N2O">-->
    <!--    </div>-->
</div>

</body>
</html>

<script type="text/javascript">
    $(document).ready(function () {
        $('#email').focus();
        $("#formLogin").validate({
            rules: {
                email: {required: true, email: true},
                senha: {required: true}
            },
            messages: {
                email: {required: 'Campo Requerido.', email: 'Insira Email válido'},
                senha: {required: 'Campo Requerido.'}
            },

            submitHandler: function (form) {
                var dados = $(form).serialize();

                console.log(dados);
                $.ajax({
                    type: "POST",
                    url: "<?php echo base_url();?>principal/verificarLoginSistema?ajax=true",
                    data: dados,
                    dataType: 'json',
                    success: function (data) {
                        console.log(data);
                        if (data.result == true) {
                            console.log("deu certo");
                            window.location.href = "<?php echo base_url();?>principal/gerenciarSistema";
                        }
                        else {
                            console.log("cheguei no nao sucess");
                            // $("#notification").modal('show');
                            $('#call-modal').trigger('click');
                        }
                    }
                });

                return false;
            },

            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');
            }
        });

    });


</script>

<a href="#notification" id="call-modal" role="button" class="btn" data-toggle="modal" style="display: none ">notification</a>

<div class="modal fade" id="notification">
    <div class="modal-dialog">
        <div class="modal-content">
            <!--Inicio Conteudo da Modal-->
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 id="myModalLabel">Antema Informa !</h4>
            </div>
            <div class="modal-body">
                <h5 style="text-align: center">Os dados de acesso estão incorretos, por favor tente novamente!</h5>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Fechar</button>
            </div>
            <!--Fim Conteudo da Modal-->
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- Bootstrap -->

