templates/dispo/_tableau_dispo.html.twig line 1

Open in your IDE?
  1. {# utilisé par : assistant_maternel/recherche_dispo_assmat.html.twig #}
  2. {# Paramètres en entrée : form_dispo le formulaire qui contient le planning (la liste d'objets "PlanningDispo") #}
  3. {# Prérequis : la liste des items de planning_dispo sont triés par id_periode, id_tranche_horaire, id_jour  #}
  4. {# Pré-requis 2 : les ids des tranches et jours commencent à 0 et se suivent #}
  5. {# Paramètre : edition true/false #}
  6. <div class="py-2">
  7.     <span class="fa-09x">Cliquer dans le calendrier pour indiquer les créneaux libres recherchés</span>
  8. </div>
  9. {% set crtIdPeriode = 0 %}
  10. {% set crtIdTranche = 0 %}
  11. {% set classes = ['accueil_vide', 'bg-dispo'] %}
  12. {# En-tête jours #}
  13. <table id="{{ (edition ? 'periode_1' : 'synthese_periode_1') }}" class="table table-bordered table_planning">
  14.     <thead class="thead-light">
  15.         <tr class="d-none d-sm-table-row">
  16.             <th class="d-none d-sm-table-cell"></th>
  17.                 {% for jour in liste_jours %}
  18.                 <th scope="col" class="d-none d-md-table-cell" >{{ jour.libelle }}</th>
  19.                 {% endfor %}
  20.                 {% for jour in liste_jours %}
  21.                 <th scope="col" class="d-none d-sm-table-cell d-md-none" >{{ jour.libelle | slice(0, 3) }}</th>
  22.                 {% endfor %}
  23.         </tr>
  24.     </thead>
  25.     <col span="1" class="wide d-none d-sm-table-column">
  26.     <tbody>
  27.         {# Itération sur les créneaux du planning #}
  28.         {% for planning in form_dispo.planning_dispo %}
  29.             {# Récupération des données à partir du formulaire #}
  30.             {% set entity = planning.vars.data %}{# get entity object #}
  31.             {# ? #}
  32.             {% set crtIdJour = entity.getJourSemaine.id %}
  33.             {# ? #}
  34.             {% if crtIdPeriode != entity.periode.id %}
  35.                 {% set crtIdPeriode = entity.periode.id %}
  36.                 {% set crtIdTranche = 0 %}
  37.             {% endif %}
  38.             {% if crtIdTranche != entity.getTrancheHoraire.id %}
  39.                 {% set crtIdTranche = entity.getTrancheHoraire.id %}
  40.                 {# changement de tranche : nouvelle ligne #}
  41.                 {% set tranche = liste_tranches[crtIdTranche-1] %}
  42.                 <tr class="d-table-row d-sm-none thead-light"><th colspan="{{ liste_jours | length }}" title="{{tranche.description}}">{{ tranche.libelle }}</th></tr>
  43.                 <tr class="">
  44.                     <th class="d-none d-sm-table-cell" title="{{tranche.description}}">{{ tranche.libelle }}</th>
  45.             {% endif %}
  46.                     {% set jour = liste_jours[entity.getJourSemaine.id-1] %}
  47.                     <td class="">
  48.                         <div id="{{edition ? 'planning' : 'synthese_planning'}}_{{ crtIdPeriode }}_{{ crtIdTranche }}_{{ jour.id }}" class="toggle_accueil {{ classes[entity.getFrequenceDispo().id-1] }}" data-statut="0">
  49.                             <span class="jour d-block d-sm-none">{{ jour.libelle | first | upper }}</span>
  50.                             {% if edition %} {{ form_row(planning.id_frequence_dispo) }} {% endif %}
  51.                         </div>
  52.                         {% if edition %}
  53.                             {{ form_row(planning.id_periode) }}
  54.                             {{ form_row(planning.id_tranche_horaire) }}
  55.                             {{ form_row(planning.id_jour_semaine) }}
  56.                         {% endif %}
  57.                     </td>
  58.             {% if crtIdJour == liste_jours|length %}
  59.                 </tr>
  60.             {% endif %}
  61.         {% endfor %}
  62.     </tbody>
  63. </table>