{% extends 'dcim/module/base.html' %}
{% load helpers %}
{% load static %}

{% block content %}
    <form method="post">
        {% csrf_token %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Front Ports</strong>
                <div class="pull-right noprint">
                    {% if request.user.is_authenticated %}
                        {% table_config_button_small frontport_table %}
                    {% endif %}
                </div>
            </div>
            {% include 'responsive_table.html' with table=frontport_table %}
            <div class="panel-footer noprint">
                {% if perms.dcim.change_frontport %}
                    <button type="submit" name="_rename" formaction="{% url 'dcim:frontport_bulk_rename' %}?return_url={% url 'dcim:module_frontports' pk=object.pk %}" class="btn btn-warning btn-xs">
                        <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
                    </button>
                    <button type="submit" name="_edit" formaction="{% url 'dcim:frontport_bulk_edit' %}?module={{ object.pk }}&return_url={% url 'dcim:module_frontports' pk=object.pk %}" class="btn btn-warning btn-xs">
                        <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
                    </button>
                    <button type="submit" name="_disconnect" formaction="{% url 'dcim:frontport_bulk_disconnect' %}?return_url={% url 'dcim:module_frontports' pk=object.pk %}" class="btn btn-danger btn-xs">
                        <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
                    </button>
                {% endif %}
                {% if perms.dcim.delete_frontport %}
                    <button type="submit" formaction="{% url 'dcim:frontport_bulk_delete' %}?return_url={% url 'dcim:module_frontports' pk=object.pk %}" class="btn btn-danger btn-xs">
                        <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
                    </button>
                {% endif %}
                {% if perms.dcim.add_frontport %}
                    <div class="pull-right">
                        <a href="{% url 'dcim:frontport_add' %}?module={{ object.pk }}&return_url={% url 'dcim:module_frontports' pk=object.pk %}" class="btn btn-primary btn-xs">
                            <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add front ports
                        </a>
                    </div>
                {% endif %}
                <div class="clearfix"></div>
            </div>
        </div>
    </form>
    {% table_config_form frontport_table %}
{% endblock content %}

{% block javascript %}
    {{ block.super }}
    <script src="{% versioned_static 'js/connection_toggles.js' %}"></script>
    <script src="{% versioned_static 'js/tableconfig.js' %}"></script>
{% endblock javascript %}
