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

{% block stylesheet %}
    <style>
        .error {
            color: red;
            border-color: red;
        }

        form.form-grupos label.error {
            display: none;
        }
    </style>
{% endblock %}

{% block javascripts %}
    <script src="{{ asset('js/misJs/curriculas.js') }}"></script>
    <script src="{{ asset('js/misJs/verMapasCurricular.js') }}"></script>
    <script src="{{ asset('js/misJs/validarCurriculas.js') }}"></script>
{% endblock %}

{% block content %}
    {% for flashMessage in app.session.flashbag.get('mensaje') %}
        <script>
            swal("", "¡REGISTRO EXITOSO!", "success");
        </script>
    {% endfor %}


    <div class="container-fluid">
        <h1 class="mt-4">REGISTRO DE MAPA CURRICULA</h1>
        <ol class="breadcrumb mb-2">
            <li class="breadcrumb-item"><a href="{{ path('cm_homepage') }}">Tablero</a></li>
            <li class="breadcrumb-item active">Mapa Curricular</li>
        </ol>
        <div class="row">
            <div class="col-lg-12">
                <div class="card border-secondary mb-1">
                    <div class="card-header bg-secondary border-secondary text-white">
                        <i class="fas fa-building mr-1"></i>
                        LLENAR EL SIGUIENTE FORMULARIO
                    </div>
                    <div class="card-body">
                        <div class="col-lg-12">
                            <form class="row small" action="{{ path('mapa_curricular') }}" method="POST"
                                  id="form-curricula">
                                <div class="col-lg-6">
                                    <label class="control-label" for="cveLic">Especialidad:</label>
                                    <select id="cveLic" name="cveLic" class="form-control form-control-sm">
                                        <option value="default">Selecciona</option>
                                        {% if licenciaturas is defined %}
                                        {% set nivel = 0 %}
                                        {% for l in licenciaturas %}
                                        {% if nivel != l.cveNivAca.ideNivAca %}
                                        {% if loop.index > 1 %}
                                            </optgroup>
                                        {% endif %}
                                        <optgroup label="{{ l.cveNivAca.nombre }}">
                                            {% set nivel = l.cveNivAca.ideNivAca %}
                                            {% endif %}
                                            <option value="{{ l.ideLic }}">{{ l.nomLic }}</option>
                                            {% endfor %}
                                            {% endif %}
                                    </select>

                                </div><!-- col-lg-6 -->
                                <div class="col-lg-3">
                                    <label class="control-label" for="clave">CLAVE RVOE:</label>
                                    <input type="text" class="form-control form-control-sm" id="clave" name="clave"
                                           placeholder="RVOE">
                                </div><!-- col-lg-3 -->
                                <div class="col-lg-3">
                                    <span class="input-group-addon">FECHA RVOE:</span>
                                    <input type="date" class="form-control form-control-sm" id="fechaI" name="fechaI">
                                </div><!-- col-lg-3 -->
                                <div class="col-lg-8">
                                    <label class="control-label" for="nomMapa">NOMBRE DEL MAPA:</label>
                                    <input type="text" class="form-control form-control-sm" id="nomMapa" name="nomMapa"
                                           placeholder="Nombre del Mapa Curricular">
                                </div><!-- col-lg-8 -->
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10 text-right">
                                        <button type="submit" class="btn btn-primary">Registrar</button>
                                    </div>
                                </div>
                            </form><!-- form -->


                        </div><!-- FIN col-ñg-12 -->
                    </div><!-- FIN card-body -->
                </div><!-- FIN row -->


            </div>
            <div class="col-lg-12 col-md-12 col-sm-12" style="margin-bottom: 5px;">
                <h4>CONSULTAR MAPAS CURRICULARES</h4>
            </div>
            <div class="col-lg-12 col-md-12 col-sm-12" style="margin-bottom: 5px;">
                <div class="form-inline">
                    <label for="nivelesMapas">Especialidad:</label>
                    <select id="nivelesMapas" name="nivelesMapas" class="form-control form-control-sm">
                        <option value="default" selected="true">Selecciona una opción</option>
                        {% set nivel = 0 %}
                        {% for e in licenciaturas %}
                        {% if nivel != e.cveNivAca.ideNivAca %}
                        {% if loop.index > 1 %}
                            </optgroup>
                        {% endif %}
                        <optgroup label="{{ e.cveNivAca.nombre }}">
                            {% set nivel = e.cveNivAca.ideNivAca %}
                            {% else %}
                            {% endif %}
                            <option value="{{ e.ideLic }}">{{ e.nomLic }}</option>
                            {% else %}

                            {% endfor %}
                    </select>
                </div>
            </div><!-- col-lg-12 col-md-12 col-sm-12 -->
            <div class="col-lg-12 col-md-12 col-sm-12 table-responsive" id="contenedor-mapas">

            </div><!-- col-lg-12 col-md-12 col-sm-12 table-responsive -->

            <div class="col-lg-12 table-responsive">
                <table class="table table-bordered table-condensed table-striped table-sobre" style="font-size: smaller;">
                    <thead>
                    <tr style="background-color: cadetblue;color: white;">
                        <th class="text-center" style="white-space: nowrap;">N.C.</th>
                        <th class="text-center" style="white-space: nowrap;">ESPECIALIDAD</th>
                        <th class="text-center" style="white-space: nowrap;">NOMBRE</th>
                        <th class="text-center" style="white-space: nowrap;">RVOE</th>
                        <th class="text-center" style="white-space: nowrap;">FECHA RVOE</th>
                        {#
                        <th class="text-center" style="white-space: nowrap;">CLAVE CARRERA</th>
                        <th class="text-center" style="white-space: nowrap;">CLAVE CAMPUS</th>
                        <th class="text-center" style="white-space: nowrap;">ID INSTITUCIÓN</th>
                        <th class="text-center" style="white-space: nowrap;">ID CARRERA</th>
                        <th class="text-center" style="white-space: nowrap;">ID NIVEL</th>
                        <th class="text-center" style="white-space: nowrap;">CLAVE PLAN</th>
                        <th class="text-center" style="white-space: nowrap;">CAL. MÍNIMA</th>
                        <th class="text-center" style="white-space: nowrap;">CAL. MÁXIMA</th>
                        <th class="text-center" style="white-space: nowrap;">CAL. MÍN. APROBATORIA</th>
                        <th class="text-center" style="white-space: nowrap;">ASIGNATURAS</th>
                        <th class="text-center" style="white-space: nowrap;">CRÉDITOS</th>
                        <th class="text-center" style="white-space: nowrap;">NOMENCLATURA</th>
                        <th class="text-center" style="white-space: nowrap;">CUATRIMESTRES</th>
                        <th class="text-center">*</th>
                        #}
                    </tr>
                    </thead>
                    <tbody>
                    {% for p in mapas %}
                        <tr>
                            <td>{{ loop.index }}</td>
                            <td style="white-space: nowrap;">{{ p.cveLic.cveNivAca.nombre }} EN {{ p.cveLic.nomLic }}</td>
                            <td style="white-space: nowrap;">{{ p.nomPlan }}</td>
                            <td>{{ p.cvePlan }}</td>
                            <td style="white-space: nowrap;">{{ p.fecIni | date('d-m-Y') }}</td>
                            {# <td>{{ p.claveCarrera }}</td>
                            <td>{{ p.claveCampus }}</td>
                            <td>{{ p.idInstitucion }}</td>
                            <td>{{ p.idCarrera }}</td>
                            <td>{{ p.idNivel }}</td>
                            <td>{{ p.clavePlan }}</td>
                            <td>{{ p.califMinima }}</td>
                            <td>{{ p.califMaxima }}</td>
                            <td>{{ p.minimaAprobatoria }}</td>
                            <td>{{ p.totalAsignaturas }}</td>
                            <td>{{ p.totalCreditos }}</td>
                            <td>{{ p.nomenclatura }}</td>
                            <td>{{ p.numCua }}</td>
                            <td>{{ p.numCua }}</td>
                            #}
                        </tr>
                    {% else %}
                        <tr>
                            <td colspan="21">AÚN SIN DATOS</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>

        </div><!-- fin row -->


    </div>

{% endblock %}