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

{% block extra_controls %}
  {% if perms.netbox_fms.add_buffertubetemplate or perms.netbox_fms.add_ribbontemplate or perms.netbox_fms.add_cableelementtemplate %}
    <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.netbox_fms.add_buffertubetemplate %}
          <li>
            <a class="dropdown-item" href="{% url 'plugins:netbox_fms:buffertubetemplate_add' %}?fiber_cable_type={{ object.pk }}&return_url={% url 'plugins:netbox_fms:fibercabletype_buffertubes' pk=object.pk %}">
              {% trans "Buffer Tube Templates" %}
            </a>
          </li>
        {% endif %}
        {% if perms.netbox_fms.add_ribbontemplate %}
          <li>
            <a class="dropdown-item" href="{% url 'plugins:netbox_fms:ribbontemplate_add' %}?fiber_cable_type={{ object.pk }}&return_url={% url 'plugins:netbox_fms:fibercabletype_ribbons' pk=object.pk %}">
              {% trans "Ribbon Templates" %}
            </a>
          </li>
        {% endif %}
        {% if perms.netbox_fms.add_cableelementtemplate %}
          <li>
            <a class="dropdown-item" href="{% url 'plugins:netbox_fms:cableelementtemplate_add' %}?fiber_cable_type={{ object.pk }}&return_url={% url 'plugins:netbox_fms:fibercabletype_cableelements' pk=object.pk %}">
              {% trans "Cable Element Templates" %}
            </a>
          </li>
        {% endif %}
      </ul>
    </div>
  {% endif %}
{% endblock extra_controls %}

{% block content %}
<div class="row mb-3">
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">{% trans "Cable Type" %}</h5>
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row">{% trans "Manufacturer" %}</th>
                    <td>{{ object.manufacturer|linkify }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Model" %}</th>
                    <td>{{ object.model }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Part Number" %}</th>
                    <td>{{ object.part_number|placeholder }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Construction" %}</th>
                    <td>{{ object.get_construction_display }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Fiber Type" %}</th>
                    <td>{{ object.get_fiber_type_display }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Strand Count" %}</th>
                    <td>{{ object.strand_count }}</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">{% trans "Physical Properties" %}</h5>
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row">{% trans "Sheath Material" %}</th>
                    <td>{{ object.get_sheath_material_display|placeholder }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Jacket Color" %}</th>
                    <td>
                        {% if object.jacket_color %}
                            <span class="color-label" style="background-color: #{{ object.jacket_color }}">&nbsp;</span>
                            {{ object.jacket_color }}
                        {% else %}
                            {{ ''|placeholder }}
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Armored" %}</th>
                    <td>{% if object.is_armored %}<span class="text-success"><i class="mdi mdi-check-bold"></i></span>{% else %}<span class="text-muted">&mdash;</span>{% endif %}</td>
                </tr>
                {% if object.is_armored %}
                <tr>
                    <th scope="row">{% trans "Armor Type" %}</th>
                    <td>{{ object.get_armor_type_display }}</td>
                </tr>
                {% endif %}
                <tr>
                    <th scope="row">{% trans "Deployment" %}</th>
                    <td>{{ object.get_deployment_display|placeholder }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Fire Rating" %}</th>
                    <td>{{ object.get_fire_rating_display|placeholder }}</td>
                </tr>
            </table>
        </div>
    </div>
</div>
{% if object.notes %}
<div class="row mb-3">
    <div class="col col-md-12">
        <div class="card">
            <h5 class="card-header">{% trans "Notes" %}</h5>
            <div class="card-body">{{ object.notes|markdown }}</div>
        </div>
    </div>
</div>
{% endif %}
{% plugin_full_width_page object %}
{% endblock %}
