{% extends "base.html" %}
{% load i18n %}


{% block title %}{{ section.title }}{% endblock %}

{% block content %}

<p>{% trans "Automatic update every" %} 5 {% trans "minuts" %}. {% trans "Last update" %}:  {% now "Y-m-d H:i:s" %}</p>
<p>{% trans "This is on air status" %}:</p>

{% if schedules %}
<table
  cellpadding="8" cellspacing="8" border="1" align="left" valign="middle" bgcolor="#888844" frame="border" rules="all">
      <tr bgcolor="#F0F0F0">
      <td><B> {% trans "Type" %} </B></td><td><B> {% trans "Title" %} </B></td><td><B> {% trans "Programmed for" %} </B></td><td><B> {% trans "That is" %} </B></td><td><B> {% trans "Last emission done" %} </B></td><td><B> {% trans "Length" %}  </B></td><td><B> {% trans "File" %} </B></td>
      </tr>
    {% for schedule in schedules %}
      <tr>
        <td 
	   {%ifequal schedule.tipo "spot" %} bgcolor="#FFA500" {% endifequal %}
	   {%ifequal schedule.tipo "playlist" %} bgcolor="#FFFF00" {% endifequal %}
	   {%ifequal schedule.tipo "program" %} bgcolor="#1E90FF" {% endifequal %}
	   {%ifequal schedule.tipo "jingle" %} bgcolor="#448888" {% endifequal %}
           >  {{ schedule.tipo  }} </td>
	<td
	   {%ifequal schedule.tipo "spot" %} bgcolor="#FFA500" {% endifequal %}
	   {%ifequal schedule.tipo "playlist" %} bgcolor="#FFFF00" {% endifequal %}
	   {%ifequal schedule.tipo "program" %} bgcolor="#1E90FF" {% endifequal %}
	   {%ifequal schedule.tipo "jingle" %} bgcolor="#448888" {% endifequal %}
	   > {{ schedule.title  }} </td>
	<td {% if schedule.isfuture %} bgcolor="#884488" {%else %} bgcolor="#00FF00" {% endif %}> {{  schedule.datet|date:"Y-m-d H:i:s" }} </td>
	<td {% if schedule.isfuture %} bgcolor="#884488" {%else %} bgcolor="#00FF00" {% endif %}> {%if schedule.datet %} {% if schedule.isfuture %} {% trans "in" %} {{ schedule.datet|timeuntil }} {% else %} {{ schedule.datet|timesince }} {% trans "ago" %} {% endif %}{% endif %}</td>
	<td> {{ schedule.datetdone|timesince }} {%if schedule.datetdone %} {% trans "ago" %} {% endif %}</td>
	<td> {{ schedule.length_s }}</td>
	<td> <a href="{{ schedule.media }}">{% trans "Download" %}</a></td>
      </tr>
    {% endfor %}
    </table>

{% else %}
    <p>{% trans "No schedule are available" %}.</p>
{% endif %}



{% endblock %}
