templates/student/list.html.twig line 1

Open in your IDE?
  1. {% extends 'layout/backEndLayout.html.twig' %}
  2. {% block content %}
  3.     <div class="row mt-4">
  4.         <div class="col-1">
  5.             <a class="btn btn-info" href="{{ path('admin_students_new') }}">
  6.                 <i class="fa fa-plus"></i>
  7.                
  8.             </a>
  9.         </div>
  10.         <div class="col-11 jumbotron">
  11.             <div class="m-1 box-shadow">
  12.                 <div class="card-header row">
  13.                     <div class="form-check d-inline-block col-3">
  14.                         <input class="form-check-input" type="radio" value="new_students_not_yet_registered_checkbox" name="list_type" id="new_students_not_yet_registered_checkbox">
  15.                         <label class="form-check-label" for="check1">
  16.                             <h4 class="my-0 font-weight-normal text-left text-justify text-uppercase">
  17.                                  Liste des nouveaux eleves non encore inscrits
  18.                             </h4>
  19.                         </label>
  20.                     </div>
  21.                     <div class="form-check d-inline-block  col-3">
  22.                         <input class="form-check-input" type="radio" value="new_registered_students_checkbox" name="list_type" id="new_registered_students_checkbox">
  23.                         <label class="form-check-label" for="check2">
  24.                             <h4 class="my-0 font-weight-normal text-center text-justify text-uppercase">
  25.                                 Liste des nouveaux eleves  inscrits
  26.                             </h4>
  27.                         </label>
  28.                     </div>
  29.                     <div class="form-check d-inline-block  col-3">
  30.                         <input class="form-check-input" type="radio" value="registered_former_students_checkbox" name="list_type" id="registered_former_students_checkbox">
  31.                         <label class="form-check-label" for="check3">
  32.                             <h4 class="my-0 font-weight-normal text-center tex t-justify text-uppercase">
  33.                                 Liste des anciens eleves  inscrits
  34.                             </h4>
  35.                         </label>
  36.                     </div>
  37.                     <div class="form-check d-inline-block  col-3">
  38.                         <input class="form-check-input" type="radio" value="complete_registered_students_checkbox" name="list_type" id="complete_registered_students_checkbox">
  39.                         <label class="form-check-label" for="check4">
  40.                              <h4 class="my-0 font-weight-normal text-right text-justify text-uppercase">
  41.                                  Liste complete des  eleves  inscrits
  42.                              </h4>
  43.                         </label
  44.                     </div>
  45.                    
  46.                        
  47.                    
  48.                 </div>
  49.                 <table width="100%" class="table table-striped">
  50.                     <thead>
  51.                         <tr>
  52.                             <th style="width:10%;" scope="col">
  53.                                 Matricule/Id
  54.                             </th>
  55.                             <th style="width:15%;" scope="col">
  56.                                 Nom 
  57.                             </th>
  58.                             <th style="width:10%;" scope="col">
  59.                                 PrĂ©nom
  60.                             </th>
  61.                             <th style="width:5%;" scope="col">
  62.                                 Sexe
  63.                             </th>
  64.                             <th style="width:10%;" scope="col">
  65.                                 Date de naissance
  66.                             </th>
  67.                             <th style="width:10%;" scope="col">
  68.                                 Lieu de naissance
  69.                             </th>
  70.                             <th style="width:10%;" scope="col">
  71.                                 RĂ©sidence
  72.                             </th>
  73.                             <th style="width:5%;" scope="col">
  74.                                 Inscription
  75.                             </th>
  76.                             <th style="width:15%;" scope="col">
  77.                                 Action
  78.                             </th>
  79.                         </tr>
  80.                     </thead>
  81.                     <tbody>
  82.                         {% for user in students %}
  83.                             <tr>
  84.                                 <td>
  85.                                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  86.                                     <a href="{{ path('admin_students_show', {id: user.id}) }}">
  87.                                         {% if user.matricule %}
  88.                                             {{ user.matricule }}
  89.                                         {% else %}
  90.                                             {{ user.id }}
  91.                                         {% endif %}
  92.                                     </a>
  93.                                 </td>
  94.                                 <td>
  95.                                     {{ user.lastName }}
  96.                                 </td>
  97.                                 <td>
  98.                                     {{ user.firstName }}
  99.                                 </td>
  100.                                 <td>
  101.                                     {% if user.gender == 0 %}
  102.                                         M 
  103.                                     {% else %}
  104.                                         F 
  105.                                     {% endif %}
  106.                                 </td>
  107.                                 <td>
  108.                                     {% if user.birthday %}
  109.                                         {{ user.birthday|date('Y-m-d') }}
  110.                                     {% endif %}
  111.                                 </td>
  112.                                 <td>
  113.                                     {{ user.birthplace }}
  114.                                 </td>
  115.                                 <td>
  116.                                     {{ user.residence }}
  117.                                 </td>
  118.                                 <td>
  119.                                     {% if user.enrolled %}
  120.                                         Inscrit
  121.                                     {% endif %}
  122.                                 </td>
  123.                                 <td>
  124.                                     <div class="btn-group">
  125.                                         <a class="btn btn-warning " href="{{ path('admin_students_edit', {id: user.id}) }}">
  126.                                             <i class="fa fa-edit"></i>
  127.                                             
  128.                                         </a>
  129.                                     </div>
  130.                                 </td>
  131.                             </tr>
  132.                         {% endfor %}
  133.                     </tbody>
  134.                 </table>
  135.             </div>
  136.         </div>
  137.     {% endblock %}
  138.     
  139.     
  140. {% block javascripts %}
  141.     {{parent()}}
  142.     <script type="text/javascript">
  143.         /*var newStudentsNotYetRegisteredCb = document.getElementById("new_students_not_yet_registered_checkbox");
  144.         var newRegisteredStudentsCb = document.getElementById("new_registered_students_checkbox");
  145.         var registeredFormerStudentsCb = document.getElementById("registered_former_students_checkbox");
  146.         var completeRegisteredStudentsCb = document.getElementById("complete_registered_students_checkbox");*/
  147.         $(document).ready(function() {
  148.             
  149.             $('input[type="radio"]').on('change', function() {
  150.                 const selectedValue = $('input[name="list_type"]:checked').val();
  151.                 const url = '{{ path('admin_students', { 'type': 'PLACEHOLDER' }) }}'.replace('PLACEHOLDER', selectedValue);
  152.                 
  153.                 $.ajax({
  154.                     type: "GET",
  155.                     url: url,
  156.                     datatype: "json",
  157.                     success: function (data) {
  158.                         
  159.                         window.location.href = url;
  160.                         console.log(selectedValue);
  161.                     },
  162.                     error: function (e) {
  163.                         console.log(e.message);
  164.                     }
  165.                     });
  166.                
  167.                 });
  168.           
  169.         });
  170.     </script>
  171. {% endblock javascripts %}