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

{% block stylesheet %}
    <style>
        .verticalText {
            -webkit-transform: rotate(-90deg);
            -moz-transform: rotate(-90deg);
        }
    </style>
{% endblock %}


{% block javascripts %}
    {#<script src="{{asset('js/misJs/se/scriptSE.js') }}" type="text/javascript"></script>#}
    <script src="{{asset('js/jsxlsx/FileSaver.min.js')}}"></script>
    <script src="{{asset('js/jsxlsx/xlsx.full.min.js')}}"></script>
    <script src="{{asset('js/jsxlsx/tableexport.min.js')}}"></script>
    <script src="{{asset('js/jsxlsx/script.js')}}"></script>
{% endblock %}


{% block content %}
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-6">
                <h1 class="mt-4">REPORTE DE ESTATUS</h1>
            </div>
        </div><!-- FIN row -->
        <ol class="breadcrumb mb-2">
            <li class="breadcrumb-item"><a href="{{ path('cm_homepage') }}">Tablero</a></li>
            <li class="breadcrumb-item active">Cuadro Estatus</li>
            <li class="breadcrumb-item">
                <a id="btnExportar" style="cursor: pointer;color: red;">Exportar</a>
                <input type="hidden" id="nombre-tabla" value="Cuadro Estatus">
            </li>
        </ol>

        <div class="row">
            <div class="col-lg-12 mt-3">
                <div class="row" id="con-cuadro-estatus">
                    <div class="col-lg-12 table-responsive">
                        <table class="table table-bordered table-condensed table-hover" style="font-size: small;" id="tabla">
                            <thead class="thead-dark">
                                <tr>
                                    <th class="text-center">#</th>
                                    <th class="text-center">NOMENCLATURA</th>
                                    <th class="text-center">PLANTEL</th>
                                    <th class="text-center">REGISTROS</th>
                                    <th class="text-center">PREINSCRITOS</th>
                                    <th class="text-center">ACTIVOS</th>
                                    <th class="text-center">BAJAS</th>
                                    <th class="text-center">BACHILLERATO</th>
                                    <th class="text-center">LICENCIATURA</th>
                                    <th class="text-center">MAESTRÍA</th>
                                    <th class="text-center">DOCTORADO</th>
                                    <th class="text-center">?</th>
                                    <th class="text-center">*</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% set registros = 0 %}
                                {% set preinscritos = 0 %}
                                {% set activos = 0 %}
                                {% set bajas = 0 %}
                                {% set bach = 0 %}
                                {% set lic = 0 %}
                                {% set mae = 0 %}
                                {% set doc = 0 %}

                                {% for d in datos %}
                                    <tr>
                                        <td class="text-right" style="vertical-align: middle;">{{ loop.index }}</td>
                                        <td class="text-center" style="vertical-align: middle;">{{ d[0] }}</td>
                                        <td class="text-center" style="vertical-align: middle;">{{ d[1] }}</td>
                                        {# TOTAL REGISTROS #}
                                        {% if d[2] > 0 %}
                                            <td class="text-center" style="vertical-align: middle;font-weight: bold;">
                                                <a class="btn btn-primary btn-xs" style="font-size: xx-small;">
                                                    {{ d[2] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[2] }}</td>
                                        {% endif %}
                                        {# PREINSCRITOS #}
                                        {% if d[3] > 0 %}
                                            <td class="text-center" style="vertical-align: middle;">
                                                <a class="btn btn-warning btn-xs" style="font-size: xx-small;">
                                                    {{ d[3] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[3] }}</td>
                                        {% endif %}
                                        {# ALUMNOS ACTIVOS #}
                                        {% if d[4] > 0 %}
                                            <td class="text-center" style="vertical-align: middle;">
                                                <a class="btn btn-success btn-xs" style="font-size: xx-small;">
                                                    {{ d[4] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">
                                                {{ d[4] }}
                                            </td>
                                        {% endif %}
                                        {# ALUMNOS BAJAS #}
                                        {% if d[5] >0 %}
                                            <td class="text-center" style="vertical-align: middle;">
                                                <a class="btn btn-danger btn-xs" style="font-size: xx-small;">
                                                    {{ d[5] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[5] }}</td>
                                        {% endif %}


                                        {% if d[6] >0 %}
                                            <td class="text-center" style="vertical-align: middle;">
                                                <a class="btn btn-secondary btn-xs" style="font-size: xx-small;">
                                                    {{ d[6] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[6] }}</td>
                                        {% endif %}
                                        {% if d[7] >0 %}
                                            <td class="text-center" style="vertical-align: middle;font-weight: bold;">                                                
                                                <a class="btn btn-secondary btn-xs" style="font-size: xx-small;">
                                                    {{ d[7] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[7] }}</td>
                                        {% endif %}
                                        {% if d[8] >0 %}
                                            <td class="text-center" style="vertical-align: middle;font-weight: bold;">
                                                <a class="btn btn-secondary btn-xs" style="font-size: xx-small;">
                                                    {{ d[8] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[8] }}</td>
                                        {% endif %}
                                        {% if d[9] >0 %}
                                            <td class="text-center" style="vertical-align: middle;font-weight: bold;">
                                                <a class="btn btn-secondary btn-xs" style="font-size: xx-small;">
                                                    {{ d[9] }}
                                                </a>
                                            </td>
                                        {% else %}
                                            <td class="text-center" style="vertical-align: middle;">{{ d[9] }}</td>
                                        {% endif %}

                                        {% if d[4] > 0 %}
                                            {% if d[6] + d[7] + d[8] + d[9] == d[4] %}
                                                <td style="color: green;font-weight: bold;">
                                                    OK
                                                </td>
                                            {% else %}
                                                <td style="color: red;font-weight: bold;">
                                                    ERROR
                                                </td>
                                            {% endif %}

                                        {% else %}
                                            <td></td>
                                        {% endif %}

                                        <td class="text-center" style="vertical-align: middle;">
                                            <a class="btn btn-xs btn-primary" style="font-size: xx-small;">
                                                <i class="fa fa-print"></i>
                                            </a>
                                        </td>
                                    </tr>

                                    {% set registros = registros + d[2] %}
                                    {% set preinscritos = preinscritos + d[3] %}
                                    {% set activos = activos + d[4] %}
                                    {% set bajas = bajas + d[5] %}
                                    {% set bach = bach + d[6] %}
                                    {% set lic = lic + d[7] %}
                                    {% set mae = mae + d[8] %}
                                    {% set doc = doc + d[9] %}

                                {% endfor %}
                            </tbody>
                            <tfoot>
                                <tr style="background-color: #e9ecef;">
                                    <td colspan="3" class="text-right" style="font-weight: bold;">TOTALES</td>
                                    <td class="text-center" style="font-weight: bold;">{{ registros }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ preinscritos }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ activos }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ bajas }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ bach }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ lic }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ mae }}</td>
                                    <td class="text-center" style="font-weight: bold;">{{ doc }}</td>
                                    <td class="text-center" colspan="2" style="font-weight: bold;">*</td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>

                </div><!-- Fin ROW -->
            </div>
        </div><!-- Fin ROW -->
    </div><!-- Fin CONTAINER-FLUID -->


    <div class="modal fade" id="myModal" data-bs-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
        <div class="modal-dialog modal-xl">
            <div class="modal-content">
                <div class="modal-header text-white" style="background-color: #336375;">
                    <h5 class="modal-title" id="staticBackdropLabel">LISTA DE ALUMNOS</h5>
                    <button type="button" class="btn-close bg-white" data-dismiss="modal" aria-label="Close"></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="con_lis_alu">

                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal" id="btnExportar">EXPORTAR</button>
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal" id="btnModCerrar">CERRAR</button>
                </div>
            </div>
        </div>
    </div>


{% endblock %}