설명 없음

addMatricula.html 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {% extends 'ElVerdaderoHeader.html' %}
  2. {% block head %}
  3. {{name}}
  4. {% endblock %}
  5. {% block css %}
  6. <link rel='stylesheet' href ='../../../static/css/estilo.css'>
  7. {% endblock %}
  8. {% block body %}
  9. <div class='row'>
  10. <div class ='col-3'></div>
  11. <div class = 'col-6'>
  12. <form action ='/addMatricula/{{oferId}}' method ='POST'>
  13. <div id='estudiantes'>
  14. <label class="mr-sm-2" for="inlineFormCustomSelect">Estudiantes</label>
  15. <select class="custom-select mr-sm-2" id = 'todosEstudiantes' name= 'estudiantes[0]'>
  16. <option selected>Choose...</option>
  17. {% for estudiante in estudiantes %}
  18. <option value ='{{estudiante.user_id}}'>{{estudiante.apellidos}}, {{estudiante.nombres}}</option>
  19. {% endfor %}
  20. </select>
  21. </div>
  22. <div id= 'estudiante'>
  23. </div>
  24. <input type = 'hidden' id = 'count' name = 'countRow' value = 1>
  25. <button type ='button' class ='btn btn-success' onclick ='javascript : myFunction("estudiante")'>Añade estudiante</button>
  26. <button type ='submit' class ='btn btn-primary'>Submit</button>
  27. </div>
  28. </div>
  29. <br>
  30. <br>
  31. <div class ='row'>
  32. <div class ='col'>
  33. <h1 class = 'text-center'>Matriculados</h1>
  34. <table class = 'table table-hover'>
  35. <thead>
  36. <tr>
  37. <th>Nombre</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. {% for matriculado in matriculados %}
  42. <tr>
  43. <td>{{matriculado.apellidos}}, {{matriculado.nombres}}</td>
  44. </tr>
  45. {% endfor %}
  46. </tbody>
  47. </table>
  48. </div>
  49. </div>
  50. <script>
  51. var index = 1
  52. function myFunction(string){
  53. var Estudiantes=document.getElementById(string);
  54. var node = document.createElement("div");
  55. var input = document.getElementById('count');
  56. var todosEstudiantes = document.getElementById('todosEstudiantes')
  57. var newForm = document.getElementById(string+'s')
  58. node.innerHTML = '<label class="mr-sm-2" for="inlineFormCustomSelect">Estudiantes</label>' +' <select class="custom-select mr-sm-2" name= "estudiantes['+index+']">' + todosEstudiantes.innerHTML+' </select>';
  59. index +=1;
  60. Estudiantes.appendChild(node)
  61. input.value = parseInt(input.value) + 1;
  62. }
  63. </script>
  64. {% endblock %}