{% extends "jury/base.html.twig" %}
{% import "jury/jury_macros.twig" as macros %}

{% block title %}Affiliations - {{ parent() }}{% endblock %}

{% block extrahead %}
    {{ parent() }}
    {{ macros.table_extrahead() }}
{% endblock %}

{% block content %}

    <h1>Affiliations</h1>

    {{ macros.table(team_affiliations, table_fields) }}

    {%- if is_granted('ROLE_ADMIN') %}
        <p class="mt-4">
            {% include 'jury/partials/_delete_button.html.twig' with {'entities': team_affiliations} %}
            {{ button(path('jury_team_affiliation_add'), 'Add new affiliation', 'primary', 'plus') }}
        </p>
    {%- endif %}

{% endblock %}

{% block extrafooter %}
    {{ parent() }}
    <script src="{{ asset('js/multi-delete.js') }}"></script>
    <script>
        $(function() {
            initializeMultiDelete({
                buttonSelector: '#delete-selected-button',
                checkboxClass: 'affiliation-checkbox',
                deleteUrl: '{{ path('jury_team_affiliation_delete_multiple') }}'
            });
        });
    </script>
{% endblock %}