{% extends 'CmBundle:Z:baseDos.html.twig' %}

{% block stylesheet %}
    <link rel="stylesheet" href="{{ asset('js/chosen/chosen.css') }}">

    <link rel="stylesheet" href="{{ asset('tablefilter/tablefilter.css') }}">

    <style>
        div.tot span {
            font-weight: 1000;
            font-size: initial;
        }
    </style>

{% endblock %}

{% block javascripts %}
    <script src="{{ asset('js/chosen/chosen.jquery2.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('js/chosen/docsupport/prism.js') }}" type="text/javascript" charset="utf-8"></script>
    <script src="{{ asset('js/chosen/docsupport/init.js') }}" type="text/javascript" charset="utf-8"></script>

    <script src="{{ asset('js/popper.min.js') }}" type="text/javascript" charset="utf-8"></script>

    <script>
        // Chosen touch support.
        if ($('.chosen-container').length > 0) {
            $('.chosen-container').on('touchstart', function (e) {
                e.stopPropagation();
                e.preventDefault();
                // Trigger the mousedown event.
                $(this).trigger('mousedown');
            });
        }
    </script>

    <script src="{{ asset('tablefilter/tablefilter.js') }}" type="text/javascript"></script>
    <script data-config>
        var filtersConfig = {
            base_path: 'tablefilter/',
            filters_row_index: 1,
            highlight_keywords: true,
            col_0: 'NONE',
            col_2: 'select',
            col_3: 'select',
            col_4: 'select',
            col_5: 'select',
            col_6: 'select',
            col_7: 'select',
            col_8: 'select',
            col_9: 'select',
            col_10: 'select',
            col_11: 'select',
            col_12: 'select',
            clear_filter_text: '< Todos >',
            auto_filter: true,
            auto_filter_delay: 200, //milliseconds
            ignore_diacritics: true,
            load_filters_on_demand: true,
            responsive: true,
            toolbar: {
                target_id: 'externalToolbar'
            },
            loader: true,
            loader: {
                text: 'Cargando...'
            },
            status_bar: {
                target_id: 'externalToolbar'
            },
            rows_counter: {
                text: 'NUMERO DE REGISTROS: '
            },
            btn_reset: true,
            msg_filter: 'Filtrando...',
            alternate_rows: true,
            mark_active_columns: {
                highlight_column: true
            },
            /* SkyBlue theme */
            themes: [{name: 'skyblue'}],
            /*paging: {
             page_text: 'Página',
             of_text: ' de ',
             toolbar_position: 'left',
             results_per_page: ['Filas: ', [5, 10, 15, 20]],
             btn_next_page_text: 'Siguiente >',
             btn_prev_page_text: '< Anterior',
             btn_last_page_text: 'Última página >>',
             btn_first_page_text: '<< Primera página'
             },*/

        };
        var tf = new TableFilter('demo', filtersConfig, 1);
        tf.init();

        $(document).ready(function () {
            $('[data-toggle="tooltip"]').tooltip();
        });

    </script>

    <script src="{{ asset('js/misJs/alumnosDA.js') }}" type="text/javascript" charset="utf-8"></script>
    <script src="{{ asset('js/misJs/cambiarCuatri.js') }}" type="text/javascript" charset="utf-8"></script>

    <script>
        $(function () {
            $('[data-toggle="popover"]').popover()
        })
    </script>
{% endblock %}

