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

{% block subtitle %}
    {% trans 'Welcome' %} {{ user.first_name }} {{ user.last_name }}
{% endblock %}

{% block main %}

    <p>
        {% if user.is_staff %}
            {% trans "On this site, you can organise your training content." %}
        {% else %}
            {% trans "On this site, you can grab your training content." %}
        {% endif %}
        {% trans "For more information about this site, please read the documentation." %}
    </p>

    {% if user.is_staff %}
        <div class="panel panel-default">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>{% trans "Name" %}</th>
                        <th>{% trans "Connected" %}</th>
                        <th>{% trans "Last connection" %}</th>
                        <th>{% trans "Connection Time" %}</th>
                        <th>{% trans "Updated" %}</th>
                        <th>{% trans "Remaining Updates" %}</th>
                    </tr>
                </thead>
                <tbody>

                {% for localserver in localservers %}
                    <tr class="{% if localserver.is_connected %}{% if localserver.is_updated %}success{% else %}info{% endif %}{% else %}danger{% endif %}">
                        <td>{{ localserver.name }}</td>
                        <td>{% if localserver.is_connected %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</td>
                        <td>{{ localserver.last_connection }}</td>
                        <td>{{ localserver.uptime }}</td>
                        <td>{% if localserver.is_updated %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</td>
                        <td>{{ localserver.needed_updates }}</td>
                    </tr>
                {% endfor %}

                </tbody>
            </table>
        </div>

    {% endif %}

{% endblock %}
