{% 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.

Copyleft © 2018  Gabriel Détraz

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 i18n %}
{% load logs_extra %}


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

{% for port_profile in port_profile_list %}
<div class="panel panel-default">
    <div class="panel-heading">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-3">
                    <h4>{{ port_profile.name }}</h4>
                </div>
                <div class="col-sm-9 text-right">
                    {% can_edit port_profile %}
                    {% include 'buttons/edit.html' with href='topologie:edit-port-profile' id=port_profile.id %}
                    {% acl_end %}
                    {% history_button port_profile %}
                    {% can_delete port_profile %}
                    {% include 'buttons/suppr.html' with href='topologie:del-port-profile' id=port_profile.id %}
                    {% acl_end %}               
                </div>
            </div>
        </div>
    </div>
    <div class="panel-body">
        <div class="table-repsonsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>{% trans "Default for" %}</th>
                        <th>{% trans "RADIUS settings" %}</th>
                        <th>{% trans "Speed limit" %}</th>
                        <th>{% trans "MAC address limit" %}</th>
                    </tr>
                </thead>
                <tr>
                    <td>
                        {{ port_profile.profil_default }} 
                        {% if port_profile.profil_default%}
                        {% if port_profile.on_dormitory %}{% blocktrans with dorm=port_profile.on_dormitory %}<b> on</b> {{ dorm }}{% endblocktrans %}{% else %}{% trans "Everywhere" %}{% endif %}
                        {% endif %}
                    </td>
                    <td>
                        <b>{% trans "RADIUS type: " %}</b>{{ port_profile.radius_type }}
                        {% if port_profile.radius_type == "MAC-radius" %}
                        <br>
                        <b>{% trans "RADIUS mode: " %}</b>{{ port_profile.radius_mode }}</td>
                    {% endif %}
                    <td>{{ port_profile.speed }}</td>
                    <td>{{ port_profile.mac_limit }}</td>
                </tr>
            </table>
        </div>
    </div>
    {% if port_profile.security_parameters_enabled %}
    <div class="panel-footer">
        <p class="text-warning"><b>{% trans "Security" %}: </b>{{ port_profile.security_parameters_enabled|join:", " }}
    </div>
    {% endif %}
    <div class="panel-footer">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-2">
                    <h4>{% trans "VLANs" %}</h4>
                </div>
                <div class="col-sm-10">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-3 text-left">
                                <b>{% trans "Untagged: " %}</b>
                            </div>
                            <div class="col-sm-9 text-rit">
                                {%if port_profile.vlan_untagged %}
                                {{ port_profile.vlan_untagged }}
                                {% else %}
                                {% trans "None" %}
                                {% endif %}
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 text-left">
                                <b>{% trans "Tagged: " %}</b>
                            </div>
                            <div class="col-sm-9 text-left">
                                {%if port_profile.vlan_tagged.all %}
                                {{ port_profile.vlan_tagged.all|join:", " }}
                                {% else %}
                                {% trans "None" %}
                                {% endif %}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endfor %}


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