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

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

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

{% block extra_controls %}
  {% if perms.netbox_inventory.add_asset %}
    <a href="{% url 'plugins:netbox_inventory:asset_add' %}?inventoryitem_type={{ object.pk }}&manufacturer={{ object.manufacturer.pk }}" class="btn btn-sm btn-primary">
      <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add asset
    </a>
  {% endif %}
{% endblock extra_controls %}

{% block content %}
  <div class="row mb-3">
    <div class="col col-md-6">
      <div class="card">
        <h5 class="card-header">Inventory Item Type</h5>
        <div class="card-body">
          <table class="table table-hover attr-table">
            <tr>
              <th scope="row">Manufacturer</th>
              <td>{{ object.manufacturer|linkify }}</td>
            </tr>
            <tr>
              <th scope="row">Model</th>
              <td>{{ object.model }}</td>
            </tr>
            <tr>
              <th scope="row">Part number</th>
              <td>{{ object.part_number }}</td>
            </tr>
            <tr>
              <th scope="row">Group</th>
              <td>{{ object.inventoryitem_group|linkify|placeholder }}</td>
            </tr>
            <tr>
              <th scope="row">Assets</th>
              <td><a href="{% url 'plugins:netbox_inventory:asset_list' %}?inventoryitem_type_id={{ object.pk }}">{{ asset_count }}</a></td>
            </tr>
          </table>
        </div>
      </div>
      {% include 'inc/panels/custom_fields.html' %}
      {% plugin_left_page object %}
    </div>
    <div class="col col-md-6">
      {% include 'inc/panels/tags.html' %}
      {% include 'inc/panels/comments.html' %}
      {% include 'inc/panels/image_attachments.html' %}
      {% plugin_right_page object %}
    </div>
  </div>
  <div class="row mb-3">
    <div class="col col-md-12">
      {% plugin_full_width_page object %}
    </div>
  </div>
{% endblock content %}
