{% extends "base.html" %}

{% set title = "Riego - Ventilboxen" %}
{% set active_menu = "boxes" %}


{% block content %}
<h1>Boxes</h1>

<table class="table">
    <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Hostname</th>
            <th scope="col">ip_address</th>
            <th scope="col">hw_type</th>
            <th scope="col">sw_version</th>
            <th scope="col">online_since</th>
        </tr>
    </thead>
    <tbody>
        {% for item in items %}
        <tr>
            <td><a href="{{url('boxes_item_view', item_id=item['id']) }}">{{ item['name'] }}</a></td>
            <td>{{ item['hostname'] }}</td>
            <td><a href="http://{{item['ip_address']}}" target="_blank">{{item['ip_address']}}</td>
            <td>{{ item['hw_type'] }}</td>
            <td>{{ item['sw_version'] }}</td>
            <td>
                {% if item['online_since'] is not none %}
                    {{ item['online_since'].strftime("%Y-%m-%d %H:%M:%S") }}
                {% else %}
                    -
                {% endif %}
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<p>
    <a href="{{url('boxes_new')}}">New</a>
</p>

{% endblock %}