{% extends 'main.html' %}
{% load i18n static cms_tags %}

{% block title %}{% trans 'Elementa Portal' %}{% endblock %}

{% block content %}
    <div class="content__frame">
        <div class="content__intro reveal_container reveal_self reveal reveal_animation image">
            <div class="content__intro__content reveal reveal_animation">
                <h1>{% trans 'Grüezi, ' %}{{ request.user.profile.full_name }}</h1>
                <p>{% trans 'Willkommen in Ihrem persönlichen Portal der Tagesschule Elementa' %}</p>
                <a href="{% url 'portal:logout' %}" class="button">
                    <span class="button__icon">{% include 'project/assets/arrow-left-long.svg' %}</span>
                    <span class="button__text">{% trans 'Logout' %}</span>
                </a>
            </div>
            {% static_placeholder 'portal_intro' %}
        </div>
        <div class="content__container">
            <div class="content__main">
                <div class="control_panel reveal_self reveal reveal_animation">
                    <div class="control_panel__content">
                        <div class="control_panel__content__item">
                            <h2 class="reveal_self reveal reveal_animation">{% trans 'Aktuell' %}</h2>
                            <div id="todo" class="load__frame">
                                <div class="load__main">
                                    <ul class="control__list reveal_container">
                                        {% for object in object_list %}
                                            <li class="data_id_{{ forloop.counter0 }} reveal reveal_animation">
                                                <a href="{{ object.get_absolute_url }}"
                                                   class="p control__item control__item--arrow control__item--status {% if request.user in object.informed_users.all %}control__item--status--active{% endif %}">
                                                    <span class="control__item__title">
                                                        <span class="control__item__status">
                                                            {% if object.is_expired %}
                                                                {% include 'project/assets/close.svg' %}
                                                            {% else %}
                                                                {% include 'project/assets/tick.svg' %}
                                                            {% endif %}
                                                        </span>
                                                        {{ object.title }}
                                                        <span class="control__item__arrow">
                                                            {% include 'project/assets/arrow-right.svg' %}
                                                        </span>
                                                    </span>
                                                </a>
                                            </li>
                                        {% endfor %}
                                    </ul>
                                    {% if page_obj.has_next or paginator.count > 0 and open_object_list %}
                                        <div class="load__replace data_id_3 reveal_self reveal reveal_animation">
                                            <a href="{% spaceless %}{% url 'portal:overview' %}?page=
{% if open_object_list %}{{ page_obj.start_index }}{% else %}{{ page_obj.next_page_number }}{% endif %}{% endspaceless %}"
                                               class="button button--load list__button button--small">
                                                <span class="button__icon">{% include 'project/assets/dots.svg' %}</span>
                                                <span class="button__text">{% trans 'Ältere laden' %}</span>
                                            </a>
                                        </div>
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                        <div class="control_panel__content__item">
                            <h2 class="reveal_self reveal reveal_animation">{% trans 'Einstellungen' %}</h2>
                            <ul class="control__list reveal_container">
                                {% for settings_title, settings_url in settings %}
                                    <li class="reveal reveal_animation data_delay_{{ forloop.counter0 }}">
                                        <div class="control__item control__item--button">
                                            <span class="control__item__title">
                                                {{ settings_title }}
                                                <a href="#" data-href="{{ settings_url }}"
                                                   class="button button--small control__item__open">
                                                    <span class="button__icon">{% include 'project/assets/dots.svg' %}</span>
                                                    <span class="button__text">{% trans 'Ändern' %}</span>
                                                </a>
                                                <a href="#"
                                                   class="button button--small button--ghost control__item__close">
                                                    <span class="button__icon">{% include 'project/assets/close.svg' %}</span>
                                                    <span class="button__text">{% trans 'Abbrechen' %}</span>
                                                </a>
                                            </span>
                                            <div class="control__item__content">
                                                <div class="control__item__content__main">
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                {% endfor %}
                            </ul>
                        </div>
                        {% trans 'Einstellungen' as settings_section_title %}
                        {% include 'project/plugins/content/section_title.html' with section_title=settings_section_title %}
                    </div>
                </div>

                <div id="information" class="downloads__frame">
                    <h2 class="reveal_self reveal reveal_animation">{% trans 'Informationen' %}</h2>
                    <form class="downloads__filter reveal_self reveal reveal_animation"
                          action="{{ request.path }}#information" method="get">
                        <div class="form__field form__field--icon">
                            <input name="information"
                                   {% if request.GET.information %}value="{{ request.GET.information }}"{% endif %}
                                   class="downloads_search"
                                   type="text" placeholder="{% trans 'Suchbegriff eingeben' %}">
                            <button>{% trans 'Suchen' %}{% include 'project/assets/search.svg' %}</button>
                        </div>
                    </form>
                    {% for section in information_sections %}
                        <div class="downloads__section reveal_container">
                            <div class="downloads__section__title{% if flat %} downloads__section__title--flat{% endif %} reveal reveal_animation">
                                <h3>{{ section.title }}</h3>
                            </div>
                            <ul class="downloads">
                                {% for item in section.items %}
                                    <li class="reveal_self reveal reveal_animation data_delay_{{ forloop.counter0 }}">
                                        <a href="{{ item.get_absolute_url }}" class="download__item download__item--page">
                                            <span class="download__item__title">{{ item.title }}</span>
                                            <span class="download__item__description">
                                                {% if item.description %}{{ item.description }}{% endif %}
                                            </span>
                                            <span class="downloads__item__tags">
                                                {% if item.tag_list %}{{ item.tag_list }}{% endif %}</span>
                                            <span class="download__item__icon">
                                                {% include 'project/assets/arrow-right.svg' %}
                                            </span>
                                        </a>
                                    </li>
                                {% endfor %}
                            </ul>
                        </div>
                    {% endfor %}
                    {% trans 'Informationen' as information_section_title %}
                    {% include 'project/plugins/content/section_title.html' with section_title=information_section_title %}
                </div>

                <div id="downloads" class="downloads__frame">
                    <h2 class="reveal_self reveal reveal_animation">{% trans 'Downloads' %}</h2>
                    <form class="downloads__filter reveal_self reveal reveal_animation"
                          action="{{ request.path }}#downloads" method="get">
                        <div class="form__field form__field--icon">
                            <input name="q" {% if request.GET.q %}value="{{ request.GET.q }}"{% endif %}
                                   class="downloads_search"
                                   type="text" placeholder="{% trans 'Suchbegriff eingeben' %}">
                            <button>{% trans 'Suchen' %}{% include 'project/assets/search.svg' %}</button>
                        </div>
                    </form>
                    {% for section in download_sections %}
                        <div class="downloads__section reveal_container">
                            <div class="downloads__section__title{% if flat %} downloads__section__title--flat{% endif %} reveal reveal_animation">
                                <h3>{{ section.title }}</h3>
                            </div>
                            {% include 'project/plugins/content/download_section.html' with instance=section %}
                        </div>
                    {% endfor %}
                    {% trans 'Downloads' as downloads_section_title %}
                    {% include 'project/plugins/content/section_title.html' with section_title=downloads_section_title %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}