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

{% block breadcrumbs %}
  {{ block.super }}
  <li class="breadcrumb-item active">{{ object }}</li>
{% endblock %}

{% block content %}
<div class="row">
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">SCION Link Assignment</h5>
            <div class="card-body">
                <table class="table table-hover attr-table">
                    <tr>
                        <th scope="row">ISD-AS</th>
                        <td><a href="{% url 'plugins:netbox_scion:isdas' object.isd_as.pk %}">{{ object.isd_as }}</a></td>
                    </tr>
                    <tr>
                        <th scope="row">Core Node</th>
                        <td>{{ object.core }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Interface ID</th>
                        <td>{{ object.interface_id }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Relationship</th>
                        <td>{{ object.get_relationship_display }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Customer Name</th>
                        <td>{{ object.customer_name }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Customer ID</th>
                        <td>{{ object.customer_id }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Zendesk Ticket</th>
                        <td><a href="{{ object.get_zendesk_url }}" target="_blank">{{ object.zendesk_ticket }}</a></td>
                    </tr>
                    {% if object.description %}
                    <tr>
                        <th scope="row">Description</th>
                        <td>{{ object.description|linebreaksbr }}</td>
                    </tr>
                    {% endif %}
                </table>
            </div>
        </div>
        {% include 'inc/panels/custom_fields.html' %}
        {% include 'inc/panels/tags.html' %}
        {% include 'inc/panels/comments.html' %}
    </div>
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">Related Information</h5>
            <div class="card-body">
                <table class="table table-hover">
                    <tr>
                        <th scope="row">Organization</th>
                        <td><a href="{% url 'plugins:netbox_scion:organization' object.isd_as.organization.pk %}">{{ object.isd_as.organization }}</a></td>
                    </tr>
                    <tr>
                        <th scope="row">Full ISD-AS Path</th>
                        <td>{{ object.isd_as.isd_as }}</td>
                    </tr>
                    {% if object.isd_as.cores %}
                    <tr>
                        <th scope="row">Available Core Nodes</th>
                        <td>
                            {% for core in object.isd_as.cores %}
                                <span class="badge badge-secondary{% if core == object.core %} badge-primary{% endif %}">{{ core }}</span>
                            {% endfor %}
                        </td>
                    </tr>
                    {% endif %}
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}
