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

{% block content %}
    <h2>
        {{ page_obj.paginator.count }}
        {% blocktrans trimmed count count=page_obj.paginator.count %}
        submitter
        {% plural %}
        submitters
        {% endblocktrans %}
    </h2>

    <div class="submit-group">
        <form class="search-form">
            {% bootstrap_form search_form %}
            {% bootstrap_form filter_form %}
            <button class="btn btn-info btn-search" type="submit">{% trans "Search" %}</button>
        </form>
    </div>
    {% has_perm 'orga.mark_speakers_arrived' request.user request.event as can_mark_speaker %}
    {% has_perm 'orga.see_speakers_arrival' request.user request.event as can_see_speaker_status %}
    <table class="table table-sm table-hover table-responsive-md">
        <thead>
            <tr>
                <th>{% trans "Name" %}</th>
                <th>{% trans "Scheduled Talks" %}</th>
                <th>{% trans "Accepted Submissions" %}</th>
                <th>{% trans "Submissions" %}</th>
                {% if can_mark_speaker or can_see_speaker_status %}<th></th>{% endif %}
            </tr>
        </thead>
        <tbody>
            {% for profile in speakers %}
                <tr>
                    <td><a href="{{ profile.orga_urls.base }}">{{ profile.user.get_display_name }}</a></td>
                    <td>{{ profile.talks.count }}</td>
                    <td>{{ profile.accepted_confirmed_submissions.count }}</td>
                    <td>{{ profile.submissions.count }}</td>
                    {% if can_mark_speaker or can_see_speaker_status %}
                        <td class="action-column">
                            {% if can_mark_speaker %}
                            <a class="btn btn-sm btn-{{ profile.has_arrived|yesno:'success,info' }}" href="{{ profile.orga_urls.toggle_arrived }}?from=list">
                                {% if profile.has_arrived %}
                                    {% trans "Mark speaker as not arrived" %}
                                {% else %}
                                    {% trans "Mark speaker as arrived" %}
                                {% endif %}
                            </a>
                            {% else %}
                                {% if profile.has_arrived %}
                                <a><i class="fa fa-check"></i> {% trans "Arrived" %}</a>
                                {% else %}
                                <a><i class="fa fa-times"></i> {% trans "Not arrived" %}</a>
                                {% endif %}
                            {% endif %}
                        </td>
                        {% endif %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
    {% include "orga/pagination.html" %}
{% endblock %}
