<!DOCTYPE html>
<html lang="pt-br">

<head>

  <!-- Metas Tags -->
  <?php include "includes/verifica.php"; ?>

  <!-- Metas Tags -->
  <?php include "../_assets/inc/metas.php"; ?>

  <!-- Title -->
  <?php include "../_assets/inc/title_adm.php"; ?>

  <!-- Head -->
  <?php include "../_assets/inc/head.php"; ?>

  <!-- Style DataTables -->
  <?php include "../_assets/inc/datatablesStyles.php"; ?>

  <!-- JS -->
  <?php include "../_assets/inc/js.php"; ?>

  <!--Input Bootstrap-->
  <?php include "../_assets/inc/js_input.php"; ?>
  <!-- morris.js -->
<script src="../_assets/js/moris/raphael-min.js"></script>
<script src="../_assets/js/moris/morris.min.js"></script>

  
  
  <script type="text/javascript" src="includes/js/manterAlunos.js"></script>

  <style type="text/css">
    .img-update-estoque{
      width: 200px; 
    }
    div#grafico_morris{
      width:100%; 
      height:300px;
    }

    /*########*/
  
    div.divTable table.tabelaDinamica {
      border-collapse: collapse;
      border: 1px solid black;
      width: 570px!important;
      margin-left: auto;
      margin-right: auto;
    }

    div.divTable table.tabelaDinamica tr.trDetalhes td {
        min-width: 100px;
        border: 1px solid black!important;
        border-color: #000!important;
        padding: 1px;
        text-align: center;
    }
    div.divTable table.tabelaDinamica tr td {
        min-width: 100px;
        border: 1px solid black!important;
        border-color: #000!important;
        padding: 1px;
        text-align: center;
    }

    div.divTable table.tabelaDinamica tr.trDetalhes{
      min-width: 100px!important;
      color: #fff;
      background-color: #73879C;
      border: 1px solid black;
      border-color: #000;
    }

    div.divTable {
      max-width: 770px!important;
      margin-left: auto;
      margin-right: auto;
      text-align: center;
    }

    div.divTableInd table.tabelaDinamica tr.trDetalhes td {
        min-width: 150px!important;
    }
    div.divTableInd table.tabelaDinamica tr td {
        min-width: 150px!important;
    }
  </style>

</head>

