templates/registration/registration_student_registration/new.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Nouveau | {{ parent() }}{% endblock %}
  3. {% block body %}
  4.     <div class="breadcrumb">
  5.         <h1 class="mr-2">Inscrits</h1>
  6.         <ul>
  7.             <li><a href="{{ path('default') }}" onclick="$('.loader').addClass('is-active');">Accueil</a></li>
  8.             <li><a href="#">Elèves</a></li>
  9.             <li><a href="{{ path('registration_student_registration_index') }}" onclick="$('.loader').addClass('is-active');">Retour</a></li>
  10.             <li>Nouveau</li>
  11.         </ul>
  12.     </div>
  13.     <div class="separator-breadcrumb border-top"></div>
  14.     <div class="row mb-4">
  15.         <div class="col-md-7 mb-4">
  16.             <div class="card text-left">
  17.                 <div class="card-header">Création</div>
  18.                 <div class="card-body">
  19.                     {{ include('registration/registration_student_registration/_form.html.twig') }}
  20.                 </div>
  21.             </div>
  22.         </div>
  23.         <div class="col-md-5 mb-4">
  24.             <div class="card text-left">
  25.                 <div class="card-header">Plus d'info</div>
  26.                 <div class="card-body">
  27.                     <table class="display table table-striped table-bordered">
  28.                         <tr>
  29.                             <th>Photo</th>
  30.                             <td><img id="_photo" src="#" alt="" style="width: 150px;" /></td>
  31.                         </tr>
  32.                         <tr>
  33.                             <th>Nom & Prénons</th>
  34.                             <td><span id="_name"></span></td>
  35.                         </tr>
  36.                         <tr>
  37.                             <th>Mle interne</th>
  38.                             <td><span id="_code"></span></td>
  39.                         </tr>
  40.                         <tr>
  41.                             <th>Mle national</th>
  42.                             <td><span id="_registrationNumber"></span></td>
  43.                         </tr>
  44.                         <tr>
  45.                             <th>Niveau</th>
  46.                             <td><span id="_entryLevel"></span></td>
  47.                         </tr>
  48.                         <tr>
  49.                             <th>Date de naissance</th>
  50.                             <td><span id="_birthDate"></span></td>
  51.                         </tr>
  52.                         <tr>
  53.                             <th>Lieu de naissance</th>
  54.                             <td><span id="_birthLocation"></span></td>
  55.                         </tr>
  56.                         <tr>
  57.                             <th>Contact SMS</th>
  58.                             <td><span id="_phoneNumber"></span></td>
  59.                         </tr>
  60.                         <tr>
  61.                             <th>Etablissement</th>
  62.                             <td><span id="_establishment"></span></td>
  63.                         </tr>
  64.                         <tr>
  65.                             <th>Affecté</th>
  66.                             <td><span id="_is_affected"></span></td>
  67.                         </tr>
  68.                         <tr>
  69.                             <th>Redoublant</th>
  70.                             <td><span id="_is_redoubling"></span></td>
  71.                         </tr>
  72.                     </table>
  73.                 </div>
  74.             </div>
  75.         </div>
  76.     </div>
  77. {% endblock %}
  78. {% block javascripts %}
  79.     {{ parent() }}
  80.     <script>
  81.         $(document).ready(function (){
  82.             $('.submitBtn').hide();
  83.             $('#registration_student_registration_registrationStudentPreRegistration').change(function(){
  84.                 id = $('#registration_student_registration_registrationStudentPreRegistration').val();
  85.                 getStudentInfo(id);
  86.             }).trigger("change");
  87.         })
  88.         
  89.         function getStudentInfo(sId) {
  90.             console.log('entity ' + sId);
  91.             path = '{{ path('api_registration_student_pre_registration_info') }}';
  92.             $('#_name').html("Traitement ...");
  93.             $('#_code').html("Traitement ...");
  94.             $('#_registrationNumber').html("Traitement ...");
  95.             $('#_birthDate').html("Traitement ...");
  96.             $('#_birthLocation').html("Traitement ...");
  97.             $('#_establishment').html("Traitement ...");
  98.             $('#_phoneNumber').html("Traitement ...");
  99.             $('#_entryLevel').html("Traitement ...");
  100.             $('#_is_affected').html("Traitement ...");
  101.             $('#_is_redoubling').html("Traitement ...");
  102.             $('#registration_student_registration_classroom').html('');
  103.             axios.get(path, {
  104.             params: {
  105.                 id: sId,
  106.             }
  107.             }).then(function (response) {
  108.                 console.log(response.data);
  109.                 console.log(response.data.is_affected);
  110.                 if(response.data.code == 200){
  111.                     $('#_photo').prop('src', '{{ app.request.schemeAndHttpHost }}/images/students/' + response.data.img_src);
  112.                     $('#_name').html(response.data.name);
  113.                     $('#_code').html(response.data.id);
  114.                     $('#_registrationNumber').html(response.data.registrationNumber);
  115.                     $('#_birthDate').html(response.data.birthDate);
  116.                     $('#_birthLocation').html(response.data.birthLocation);
  117.                     $('#_establishment').html(response.data.establishment);
  118.                     $('#_phoneNumber').html(response.data.phoneNumber);
  119.                     $('#_entryLevel').html(response.data.classroom);
  120.                     if(response.data.is_affected){
  121.                         $('#_is_affected').html('OUI');
  122.                         $('#registration_student_registration_is_affected').prop("checked", true);
  123.                     }else{
  124.                         $('#_is_affected').html('NON');
  125.                         $('#registration_student_registration_is_affected').prop("checked", false);
  126.                     }
  127.                     if(response.data.is_redoubling){
  128.                         $('#_is_redoubling').html('OUI');
  129.                         $('#registration_student_registration_is_redoubling').prop("checked", true);
  130.                     }else{
  131.                         $('#_is_redoubling').html('NON');
  132.                         $('#registration_student_registration_is_redoubling').prop("checked", false);
  133.                     }
  134.                     var option = '';
  135.                     for(var i = 0; i < response.data.classrooms.length; i++){
  136.                         option = "<option value=" + response.data.classrooms[i].id + ">" + response.data.classrooms[i].label + "</option>";
  137.                         $('#registration_student_registration_classroom').append(option);
  138.                     }
  139.                     $('.submitBtn').show();
  140.                 }else{
  141.                     alert(response.data.message);
  142.                     $('.submitBtn').hide();
  143.                 }
  144.                 console.log(response.data.message);
  145.                 //$(".loader").removeClass("is-active");
  146.             });
  147.         }
  148.     </script>
  149. {% endblock %}