Keine Beschreibung

addOferta.html 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. {% extends 'ElVerdaderoHeader.html' %}
  2. {% block head %}
  3. {% endblock %}
  4. {% block css %}
  5. <link rel='stylesheet' href ='../../../static/css/estilo.css'>
  6. {% endblock %}
  7. {% block body %}
  8. <div class = 'row'>
  9. <div class ='col-3'></div>
  10. <div class="col-6">
  11. <form action ='/addOferta' method = 'POST'>
  12. Año: <input type="text" name = 'academico' class="form-control" placeholder="20xx-20xx">
  13. Horario: <input type="text" name = 'horario' class="form-control" placeholder="9:00am - 10:00am">
  14. <label class="mr-sm-2" for="inlineFormCustomSelect">Curso</label>
  15. <select class="custom-select mr-sm-2" id="inlineFormCustomSelect" name= 'curso'>
  16. <option selected>Choose...</option>
  17. {% for curso in cursos %}
  18. <option value ='{{curso.id}}'>{{curso.codigo}}</option>
  19. {% endfor %}
  20. </select>
  21. <div id='maestros'>
  22. <label class="mr-sm-2" for="inlineFormCustomSelect">Maestrx</label>
  23. <select class="custom-select mr-sm-2" id = 'todosMaestros' name= 'Maestro[0]'>
  24. <option selected>Choose...</option>
  25. {% for maestro in maestros %}
  26. <option value ='{{maestro.user_id}}'>{{maestro.apellidos}}, {{maestro.nombres}}</option>
  27. {% endfor %}
  28. </select>
  29. </div>
  30. <div id = 'maestro'>
  31. </div>
  32. <input type = 'hidden' id = 'count' name = 'countRow' value = 1>
  33. <button type ='button' class ='btn btn-success' onclick ='javascript : myFunction("maestro")'>Añade Maestro</button>
  34. <button type ='submit' class ='btn btn-primary'>Someter</button>
  35. </form>
  36. </div>
  37. </div>
  38. <br>
  39. <br>
  40. <div class ='row'>
  41. <div class = 'col'>
  42. <table class='table table-hover'>
  43. <thead>
  44. <tr>
  45. <th>Curso</th>
  46. <th>Codigo</th>
  47. <th>horario</th>
  48. <th>Cantidad de maestrxs</th>
  49. <th>Año académico</th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. {% for oferta in ofertas %}
  54. <tr>
  55. <td>{{oferta.titulo}}</td>
  56. <td>{{oferta.codigo}}</td>
  57. <td>{{oferta.horario}}</td>
  58. <td>{{oferta.cantidadMaestros}}</td>
  59. <td>{{oferta.semestre}}</td>
  60. <td><a type='button' class = 'btn btn-primary' href='/addMatricula/{{oferta.oferta_id}}'>Añadir estudiantes</a></td>
  61. </tr>
  62. {% endfor %}
  63. </tbody>
  64. </table>
  65. </div>
  66. </div>
  67. <script>
  68. var index = 1
  69. function myFunction(string){
  70. var maestro =document.getElementById(string);
  71. var node = document.createElement("div");
  72. var input = document.getElementById('count');
  73. var todosMaestros = document.getElementById('todosMaestros')
  74. var newForm = document.getElementById(string+'s')
  75. node.innerHTML = '<label class="mr-sm-2" for="inlineFormCustomSelect">Maestrx</label>' +' <select class="custom-select mr-sm-2" name= "Maestro['+index+']">' + todosMaestros.innerHTML+' </select>';
  76. index +=1;
  77. maestro.appendChild(node)
  78. input.value = parseInt(input.value) + 1;
  79. }
  80. </script>
  81. {% endblock %}