{% load form_helpers %}
{% load helpers %}
{% load static %}
{% if object.cableinventoryitem %}
{% with item=object.cableinventoryitem %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>Cable Inventory Item</strong>
        </div>
        <table class="table table-hover panel-body attr-table">
            <tr>
                <td>Name</td>
                <td>{{ item|hyperlinked_object }}</td>
            </tr>
            <tr>
                <td>Label</td>
                <td>{{ item.label }}</td>
            </tr>
            <tr>
                <td>In use</td>
                <td><span>{% if item.cable %}✔{% else %}✘{% endif %}</span></td>
            </tr>
            <tr>
                <td>Owner</td>
                <td>{{ item.owner|hyperlinked_object }}</td>
            </tr>
            <tr>
                <td>Type</td>
                <td>{{ item.get_type_display|placeholder }}</td>
            </tr>
            <tr>
                <td>Plug</td>
                <td>{{ item.plug }}</td>
            </tr>
            
            <tr>
                <td>Color</td>
                <td>    
                    {% if item.color %}
                        <span class="label color-block" style="background-color: #{{ item.color }}">&nbsp;</span>
                    {% else %}
                        <span class="text-muted">&mdash;</span>
                    {% endif %}
                </td>
            </tr>
            <tr>
                <td>Length</td>
                <td>
                    {% if item.length %}
                        {{ item.length }} {{ item.get_length_unit_display }}
                    {% else %}
                        <span class="text-muted">&mdash;</span>
                    {% endif %}
                </td>
            </tr>
            <tr>
                <td>Supplier</td>
                <td>{{ item.supplier|hyperlinked_object }}</td>
            </tr>
            <tr>
                <td>Storage rack</td>
                <td>{{ item.storage_rack|hyperlinked_object }}</td>
            </tr>
            <tr>
                <td>Procurement identifier</td>
                <td>{{ item.procurement_ident|placeholder }}</td>
            </tr>
        </table>
    </div>
{% endwith %}
{% endif %}
