{% extends 'generic/object.html' %}
{% load buttons %}
{% load helpers %}
{% load plugins %}
{% load i18n %}

{% block title %}{{ object.manufacturer }} {{ object.model }}{% endblock %}

{% block breadcrumbs %}
  {{ block.super }}
  <li class="breadcrumb-item"><a href="{% url 'dcim:moduletype_list' %}?manufacturer_id={{ object.manufacturer.pk }}">{{ object.manufacturer }}</a></li>
{% endblock %}

{% block extra_controls %}
  {% if perms.dcim.change_devicetype %}
    <div class="dropdown">
      <button type="button" class="btn btn-primary dropdown-toggle"data-bs-toggle="dropdown" aria-expanded="false">
        <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add Components" %}
      </button>
      <ul class="dropdown-menu">
        {% if perms.dcim.add_consoleporttemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:consoleporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_consoleports' pk=object.pk %}">{% trans "Console Ports" %}</a></li>
        {% endif %}
        {% if perms.dcim.add_consoleserverporttemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:consoleserverporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_consoleserverports' pk=object.pk %}">{% trans "Console Server Ports" %}</a></li>
        {% endif %}
        {% if perms.dcim.add_powerporttemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:powerporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_powerports' pk=object.pk %}">{% trans "Power Ports" %}</a></li>
        {% endif %}
        {% if perms.dcim.add_poweroutlettemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:poweroutlettemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_poweroutlets' pk=object.pk %}">{% trans "Power Outlets" %}</a></li>
        {% endif %}
        {% if perms.dcim.add_interfacetemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:interfacetemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_interfaces' pk=object.pk %}">{% trans "Interfaces" %}</a></li>
        {% endif %}
        {% if perms.dcim.add_frontporttemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:frontporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_frontports' pk=object.pk %}">{% trans "Front Ports" %}</a></li>
        {% endif %}
        {% if perms.dcim.add_rearporttemplate %}
          <li><a class="dropdown-item" href="{% url 'dcim:rearporttemplate_add' %}?module_type={{ object.pk }}&return_url={% url 'dcim:moduletype_rearports' pk=object.pk %}">{% trans "Rear Ports" %}</a></li>
        {% endif %}
      </ul>
    </div>
  {% endif %}
{% endblock %}