<body class="nav-md">
  <div id="maskLoad"></div>
  <div class="container body">
    <div class="main_container">

      <?php include "includes/menu.php"; ?>
      <?
        try {

          $sql = $pdo->prepare("select turma_id, turma_titulo FROM turma 
                      WHERE turma_status = 1 
                      ORDER BY turma_titulo ASC");
          $sql->execute();
          $result=$sql->fetchAll(PDO::FETCH_ASSOC);//FETCH_ASSOC

        } catch (Exception $e) {
          echo $e->getMessage();
        }

      ?>

      <div class="right_col" role="main">

        <p class="text-center"><img  id="loadPublicacao" src="../_assets/images/gif/loading.gif" style="max-width: 150px; display:scroll;position:fixed;right: 0px; bottom: 0px; z-index: 10; display: none;"></p>
        <div class="">
          <!--Modal para atualizaçao-->
          <div class="modal fade" id="myModalAtualizar" role="dialog">
            <div class="modal-dialog">
              <!-- Modal content-->
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal">&times;</button>
                  <h3><span class="glyphicon glyphicon-pencil"></span> Atualizar Aluno</h3>
                </div>
                <div class="modal-body" style="padding:30px 40px;">

                  <form class="form-horizontal" id="formAtualizar" enctype="multipart/form-data" style="max-width: 600px;">

                    <div class="row">
                      <div class="col-md-4 col-sm-12 col-xs-12">
                        <img id="img-pro" class="img-update-estoque" src="">
                      </div>
                      <div class="col-md-8 col-sm-12 col-xs-12" id="produtoDetalhe">
                        
                        <div class="form-group">
                          <label class="control-label col-md-3 col-sm-3 col-xs-12" for="nomeAt">Nome <span class="required">*</span>
                          </label>
                          <div class="col-md-9 col-sm-9 col-xs-12">
                            <input type="text" id="nomeAt" name="nomeAt" placeholder="Nome do ALuno" required="required" class="form-control col-md-7 col-xs-12">
                            <input type="hidden" id="idAt" name="idAt">
                            <input type="hidden" id="idturma_aluno_id" name="idturma_aluno_id">
                            <input type="hidden" id="statusAt" name="statusAt">
                            <input type="hidden" id="reloadAt" name="reloadAt">
                          </div>
                        </div>

                        <!--Matricula-->
                        <div class="form-group">
                          <label class="control-label col-md-3 col-sm-3 col-xs-12" for="matAt">Matricula:</label>
                          <div class="col-sm-9"> 
                            <input type="text" id="matAt" name="matAt" placeholder="Matricula do Aluno" required="required" class="form-control col-md-7 col-xs-12">
                          </div>
                        </div>

                        <!--Senha-->
                        <div class="form-group">
                          <label class="control-label col-md-3 col-sm-3 col-xs-12" for="senhaAt">Senha:</label>
                          <div class="col-sm-9"> 
                            <input type="checkbox"  onchange="document.getElementById('senhaAt').disabled = !this.checked;"> Para habilitar marque a caixa ao lado.
                            <input type="password" id="senhaAt" name="senhaAt" placeholder="Informe uma senha" required="required" class="form-control col-md-7 col-xs-12" disabled>
                          </div>
                        </div>

                        <!--CPF-->
                        <div class="form-group">
                          <label class="control-label col-md-3 col-sm-3 col-xs-12" for="cpfAt">CPF:</label>
                          <div class="col-sm-9"> 
                            <input pattern="\d{3}\.\d{3}\.\d{3}-\d{2}" type="text" id="cpfAt" name="cpfAt" placeholder="Informe o CPF" class="form-control" data-inputmask="'mask': '999.999.999-99'" title="000.000.000-00">
                          </div>
                        </div>
                            
                        <!--E-Mail-->
                        <div class="form-group">
                          <label class="control-label col-md-3 col-sm-3 col-xs-12" for="emailAt">E-Mail:</label>
                          <div class="col-sm-9"> 
                            <input type="email" class="form-control" id="emailAt" name="emailAt" placeholder="E-mail para contato" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" title="exemplo@exemplo.com">
                          </div>
                        </div>
                        <!--Login-->
                        <div class="form-group">
                          <label class="control-label col-md-3 col-sm-3 col-xs-12" for="dataAt">Data de Nasc:</label>
                          <div class="col-sm-9">
                            <input type="date" class="form-control" id="dataAt" name="dataAt" placeholder="Login para acesso">
                          </div>
                        </div>

                        
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="idTurmaAt">Turma</label>
                      <div class="col-sm-9">
                        <select id="idTurmaAt" name="idTurmaAt" class="form-control" required>
                          <option value="" selected disabled>Escolha a turma</option>
                          <? foreach ($result as $key => $value) { ?>
                          <option value="<?=$value['turma_id']?>"><?=$value['turma_titulo']?></option>
                          <? } ?>
                        </select>
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="enderecoAt">Endereço <span class="required">*</span>
                      </label>
                      <div class="col-md-9 col-sm-9 col-xs-12">
                        <textarea type="text" id="enderecoAt" name="enderecoAt" placeholder="Descreva o endereço do aluno." class="form-control col-md-7 col-xs-12" rows="4" cols="50" style="resize: none;"></textarea>
                      </div>
                    </div>

                    <div class="form-group"> 
                      <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default" id="btnAtualizar">Atualizar</button>
                        <img  id="submitGif" src="../_assets/images/gif/load.gif" style="max-width: 50px;">
                        <p id="retornoAt" class="text-center"></p>
                      </div>
                    </div>

                  </form>
                </div> <!--modal-body (Atualizar)-->
              </div><!--modal-content (Atualizar)-->
            </div><!--modal-dialog (Atualizar)-->
          </div> <!--modal fade (Atualizar)-->

          <!--Modal para Gabarito-->
          <div class="modal fade" id="myModalGabarito" role="dialog">
            <div class="modal-dialog">
              <!-- Modal content-->
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal">&times;</button>
                  <h3><span class="glyphicon glyphicon-pencil"></span> Atualizar Gabarito</h3>
                </div>
                <div class="modal-body" style="padding:30px 40px;">

                  <form class="form-horizontal" id="formAtualizarGab" enctype="multipart/form-data" style="max-width: 600px;">

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="nomeAt">Nome <span class="required">*</span>
                      </label>
                      <div class="col-md-9 col-sm-9 col-xs-12">
                        <input type="text" id="nomeAtGab" name="nomeAt" placeholder="Nome do ALuno" required="required" class="form-control col-md-7 col-xs-12" disabled>
                        <input type="hidden" id="idAtGab" name="idAtGab">
                        <input type="hidden" id="statusGab" name="statusGab">
                      </div>
                    </div>
                    <!--Matricula-->
                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="matAt">Matricula:</label>
                      <div class="col-sm-9"> 
                        <input type="text" id="matAtGab" name="matAtGab" placeholder="Matricula do Aluno" required="required" class="form-control col-md-7 col-xs-12" disabled>
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="matAt">Simulado:</label>
                      <div class="col-sm-9"> 
                        <select id="simuAt" name="simuAt" class="form-control" required>
                          <option value="" selected disabled>---</option>
                        </select>
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="inicioAt">Início:</label>
                      <div class="col-sm-9"> 
                        <input type="time" id="inicioAt" name="inicioAt" required="required" class="form-control col-md-7 col-xs-12">
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="fimAt">Fim:</label>
                      <div class="col-sm-9"> 
                        <input type="time" id="fimAt" name="fimAt" required="required" class="form-control col-md-7 col-xs-12">
                      </div>
                    </div>

                    <div class="form-group" style="max-width: 350px; margin-left: auto; margin-right: auto;">
                      
                      <div class="row questoes">
                          <div class="col-md-6 col-sm-6 col-xs-12">
                            
                            <? for ($i=1; $i < 6; $i++) { ?>

                            <div class="form-group">
                              <label for="data" class="control-label col-md-3 col-sm-3 col-xs-12"><?=$i?>º</label>
                              <div class="col-md-9 col-sm-12 col-xs-12">
                                <input type="hidden" id="simu_resp_id<?=$i?>" name="simu_resp_id[]">
                                <select id="questaoAt<?=$i?>" name="questoesAt[]" class="form-control" required>
                                    <option value="" selected disabled>---</option>
                                    <option value="A">A</option>
                                    <option value="B">B</option>
                                    <option value="C">C</option>
                                    <option value="D">D</option>
                                    <option value="E">E</option>
                                </select>
                              </div>

                            </div> <!-- form-group -->
                            
                            <? } ?>

                          </div><!-- col -->

                          <div class="col-md-6 col-sm-6 col-xs-12">
                            
                            <? for ($i=6; $i < 11; $i++) { ?>

                            <div class="form-group">
                              <label for="data" class="control-label col-md-3 col-sm-3 col-xs-12"><?=$i?>º</label>
                              <div class="col-md-9 col-sm-12 col-xs-12">
                                <input type="hidden" id="simu_resp_id<?=$i?>" name="simu_resp_id[]">
                                <select id="questaoAt<?=$i?>" name="questoesAt[]" class="form-control" required>
                                    <option value="" selected disabled>---</option>
                                    <option value="A">A</option>
                                    <option value="B">B</option>
                                    <option value="C">C</option>
                                    <option value="D">D</option>
                                    <option value="E">E</option>
                                </select>
                              </div>

                            </div> <!-- form-group -->
                            
                            <? } ?>

                          </div><!-- col -->
                      </div><!-- row -->
                    </div>
                    

                   

                    <div class="form-group"> 
                      <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default" id="btnAtualizar2">Atualizar</button>
                        <img  id="submitGif2" src="../_assets/images/gif/load.gif" style="max-width: 50px;">
                        <p id="retornoAtGab" class="text-center"></p>
                      </div>
                    </div>

                  </form>
                </div> <!--modal-body (Atualizar)-->
              </div><!--modal-content (Atualizar)-->
            </div><!--modal-dialog (Atualizar)-->
          </div> <!--modal fade (Gabarito)-->

          <!--Modal para Gabarito-->
          <div class="modal fade" id="myModalGrafico" role="dialog">
            <div class="modal-dialog">
              <!-- Modal content-->
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal">&times;</button>
                  <h3><span class="glyphicon glyphicon-pencil"></span> Visualizar Notas</h3>
                </div>
                <div class="modal-body" style="padding:30px 40px;">

                  <form class="form-horizontal" id="formAtualizarGraf" enctype="multipart/form-data" style="max-width: 600px;">

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="nomeAt">Nome <span class="required">*</span>
                      </label>
                      <div class="col-md-9 col-sm-9 col-xs-12">
                        <input type="text" id="nomeAtNota" name="nomeAt" placeholder="Nome do ALuno" required="required" class="form-control col-md-7 col-xs-12" disabled>
                      </div>
                    </div>
                    <!--Matricula-->
                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="matAt">Matricula:</label>
                      <div class="col-sm-9"> 
                        <input type="text" id="matAtNota" name="matAtGab" placeholder="Matricula do Aluno" required="required" class="form-control col-md-7 col-xs-12" disabled>
                      </div>
                    </div>

                  <div class="x_content" id="grafico_add" style="margin-left: 40px;">
                  </div>
                  </form>
                </div> <!--modal-body (Atualizar)-->
              </div><!--modal-content (Atualizar)-->
            </div><!--modal-dialog (Atualizar)-->
          </div> <!--modal fade (Gabarito)-->

          <div class="page-title">
            <div class="title_left">
              <h3>Alunos</h3>
            </div>
            <div class="title_right">
              <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
                <div class="input-group">

                </div>
              </div>
            </div>
          </div>
          <div class="clearfix"></div>

          <div class="row">

            <!-- Form de cadastro-->
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="x_panel">
                <div class="x_title">
                  <h2>Cadastrar Aluno<small>*Para uso do sistema</small></h2>
                  <ul class="nav navbar-right panel_toolbox">
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                    </li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                      <ul class="dropdown-menu" role="menu">
                        <li><a href="includes/excel.php?tipo=login" target="_blank">Exportar para Excel(Infos de Login)</a>
                        </li>
                      </ul>
                    </li>
                    <li><a class="close-link"><i class="fa fa-close"></i></a>
                    </li>
                  </ul>
                  <div class="clearfix"></div>
                </div>
                <div class="x_content">
                  <br />

                  <form id="formCadastrar" data-parsley-validate class="form-horizontal form-label-left" enctype="multipart/form-data">

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Nome <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="text" id="nome" name="nome" placeholder="Nome do aluno" required="required" class="form-control col-md-7 col-xs-12">
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Matrícula <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="text" id="matricula" name="matricula" placeholder="Matrícula do aluno" required="required" class="form-control col-md-7 col-xs-12">
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Senha <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="password" id="senha" name="senha" placeholder="Informe uma senha" required="required" class="form-control col-md-7 col-xs-12">
                      </div>
                    </div>

                    
                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">E-Mail <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="email" id="email" name="email" placeholder="E-mail para contato" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" title="exemplo@exemplo.com" class="form-control col-md-7 col-xs-12">
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="cpf">CPF <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input pattern="\d{3}\.\d{3}\.\d{3}-\d{2}" type="text" name="cpf" placeholder="Informe o CPF" class="form-control" data-inputmask="'mask': '999.999.999-99'" title="000.000.000-00">
                      </div>
                    </div>

                    <div class="form-group">
                      <label for="data" class="control-label col-md-3 col-sm-3 col-xs-12">Data de Nasc. 
                        <span class="required">*</label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input id="data" name="data" class="form-control col-md-7 col-xs-12" type="date" placeholder="Informe a data" >
                      </div>
                    </div>

                    <div class="form-group">
                      <label for="data" class="control-label col-md-3 col-sm-3 col-xs-12">Turma 
                        <span class="required">*</label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <select id="idTurma" name="idTurma" class="form-control" required>
                          <option value="" selected disabled>Escolha a turma</option>
                          <? foreach ($result as $key => $value) { ?>
                            <option value="<?=$value['turma_id']?>"><?=$value['turma_titulo']?></option>
                          <? } ?>
                        </select>
                      </div>
                    </div>

                    <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="endereco">Endereço <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <textarea type="text" id="endereco" name="endereco" placeholder="Descreva o endereco do aluno." class="form-control col-md-7 col-xs-12" rows="4" cols="50" style="resize: none;"></textarea>
                      </div>
                    </div>

                    <div class="ln_solid"></div>
                    <div class="form-group">
                      <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                        <a class="btn btn-primary" id="btmCancelar">Cancelar</a>
                        <button type="submit" id="btnCadastro" class="btn btn-success">Cadastrar</button>
                      </div>
                    </div>

                  </form>
                </div>
              </div>
            </div><!--Form de cadastro-->

            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="x_panel">
                <div class="x_title">
                  <h2>Manter Alunos <small>*Atualizar dados</small></h2>
                  <ul class="nav navbar-right panel_toolbox">
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                    </li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                      <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Settings 1</a>
                        </li>
                        <li><a href="#">Settings 2</a>
                        </li>
                      </ul>
                    </li>
                    <li><a href="#"><i class="fa fa-close"></i></a>
                    </li>
                  </ul>
                  <div class="clearfix"></div>
                </div>
                <div class="x_content">
                  <p class="text-muted font-13 m-b-30">
                    Aqui você acompanha os dados de cada aluno e poderá verificar suas informações.
                  </p>

                  <div class="" role="tabpanel" data-example-id="togglable-tabs">
                    <ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
                      <li role="presentation" class="active"><a href="#tab_content1" id="home-tab" role="tab" data-toggle="tab" aria-expanded="true">Alunos Ativos</a>
                      </li>
                      <li role="presentation" class=""><a href="#tab_content2" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">Alunos Inativos</a>
                      </li>
                    </ul>

                    <div id="myTabContent" class="tab-content">
                      <!--Ativos-->
                      <div role="tabpanel" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab">
  
                        <table id="datatable-aluno-active" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
                          <thead>
                            <tr>
                              <th>Nome</th>
                              <th>Matrícula</th>
                              <th>E-Mail</th>
                              
                              <th>Ações</th>
                            </tr>
                          </thead>
                        </table>
                      </div><!--tab_content1-->

                      <!--inativos-->
                      <div role="tabpanel" class="tab-pane fade" id="tab_content2" aria-labelledby="profile-tab">
                        <table id="datatable-aluno-inactive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
                          <thead>
                            <tr>
                              <th>Nome</th>
                              <th>Matrícula</th>
                              <th>E-Mail</th>
                              
                              <th>Ações</th>
                            </tr>
                          </thead>
                        </table>
                      </div><!--tab_content2-->
                    
                    </div><!--myTabContent-->
                  </div><!--tabpanel-->


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

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

  </div>
</div>

<?php include "includes/alertas.php"; ?>
<?php include "../_assets/inc/datatables.php"; ?>
<?php include "../_assets/inc/js_footer.php"; ?>




</body>

</html>
