{% extends "ui/panels/_base.html" %}
{% load helpers i18n %}

{% block panel_content %}
  <table class="table table-hover">
    <thead>
      <tr>
        <th>{% trans "Name" %}</th>
        <th>{% trans "Label" %}</th>
        <th>{% trans "Role" %}</th>
        <th aria-label="{% trans "Actions" %}"></th>
      </tr>
    </thead>
    <tbody>
      {% for item in object.inventory_items.all %}
        <tr>
          <td>{{ item|linkify:"name" }}</td>
          <td>{{ item.label|placeholder }}</td>
          <td>{{ item.role|linkify|placeholder }}</td>
          <td class="text-end d-print-none">
            {% if perms.dcim.change_inventoryitem %}
              <a href="{% url 'dcim:inventoryitem_edit' pk=item.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-warning" title="{% trans "Edit" %}">
                <i class="mdi mdi-pencil" aria-hidden="true"></i>
              </a>
            {% endif %}
            {% if perms.dcim.delete_inventoryitem %}
              <a href="{% url 'dcim:inventoryitem_delete' pk=item.pk %}?return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-danger" title="{% trans "Delete" %}">
                <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i>
              </a>
            {% endif %}
          </td>
        </tr>
      {% empty %}
        <tr>
          <td colspan="4" class="text-muted">{% trans "None" %}</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% endblock panel_content %}
