<!--
SPDX-FileCopyrightText: 2017-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms

This file contains Apache-2.0 licensed contributions copyrighted by the following contributors:
SPDX-FileContributor: luto
-->

{% extends "orga/base.html" %}

{% load i18n %}
{% load rules %}
{% load static %}

{% block extra_title %}{% translate "Dashboard" %} :: {% endblock extra_title %}

{% block stylesheets %}
    <link rel="stylesheet" href="{% static "orga/css/ui/dashboard.css" %}">
{% endblock stylesheets %}

{% block content %}
    {% has_perm "event.create_event" request.user request.user as can_create_event %}

    {% if current_orga_events or past_orga_events or can_create_event %}
        <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>
        {% if current_orga_events or can_create_event %}
            <h2>{% translate "Your upcoming events" %}</h2>
            <div class="dashboard-list">
                {% for event in current_orga_events %}
                    {% include "orga/includes/dashboard_block_event.html" %}
                {% endfor %}
                {% if can_create_event %}
                    <a class="dashboard-block symbol" href="{% url "orga:event.create" %}">
                        <i class="fa fa-plus-circle" title="{% translate "Create a new event" %}"></i>
                    </a>
                {% endif %}
            </div>
        {% endif %}
        {% if past_orga_events %}
            <h2>{% translate "Your most recent events" %}</h2>
            <div class="dashboard-list">
                {% for event in past_orga_events %}
                    {% include "orga/includes/dashboard_block_event.html" %}
                {% endfor %}
            </div>
        {% endif %}
    {% endif %}
    {% if not hide_speaker_events and speaker_events %}
        <div class="alert alert-info">
            <div>
                {% translate "You are currently in the organiser area of pretalx. To view your submitted proposals, please go directly to the event page:" %}
                {% if speaker_events|length == 1 %}
                    <a href="{{ event.urls.user_submissions.full }}">{{ event.name }}</a>
                {% else %}
                    <ul class="mb-0">
                        {% for event in speaker_events %}
                            <li><a href="{{ event.urls.user_submissions.full }}">{{ event.name }}</a></li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </div>
        </div>
    {% endif %}
{% endblock content %}
