{% extends "admin/index.html" %}
{% load i18n thumbnail %}


{% block app %}
<div class="section">
<div class="columns">
    <div class="column">
        <div class="box">
            <h1 class="title icon-text is-4">
                <span class="icon"><i class="fa-regular fa-calendar-days"></i></span>
                <span>{% translate "Today" %}</span>
            </h1>
            {% if diffusions %}
            <table class="table is-fullwidth is-striped">
                <tbody>
                    {% for diffusion in diffusions %}
                    {% with episode=diffusion.episode %}
                    <tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
                        <td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
                        <td><img src="{% thumbnail episode.cover 64x64 crop %}"/></td>
                        <td>
                            <a href="{% url "admin:aircox_episode_change" episode.pk %}">{{ episode.title }}</a>
                            &nbsp;
                            {% if diffusion.type == diffusion.TYPE_ON_AIR %}
                            <span class="tag is-info">
                                <span class="icon is-small">
                                    {% if diffusion.is_live %}
                                    <i class="fa fa-microphone"
                                        title="{% translate "Live diffusion" %}"></i>
                                    {% else %}
                                    <i class="fa fa-music"
                                        title="{% translate "Differed diffusion" %}"></i>
                                    {% endif %}
                                </span>
                                &nbsp;
                                {{ diffusion.get_type_display }}
                            </span>
                            {% elif diffusion.type == diffusion.TYPE_CANCEL %}
                            <span class="tag is-danger">
                                {{ diffusion.get_type_display }}</span>
                            {% elif diffusion.type == diffusion.TYPE_UNCONFIRMED %}
                            <span class="tag is-warning">
                                {{ diffusion.get_type_display }}</span>
                            {% endif %}
                        </td>
                    </tr>
                    {% endwith %}
                    {% endfor %}
                </tbody>
            </table>
            {% else %}
            <div class="block has-text-centered">
                {% trans "No diffusion is scheduled for today." %}
            </div>
            {% endif %}
        </div>

        <div class="box">
            <h1 class="title is-4 icon-text">
                <span class="icon"><i class="fa-regular fa-comments"></i></span>
                <span>{% translate "Latest comments" %}</span>
            </h1>
            {% if comments %}
            {% include "aircox/widgets/page_list.html" with object_list=comments with_title=True %}
            <div class="has-text-centered">
                <a href="{% url "admin:aircox_comment_changelist" %}" class="float-center">{% translate "All comments" %}</a>
            </div>
            {% else %}
            <p class="block has-text-centered">{% trans "No comment posted yet" %}</p>
            {% endif %}
        </div>
    </div>
    <div class="column">
        <div class="box">
            <h1 class="title is-4 icon-text">
                <span class="icon"><i class="fa-regular fa-newspaper"></i></span>
                <span>{% translate "Latest publications" %}</span>
            </h1>
            {% if latests %}
            {% include "aircox/widgets/page_list.html" with object_list=latests no_actions=True %}
            {% endif %}
        </div>
        <div class="box">
            <h1 class="title is-4 icon-text">
                <span class="icon"><i class="fa fa-screwdriver-wrench"></i></span>
                <span>{% translate "Administration" %}</span>
            </h1>
            {% include "admin/app_list.html" with app_list=app_list show_changelinks=True %}
        </div>
    </div>
</div>
</div>
{% endblock %}
