templates/school/school_teacher_call_sheet/re/call.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Fiches d'appel | {{ parent() }}{% endblock %}
  3. {% block body %}
  4.     <div class="breadcrumb">
  5.         <h1 class="mr-2">Fiches d'appel</h1>
  6.         <ul>
  7.             <li><a href="{{ path('default') }}">Accueil</a></li>
  8.             <li><a href="{{ path('school_teacher_call_sheet_index') }}">Retour</a></li>
  9.             <li>{{ school_teacher_call_sheet.schoolTeacher ? school_teacher_call_sheet.schoolTeacher.name : '' }}</li>
  10.             <li>{{ school_teacher_call_sheet.settingClassroom ? school_teacher_call_sheet.settingClassroom.label : '' }}</li>
  11.             <li>{{ school_teacher_call_sheet.schoolMatter ? school_teacher_call_sheet.schoolMatter.label : '' }}</li>
  12.             <li>{{ school_teacher_call_sheet.day }}</li>
  13.             <li>{{ school_teacher_call_sheet.settingTimeTable ? school_teacher_call_sheet.settingTimeTable.label : '' }}</li>
  14.             <li>{{ school_teacher_call_sheet.createdAt ? school_teacher_call_sheet.createdAt|date('d/m/Y H:i:s') : '' }}</li>
  15.         </ul>
  16.     </div>
  17.     <div class="separator-breadcrumb border-top"></div>
  18.     <div class="row mb-4">
  19.         <div class="col-md-12">
  20.             {% if school_teacher_call_sheet.rejectionReason %}
  21.                 <div class="alert alert-danger">
  22.                     <strong>Motif du rejet :</strong> {{ school_teacher_call_sheet.rejectionReason }}
  23.                 </div>
  24.             {% endif %}
  25.             
  26.             {% if school_teacher_call_sheet.isCanBeSaved %}
  27.                 {% if not school_teacher_call_sheet.isAproved %}
  28.                     {% if school_teacher_call_sheet.status == 'Validé' %}
  29.                         {% if is_granted('ROLE_FICHE_APPEL') %}
  30.                             <a href="#" class="btn btn-warning" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_cancel', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-times"></i> Annuler</a>
  31.                             {# <button type="button" class="btn btn-danger" onclick="showRejectModal()"><i class="fa fa-ban"></i> Rejeter</button> #}
  32.                             <a href="#" class="btn btn-success" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_aproved', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-check"></i> Approuver</a>
  33.                         {% endif %}
  34.                     {% elseif school_teacher_call_sheet.status == 'Brouillon' or school_teacher_call_sheet.status == 'Rejeté' %}
  35.                         {% if school_teacher_call_sheet.status != 'Rejeté' %}
  36.                             <a href="#" class="btn btn-success validate" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_validate', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-check"></i> Valider</a>
  37.                             &nbsp;<a href="{{ path('school_teacher_call_sheet_call', {'id': school_teacher_call_sheet.id}) }}" onclick="$('.loader').addClass('is-active');" class="btn btn-primary save"><i class="fa fa-save"></i> Sauvegarder</a>
  38.                         {% endif %}
  39.                     {% endif %}
  40.                 {% endif %}
  41.             {% endif %}
  42.             {% if school_teacher_call_sheet.isAproved %}
  43.                 {% if is_granted('ROLE_FICHE_APPEL') %}
  44.                     <a href="#" class="btn btn-danger" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_disaproved', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-times"></i> Annuler l'approbation</a>
  45.                 {% endif %}
  46.             {% endif %}
  47.             {% if school_teacher_call_sheet.status == 'Brouillon' or school_teacher_call_sheet.status == 'Rejeté' %}
  48.                 &nbsp;<a href="#" class="btn btn-warning selected-btn" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_line_set_to_absents')}}')"> Mettre Absent(e)</a>
  49.                 &nbsp;<a href="#" class="btn btn-success selected-btn" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_line_set_to_presents')}}')"> Mettre Présent(e)</a>
  50.             {% endif %}
  51.             {% if is_granted('ROLE_EDUCATEUR') %}
  52.                 &nbsp;<a href="#" class="btn btn-primary selected-btn" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_line_send_adsense_sms')}}')"><i class="fa fa-envelope"></i> SMS Absense</a>
  53.             {% endif %}
  54.         </div>
  55.     </div>
  56.     <div class="row mb-4">
  57.         <div class="col-md-12 mb-4">
  58.             <div class="card text-left">
  59.                 <div class="card-body">
  60.                     {{ include('school/school_teacher_call_sheet/re/_call_table.html.twig') }}
  61.                 </div>
  62.             </div>
  63.         </div>
  64.     </div>
  65.     <div class="separator-breadcrumb border-top"></div>
  66.     <div class="row mb-4">
  67.         <div class="col-md-12">
  68.             {% if school_teacher_call_sheet.isCanBeSaved %}
  69.                 {% if not school_teacher_call_sheet.isAproved %}
  70.                     {% if school_teacher_call_sheet.status == 'Validé' %}
  71.                         {% if is_granted('ROLE_FICHE_APPEL') %}
  72.                             <a href="#" class="btn btn-warning" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_cancel', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-times"></i> Annuler</a>
  73.                             {# <button type="button" class="btn btn-danger" onclick="showRejectModal()"><i class="fa fa-ban"></i> Rejeter</button> #}
  74.                             <a href="#" class="btn btn-success" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_aproved', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-check"></i> Approuver</a>
  75.                         {% endif %}
  76.                     {% elseif school_teacher_call_sheet.status == 'Brouillon' or school_teacher_call_sheet.status == 'Rejeté' %}
  77.                         {% if school_teacher_call_sheet.status != 'Rejeté' %}
  78.                             <a href="#" class="btn btn-success validate" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_validate', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-check"></i> Valider</a>
  79.                             &nbsp;<a href="{{ path('school_teacher_call_sheet_call', {'id': school_teacher_call_sheet.id}) }}" onclick="$('.loader').addClass('is-active');" class="btn btn-primary save"><i class="fa fa-save"></i> Sauvegarder</a>
  80.                         {% endif %}
  81.                     {% endif %}
  82.                 {% endif %}
  83.             {% endif %}
  84.             {% if school_teacher_call_sheet.isAproved %}
  85.                 {% if is_granted('ROLE_FICHE_APPEL') %}
  86.                     <a href="#" class="btn btn-danger" onclick="javascript:actionByPathAndElts('{{path('school_teacher_call_sheet_disaproved', {'id': school_teacher_call_sheet.id})}}')"><i class="fa fa-times"></i> Annuler l'approbation</a>
  87.                 {% endif %}
  88.             {% endif %}
  89.         </div>
  90.     </div>
  91.     <!-- Modal de rejet -->
  92.     <div class="modal fade" id="rejectModal" tabindex="-1" role="dialog" aria-labelledby="rejectModalLabel" aria-hidden="true">
  93.         <div class="modal-dialog" role="document">
  94.             <div class="modal-content">
  95.                 <div class="modal-header">
  96.                     <h5 class="modal-title" id="rejectModalLabel">Rejeter la fiche d'appel</h5>
  97.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  98.                         <span aria-hidden="true">&times;</span>
  99.                     </button>
  100.                 </div>
  101.                 <div class="modal-body">
  102.                     <form id="rejectForm">
  103.                         <div class="form-group">
  104.                             <label for="rejection_reason">Motif du rejet <span class="text-danger">*</span></label>
  105.                             <textarea class="form-control" id="rejection_reason" name="rejection_reason" rows="4" required placeholder="Veuillez saisir le motif du rejet..."></textarea>
  106.                         </div>
  107.                     </form>
  108.                 </div>
  109.                 <div class="modal-footer">
  110.                     <button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
  111.                     <button type="button" class="btn btn-danger" onclick="submitReject()">Rejeter</button>
  112.                 </div>
  113.             </div>
  114.         </div>
  115.     </div>
  116. {% endblock %}
  117. {% block javascripts %}
  118.     {{ parent() }}
  119.     <script>
  120.         $(document).ready(function (){
  121.             var isCanBeSaved = {{ school_teacher_call_sheet.isCanBeSaved ? 1 : 0 }};
  122.             if(isCanBeSaved){
  123.                 $('.validate').show();
  124.                 $('.save').show();
  125.             }else{
  126.                 $('.validate').hide();
  127.                 $('.save').hide();
  128.             }
  129.         })
  130.         function setToAbsent(path, id) {
  131.             console.log(path);
  132.             axios.get(path, {
  133.             params: {
  134.                 tk : "welmat"
  135.             }
  136.             }).then(function (response) {
  137.                 if(response.data.code == 200){
  138.                     console.log(response.data.message);
  139.                     $(response.data.td).html(response.data.message);
  140.                     $(response.data.btnAbsent).hide()
  141.                     $(response.data.btnPresent).show()
  142.                     if(response.data.isCanBeSaved){
  143.                         $('.validate').show();
  144.                         $('.save').show();
  145.                     }else{
  146.                         $('.validate').hide();
  147.                         $('.save').hide();
  148.                     }
  149.                 }else{
  150.                     console.log(response.data.message);
  151.                 }
  152.             });
  153.         }
  154.         function setToPresent(path, id) {
  155.             console.log(path);
  156.             axios.get(path, {
  157.             params: {
  158.                 tk : "welmat"
  159.             }
  160.             }).then(function (response) {
  161.                 if(response.data.code == 200){
  162.                     console.log(response.data.message);
  163.                     $(response.data.td).html(response.data.message);
  164.                     $(response.data.btnAbsent).show();
  165.                     $(response.data.btnPresent).hide();
  166.                     if(response.data.isCanBeSaved){
  167.                         $('.validate').show();
  168.                         $('.save').show();
  169.                     }else{
  170.                         $('.validate').hide();
  171.                         $('.save').hide();
  172.                     }
  173.                 }else{
  174.                     console.log(response.data.message);
  175.                 }
  176.             });
  177.         }
  178.         function showRejectModal() {
  179.             $('#rejection_reason').val('');
  180.             $('#rejectModal').modal('show');
  181.         }
  182.         function submitReject() {
  183.             const reason = $('#rejection_reason').val().trim();
  184.             
  185.             if (!reason) {
  186.                 alert('Le motif de rejet est obligatoire');
  187.                 return;
  188.             }
  189.             
  190.             $('.loader').addClass('is-active');
  191.             
  192.             $.ajax({
  193.                 url: '{{ path('school_teacher_call_sheet_reject', {'id': school_teacher_call_sheet.id}) }}',
  194.                 type: 'POST',
  195.                 data: {
  196.                     rejection_reason: reason
  197.                 },
  198.                 success: function(response) {
  199.                     $('.loader').removeClass('is-active');
  200.                     $('#rejectModal').modal('hide');
  201.                     
  202.                     if (response.code == 200) {
  203.                         location.reload();
  204.                     } else {
  205.                         alert(response.message);
  206.                     }
  207.                 },
  208.                 error: function() {
  209.                     $('.loader').removeClass('is-active');
  210.                     alert('Une erreur est survenue');
  211.                 }
  212.             });
  213.         }
  214.     </script>
  215. {% endblock %}