{% comment %}
Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.

Copyright © 2017  Gabriel Détraz
Copyright © 2017  Lara Kermarec
Copyright © 2017  Augustin Lemesle

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}

{% load acl %}
{% load logs_extra %}
{% load i18n %}

{% if switch_list.paginator %}
    {% include 'pagination.html' with list=switch_list %}
{% endif %}

{% for switch in switch_list %}
<div class="panel panel-default">
    <div class="panel-heading">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-3">
                    <a href="{%url 'topologie:index-port' switch.id %}">
                        {{ switch }}
                    </a>
                </div>
                <div class="col-sm-3">
                    {% trans "Switch bay" as tr_bay %} {{switch.switchbay}}
                </div>
                <div class="col-sm-6 text-right">
                    {% can_edit switch %}
                    {% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.id %}
                    {% acl_end %}
                    {% history_button switch %}
                    {% can_delete switch %}
                    {% include 'buttons/suppr.html' with href='machines:del-machine' id=switch.id %} 
                    {% acl_end %}
                    {% can_create Port %}
                    {% trans "Creation of ports" as tr_creation %}
                    {% include 'buttons/add.html' with href='topologie:create-ports' id=switch.id desc=tr_creation %}
                    {% acl_end %}                   
                </div>
            </div>
        </div>
    </div>
    <div class="panel-body">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-3">
                    <b>{% trans "IPv4 address"%}</b>
                    </br>
                    {{ switch.interface_set.first.ipv4 }}
                </div>
                <div class="col-sm-2">
                    <b>{% trans "Ports"%}</b>
                    </br>
                    {{ switch.number }}
                </div>
                <div class="col-sm-2">
                    <b>{% trans "Stack"%}</b>
                    </br>
                    {{ switch.stack.name }}
                </div>
                <div class="col-sm-2">
                    <b>{% trans "Stack member ID" %}</b>
                    </br>
                    {{ switch.stack_member_id }}
                </div>
                <div class="col-sm-3">
                    <b>{% trans "Switch model" %}</b>
                    </br>
                    {{ switch.model }}
                </div>
            </div>
        </div>
    </div>
    {% if switch.interface_set.first.details  %}
    <div class="panel-footer">
        <span><b>{% trans "Details: " %}</b>{{ switch.interface_set.first.details }}</span>
    </div>
    {% endif %}
</div>
{% endfor %}

{% if switch_list.paginator %}
    {% include 'pagination.html' with list=switch_list %}
{% endif %}

