{% extends "./page.html" %}
{% load i18n humanize aircox %}

{% block outer %}
{% with diffusion.is_now as is_active %}
    {% if admin %}
        {% with object|admin_url:"change" as url %}
        {{ block.super }}
        {% endwith %}
    {% else %}
        {{ block.super }}
    {% endif %}
{% endwith %}
{% endblock %}

{% block subtitle %}
{% if diffusion %}
    {% if timetable %}
        {{ diffusion.start|date:"H:i" }}
        &mdash;
        {{ diffusion.end|date:"H:i" }}
    {% else %}
        {{ diffusion.start|naturalday }},
        {{ diffusion.start|date:"H:i" }}
    {% endif %}
{% else %}
    {{ block.super }}
{% endif %}
{% endblock %}


{% block actions %}
{{ block.super }}

{% if admin and diffusion %}
    {% 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 %}
{% endif %}

{% if object.sound_set.count %}
<button class="button action" @click="player.playButtonClick($event)"
        data-sounds="{{ object.podcasts|json }}">
    <span class="icon is-small">
        <span class="fas fa-play"></span>
    </span>
    <label>{% translate "Listen" %}</label>
</button>
{% endif %}
{% endblock %}