{% block content %}
    <div class="container-fluid">
        <h1 class="mt-4">BASE GENERAL DE ALUMNOS</h1>
        <ol class="breadcrumb mb-2">
            <li class="breadcrumb-item"><a href="{{ path('cm_homepage') }}">Tablero</a></li>
            <li class="breadcrumb-item active">BG</li>
        </ol>

        <div class="row">

            <div class="col-lg-12 table-responsive">
                <div id="externalToolbar">

                </div>
            </div>


            <div class="col-lg-12 table-responsive">
                <table style="font-size: xx-small;" id="demo">
                    <thead>
                    <tr>
                        <th>N.C.</th>
                        <th>NOMBRE</th>
                        <th>NIVEL ACADEMICO</th>
                        <th>ESPECIALIDAD</th>
                        <th>SISTEMA</th>
                        <th>GRADO</th>
                        <th>PLANTEL</th>
                    </tr>

                    </thead>
                    <tbody>
                    {% set especialidad = "" %}
                    {% set sumaTotalIngresosColegiaturas = 0 %}
                    {% set sumaTotalAdeudosColeInscripciones = 0 %}
                    {% set registros = 0 %}
                    {% for a in alumnos %}
                        {% set registros = 1 %}
                        {% if a[0].cveLic != null %}
                            {% if especialidad == a[0].cveLic.nomLic %}
                            {% else %}
                                {% set especialidad = a[0].cveLic.nomLic %}
                                {% if loop.index > 1 %}
                                    {# <tr>
                                            <td colspan="13" style="background-color: darkgray;"></td>
                                        </tr> #}
                                {% else %}
                                {% endif %}
                            {% endif %}
                        {% else %}
                        {% endif %}
                        <tr>
                            <td style="vertical-align: middle;text-align: right;">{{ loop.index }}</td>
                            <td class="align-middle" style="vertical-align: middle;">
                                {{ a[0].apePat }} {{ a[0].apeMat }} <i
                                        style="font-weight: bolder;">{{ a[0].nomAlu }}</i> :
                                <span style="font-weight: bolder;">
                                        <a href="{{ path('consulta_alumno_dos', {ideAlu: a[0].ideAlu} ) }}"
                                           target="_blank" style="color: black;">{{ a[0].cveCtl }}</a>
                                    </span>
                                {% set tipoUsuario = app.session.get('rol') %}
                                {% if tipoUsuario == 99 %}
                                    <a href="{{ path('vista_pago',{cveCtl:a[0].cveCtl}) }}"
                                       class="btn btn-xs btn-success float-end" target="_blank" data-toggle="tooltip"
                                       title="Ir a Caja..." data-placement="right">$</a>
                                {% endif %}
                            </td>
                            {% if a[0].tipoAlumno == 1 %}
                                <td style="vertical-align: middle;">BACHILLERATO</td>
                            {% elseif a[0].tipoAlumno == 2 %}
                                <td style="vertical-align: middle;">EXAMEN UNICO</td>
                            {% elseif a[0].tipoAlumno == 3 %}
                                <td style="vertical-align: middle;">LICENCIATURA</td>
                            {% elseif a[0].tipoAlumno == 4 %}
                                <td style="vertical-align: middle;">MAESTRÍA</td>
                            {% elseif a[0].tipoAlumno == 5 %}
                                <td style="vertical-align: middle;">DOCTORADO</td>
                            {% elseif a[0].tipoAlumno == 6 %}
                            {% elseif a[0].tipoAlumno == 9 %}
                                <td style="vertical-align: middle;">MATERNAL</td>
                            {% elseif a[0].tipoAlumno == 10 %}
                                <td style="vertical-align: middle;">PREESCOLAR</td>
                            {% elseif a[0].tipoAlumno == 11 %}
                                <td style="vertical-align: middle;">PRIMARIA</td>
                            {% elseif a[0].tipoAlumno == 12 %}
                                <td style="vertical-align: middle;">SECUNDARIA</td>
                            {% elseif a[0].tipoAlumno == 13 %}
                                <td style="vertical-align: middle;">ESPECIALIDAD</td>
                            {% endif %}
                            {% if a[0].cveLic != null %}
                                <td style="vertical-align: middle;">{{ a[0].cveLic.nomLic }}</td>
                            {% else %}
                                <td style="vertical-align: middle;background-color: red;">---INDETERMINADO---</td>
                            {% endif %}
                            <td style="vertical-align: middle;">{{ a[0].modalidad }}</td>
                            <td style="vertical-align: middle;text-align: center;">{{ a[0].numero }}</td>
                            <td style="vertical-align: middle;">{{ a[0].cvePla.nomPla }}</td>
                        </tr>
                    {% else %}
                        <tr>
                            <td>NO HAY REGISTROS DE ALUMNOS __(°o°)__</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            </div><!-- FIN col-lg-12 -->
        </div><!-- FIN row -->
    </div><!-- FIN container-fluid -->

    <!-- Modal -->
    <div class="modal fade" id="exampleModal" role="dialog" tabindex="-1">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 table-responsive" id="contenedor-alumno"
                             style="border: solid 1px #f1f1f1;">
                        </div>
                    </div><!-- FIN ROW -->
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div>
            </div>
        </div>
    </div><!-- FIN MODAL EXAMPLEmODAL -->
{% endblock %}
