<!--Cabecalho -->
<?php $this->load->view('commons/cabecalho'); ?>
<!--Header -->
<?php $this->load->view('commons/header'); ?>
<script>
    $(window).on("load", function () {
        var auth2 = gapi.auth2.getAuthInstance();
        auth2.signOut().then(function () {
            console.log('Usuário deslogou');
        });
        auth2.disconnect();
    });
</script>
<style>
    .list-inline {
        padding-left: 0;
        margin-left: -5px;
        list-style: none;
    }
    .list-inline > li {
        display: inline-block;
        padding-right: 5px;
        padding-left: 5px;
    }
    .g-signin2 {
        background-color: white;
    }
    <?php
    $this->load->library('user_agent');
    $agent = $this->agent->browser();
    if ($agent == 'Firefox') {
        echo '.btn-google-li {position: absolute;}';
    }
    ?>
</style>
<link rel="stylesheet" href="<?php echo base_url('assets/css/materialize-social.css') ?>">
<br>
<div class="container"> 
    <div class="row">
        <div class="col m2"></div>
        <div class="col s12 m8">

            <h4 style="font-size: 30pt;" class="text-mobile"><b>Faça o seu cadastro</b></h4>
            <div class="login-social">
                <ul class="list-inline">
                    <li class="btn-facebook-li"><button class="btn-facebook waves-effect waves-light btn social facebook">&nbsp;&nbsp; Login com Facebook</button></li>
                    <li class="btn-google-li"><button class="g-signin2" onclick="google()" data-onsuccess="onSignIn" data-width="180"style="background-color: white !important; border:none !important;"></button></li>
                </ul>
            </div>
            <br>

            <div id="form_login_site"></div>
            <div class="form-error-cadastro">
            </div>
            <form id="form-cadastro-aluno" autocomplete="off">
                <div class="row">
                    <div class="input-field col s12">
                        <input autofocus="" name="nome-aluno" type="text" class="nome-aluno" required="" minlength="10" autocomplete="off">
                        <label for="nome" >Digite o seu <b>Nome Completo</b> (Sem abreviações)</label>
                    </div>
                </div>
                <div class="row">
                    <div class="input-field col s12" style="margin-top: -2%">
                        <?php if (isset($_SESSION['email-aluno']) == TRUE) { ?>
                            <input   class="autocomplete" value="<?= $_SESSION['email-aluno'] ?>" onkeyup="maiuscula(this)" autocomplete="off" type="email" id="email_login" name="email"  pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"  required="">
                        <?php } else { ?>
                            <input   class="autocomplete" onkeyup="maiuscula(this)" autocomplete="off" type="email" id="email_login" name="email"  pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"  required="">
<?php } ?>            <label for="nome" >Digite o seu melhor email</label>  
                        <input id="emailAux" class="aux">
                       
                    </div>
                </div>
                <div class="row">
                    <div class="input-field col s5 m6" style="margin-top: -4%">
                        <input name="senha-aluno" autocomplete="off" type="password" class="senha-aluno" required="" minlength="6" autocomplete="off">
                        <label for="senha">Senha</label>
                    </div>

                    <div class="input-field col s5 m6" style="margin-top: -4%">
                        <input name="senha-aluno-conf" autocomplete="off" type="password" class="senha-aluno-conf" required="" minlength="6" autocomplete="off">
                        <label for="senha">Confirmação de Senha</label>
                    </div>
                </div>
                <div class="row">
                    <div class="input-field col s5 m4" style="margin-top: -4%">
                        <input type="tel" class="only-number" required="" name="ddd" pattern="[0-9]+$" minlength="2" maxlength="2" autocomplete="off">
                        <label for="ddd">DDD</label>
                    </div>
                    <div class="input-field col s7 m8" style="margin-top: -4%">
                        <input type="tel" class="only-number" required="" name="celular" minlength="9" maxlength="9" pattern="[0-9]+$" autocomplete="off">
                        <label for="celular">Celular</label>
                    </div>
                </div>
                <div class="row">
                    <input type="checkbox" id="termo" class="filled-in" name="termo" required=""/>
                    <label for="termo">Concordo com o <a href="" class="modal-trigger modal-termo tooltipped"  data-target="termo_uso" data-position="right" data-delay="50" data-tooltip="Clique para mais detalhes"><b>Termo de Uso</b></a></label>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="checkbox" id="notificacao" class="filled-in" name="notificacao" checked="">
                    <label for="notificacao">Gostaria de receber Notificações Promocionais?</label>
                </div>
                <br>
                <div class="col s12">
                    <button class="btn waves-effect waves-light cadastra" type="submit" name="action" style="background-color: #2ba447; width: 100%; margin-left: -1.3%;">Cadastrar</button>
                </div>
            </form> 
        </div>
    </div>
</div>
<br>
<?php $this->session->unset_userdata('email-aluno');
$this->load->view('commons/rodape'); ?>
<script>
$('body').delegate('input[name=senha-aluno]', 'keypress', function (e) {
    if (e.which === 32) {
       e.preventDefault();
    }
});
$('body').delegate('input[name=senha-aluno-conf]', 'keypress', function (e) {
    if (e.which === 32) {
       e.preventDefault();
    }
});
</script>