{% extends 'bulma.html.twig' %}

{% block title %}Préparation pour {{ event.name }}{% endblock %}

{% block content %}

{{ component('Modal')}}


<div class="card" {{ stimulus_controller('dropdown')}} >
  <div class="card-footer">
    <div class="dropdown card-footer-item is-flex is-justify-content-space-between is-align-items-center" data-action="click->dropdown#toggle">
      <button>
        <span><strong>{{ event.name }} - du {{ event.startOn|date('d/m/y à H:i', app_timezone) }} au {{ event.endOn|date('d/m/y à H:i', app_timezone)}}</strong></span>        
      </button>
      {% if events|length > 1 %}
      <span class="icon is-small">
        <twig:ux:icon name="bi:chevron-down" />&nbsp;
      </span>
      <div data-dropdown-target="menu" class="dropdown-menu">
        <div class="dropdown-content">
          {% for evt in events %}
          {% if event.id != evt.id %}
          <a href="{{ path('app_prepare_planning', {id: evt.id})}}" class="dropdown-item"><strong>{{ evt.name }}</strong><small> du {{ evt.startOn|date('d/m/y H:i', app_timezone) }} au {{ evt.endOn|date('d/m/y H:i', app_timezone)}}</small></a>
          {% endif %}
          {% endfor %}
        </div>
      </div>
      {% endif %}
    </div>
  </div>





</div>

<div class="box is-clearfix">
  <div class="columns">
    {% if not event.isHiddenPlanning %}
    <div class="column">
      <p>{{ event.getParties()|length }} parties proposées</p>
    </div>
    {% endif %}
    <div class="column">
      <p class="is-inline-block icon-text">{{ event.getGamemastersAssigned|length }} meneur(euse)s de jeu
        {% for gamemaster in event.getGamemastersAssigned %}
          <span class="icon">
              <a href="{{ path('app_gamemaster_public_profile', {id: gamemaster.id}) }}" class="open-modal" title="{{ gamemaster.preferedName }}"><figure class="image is-24x24 is-inline-block">
              {% if gamemaster.picture %}
              <img class="is-rounded" src="/images/gamemasters/{{ gamemaster.picture }}" alt="{{ gamemaster.preferedName }}"/>
              {% else %}
              <twig:ux:icon name="bi:person-fill"/>
              {% endif %}
              </figure></a>
          </span>   
        {% endfor %}
      </p>
    </div>
    {% if is_granted('ROLE_MANAGER') %}
    <div class="column">
      <a class="button is-primary" href="{{ path('app_admin_event_config', {id: event.id}) }}">Configurer</a>
    </div>
    {% endif %}
  </div>

</div>

    <div class="tabs is-boxed">
        <ul>
            <li class="is-active"><a>Planning</a></li>
            <li><a>Disponibilités</a></li>
        </ul>
    </div>


<section>
  <div id="planning">
    {% if is_granted('ROLE_MANAGER') %}
    {{ component('Planning', {event: event, pathEmptySlot: 'app_party_add', pathFullSlot: 'app_party_modify', displayUnvalidates: true}) }}
    {% else %}
    N'joute que les parties de MJ (à supprimer, c'est d debug)
    {{ component('Planning', {event: event, pathEmptySlot: 'app_party_add', displayUnvalidates: true}) }}
    {% endif %}
  </div>
</section>

{% endblock %}
