{% extends "base.html" %}
{% block body %}

<p>
{% if has_sampled and has_uploaded %}
This device is sampling, and has uploaded data to the server at {{ most_recent_upload }}.
{% elif has_sampled and not has_uploaded %}
This device is sampling, but has not yet uploaded data to the server. The last sample was taken at {{ most_recent_sample }}.
{% else %}
This device is neither sampling, nor uploading anything to the server.
{% endif %}
</p>

<p>
{% if socket_iface_address %}
This client's address: <code>{{ socket_iface_address }}</code>.
{% else %}
Could not obtain this client's address.
{% endif %}
</p>

<p>Recent samples:</p>
<table style="width: 100%" class="pure-table">
<thead>
    <tr>
        <td>ID</td>
        <td>Value</td>
        <td>Sample type</td>
        <td>Time</td>
        <td>Uploaded</td>
    </tr>
</thead>
{% for row in get_recent_samples %}
  <tr>
  <td>{{ row[0] }}</td>
  <td>{{ row[1] }}</td>
  <td>{{ row[2] }}</td>
  <td>{{ row[3] }}</td>
  {% if row[4] %}
  <td class="recent_sample_uploaded">uploaded</td>
  {% else %}
  <td class="recent_sample_nonuploaded">not yet uploaded</td>
  {% endif %}
  </tr>
{% endfor %}
</table>

{% endblock %}
