{% extends "orga/base.html" %}
{% load bootstrap4 %}
{% load i18n %}
{% load rules %}

{% block title %}Organisers{% endblock %}

{% block content %}
    <form class="mb-4 m-2">
        <input type="text" name="q" class="form-control" value="{% if request.GET.q %}{{ request.GET.q }}{% endif %}" placeholder="{% translate "Search" %}">
    </form>
    {% has_perm 'orga.change_organiser_settings' request.user None as can_create_organiser %}
    <div class="dashboard-list event-blocks">
        {% if can_create_organiser %}
            <a class="dashboard-block symbol" href="{% url "orga:organiser.create" %}">
                <i class="fa fa-plus-circle"></i>
            </a>
        {% endif %}
        {% for organiser in organisers %}
            <a class="event-block dashboard-block" href="{{ organiser.orga_urls.base }}">
                <h2 class="name">{{ organiser.name }}</h2>
                <div class="dashboard-description">
                    <div class="date">/{{ organiser.slug }}</div>
                </div>
                <div class="stats">
                    <div class="submissions">
                        {{ organiser.events.count }}
                        {% blocktranslate trimmed count count=organiser.events.count %}
                            event
                        {% plural %}
                            events
                        {% endblocktranslate %}
                    </div>
                    <div class="state inactive">
                        {{ organiser.teams.count }}
                        {% blocktranslate trimmed count count=organiser.teams.count %}
                            team
                        {% plural %}
                            teams
                        {% endblocktranslate %}
                    </div>
                </div>
            </a>
        {% endfor %}
    </div>
    {% if not organisers and not can_create_organiser %}
        <div class="alert alert-info">
            {% translate "There are no organisers you can edit." %}
        </div>
    {% endif %}
{% endblock %}
