templates/evaluation/new.html.twig line 1

Open in your IDE?
  1. {% extends 'layout/backEndLayout.html.twig' %}
  2. {% block content %}
  3. {% form_theme form 'bootstrap_4_layout.html.twig' %}
  4. <div class="col-12 jumbotron" >
  5. <div class="row mt-4 mx-auto box-shadow">
  6. <div class="card-header">
  7. <h3 class="my-0 text-center text-justify text-uppercase"> Nouvelle fiche d evaluation</h3>
  8. </div>
  9. <div class="mt-4 col-md-12 col-sm-12 table-responsive">
  10. <div class="row">
  11. <div class="col-2 table-responsive"></div>
  12. <div class="col-8 table-responsive">
  13. {{ form_start(form, {action: path('admin_evaluations_create'),'attr': {'id': 'formEvaluation', 'class':'evaluation'} }) }}
  14. <p>
  15. {{ form_widget(form.sequence ,{'attr':{'class':'ChoiceSequence'} } ) }}
  16. </p>
  17. <p>
  18. {{ form_widget(form.classRoom,{'attr':{'class':'ChoiceClassRoom', 'name' :'ChoiceClassRoom', 'id':'ChoiceClassRoom'} }) }}
  19. </p>
  20. <p>
  21. {{ form_widget(form.competence,{'attr':{'class':'form form-control'} }) }}
  22. </p>
  23. </div>
  24. <div class="col-2 table-responsive"></div>
  25. </div>
  26. </div>
  27. <div id="ficheBodyStudents" class=" col-md-12 row">
  28. {% include "evaluation/liststudents.html.twig" %}
  29. </div>
  30. </div>
  31. <div class="row mt-2 mx-auto">
  32. <div class=" col-3">
  33. </div>
  34. <div class=" col-3 mx-auto btn-group d-inline-flex p-2 bd-highlight">
  35. <button class="btn btn-danger" type="submit">
  36. <b>
  37. <i class="fa fa-balance-scale"></i>submit</b>
  38. </button>
  39. </div>
  40. <div class=" col-3 mx-auto btn-group d-inline-flex p-2 bd-highligh">
  41. <a class="btn btn-info" href="{{ path('admin_evaluations') }}">
  42. <i class="fa fa-list"></i>
  43. {{ 'Back to the list'|trans({}, 'admin') }}
  44. </a>
  45. </div>
  46. <div class=" col-3">
  47. </div>
  48. </div>
  49. {{ form_end(form) }}
  50. </div>
  51. {% endblock %}
  52. {% block footer %}
  53. {{ parent() }}
  54. {% endblock %}
  55. {% block javascripts %}
  56. {{parent()}}
  57. <script type="text/javascript">
  58. var classRoom = document.getElementById("evaluation_classRoom"),
  59. competence = document.getElementById("evaluation_competence"),
  60. idclassroom,
  61. idcourse,
  62. idsequence,
  63. formEval = document.getElementById("formEvaluation");
  64. classRoom.setAttribute('name', 'ChoiceClassRoom');
  65. $(".ChoiceSequence").change(function () {
  66. idsequence = $("select.ChoiceSequence option:selected").val();
  67. });
  68. $(".ChoiceClassRoom").change(function () {
  69. idclassroom = $("select.ChoiceClassRoom option:selected").val();
  70. $.ajax({
  71. type: "POST",
  72. url: "{{ path('admin_classroom_students') }}",
  73. data: {
  74. idclassroom: idclassroom,
  75. idsequence: idsequence
  76. },
  77. datatype: "json",
  78. success: function (data) {
  79. $("#ficheBodyStudents").html(data).show();
  80. }
  81. });
  82. });
  83. var marksJson = [],
  84. postData;
  85. $(function () {
  86. $(document).on('submit', 'form', function (e) { // il est impératif de commencer avec cette méthode qui va empêcher le navigateur d'envoyer le formulaire lui-même
  87. e.preventDefault();
  88. $("input[max=20]").each(function (index) {
  89. marksJson.push({"matricule": $(this).attr('id'), "note": $(this).val(), "appreciation": $(this).parent().next().children().val(), "weight": $(this).parent().next().next().children().val()});
  90. });
  91. idcourse = $("select.ChoiceCourse option:selected").val();
  92. postData = {
  93. "marks": JSON.stringify(marksJson),
  94. "idroom": idclassroom,
  95. "idcourse": idcourse,
  96. "idsequence": idsequence,
  97. "competence": competence.value
  98. };
  99. $.ajax({
  100. type: "POST",
  101. url: "{{ path('admin_evaluations_create') }}",
  102. data: postData,
  103. datatype: "json",
  104. success: function (data) {
  105. alert("Enregistre avec succes.");
  106. },
  107. error: function (e) {
  108. console.log(e.message);
  109. alert("Echec.");
  110. }
  111. });
  112. });
  113. });
  114. </script>
  115. {% endblock javascripts %}