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

{% block outer %}
{% with diffusion.is_now as is_active %}
    {{ block.super }}
{% 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-container %}
{% if admin and diffusion %}
<div class="flex-row">
    <div class="flex-grow-1">
        {% 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 %}
    </div>
    {{ block.super }}
</div>
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}

{% block actions %}
{{ block.super }}
{% if object.episodesound_set.available.public.count %}
<button type="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 %}
