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

{% block header %}
<div class="row noprint">
    <div class="col-sm-8 col-md-9">
        <ol class="breadcrumb">
            <li><a href="{% url 'plugins:netbox_bgp:community_list' %}">Communities</a></li>
            <li>{{ object }}</li>
        </ol>
    </div>
    <div class="col-sm-4 col-md-3">
        <form action="{% url 'plugins:netbox_bgp:community_list' %}" method="get">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search Communities" />
                <span class="input-group-btn">
                    <button type="submit" class="btn btn-primary">
                        <span class="mdi mdi-magnify" aria-hidden="true"></span>
                    </button>
                </span>
            </div>
        </form>
    </div>
</div>
<div class="pull-right noprint">
    {% comment %}
    {% plugin_buttons object %}
    {% if perms.netbox_bgp.add_community %}
    {% clone_button object %}
    {% endif %}
    {% if perms.netbox_bgp.change_community %}
    {% edit_button object %}
    {% endif %}
    {% if perms.netbox_bgp.delete_community %}
    {% delete_button object %}
    {% endif %}
    {% endcomment %}
    {% if perms.netbox_bgp.change_community %}
    <a href="{% url 'plugins:netbox_bgp:community_edit' pk=object.pk %}" class="btn btn-warning">
        <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
    </a>    
    {% endif %}
    {% if perms.netbox_bgp.delete_community %}
    <a href="{% url 'plugins:netbox_bgp:community_delete' pk=object.pk %}" class="btn btn-danger">
        <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
    </a>    
    {% endif %}    
</div>
<h1>{% block title %}{{ object }}{% endblock %}</h1>
<p>
    <small class="text-muted">
      Created {{ object.created }} &middot;
      Updated <span title="{{ object.last_updated }}">{{ object.last_updated|timesince }}</span> ago
    </small>
    <span class="label label-default">{{ object|meta:"app_label" }}.{{ object|meta:"model_name" }}:{{ object.pk }}</span>
</p>
<div class="pull-right noprint">
    {% custom_links object %}
</div>
<ul class="nav nav-tabs">
    <li role="presentation" {% if not active_tab %} class="active" {% endif %}>
        <a href="{{ object.get_absolute_url }}">Community</a>
    </li>
    {% if perms.extras.view_objectchange %}
    <li role="presentation" {% if active_tab == 'changelog' %} class="active" {% endif %}>
        <a href="{% url 'plugins:netbox_bgp:community_changelog' pk=object.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>Community</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>Value</td>
                    <td>{{ object.value }}</td>
                </tr>
                <tr>
                    <td>Tenant</td>
                    <td>
                        {% if object.tenant %}
                        <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
                        {% else %}
                        <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Status</td>
                    <td>
                    <span class="label label-{{ object.get_status_class }}">{{ object.get_status_display }}</span>
                    </td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>{{ object.description|placeholder }}</td>
                </tr>
            </table>
        </div>
        {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='plugins:netbox_bgp:community_list' %}
        {% include 'inc/custom_fields_panel.html' %}
        {% plugin_left_page object %}
    </div>
    <div class="col-md-6">
        {% plugin_right_page object %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock %}