templates/formations/formationsAfficherConvocations.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block content %}
  3.     <h5 class="text-uppercase fw-bold">
  4.         <a href="{{ path('formations') }}"><button type="button" class="btn btn-secondary text-uppercase" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Retour"><i class="bi bi-arrow-bar-left"></i> Liste Formations</button></a> 
  5.         <i class="bi bi-caret-right"></i> Fiche formation
  6.         <i class="bi bi-caret-right"></i> <span class="text-decoration-underline">{{ formation.intitule }}</span>
  7.     </h5>
  8.     {% block navFormation %}
  9.         {# MENU DE NAVIGATION ONGLETS #}
  10.         {% include "navigation_onglets_formations.twig" %}
  11.     {% endblock %}
  12.     
  13.     <div class="row">
  14.         <div class="col-12 mt-3">
  15.             <div class="card m-auto" style="width: 100%">
  16.                 <h5 class="p-3 text-uppercase fw-bold bg-dark text-white">
  17.                     <i class="bi bi-envelope-check"></i> Convocations
  18.                     <span class="float-end badge bg-{{ formationEtat.colors }}">{{ formationEtat.intitule }}</span>
  19.                 </h5>
  20.                 <div class="card-body">
  21.                     <p class="card-text">
  22.                         <div class="mb-3" style="margin-top:-15px">
  23.                             {% if convocations is empty %}
  24.                                 <div class="alert alert-secondary">Aucun stagiaire convoqué</div>
  25.                             {% else %}
  26.                                 <div class="row">
  27.                                     <div class="col-6 fst-italic">
  28.                                          Convoqué(s) : <!--<span class="badge bg-secondary">{# convocations|length #}</span> / --> <span class="badge bg-primary">{{ formation.convocations|length }}
  29.                                     </div>
  30.                                     <div class="col-6">
  31.                                         {% if app.user.roles[0] != 'ROLE_CD' or app.user.roles[0] == 'ROLE_CFC' %}
  32.                                             {% if formation.etat == 1 and formation.formationInsciptions is not empty %}
  33.                                                 <div class="text-end">
  34.                                                     <a href="{{ path('convocations_generate', {'idFormation':formation.id}) }}" class="btn btn-primary btn-sm" data-bs-toggle="tooltip" data-bs-placement="top" title="Seuls les stagiaires inscrits à cette formation pourront être convoqués">Convoquer</a>
  35.                                                 </div>
  36.                                             {% endif %}
  37.                                         {% endif %}
  38.                                     </div>
  39.                                 </div>
  40.                                 {% for convocation in convocations %}
  41.                                     <div class="mt-2 row">
  42.                                         <div class="col-5">
  43.                                             {% if app.user.roles[0] != 'ROLE_CD' or app.user.roles[0] == 'ROLE_CFC' %}
  44.                                                 <a href="{{ path('convocations_show', {'idConvocation':convocation.id}) }}" class="btn btn-primary btn-sm" data-bs-toggle="tooltip" data-bs-placement="top" title="Visualiser les détails de cette convocation"><i class="bi bi-search"></i></a>
  45.                                             {% endif %}
  46.                                             <span class="fw-bold ms-2 me-3">{{ convocation.stagiaire.nom }} {{ convocation.stagiaire.prenom }}</span>
  47.                                             {% if stagiairesReportsTab[convocation.stagiaire.id][0] == true %}
  48.                                                 <span class="badge bg-secondary">
  49.                                                     {{ stagiairesReportsTab[convocation.stagiaire.id][0] }}x REPORT(S)
  50.                                                 </span>
  51.                                             {% endif %}
  52.                                             {% if stagairesAbsencesTab[convocation.stagiaire.id][0] == true %}
  53.                                                 <span class="badge bg-info">
  54.                                                     {{ stagairesAbsencesTab[convocation.stagiaire.id][0] }}x ABSENCES(S)
  55.                                                 </span>
  56.                                             {% endif %}
  57.                                             {% if convocation.stagiaire.dispenseDomaine1 == 1 or convocation.stagiaire.dispenseDomaine2 == 1 or convocation.stagiaire.dispenseDomaine3 == 1 %}
  58.                                                 <span class="badge bg-warning text-black">
  59.                                                     Dispensé(e) domaine(s) :
  60.                                                     {% set temp = 0 %}
  61.                                                     {% if convocation.stagiaire.dispenseDomaine1 %}
  62.                                                         1
  63.                                                         {% set temp = 1 %}
  64.                                                     {% endif %}
  65.                                                     {% if convocation.stagiaire.dispenseDomaine2 %}
  66.                                                         {% if temp == 1 %} | {% endif %}
  67.                                                         2
  68.                                                         {% set temp = 1 %}
  69.                                                     {% endif %}
  70.                                                     {% if convocation.stagiaire.dispenseDomaine3 %}
  71.                                                         {% if temp == 1 %} | {% endif %}
  72.                                                         3
  73.                                                     {% endif %}
  74.                                                 </span>
  75.                                             {% endif %}
  76.                                         </div>
  77.                                         <div class="col-7">
  78.                                             <!-- <span class="badge bg-primary">{{ convocation.stagiaire.id }}</span> -->
  79.                                             
  80.                                             {% if formation.etat == 1 %}
  81.                                                 <a href="{{ path('convocations_generate_pdf', {'idConvocation':convocation.id}) }}" target="_blank" class="badge bg-primary text-white text-decoration-none"><i class="bi bi-file-earmark-pdf"></i> Convocation (PDF) G</a>
  82.                                                 <a href="{{ path('convocations_mail',{'idConvocation':convocation.id}) }}" target="_blank" class="badge bg-secondary text-white text-decoration-none"><i class="bi bi-envelope-plus"></i> Envoyer convocation par mail</a>
  83.                                             {% else %}
  84.                                                 <a href="{{ path('convocations_PDF_show', {'idConvocation':convocation.id}) }}" target="_blank" class="badge bg-primary text-white text-decoration-none"><i class="bi bi-file-earmark-pdf"></i> Convocation (PDF) S</a>
  85.                                             {% endif %}
  86.                                             {% if formation.etat == 1 %}
  87.                                             <a 
  88.                                                 href="" 
  89.                                                 class="buttonReponseConvocation" 
  90.                                                 data-bs-toggle="modal" 
  91.                                                 data-bs-target="#modalTraiterReponseConvocation" 
  92.                                                 data-idConvocation="{{ convocation.id }}" 
  93.                                                 data-nomPrenom="{{ convocation.stagiaire.nom }} {{ convocation.stagiaire.prenom }}"
  94.                                                 data-action=""
  95.                                             >
  96.                                             {% endif %}
  97.                                             {% if convocation.reponse == null %}
  98.                                                 <span id="badgeResponse-{{ convocation.id }}" class="badge bg-secondary">Convocation non traitée</span>{% if convocation.etat == 1 %}</a>{% endif %}
  99.                                             {% else %}
  100.                                                 <span id="badgeResponse-{{ convocation.id }}" class="badge bg-{{ convocation.reponse.colors }}">{{ convocation.reponse.intitule }}</span>{% if formation.etat == 1 %}</a>{% endif %}
  101.                                             {% endif %}
  102.                                             {% if convocation.etat == 1 %}
  103.                                                 {% set ico = 'bi-unlock' %}
  104.                                             {% else %}
  105.                                                 {% set ico = 'bi-lock-fill' %}
  106.                                             {% endif %}
  107.                                             
  108.                                             <!-- BOUTON DE CLOTURE DE LA CONVOCATION -->
  109.                                             {% if formation.etat == 1 %}
  110.                                             <a 
  111.                                                 href="" 
  112.                                                 class="buttonCloturerConvocation" 
  113.                                                 data-bs-toggle="modal" 
  114.                                                 data-bs-target="#modalCloturerConvocation" 
  115.                                                 data-idConvocation="{{ convocation.id }}" 
  116.                                                 data-nomPrenom="{{ convocation.stagiaire.nom }} {{ convocation.stagiaire.prenom }}"
  117.                                                 data-action="{{ convocation.etat }}"
  118.                                             >
  119.                                             {% endif %}
  120.                                                 <span id="badgeId-{{ convocation.id }}">
  121.                                                     <span class="badge bg-{{ convocationEtat[convocation.etat-1].colors }}"><i class="bi {{ ico }}"></i> {{ convocationEtat[convocation.etat-1].intitule }}</span>
  122.                                                 </span>
  123.                                             {% if formation.etat == 1 %}
  124.                                             </a>
  125.                                             {% endif %}
  126.                                         </div>
  127.                                     </div>
  128.                                 {% endfor %}
  129.                             {% endif %}
  130.                         </div>
  131.                         
  132.                         {% if app.user.roles[0] != 'ROLE_CD' or app.user.roles[0] == 'ROLE_CFC' %}
  133.                             {% if formation.etat == 1 and formation.formationInsciptions is not empty %}
  134.                                 <div class="text-end">
  135.                                     <a href="{{ path('convocations_generate', {'idFormation':formation.id}) }}" class="btn btn-primary btn-sm" data-bs-toggle="tooltip" data-bs-placement="top" title="Seuls les stagiaires inscrits à cette formation pourront être convoqués">Convoquer</a>
  136.                                 </div>
  137.                             {% endif %}
  138.                         {% endif %}
  139.                         {% if app.user.roles[0] != 'ROLE_CD' or app.user.roles[0] == 'ROLE_CFC' %}
  140.                             <div id="zoneConvocationsTraitementsOk">
  141.                                 {% if traitementConvocProgress == true and convocations is not empty and ConvocAllClosed == false %}
  142.                                 <div class="alert alert-secondary mt-5 text-center" role="alert">
  143.                                     <h5><i class="bi bi-flag-fill"></i><br>Vous y êtes presque...</h5>
  144.                                     <div class="mt-3"><a href="{{ path('convocations_close_all', {'idFormation':formation.id})}}" class="btn btn-primary btn-xl" data-bs-toggle="tooltip" data-bs-placement="top" title="NB : il sera possible de rouvrir les convocations.">Clôturer toutes les convocations <i class="bi bi-play-circle-fill"></i></a></div>
  145.                                 </div>
  146.                                 {% endif %}
  147.                                 
  148.                                 {% if ConvocAllClosed == true and formation.etat == 1 and convocations is not empty %}
  149.                                 <div class="alert alert-secondary mt-5 text-center" role="alert">
  150.                                     <h5><i class="bi bi-trophy fs-2"></i><br>Félicitations !<br>Toutes les convocations ont été traitées et clôturées.</h5>
  151.                                     <div class="mt-3"><a href="{{ path('formations_plages_construct', {'idFormation':formation.id})}}" class="btn btn-success btn-xl" data-bs-toggle="tooltip" data-bs-placement="top" title="Avertissement : il sera impossible de retourner dans l'état antérieur. Ne cliquez pas sur ce bouton si vous n'avez pas encore terminé de construire cette formation.">Démarrer la formation <i class="bi bi-play-circle-fill"></i></a></div>
  152.                                 </div>
  153.                                 {% endif %}
  154.                             </div>
  155.                             <div id="zoneConvocationsTraitementsRefresh" class="mt-3">
  156.                                 <div class="alert alert-secondary text-center">
  157.                                     <i class="bi bi-exclamation-triangle-fill fs-1 mb-3"></i>
  158.                                     <br>
  159.                                     <h5>Des modifications ont été effectuées sur les convocations. Veuillez recharger la page pour clôturer toutes les convocations ou démarrer la formation.</h5>
  160.                                     <br>
  161.                                     <a href="{{ path('formations_show_convocations', {'idFormation':formation.id}) }}" class="btn btn-primary"><i class="bi bi-arrow-clockwise"></i> Recharger</a>
  162.                                 </div>
  163.                             </div>
  164.                         {% endif %}
  165.                     </p>  
  166.                 </div>
  167.             </div>
  168.         </div>
  169.     </div>
  170.     <div class="mb-5"></div>
  171.     <!-- MODALE POUR TRAITEMENT RAPIDE DES RÉPONSES AUX CONVOCATIONS -->
  172.     <div class="modal fade" id="modalTraiterReponseConvocation" tabindex="-1" aria-labelledby="modalTraiterReponseConvocation" aria-hidden="true">
  173.         <div class="modal-dialog">
  174.             <div class="modal-content">
  175.                 <div class="modal-header">
  176.                     <h1 class="modal-title fs-5" id="exampleModalLabel">Traiter la réponse</h1>
  177.                     <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  178.                 </div>
  179.                 <div class="modal-body">
  180.                     <div id="modalZoneAttenteAjax">
  181.                         <div class="spinner-border" role="status">
  182.                             <span class="visually-hidden">Veuillez patienter...</span>
  183.                         </div>
  184.                     </div>
  185.                     <div id="modalZoneFormulaire">
  186.                         <div id="modalReponseConvocation_zoneHtml">
  187.     
  188.                         </div>
  189.                         <form>
  190.                             <select name="reponseId" id="reponseId" class="form-select mt-3">
  191.                                 {% for reponse in convocationsResponsesListe %}
  192.                                     <option value="{{ reponse.id }}">{{ reponse.intitule }}</option>
  193.                                 {% endfor %}
  194.                             </select>
  195.                             <textarea name="reponseObservations" id="reponseObservations" cols="30" rows="10" class="form-control mt-3" placeholder="Observations"></textarea>
  196.                     </div>
  197.                     <div id="reponseAlert" class="mt-3 alert alert-danger">Veuillez rouvrir la convocation afin de permettre la modification de la réponse !</div>
  198.                     </form>
  199.                 </div>
  200.                 <div class="modal-footer">
  201.                     <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annuler</button>
  202.                     <button id="modalTraiterReponseConvocation_BoutonConfirmer" type="button" class="btn btn-primary" data-idConvocation="">Enregistrer</button>
  203.                 </div>
  204.             </div>
  205.         </div>
  206.     </div>
  207.     <!-- MODALE POUR TRAITEMENT RAPIDE DES CLÔTURES ET RÉOUVERTURES DES CONVOCATIONS -->
  208.     <div class="modal fade" id="modalCloturerConvocation" tabindex="-1" aria-labelledby="modalCloturerConvocation" aria-hidden="true">
  209.         <div class="modal-dialog">
  210.             <div class="modal-content">
  211.                 <div class="modal-header">
  212.                     <h1 class="modal-title fs-5" id="exampleModalLabel">Clôturer la convocation</h1>
  213.                     <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  214.                 </div>
  215.                 <div class="modal-body" id="modalCloturerConvocation_zoneHtml">
  216.                      
  217.                 </div>
  218.                 <div class="modal-footer">
  219.                     <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annuler</button>
  220.                     <button type="button" class="btn btn-primary" id="modalCloturerConvocation_BoutonConfirmer" data-idConvocation="">Confimer</button>
  221.                 </div>
  222.             </div>
  223.         </div>
  224.     </div>
  225.     <script>
  226.         $(document).ready(function(){
  227.             $('#modalZoneAttenteAjax').hide();
  228.             $('#reponseAlert').hide();
  229.             $('#zoneConvocationsTraitementsRefresh').hide();
  230.         });
  231.         // TRAITEMENT RAPIDE DES REPONSES AUX COVOCATIONS
  232.         $('.buttonReponseConvocation').click(function() {
  233.             
  234.             $('#modalZoneFormulaire').hide();
  235.             $('#modalZoneAttenteAjax').show();
  236.             
  237.             var idConvocation = $(this).attr('data-idConvocation');
  238.             var valeurIdConvocation = $(this).attr('data-idConvocation');
  239.             var stagiaireNomPrenom = $(this).attr('data-NomPrenom');
  240.             var action = $(this).attr('data-action');
  241.             $('#modalTraiterReponseConvocation_BoutonConfirmer').attr('data-idConvocation', idConvocation);
  242.             var message = '<strong>'+stagiaireNomPrenom+'</strong> ('+idConvocation+')';
  243.         
  244.             $.ajax({
  245.                 method: "POST",
  246.                 url: "{{ path('convocations_ajax_stagiaireReponseData') }}",
  247.                 data: { idConvocation: valeurIdConvocation }
  248.             })
  249.             .done(function( msg ) {
  250.                 if(msg != 'vide') {
  251.                     msg = JSON.parse(msg);
  252.                     var id = msg['id'];
  253.                     var observations = msg['observations'];
  254.                     $('#reponseId option[value="'+id+'"').prop('selected', true);
  255.                     $('#reponseObservations').val(observations);
  256.                    
  257.                     if(msg['etat'] !=1 ) {
  258.                         $('#reponseId').attr('disabled', true);
  259.                         $('#reponseObservations').attr('disabled', true);
  260.                         $('#modalTraiterReponseConvocation_BoutonConfirmer').attr('disabled', true);
  261.                         $('#reponseAlert').show();
  262.                     }
  263.                     else {
  264.                         $('#reponseId').attr('disabled', false);
  265.                         $('#reponseObservations').attr('disabled', false);
  266.                         $('#modalTraiterReponseConvocation_BoutonConfirmer').attr('disabled', false);
  267.                         $('#reponseAlert').hide();
  268.                     } 
  269.                 }
  270.                 $('#modalZoneAttenteAjax').hide();
  271.                 $('#modalZoneFormulaire').show()
  272.             });    
  273.             
  274.             $('#modalReponseConvocation_zoneHtml').html(message);
  275.         });
  276.         $('#modalTraiterReponseConvocation_BoutonConfirmer').click(function() {
  277.             
  278.             $('#modalZoneFormulaire').hide();
  279.             $('#modalZoneAttenteAjax').show();
  280.             
  281.             var valeurReponseId = $('#reponseId').val();
  282.             var valeurReponseObservations = $('#reponseObservations').val();
  283.             valeurIdConvocation = $('#modalTraiterReponseConvocation_BoutonConfirmer').attr('data-idConvocation');
  284.       
  285.             $.ajax({
  286.                 method: "POST",
  287.                 url: "{{ path('convocations_ajax_stagiaireReponse_enregistrer') }}",
  288.                 data: { 'idConvocation': valeurIdConvocation, 'reponseId': valeurReponseId, 'reponseObservations': valeurReponseObservations }
  289.             })
  290.             .done(function( msg ) {
  291.                 msg = JSON.parse(msg);
  292.                 badgeColor = msg['color'];
  293.                 badgeIntitule = msg['intitule'];
  294.                 $('#badgeResponse-'+valeurIdConvocation).attr('class', 'badge bg-'+badgeColor);
  295.                 $('#badgeResponse-'+valeurIdConvocation).html(badgeIntitule);
  296.                 $('#modalTraiterReponseConvocation').modal('hide');
  297.             });    
  298.             
  299.         });
  300.         // TRAITEMENT RAPIDE DES CLÔTURES ET RÉOUVERTURE DES CONVOCATIONS AVEC MODALE
  301.         $('.buttonCloturerConvocation').click(function() {
  302.             var idConvocation = $(this).attr('data-idConvocation');
  303.             var stagiaireNomPrenom = $(this).attr('data-NomPrenom');
  304.             var action = $(this).attr('data-action');
  305.             $('#modalCloturerConvocation_BoutonConfirmer').attr('data-idConvocation', idConvocation);
  306.             // $('this').attr('data-badge', 1);
  307.             if(action == 1) {
  308.                 var message = 'Vous êtes sur le point de clôturer la convocation de :<br><br><strong>'+stagiaireNomPrenom+'</strong> ('+idConvocation+')';
  309.             }
  310.             else {
  311.                 var message = 'Vous êtes sur le point de rouvrir la convocation de :<br><br><strong>'+stagiaireNomPrenom+'</strong> ('+idConvocation+')';
  312.             }
  313.             $('#modalCloturerConvocation_zoneHtml').html(message);
  314.         });
  315.         $('#modalCloturerConvocation_BoutonConfirmer').click(function(){
  316.                 var valeurIdConvocation = $(this).attr('data-idConvocation');
  317.                 
  318.                 $.ajax({
  319.                     method: "POST",
  320.                     url: "{{ path('convocations_ajax_enclose') }}",
  321.                     data: { idConvocation: valeurIdConvocation }
  322.                 })
  323.                 .done(function( msg ) {
  324.                     msg = JSON.parse(msg);
  325.                     badgeColor = msg['color'];
  326.                     badgeIntitule = msg['intitule'];
  327.                     $('#badgeId-'+valeurIdConvocation).attr('class', 'badge bg-'+badgeColor);
  328.                     $('#badgeId-'+valeurIdConvocation).html(badgeIntitule);
  329.                     $('#modalCloturerConvocation').modal('hide');
  330.                     $('#zoneConvocationsTraitementsRefresh').show();
  331.                     $('#zoneConvocationsTraitementsOk').hide();
  332.                 });
  333.         });
  334.     </script>
  335.     
  336. {% endblock %}