{% extends "base_new.html" %}

{% load pagination_tags %}

{% block title %}{% if listHeader %}{{listHeader}}{% else %}Followup List{% endif %}{% endblock %}

{% block content %}

<body>

<div id="quickfollowup">
<nav id="navigation">
<ul>
{% if not public %}
<li><a HREF="../{% if listHeader %}../{% endif %}">home</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup/1/">confirmed</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup/2/">good</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup/3/">possible</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup/5/">attic</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup/4/">eyeball</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup/8/">eyeball-fast-track</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/userlist/">custom</a></li>
{% else %}
<li><a HREF="../{% if listHeader %}../{% endif %}">home</a></li>
<li><a HREF="../{% if listHeader %}../{% endif %}public_quickview/">object quickview list</a></li>
{% endif %}
{% if form_searchobject %}
<li>
{% if form_searchobject.errors %}
    <p style="color: red;">
        Please correct the error{{ form_searchobject.errors|pluralize }} below.
    </p>
{% endif %}

<form id="search_form" action="{% url "searchresults" %}" method="post">{% csrf_token %}
    {{ form_searchobject.non_field_errors }}
    <div class="fieldWrapper">
    <p>
        {{ form_searchobject.searchText.errors }}
        {{ form_searchobject.searchText }}
    <input type="submit" value="Find Object" name="find_object" /></p>
    </div>
</form>
</li>
{% endif %}
</ul>
</nav>

<section id="table_layout">
<article id="followup_table">
<header id="followup_list">
<hgroup>
{% if listHeader %}
   <h1>{{ listHeader }}</h1>
{% else %}
   <h1>Object List</h1>
{% endif %}

<h2>({{table.rows.count}})</h2>
</hgroup>
</header>

<table class="followuplists_standardview">
{% autopaginate rows 100 %}
<tr>
  {% for column in table.columns %}
  <th>
    {% if column.sortable %}
      <a href="?sort={{ column.name_toggled }}">
        {{ column }}
      </a>
      {% if column.is_ordered_reverse %}
        <!-- <img src="{{ STATIC_URL }}images/up.jpg" /> -->
      {% else %}
         <!-- <img src="{{ STATIC_URL }}images/down.jpg" /> -->
      {% endif %}
    {% else %}
      {{ column }}
    {% endif %}
  </th>
  {% endfor %}
</tr>

{% for row in rows %}
  <tr>
  <td><a href="../{% if listHeader %}../{% endif %}candidate/{{row.data.ID}}/">{{ row.data.rank }}</a></td>
  <td>{{ row.data.survey_field }}</td>
  <td>{{ row.data.local_designation|default_if_none:"" }}</td>
  <td>{{ row.data.ps1_designation|default_if_none:"" }}</td>
  <td>{{ row.data.ra_sex }}</td>
  <td>{{ row.data.dec_sex }}</td>
  <td>{{ row.data.sherlockClassification|default_if_none:"" }}</td>
  <td>{{ row.data.followup_flag_date }}</td>
  <td>{{ row.data.observation_status|default_if_none:"" }}</td>
  <td>{{ row.data.current_trend|default_if_none:"" }}</td>
  <td>{{ row.data.earliest_mjd|floatformat:5 }}</td>
  <td>{{ row.data.earliest_mag|floatformat:2 }}</td>
  <td>{{ row.data.earliest_filter|default_if_none:"" }}</td>
  <td>{{ row.data.latest_mjd|floatformat:5 }}</td>
  <td>{{ row.data.latest_mag|floatformat:2 }}</td>
  <td>{{ row.data.latest_filter|default_if_none:"" }}</td>
  <td>{{ row.data.confidence_factor|floatformat:2 }}</td>
  <td>{% for xm in row.data.externalXMs %}{% ifchanged xm.external_designation %}{% if xm.url %}<a href="{{ xm.url }}">{{ xm.external_designation }}</a>{% else %}{{ xm.external_designation }}{% endif %} {% endifchanged %}{% endfor %}</td>
  </tr>
{% endfor %}

{% paginate %}

</table>


</article>
</section>
</div>
{% endblock %}
