{% extends 'inc/base.html.twig' %}
{% block body %}
<div class="container-fluid mt-3">
<h2>Educador: {{ datos_educa.id_ed }}&nbsp;-&nbsp;{{ datos_educa.ape_ed}}&nbsp;{{ datos_educa.nom_ed }}</h2>

<h3>Aprendiz: {{ eval_alumnos.ap_ced }}&nbsp;-&nbsp;{{ eval_alumnos.ap_ape}}&nbsp;{{ eval_alumnos.ap_nom }}&nbsp;&nbsp;({{ eval_alumnos.ap_cur }})</h3>
<div class="row">
    <div class="col-12 text-center bg-info text-white">
    <b><h2>ASIGNAR NOTAS REMEDIALES</h2></b>
    </div>
</div>
<div class="row">
<div class="col-md-7 mx-auto mt-5">
<table class="table table-striped table-hover table-sm" style="width:100%">
  <thead style="background-color: #006699;color:#FFFFFF;">
    <tr>
<!--    <th scope="col" class="text-center">Id</th>-->
    <th scope="col">T&eacute;cnicas</th>
    <th scope="col" class="text-center">Nota</th>
    <th scope="col">&nbsp;</th>
    </tr>
  </thead>
  <tbody>

{% for educado in record %}
    <tr>
 <!--     <td class="text-center">{{ educado.id }}</td>-->
      <td>{{ educado.descripcion }}</td>
      <td class="text-center">{{ educado.nt3 }}</td>

    <td class="text-center">
    <button type="button" class="btn btn-dark btn-sm" data-nt='{{ educado.nt3 }}' data-tec='{{ educado.tecnica }}' data-curso='{{ educado.id }}' data-des='{{ educado.descripcion }}' data-toggle="modal" data-target="#ModalNt" data-whatever="@mdo" title="Modificar Nota" >Modificar</button>
 </td>
    </tr>

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

</div>
</div>

<div class="row">
<div class="col-md-6 mx-auto mt-5">
    <div class="col-12 text-center bg-info text-white">
    <b><h3>NOTAS REMEDIALES</h3></b>
    </div>
<table class="table table-striped table-hover table-sm" style="width:100%">
  <thead style="background-color: #006699;color:#FFFFFF;">
    <tr>
    <th scope="col">T&eacute;cnicas</th>
    <th scope="col" class="text-center">Nota</th>
    <th scope="col" class="text-center">Fecha</th>
    </tr>
  </thead>
  <tbody>

{% for educadxo in remedial %}
    <tr>
      <td>{{ educadxo.descripcion }}</td>
      <td class="text-center">{{ educadxo.nt3 }}</td>
      <td class="text-center">{{ educadxo.created_at | date('d/m/Y') }}</td>
    </tr>

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

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



<div class="modal fade" id="remedial" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<form id="form1" name="form1" action="{{ constant('URLROOT2') }}/estudiantes/asistencia" method="POST">

  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Remediales Aprendiz:</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Cerrar">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
<div class='form-row text-center'>
<div class="form-group-sm col-12 mt-2">

    <div class="input-group">
<label for="name">C&eacute;dula del Aprendiz:</label>
    <input class="form-control" tabindex="1" type="number" id="cedula" name="cedula" value="" autofocus="autofocus" required/>
    </div>

</div>
</div>
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
        <button type="submit" class="btn btn-success">Aceptar</button>
      </div>
    </div>
  </div>
</div>
</form>
</div>


 <div class="modal fade" id="ModalNt" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
    <form action="{{ constant('URLROOT2') }}/educadores/guardar_remedial" method="post">

        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Nota Remedial</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">
    <div class="input-group">
    <label for="name">T&eacute;nica:</label>
    <input class="form-control" type="text" id="tecnica" name="tecnica" value="" disabled/>
    </div>

    <div class="input-group">
    <label for="name">Nota:</label>
    <input class="form-control" tabindex="0" type="number" min='0' max='20' id="nota" name="nota" value="" autofocus="autofocus" required/>
    </div>
           </div>
            <input id="id_idd" type="hidden" name="id_idd" value="">
            <input id="id_cur" type="hidden" name="id_cur" value="{{ eval_alumnos.ap_cur }}">
            <input id="id_ced" type="hidden" name="id_ced" value="{{ eval_alumnos.ap_ced }}">
            <input id="id_tec" type="hidden" name="id_tec" value="">
            <input id="id_nt0" type="hidden" name="id_nt0" value="5">
            </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>
        </div>
    </form>
    </div>
</div>

{% endblock %}
{% block javascripts %}
<script>


$('#ModalNt').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 des = button.data('des')
                    var tec = button.data('tec')
                    var nt0 = button.data('nt')
                    var modal = $(this)
                //    modal.find('.modal-title').text('Modificar país: '+nombre)
                    modal.find('.modal-body #id_idd').val(id)
                    modal.find('.modal-body #tecnica').val(des)
                    modal.find('.modal-body #id_nt0').val(nt0)
                    modal.find('.modal-body #id_tec').val(tec)

})
</script>
{% endblock %}
