{% load helpers %}
{% if perms.dcim.change_devicetype %}
    <form method="post">
        {% csrf_token %}
        <div class="card">
            <h5 class="card-header">
                {{ title }}
            </h5>
            <div class="card-body">
                {% include 'inc/responsive_table.html' %}
            </div>
            <div class="card-footer noprint">
                {% if table.rows %}
                    <button type="submit" name="_edit" formaction="{% url table.Meta.model|viewname:"bulk_rename" %}?return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-warning">
                        <span class="mdi mdi-pencil-outline" aria-hidden="true"></span> Rename
                    </button>
                    <button type="submit" name="_edit" formaction="{% url table.Meta.model|viewname:"bulk_edit" %}?return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-warning">
                        <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
                    </button>
                    <button type="submit" name="_delete" formaction="{% url table.Meta.model|viewname:"bulk_delete" %}?return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-danger">
                        <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete
                    </button>
                {% endif %}
                <div class="float-end">
                    <a href="{% url table.Meta.model|viewname:"add" %}?device_type={{ object.pk }}&return_url={{ object.get_absolute_url }}%23tab_{{ tab }}" class="btn btn-primary btn-sm">
                        <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
                        Add {{ title }}
                    </a>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </form>
{% else %}
    <div class="card">
        <h5 class="card-header">
            {{ title }}
        </h5>
        <div class="card-body">
            {% include 'inc/responsive_table.html' %}
        </div>
    </div>
{% endif %}
