<?php $this->load->view('commons/cabecalho'); ?>
<?php $this->load->view('commons/header'); ?>
<?php $this->load->view('commons/menu'); ?>
<style>
    div.dataTables_wrapper div.dataTables_info {
        padding-top: 18px !important;
    }
    div.dataTables_wrapper div.dataTables_paginate {
        padding-top: 18px !important;
    }
</style>
<div class="lds-css ng-scope"><div style="width:100%;height:100%" class="lds-cube"></div></div>
<div class="content-wrapper">
    <section class="content-header">
        <h1>Cursos Repetidos</h1>
        <br>
    </section>
    <section class="content container-fluid">    
        <div class="row">
            <div class="col-md-8">
                <div class="x_panel">
                    <div class="table-responsive">
                        <table id="tabela_aluno_curso" class="table table-bordered tablesorter table-striped">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Nome</th>
                                    <th>Curso</th>
                                    <th>Quantidade</th>
                                    <th>Situação</th> 
                                    <th></th>  
                                </tr>
                            </thead>    
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<?php $this->load->view('commons/rodape'); ?>
<script>
    $(document).ready(function () {
        $('#tabela_aluno_curso').DataTable({
            "paging": true,
            scrollX: true,
            scrollCollapse: true,
            "ordering": true,
            responsive: {
                details: {
                    type: 'column',
                    target: 'tr'
                }
            },
            "stateSave": false,
            "language": {
                "sEmptyTable": "Nenhum registro encontrado",
                "sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
                "sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
                "sInfoFiltered": "(Filtrados de _MAX_ registros)",
                "sInfoPostFix": "",
                "sInfoThousands": ".",
                "sLengthMenu": "_MENU_ Resultados por página",
                "sLoadingRecords": "Carregando...",
                "sProcessing": "Processando...",
                "sZeroRecords": "Nenhum registro encontrado",
                "sSearch": "Digite sua busca:",
                "oPaginate": {
                    "sNext": "<i class='fa fa-arrow-circle-right' aria-hidden='true'>",
                    "sPrevious": "<i class='fa fa-arrow-circle-left' aria-hidden='true'></i>",
                    "sFirst": "Primeiro",
                    "sLast": "Último"
                },
                "oAria": {
                    "sSortAscending": ": Ordenar colunas de forma ascendente",
                    "sSortDescending": ": Ordenar colunas de forma descendente"
                }
            },
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "Estatisticas/lista",
                "type": "POST"

            },
            "order": [[4, "DESC"]],
            "columnDefs": [
                {"orderable": false, "targets": [0, 1, 2, 3, 5]}
            ]
        });
         $('body').delegate('.btn-verifica', 'click', function () {
            let id_aluno = $(this).data("id_aluno");
            $.ajax({
                data: {id_aluno: id_aluno},
                type: "POST",
                dataType: 'json',
                url: 'Estatisticas/verifica',
                success: function (data) {
                    if (data['situacao'] === "sucesso") {
                        $('#tabela_aluno_curso').DataTable().ajax.reload();
                    }
                }
            });
        });
    });
</script>