Planning.html.twig 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {# Template pour les plannings #}
  2. {% set cols = event.getSpaces()|length +1 %}
  3. {# début du block de grille #}
  4. <div class="block" {{ stimulus_controller('planning') }}>
  5. {# Nombre de colonnes = nombre d'espaces + colonne d'intro #}
  6. <div class="fixed-grid has-{{ cols }}-cols">
  7. <div class="grid is-gap-0">
  8. {# en-tête avec les noms des espaces #}
  9. <div class="cell is-coll-start planning-cell planning-cell-heading">
  10. Espaces
  11. </div>
  12. {% for space in event.getSpaces() %}
  13. <div class="cell planning-cell planning-cell-heading">
  14. {{ space.name }}
  15. </div>
  16. {% endfor %}
  17. </div>
  18. </div>
  19. {# On détermine la première période sur laquelle on calle l'affichage #}
  20. {# date() > period.getEndOn #}
  21. {% set now = date() %}
  22. {% set first_period = null %}
  23. {% for period in event.getPeriods|sort((a, b) => a.endOn <=> b.endOn) %}
  24. {% if first_period is null and period.endOn > now %}
  25. {% set first_period = period.id %}
  26. {% endif %}
  27. {% endfor %}
  28. {# On ajoute les horaires période par période #}
  29. {% set i=0 %}
  30. {% for period in event.getPeriods() %}
  31. <div class="fixed-grid has-{{ cols }}-cols period-panel{% if period.id != first_period %} is-hidden{% endif %}" id="#period-{{ period.id }}">
  32. <div class="grid is-gap-0">
  33. <div class="cell planning-cell planning-cell-period is-col-span-{{ cols }} has-text-centered">
  34. {% if i > 0 %}
  35. <span class="icon period-controller" data-id="#period-{{ event.getPeriods()[i-1].id }}"><twig:ux:icon name='bi:arrow-left-circle'/></span>
  36. {% endif %}
  37. <div class="planning-cell-force-large has-text-centered">Période du {{ period.startOn|date('d/m/Y \\d\\e H:i', app_timezone) }} à {{ period.endOn|date('H:i', app_timezone) }}</div>
  38. {% if i+1 < event.getPeriods()|length %}
  39. <span class="icon period-controller" data-id="#period-{{ event.getPeriods()[i+1].id }}"><twig:ux:icon name='bi:arrow-right-circle'/></span>
  40. {% endif %}
  41. {% set i=i+1 %}
  42. </div>
  43. {# On affiche tous les slots de la période, space par space #}
  44. {% for dateRef in this.getDateOrdered(period) %}
  45. <div class="cell planning-cell planning-cell-heading">
  46. {{ dateRef|date('H:i', app_timezone) }}
  47. </div>
  48. {% for space in event.getSpaces() %}
  49. {# extraction du slot de cet espace, ce moment et cette période #}
  50. {% set thisSlot = this.getThisSlotInfo(dateRef, space, period) %}
  51. {# --CASE1-- si le slot est Indisponible #}
  52. {% if thisSlot.unavailable %}
  53. {% if displayLocked %}
  54. <div class="cell planning-cell planning-cell-locked has-text-centered" data-id="{{ thisSlot.id }}">
  55. <div class="icon"><twig:ux:icon name="bi:lock-fill" /></div>
  56. </div>
  57. {% else %}
  58. <div class="cell planning-cell planning-cell-locked">
  59. </div>
  60. {% endif %}
  61. {% endif %}
  62. {# --CASE2 -- si une partie est sur le slot #}
  63. {% if thisSlot.party %}
  64. {% if thisSlot.party.isValidated or displayUnvalidates %}
  65. {% if thisSlot == thisSlot.party.slots[0] %}
  66. {# Premier slot d'une partie ou partie non validée #}
  67. <div class="cell planning-cell planning-cell-game-parent">
  68. <div class="planning-cell-game {% if thisSlot.party.getSeatsLeft < 1 %}planning-cell-game-isfull {% endif %}{% if pathFullSlot %} open-modal" href="{{ path(pathFullSlot, {id: thisSlot.id}) }}"{% else %}"{% endif %} style="height: {{ thisSlot.party.slots|length * 4 * app_hmult }}rem !important">
  69. {# Carte "jeu" DEBUT #}
  70. <div class="card has-background-primary-45 has-text-primary-45-invert" style="{% if thisSlot.party.game.picture %}background-image: url('/images/games/{{ thisSlot.party.game.picture }}');{% endif %} height: {{ thisSlot.party.slots|length * 4 * app_hmult - 0.7 }}rem !important; {% if not thisSlot.party.isValidated %}filter:grayscale(1) opacity(0.3);{% endif %};">
  71. <div class="card-header">
  72. <div class="media">
  73. <div class="media-left">
  74. <figure class="image is-48x48">
  75. {% if thisSlot.party.gamemaster.picture %}
  76. <img class="is-rounded" src="/images/gamemasters/{{ thisSlot.party.gamemaster.picture }}" />
  77. {% else %}
  78. <twig:ux:icon name="bi:person-fill"/>
  79. {% endif %}
  80. </figure>
  81. </div>
  82. </div>
  83. <div class="media-content">
  84. <small class="has-text-grey-darker">{{ thisSlot.party.gamemaster.preferedName }}</small><br/>
  85. <span class="title is-6 has-text-primary-45-invert">{{ thisSlot.party.game.name }}</span>
  86. </div>
  87. </div>
  88. <div class="card-content">
  89. <p><span class="tag is-dark m-1">Places : {{ thisSlot.party.getSeatsLeft }}/{{ thisSlot.party.getMaxParticipants }}</span></p>
  90. {% if thisSlot.party.gamemasterIsAuthor %}<p><span class="tag is-warning m-1">partie animée par l'auteur</span></p>{% endif %}
  91. <p>{% for genre in thisSlot.party.game.genre %}<span class="tag is-info m-1">{{ genre.genre }}</span>{% endfor %}</p>
  92. </div>
  93. {% if pathFullSlot %}</a>{% endif %}
  94. </div>
  95. {# Carte "jeu" FIN #}
  96. </div>
  97. </div>
  98. {% else %}
  99. {# Slot suivant d'une partie #}
  100. <div class="cell planning-cell planning-cell-game-parent">
  101. </div>
  102. {% endif %}
  103. {% else %}
  104. {# Partie non validée masquée #}
  105. <div class="cell planning-cell planning-cell-free">
  106. </div>
  107. {% endif %}
  108. {% endif %}
  109. {# --CASE3-- si le slot est disponible et sans partie #}
  110. {% if not thisSlot.unavailable and not thisSlot.party %}
  111. {% if pathEmptySlot %}
  112. <a href="{{ path(pathEmptySlot, {id: thisSlot.id}) }}" class="open-modal">
  113. <div class="cell planning-cell planning-cell-free has-text-centered" data-id="{{ thisSlot.id }}">
  114. <div class="icon"><twig:ux:icon name="bi:plus-circle" /></div>
  115. </div>
  116. </a>
  117. {% elseif displayLocked %}
  118. <div class="cell planning-cell planning-cell-free has-text-centered" data-id="{{ thisSlot.id }}">
  119. <div class="icon"><twig:ux:icon name="bi:unlock-fill" /></div>
  120. </div>
  121. {% else %}
  122. <div class="cell planning-cell planning-cell-free" data-id="{{ thisSlot.id }}">
  123. </div>
  124. {% endif %}
  125. {% endif %}
  126. {% endfor %}
  127. {% endfor %}
  128. </div>
  129. </div>
  130. {% endfor %}
  131. {# fin du block de grille #}
  132. {% if i > 1 %}
  133. <div class="has-text-centered"><p data-store="#period-{{ first_period }}" data-action="show" class="button">Afficher toutes les périodes à la suite</p></div>
  134. {% endif %}
  135. </div>