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

{% block title %}Mes parties{% endblock %}

{% block content %}

    <nav class="breadcrumb has-arrow-separator" aria-label="breadcrumbs">
      <ul>
        <li><a href="{{ path('app_main') }}">Accueil</a></li>
        <li class="is-active"><a href="{{ path('app_profile_participations') }}">Mes parties</a></li>
      </ul>
    </nav>

    <div class="tabs is-boxed">
        <ul>
            <li class="is-active"><a>En tant que joueur(euse)</a></li>
            {% if app.user.linkToGamemaster %}
            <li><a href="{{ path('app_profile_participations_gming') }}">En tant que meneur(euse) de jeu</a></li>
            {% endif %}
            <li><a href="{{ path('app_prodile_participations_requests') }}">Mes demandes</a></li>
        </ul>
    </div>

    <div class="block">
        <table id="datatable" {{ stimulus_controller('datatables') }} class="table is-striped is-hoverable is-fullwidth">
            <thead>
            <tr>
                <th>Événement</th>
                <th>Participant</th>
                <th>Partie</th>
                <th>Meneur(euse)</th>
                <th>Date et heure</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>
            {% for participation in participations %}
                <tr>
                    <th>{{ participation.party.event.name }}</th>
                    <td>{{ participation.participantName }}</td>
                    <td>{{ participation.party.game.name }}</td>
                    <td>{{ participation.party.gamemaster.preferedName }}</td>
                    <td>{{ participation.party.startOn|date('d/m/y \\à H:i', app_timezone) }}</td>
                    <td>
                    {% if participation.checkin %}
                      <button class="button is-danger" disabled>Annuler</button>
                      {% else %}
                      <a href="#" data-id="{{ path('app_participation_cancel', {id: participation.id}) }}" class="button is-danger" {{ stimulus_controller('admin_confirm') }}>Annuler</a>
                      {% endif %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>

        </table>
    </div>

{% endblock %}
