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

{% block title %}{% endblock %}

{% block top %}
  <div class="row" id="search">
    <div class="col-md-7">
      <input type="text" list="satellites-list"
             class="form-control input-lg satellite-search"
             placeholder="Filter by Name or NORAD Cat ID"
             autocomplete="off">
    </div>
    <div class="col-md-5">
      <div class="row hidden-xs hidden-sm">
        <p class="statistics" title="satellites" data-toggle="tooltip">
          <img src="{% static 'img/satellites.png' %}">
          {{ statistics.total_satellites }}
        </p>
        <p class="statistics" title="transmitters" data-toggle="tooltip">
          <img src="{% static 'img/transmitters.png' %}">
          {{ statistics.transmitters }}
        </p>
        {% if transmitter_suggestions %}
          <p class="statistics" title="transmitter_suggestions" data-toggle="tooltip">
            <img src="{% static 'img/transmitter_suggestions.png' %}">
            {{ transmitter_suggestions }}
          </p>
        {% endif %}
        <p class="statistics" title="telemetry" data-toggle="tooltip">
          <img src="{% static 'img/payloads.png' %}">
          {{ statistics.total_data }}
        </p>
        <p class="statistics" title="contributors" data-toggle="tooltip">
          <img src="{% static 'img/contributors.png' %}">
          {{ contributors }}
        </p>
      </div>
    </div>
  </div>
{% endblock %}

{% block content %}
  <div class="row sats">
    {% for sat in satellites %}
      <div class="satellite-group-item"
           data-selector="{{ sat.name|lower }}{{ sat.norad_cat_id }}{{ sat.names|lower }}"
           data-image="{{ sat.get_image }}">
        <a href="{% url 'satellite' norad=sat.norad_cat_id %}" class="panel panel-default satellite-item">
          <div class="panel-heading"></div>
          <div class="panel-body">
            <div class="satellite-title">{{ sat.norad_cat_id }} - {{ sat.name }}</div>
            <div class="satellite-names">{{ sat.names }}&nbsp;</div>
          </div>
          <div class="panel-footer">
            {% with total=sat.transmitters.all.count %}
              {{ total }} transmitter{{ total|pluralize }}
            {% endwith %}
            {% if request.user.is_superuser and sat.transmitter_suggestion_count %}
              - <span class="glyphicon glyphicon-edit" title="Suggest edits"></span> {{  sat.transmitter_suggestion_count }}
            {% endif %}
          </div>
        </a>
      </div>
    {% endfor %}
  </div>

  <div class="info row">
    <div class="col-md-4">
      <h3>Open</h3>
      <p>
        SatNOGS DB is, and will always be, an open database. We aspire to create an hollistic,
        unified, global transmitter database for all satellite transmitters. You can export the
        data or even connect your application using our API.
      </p>
    </div>
    <div class="col-md-4">
      <h3>Crowd-sourced</h3>
      <p>
        We rely on user submitted crowd-sourced information. Create an account and start
        suggesting additions and/or modifications on our Database. We need your help!
      </p>
    </div>
    <div class="col-md-4">
      <h3>Extensible</h3>
      <p>
        We designed SatNOGS-DB to be easily extensible to accommodate additions and modification
        on transmitter model. Go ahead and suggest changes or even code them in
        <a href="https://gitlab.com/librespacefoundation/satnogs/satnogs-db">our repo</a>.
      </p>
    </div>
  </div>
{% endblock %}

{% block javascript %}
  <script src="{% static 'js/home.js' %}"></script>
{% endblock %}
