{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}

{% block header %}
    <div class="row noprint">
        <div class="col-md-12">
            <ol class="breadcrumb">
                <li><a href="{% url 'dcim:cable_list' %}">Cables</a></li>
                <li>{{ cable }}</li>
            </ol>
        </div>
    </div>
    <div class="pull-right noprint">
        {% plugin_buttons cable %}
        {% if perms.dcim.change_cable %}
            {% edit_button cable %}
        {% endif %}
        {% if perms.dcim.delete_cable %}
            {% delete_button cable %}
        {% endif %}
    </div>
    <h1>{% block title %}Cable {{ cable }}{% endblock %}</h1>
    {% include 'inc/created_updated.html' with obj=cable %}
    <div class="pull-right noprint">
        {% custom_links cable %}
    </div>
    <ul class="nav nav-tabs">
        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
            <a href="{{ cable.get_absolute_url }}">Cable</a>
        </li>
        {% if perms.extras.view_objectchange %}
            <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
                <a href="{% url 'dcim:cable_changelog' pk=cable.pk %}">Change Log</a>
            </li>
        {% endif %}
    </ul>
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Cable</strong>
                </div>
                <table class="table table-hover panel-body attr-table">
                    <tr>
                        <td>Type</td>
                        <td>{{ cable.get_type_display }}</td>
                    </tr>
                    <tr>
                        <td>Status</td>
                        <td>{{ cable.get_status_display }}</td>
                    </tr>
                    <tr>
                        <td>Label</td>
                        <td>{{ cable.label|placeholder }}</td>
                    </tr>
                    <tr>
                        <td>Color</td>
                        <td>
                            {% if cable.color %}
                                <span class="label color-block" style="background-color: #{{ cable.color }}">&nbsp;</span>
                            {% else %}
                                <span class="text-muted">&mdash;</span>
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <td>Length</td>
                        <td>
                            {% if cable.length %}
                                {{ cable.length }} {{ cable.get_length_unit_display }}
                            {% else %}
                                <span class="text-muted">&mdash;</span>
                            {% endif %}
                        </td>
                    </tr>
                </table>
            </div>
            {% include 'extras/inc/tags_panel.html' with tags=cable.tags.all url='dcim:cable_list' %}
            {% plugin_left_page cable %}
        </div>
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Termination A</strong>
                </div>
                {% include 'dcim/inc/cable_termination.html' with termination=cable.termination_a %}
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Termination B</strong>
                </div>
                {% include 'dcim/inc/cable_termination.html' with termination=cable.termination_b %}
            </div>
            {% plugin_right_page cable %}
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            {% plugin_full_width_page cable %}
        </div>
    </div>
{% endblock %}
