{% extends "base.html" %}

{% block content %}

<link rel="stylesheet" href="{{ url_for('static', filename='css/flags/flags.css') }}"/>

<div class="container">
<div class="panel panel-success" id="asdf">
<div class="panel-heading"><h3 class="panel-title">Receivers</h3></div>
<div class="panel-body">

<form>
<div class="well">
<select name="country" onchange="this.form.submit();">
	<option value="">(all)</option>
    {% for country in countries %}
    <option value="{{ country.iso2 }}"{% if sel_country == country.iso2 %} SELECTED{% endif %}>{{ country.iso2 }}</option>
    {% endfor %}
</select>
</div>
</form>

  <table class="datatable table table-striped table-bordered">
    <tr>
      <th>#</th>
      <th>Country</th>
      <th>Name</th>
      <th>Airport</th>
      <th>Altitude</th>
      <th>Status</th>
      <th>Version</th>
      <th>Platform</th>
    </tr>

    {% for receiver in receivers %}
	<tr>
    <td>{{ loop.index }}</td>
    <td><img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ receiver.country.iso2|lower }}" alt="{{ receiver.country.iso2 }}"/></td>
    <td><a href="{{ url_for('main.receiver_detail', receiver_id=receiver.id) }}">{{ receiver.name }}</a></td>
    <td><a href="{{ url_for('main.airport_detail', airport_id=receiver.airport.id) }}">{{ receiver.airport.name }}</a></td>
    <td>{{ receiver.altitude|int }} m</td>
    <td>{{ receiver.lastseen|timestamp_to_status|safe }}</td>
	  <td>{{ receiver.version if receiver.version else '-' }}</td>
	  <td>{{ receiver.platform if receiver.platform else '-' }}</td>
	</tr>
	{% endfor %}
  </table>
</div>
</div>

{% endblock %}