{% extends 'inc/base.html.twig' %}
{% block body %}
<div class="container">
<h2>Educador: {{ datos_educa.id_ed }}&nbsp;-&nbsp;{{ datos_educa.ape_ed}}&nbsp;{{ datos_educa.nom_ed }}</h2>
</div>
<table class="table table-striped table-hover table-sm">
  <thead style="background-color: #006699;color:#FFFFFF;">
    <tr class="d-flex">
    <th class='col-sm-1 text-center'>C&oacute;digo</th>
    <th class='col-sm-5 text-center'>T&eacute;cnicas</th>
    <th class='col-sm-2 text-center'>Hrs. Dictadas</th>
    <th class='col-sm-2 text-right'>&nbsp;</th>
    <th class='col-sm-2 text-right'>&nbsp;</th>
    </tr>
  </thead>
  <tbody>

{% for educado in educador %}
    <tr class="d-flex">
      <td class='col-sm-1 text-center'>{{ educado.codigo }}</td>
      <th class='col-sm-5 text-left'>{{ educado.descripcion }}</th>
      <th class='col-sm-2 text-center'>{{ educado.horas }}</th>
      <th class='col-sm-2 text-center'>
{% if educado.estatus=='F' %}
<span class="badge badge-danger">Finalizado</span>
{% else %}
<span class="badge badge-success">Activo</span>
{% endif %}
    </th>
    <td class='col-sm-2 text-center'>
    <button type="button" class="btn btn-dark btn-sm" data-curso='{{ educado.codigo }}' data-toggle="modal" data-target="#ModalSabana" data-whatever="@mdo" title="Imprimir S&aacute;bana" ><i class="fa fa-print"></i></button>
    <a onclick="procesando();" class="btn btn-info btn-sm" href="{{ constant('URLROOT2') }}/educadores/evaluaciones/{{ educado.id }}" data-toggle="tooltip" data-placement="top" title="Evaluaciones">Evaluaciones</a>
<!--    <a onclick="procesando();" class="btn btn-info btn-sm" href="{{ constant('URLROOT2') }}/lms/escritorio/{{ educado.codigo }}" data-toggle="tooltip" data-placement="top" title="Evaluaciones">Clases</a>   -->
    </td>
    </tr>

{% endfor %}
</tbody>
</table>

 <div class="modal fade" id="ModalSabana" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
    <form target="_blank" action="{{ constant('URLROOT2') }}/educadores/sabana/{{ educado.codigo }}" method="post">

        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Fecha a Imprimir</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="form-row">
                <div class="form-group col-md-12">
                    <label for="recipient-name">Mes:</label>
                    <select data-placeholder="Seleccione Mes..." class="form-control" name="mes" tabindex="1">
                    <option value="01">Enero</option>
                    <option value="02">Febrero</option>
                    <option value="03">Marzo</option>
                    <option value="04">Abril</option>
                    <option value="05">Mayo</option>
                    <option value="06">Junio</option>
                    <option value="07">Julio</option>
                    <option value="08">Agosto</option>
                    <option value="09">Septiembre</option>
                    <option value="10">Octubre</option>
                    <option value="11">Noviembre</option>
                    <option value="12">Diciembre</option>
                </select>
                </div>
                <div class="form-group col-md-12">
{% set anio = "now"|date('Y')  %}
<label for="message-text">A&ntilde;o:</label>
<select data-placeholder="Seleccione Año..." class="form-control" id="anho" name="anho" tabindex="1">
{% for i in 0..1 %}
{% set anio1 = anio-i  %}
<option value="{{ anio1 }}">{{ anio1 }}</option>
{% endfor %}
</select>
</div>
           </div>
            <input id="id_curso" type="hidden" name="id_curso" value="">
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-success">Aceptar</button>
                <button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
            </div>

        </div>
    </form>
    </div>
</div>

{% endblock %}
{% block javascripts %}
<script>
$('#ModalSabana').on('show.bs.modal', function (event) {
          var button = $(event.relatedTarget) // Botón que activó el modal
                    var id = button.data('curso') // Extraer la información de atributos de datos

                    var modal = $(this)
                //    modal.find('.modal-title').text('Modificar país: '+nombre)
                    modal.find('.modal-body #id_curso').val(id)

})
</script>
{% endblock %}
