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

{% block stylesheet %}
{% endblock %}

{% block javascripts %}
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><strong>BIENVENIDO AL SISTEMA</strong></h3>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <div class="row">
        {% set b = 0 %}
        {% set sum = 0 %}
        {% set escuela = "" %}
        {% for d in datos %}
            {% set b = 1 %}
            {% if escuela == d['nomPla'] %}

            {% else %}
                {% set escuela = d['nomPla'] %}
                {% if b == 1 and loop.index > 1 %}
                    <tr style="background-color: yellow;font-weight: bold;" class="text-right">
                        <td colspan="3">TOTAL DE ALUMNOS</td>
                        <td>{{ sum }}</td>
                    </tr>
                </tbody>
            </table>
        </div>
        {% set sum = 0 %}
    {% endif %}
    <div class="col-lg-4 table-responsive">
        <table class="table table-condensed table-bordered table-striped table-sobre">
            <thead>
                <tr style="background-color: orange;">
                    <th class="text-center">PLANTEL</th>
                    <th class="text-center">NIVEL</th>
                    <th class="text-center">CUA/SEM</th>
                    <th class="text-center">TOTAL</th>
                </tr>
            </thead>
            <tbody>
            {% endif %}



            <tr class="text-center">

                <td style="vertical-align: middle;background-color: #000080;color: white;">{{ d['nomPla'] }}</td>
                <td>
                    {% if d['tipoAlumno'] == 3 %}
                        LIC.
                    {% elseif d['tipoAlumno'] == 4 %}
                        MTRÍA.
                    {% elseif d['tipoAlumno'] == 5 %}
                        DOC.
                    {% endif %}
                </td>
                <td>
                    {{ d['cua'] }}°
                </td>
                <td>
                    {{ d['total'] }}
                    {% set sum = sum + d['total'] %}
                </td>
            </tr>



            </div>
        {% else %}
            <tr>
                <td colspan="4">SIN DATOS</td>
            </tr>
        {% endfor %}

        {% if b == 1 %}
            <tr style="background-color: yellow;font-weight: bold;" class="text-right">
                <td colspan="3">TOTAL DE ALUMNOS</td>
                <td>{{ sum }}</td>
            </tr>
        </tbody>
    </table>
</div>
{% endif %}


{% endblock %}