{% load helpers %}

<div class="panel panel-default">
    <div class="panel-heading text-center">
        {% if end.device %}
            <strong><a href="{{ end.device.get_absolute_url }}">{{ end.device }}</a></strong><br/>
            <small>
                <a href="{{ end.device.site.get_absolute_url }}">{{ end.device.site }}</a>
                {% if end.device.rack %}
                    / <a href="{{ end.device.rack.get_absolute_url }}">{{ end.device.rack }}</a>
                {% endif %}
            </small>
        {% else %}
            <strong><a href="{{ end.circuit.provider.get_absolute_url }}">{{ end.circuit.provider }}</a></strong>
        {% endif %}
    </div>
    <div class="panel-body text-center">
        {% if end.device %}
            {# Device component #}
            {% with model=end|meta:"verbose_name" %}
                <strong>{{ model|bettertitle }} {{ end }}</strong><br />
                {% if model == 'interface' %}
                    {{ end.get_type_display }}
                {% elif model == 'front port' or model == 'rear port' %}
                    {{ end.get_type_display }}
                {% endif %}
            {% endwith %}
        {% else %}
            {# Circuit termination #}
            <strong><a href="{{ end.circuit.get_absolute_url }}">{{ end.circuit }}</a></strong><br/>
            {{ end }}
        {% endif %}
    </div>
</div>
