{% extends "base.html" %}
{% block title %}
{{_("Live broadcasts") if live else _("TV program")}} | {{format_date(response.date, 'E, d MMMM Y', locale=request.state.language)}}
{% endblock %}

{% block header %}
<app-link href="/schedule"
          icon="tv">{{_("TV program")}}</app-link>
{% endblock %}

{% block content %}
<h4>
  <a class="button {{'disabled' if response.date == datetime.date.today() else ''}}"
     href="../tag/{{tag_util.create_tag('day', response.date, -1)}}">⬅️</a>
  <a class="button"
     href="..">⬆️</a>
  <span>{{_("Live broadcasts") if live else _("TV program")}} | {{format_date(response.date, 'E, d MMMM Y', locale=request.state.language)}}</span>
  <a class="button"
     href="../tag/{{tag_util.create_tag('day', response.date, 1)}}">➡️</a>
</h4>
<div>
  <table class="table">
    <thead>
      <tr>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </thead>
    <tbody>
      {% for response in responses %}
      {% set values = (response.values|selectattr('live') if live else response.values)|list %}
      {% if values|length > 0 %}
      <tr class="table-primary fs-4">
        <td colspan="3">
          <div>{{response.channel.name}}</div>
        </td>
      </tr>
      {% for value in values %}
      <tr class="{{'table-success' if not live and value.live else ''}}">
        <td>{{value.start.strftime('%H:%M')}}</td>
        <td>{{(value.end - value.start) | timedelta_format}}</td>
        <td>{{value.label}}</td>
      </tr>
      {% endfor %}
      {% endif %}
      {% endfor %}
    </tbody>
  </table>
</div>
{% endblock %}