{% extends request.is_ajax|yesno:'nullcont.htm,devapp/ext.htm' %}
{% load i18n %}
{% block content %}

    <div class="row">
        <div class="col-sm-12">
            <div class="table-responsive">
                {% with uptime=dev_manager.uptime %}
                {% if uptime %}
                    {% trans 'Uptime' %} {{ uptime }}
                {% endif %}
                {% endwith %}
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th class="col-xs-1">#</th>
                        <th class="col-xs-1">{% trans 'SNMP Num' %}</th>
                        <th class="col-xs-4">{% trans 'Name' %}</th>
                        <th class="col-xs-3">{% trans 'Mac' %}</th>
                        <th class="col-xs-2">{% trans 'Signal' %}</th>
                        <th class="col-xs-1">#</th>
                    </tr>
                    </thead>

                    <tbody>
                    {% with grp=dev.group.pk %}
                    {% for port in ports %}
                        <tr>
                            <td>{% if port.st %}<span class="glyphicon glyphicon-ok text-success"></span>
                                {% else %}<span class="glyphicon glyphicon-warning-sign text-danger"></span>
                                {% endif %}
                            </td>
                            <td>{{ port.num }}</td>
                            <td>{{ port.nm }}</td>
                            <td>{{ port.mac }}</td>
                            <td>{{ port.signal }}</td>
                            <td>
                                <a href="{% url 'devapp:add' grp %}?mac={{ port.mac }}&t=On&c={{ port.nm }}&pdev={{ dev.pk }}&n={{ port.num }}" title="{% trans 'Create device' %}">
                                    <span class="glyphicon glyphicon-plus"></span>
                                </a>
                            </td>
                        </tr>
                    {% empty %}
                        <tr>
                            <td colspan="7">{% trans 'Ports not found' %}</td>
                        </tr>
                    {% endfor %}
                    {% endwith %}
                    </tbody>

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

{% endblock %}
