{% extends 'dcim/device/base.html' %}
{% load render_table from django_tables2 %}
{% load helpers %}
{% load static %}

{% block content %}
  <form method="post">
    {% csrf_token %}
    {% include 'inc/table_controls.html' with table_modal="DevicePowerPortTable_config" %}
    {% render_table powerport_table 'inc/table.html' %}
    <div class="noprint bulk-buttons">
        <div class="bulk-button-group">
            {% if perms.dcim.change_powerport %}
                <button type="submit" name="_rename" formaction="{% url 'dcim:powerport_bulk_rename' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-outline-warning btn-sm">
                    <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename
                </button>
                <button type="submit" name="_edit" formaction="{% url 'dcim:powerport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-warning btn-sm">
                    <i class="mdi mdi-pencil" aria-hidden="true"></i> Edit
                </button>
                <button type="submit" name="_disconnect" formaction="{% url 'dcim:powerport_bulk_disconnect' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-outline-danger btn-sm">
                    <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
                </button>
            {% endif %}
            {% if perms.dcim.delete_powerport %}
                <button type="submit" name="_delete" formaction="{% url 'dcim:powerport_bulk_delete' %}?return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-danger btn-sm">
                    <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete
                </button>
            {% endif %}
        </div>
        {% if perms.dcim.add_powerport %}
            <div class="bulk-button-group">
                <a href="{% url 'dcim:powerport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-sm btn-primary">
                    <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Power Port
                </a>
            </div>
        {% endif %}
    </div>
  </form>
  {% include 'inc/paginator.html' with paginator=powerport_table.paginator page=powerport_table.page %}
  {% table_config_form powerport_table %}
{% endblock %}
