{% 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_quickview/1/">confirmed</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup_quickview/2/">good</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup_quickview/3/">possible</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup_quickview/5/">attic</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup_quickview/4/">eyeball</a></li>
<li><a HREF="..{% if listHeader %}/..{% endif %}/followup_quickview/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/">object 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>

{% if not public %}
{% if listHeader %}
  {% if list_id >= 0 and list_id < 9 %}
<form id="classify_form" action="" method="post">{% csrf_token %}
  {% endif %}
{% endif %}
{% endif %}
<table class="followuplists_quickview">

{% autopaginate rows nobjects %}

<tr>
  {% for column in table.columns %}
  <th>
    {% if column.sortable %}
      <a href="?sort={{ column.name_toggled }}">{{ column }}</a>
    {% else %}
      {{ column }}
    {% endif %}
  </th>
  {% endfor %}

{% if not public %}
{% if processingStatus != 1 %}

{% if list_id == 4 %}
  <th>
    <a id="select_all_u" name="select_all_u" value="all_u">U</a>
  </th>
  <th>
    <a id="select_all_g" name="select_all_g" value="all_g">G</a>
  </th>
  <th>
    <a id="select_all_p" name="select_all_p" value="all_p">P</a>
  </th>
  <th>
    <a id="select_all_a" name="select_all_a" value="all_a">A</a>
  </th>
  <th>
    <a id="select_all_t" name="select_all_t" value="all_t">T</a>
  </th>
{% endif %}
{% if list_id == 3 %}
  <th>
    <a id="select_all_u" name="select_all_u" value="all_u">U</a>
  </th>
  <th>
    <a id="select_all_g" name="select_all_g" value="all_g">G</a>
  </th>
  <th>
    <a id="select_all_a" name="select_all_a" value="all_a">A</a>
  </th>
  <th>
    <a id="select_all_t" name="select_all_t" value="all_t">T</a>
  </th>
{% endif %}
{% if list_id == 2 %}
  <th>
    <a id="select_all_u" name="select_all_u" value="all_u">U</a>
  </th>
  <th>
    <a id="select_all_c" name="select_all_c" value="all_c">C</a>
  </th>
  <th>
    <a id="select_all_p" name="select_all_p" value="all_p">P</a>
  </th>
  <th>
    <a id="select_all_a" name="select_all_a" value="all_a">A</a>
  </th>
  <th>
    <a id="select_all_t" name="select_all_t" value="all_t">T</a>
  </th>
{% endif %}
{% if list_id == 5 %}
  <th>
    <a id="select_all_u" name="select_all_u" value="all_u">U</a>
  </th>
  <th>
    <a id="select_all_g" name="select_all_g" value="all_g">G</a>
  </th>
  <th>
    <a id="select_all_p" name="select_all_p" value="all_p">P</a>
  </th>
  <th>
    <a id="select_all_t" name="select_all_t" value="all_t">T</a>
  </th>
{% endif %}
{% if list_id == 6 %}
  <th>
    <a id="select_all_u" name="select_all_u" value="all_u">U</a>
  </th>
  <th>
    <a id="select_all_e" name="select_all_e" value="all_e">E</a>
  </th>
  <th>
    <a id="select_all_t" name="select_all_t" value="all_t">T</a>
  </th>
{% endif %}
{% if list_id == 0 %}
  <th>
    <a id="select_all_u" name="select_all_u" value="all_u">U</a>
  </th>
  <th>
    <a id="select_all_e" name="select_all_e" value="all_e">E</a>
  </th>
{% endif %}

{% endif %}
{% endif %}
</tr>

{% for row in rows %}
  <tr>
  <td><a href="../{% if listHeader %}../{% endif %}candidate/{{row.data.id}}/">{{ row.data.followup_id }}</a></td>
  <td>{{ row.data.followup_flag_date }}</td>
  <td>{{ row.data.ra_sex }}</td>
  <td>{{ row.data.dec_sex }}</td>
  <td>{{ row.data.decode_flag_bits }}</td>
  <td>{{ row.data.sherlockClassification|default_if_none:""  }}</td>
  <td>{{ row.data.observation_status|default_if_none:"" }}</td>
  <td>{{ row.data.local_designation|default_if_none:"" }}</td>
  <td>{{ row.data.ps1_designation|default_if_none:"" }}</td>
{% if not public %}
  <td>{{ row.data.current_trend|default_if_none:"" }}</td>
{% endif %}
  <td><img id="stampimages" src="{{ STATIC_URL }}images/data/{{ dbname }}/{{ row.data.tcs_images_id.whole_mjd }}/{{ row.data.tcs_images_id.target }}.jpeg" alt="triplet" title="{{ image.pss_filename }}" onerror="this.src='{{ STATIC_URL }}images/image_not_available.jpeg';" height="200" /></td>
  {% if not fgss %}
  <td><img id="stampimages" src="{{ STATIC_URL }}images/data/{{ dbname }}/{{ row.data.tcs_images_id.whole_mjd }}/{{ row.data.tcs_images_id.ref }}.jpeg" alt="triplet" title="{{ image.pss_filename }}" onerror="this.src='{{ STATIC_URL }}images/image_not_available.jpeg';" height="200" /></td>
  <td><img id="stampimages" src="{{ STATIC_URL }}images/data/{{ dbname }}/{{ row.data.tcs_images_id.whole_mjd }}/{{ row.data.tcs_images_id.diff }}.jpeg" alt="triplet" title="{{ image.pss_filename }}" onerror="this.src='{{ STATIC_URL }}images/image_not_available.jpeg';" height="200" /></td>
  {% endif %}
{% if not public %}
  <td>{{ row.data.confidence_factor|floatformat:2 }}</td>
{% endif %}
  <td>{{ row.data.tcs_images_id.mjd_obs|floatformat:5 }}</td>

{% if not public %}
{% if processingStatus != 1 %}

{% if list_id == 4 or list_id == 7 or list_id == 8 %}
  <td>
      <div class="radio-ugpt-u">
<input class="U" type="radio" id="{{row.data.id}}_promote_demote_1000" value="U" name="{{row.data.id}}_promote_demote" checked />
<label for="{{row.data.id}}_promote_demote_1000">U</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-g">
<input class="G" type="radio" id="{{row.data.id}}_promote_demote_2" value="G" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_2">G</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-p">
<input class="P" type="radio" id="{{row.data.id}}_promote_demote_3" value="P" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_3">P</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-a">
<input class="A" type="radio" id="{{row.data.id}}_promote_demote_5" value="A" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_5">A</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-t">
<input class="T" type="radio" id="{{row.data.id}}_promote_demote_0" value="T" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_0">T</label>
      </div>
  </td>
{% endif %}
{% if list_id == 3 %}
  <td>
      <div class="radio-ugpt-u">
<input class="U" type="radio" id="{{row.data.id}}_promote_demote_1000" value="U" name="{{row.data.id}}_promote_demote" checked />
<label for="{{row.data.id}}_promote_demote_1000">U</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-g">
<input class="G" type="radio" id="{{row.data.id}}_promote_demote_2" value="G" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_2">G</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-a">
<input class="A" type="radio" id="{{row.data.id}}_promote_demote_5" value="A" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_5">A</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-t">
<input class="T" type="radio" id="{{row.data.id}}_promote_demote_0" value="T" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_0">T</label>
      </div>
  </td>
{% endif %}
{% if list_id == 2 %}
  <td>
      <div class="radio-ugpt-u">
<input class="U" type="radio" id="{{row.data.id}}_promote_demote_1000" value="U" name="{{row.data.id}}_promote_demote" checked />
<label for="{{row.data.id}}_promote_demote_1000">U</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-c">
<input class="C" type="radio" id="{{row.data.id}}_promote_demote_1" value="C" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_1">C</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-p">
<input class="P" type="radio" id="{{row.data.id}}_promote_demote_3" value="P" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_3">P</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-a">
<input class="A" type="radio" id="{{row.data.id}}_promote_demote_5" value="A" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_5">A</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-t">
<input class="T" type="radio" id="{{row.data.id}}_promote_demote_0" value="T" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_0">T</label>
      </div>
  </td>
{% endif %}
{% if list_id == 5 %}
  <td>
      <div class="radio-ugpt-u">
<input class="U" type="radio" id="{{row.data.id}}_promote_demote_1000" value="U" name="{{row.data.id}}_promote_demote" checked />
<label for="{{row.data.id}}_promote_demote_1000">U</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-g">
<input class="G" type="radio" id="{{row.data.id}}_promote_demote_2" value="G" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_2">G</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-p">
<input class="P" type="radio" id="{{row.data.id}}_promote_demote_3" value="P" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_3">P</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-t">
<input class="T" type="radio" id="{{row.data.id}}_promote_demote_0" value="T" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_0">T</label>
      </div>
  </td>
{% endif %}
{% if list_id == 6 %}
  <td>
      <div class="radio-ugpt-u">
<input class="U" type="radio" id="{{row.data.id}}_promote_demote_1000" value="U" name="{{row.data.id}}_promote_demote" checked />
<label for="{{row.data.id}}_promote_demote_1000">U</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-e">
<input class="E" type="radio" id="{{row.data.id}}_promote_demote_4" value="E" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_4">E</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-t">
<input class="T" type="radio" id="{{row.data.id}}_promote_demote_0" value="T" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_0">T</label>
      </div>
  </td>
{% endif %}
{% if list_id == 0 %}
  <td>
      <div class="radio-ugpt-u">
<input class="U" type="radio" id="{{row.data.id}}_promote_demote_1000" value="U" name="{{row.data.id}}_promote_demote" checked />
<label for="{{row.data.id}}_promote_demote_1000">U</label>
      </div>
  </td>
  <td>
      <div class="radio-ugpt-e">
<input class="E" type="radio" id="{{row.data.id}}_promote_demote_4" value="E" name="{{row.data.id}}_promote_demote" />
<label for="{{row.data.id}}_promote_demote_4">E</label>
      </div>
  </td>
{% endif %}

{% endif %}
{% endif %}

  </tr>
{% endfor %}
{% paginate %}

</table>

{% if not public %}
{% if processingStatus != 1 %}
{% if listHeader %}
  {% if list_id >= 0 and list_id < 9 %}
<input type="submit" value="Classify Objects" /></p>
  {% endif %}
</form>
{% endif %}
{% endif %}
{% endif %}

<script language="javascript" type="text/javascript" src="{{ STATIC_URL }}js/flot/jquery-1.7.2.js"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="{{ STATIC_URL }}js/flot/excanvas.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="{{ STATIC_URL }}js/followup_selectall.js"></script>

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