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

{% block breadcrumbs %}
  <li class="breadcrumb-item"><a href="{% url 'circuits:provider_list' %}">Providers</a></li>
  <li class="breadcrumb-item">{{ object }}</li>
{% endblock %}

{% block content %}
<div class="row">
	<div class="col col-md-4">
        <div class="card">
            <h5 class="card-header">
                Provider
            </h5>
            <div class="card-body">
                <table class="table table-hover attr-table">
                    <tr>
                        <th scope="row">ASN</th>
                        <td><code>{{ object.asn|placeholder }}</code></td>
                    </tr>
                    <tr>
                        <th scope="row">Account</th>
                        <td>{{ object.account|placeholder }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Customer Portal</th>
                        <td>
                            {% if object.portal_url %}
                                <a href="{{ object.portal_url }}">{{ object.portal_url }}</a>
                            {% else %}
                                <span class="text-muted">&mdash;</span>
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">NOC Contact</th>
                        <td class="rendered-markdown">{{ object.noc_contact|render_markdown|placeholder }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Admin Contact</th>
                        <td class="rendered-markdown">{{ object.admin_contact|render_markdown|placeholder }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Circuits</th>
                        <td>
                            <a href="{% url 'circuits:circuit_list' %}?provider={{ object.slug }}">{{ circuits_table.rows|length }}</a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        {% plugin_left_page object %}
    </div>
    <div class="col col-md-6">
        {% include 'inc/custom_fields_panel.html' %}
        {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='circuits:provider_list' %}
        <div class="card">
            <h5 class="card-header">
                Comments
            </h5>
            <div class="card-body rendered-markdown">
                {% if object.comments %}
                    {{ object.comments|render_markdown }}
                {% else %}
                    <span class="text-muted">None</span>
                {% endif %}
            </div>
        </div>
        {% plugin_right_page object %}
	</div>
	<div class="col col-md-8">
        <div class="card">
            <h5 class="card-header">
                Circuits
            </h5>
            <div class="card-body">
            {% include 'inc/table.html' with table=circuits_table %}
            </div>
            {% if perms.circuits.add_circuit %}
            <div class="card-footer text-end noprint">
                <a href="{% url 'circuits:circuit_add' %}?provider={{ object.pk }}" class="btn btn-sm btn-primary">
                    <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add circuit
                </a>
            </div>
            {% endif %}
        </div>
        {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
    </div>
</div>
<div class="row">
    <div class="col col-md-12">
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock %}
