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

    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    {% with uptime=dev_manager.uptime %}
                        {% if uptime %}
                            <h3 class="panel-title">{% trans 'Uptime' %} {{ uptime }}</h3>
                        {% endif %}
                    {% endwith %}
                </div>
                <div class="panel-body">
                {% with grp=dev.group.pk mng=dev_manager %}
                    {% for fiber in dev_manager.get_fibers %}
                        <div class="port{% if fiber.fb_onu_num > 0 %} mega{% endif %} text-center">
                            <b>{{ fiber.fb_name }}</b>
                            <span class="port-img"><b>{{ fiber.fb_onu_num }}</b></span>
                        </div>
                    {% empty %}
                        <h3>{% trans 'We have not received info, please check options :(' %}</h3>
                    {% endfor %}
                    <hr>

                    <h4>{% trans 'Unregistered units' %}</h4>
                    <table class="table table-striped table-bordered">
                        <thead>
                        <tr>
                            <th class="col-xs-1">#</th>
                            <th class="col-xs-2">{% trans 'Mac' %}</th>
                            <th class="col-xs-3">{% trans 'Firmware version' %}</th>
                            <th class="col-xs-3">{% trans 'LOID password' %}</th>
                            <th class="col-xs-2">{% trans 'LOID' %}</th>
                            <th class="col-xs-1">#</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for onu in unregistered %}
                            <tr>
                                <td>-</td>
                                <td>{{ onu.mac }}</td>
                                <td>{{ onu.firmware_ver }}</td>
                                <td>{{ onu.loid_passw }}</td>
                                <td>{{ onu.loid }}</td>
                                <td>
                                    <a href="{% url 'devapp:add' grp %}?t=Zo&pdev={{ dev.pk }}&c={{ onu.loid }}&mac={{ onu.mac }}" title="{% trans 'Create device' %}">
                                        <span class="glyphicon glyphicon-plus"></span>
                                    </a>
                                </td>
                            </tr>
                        {% empty %}
                            <tr>
                                <td colspan="7">{% trans 'ONU not found' %}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>

                </div>
                <div class="panel-footer">
                    <b>{% trans 'Long description' %}</b>: {{ mng.get_long_description }}<br>
                    <b>{% trans 'Hostname' %}</b>: {{ mng.get_hostname }}.
                </div>
                {% endwith %}
            </div>
        </div>
    </div>

{% endblock %}
