{% extends 'base.html' %}
{% load buttons %}
{% load static %}

{% block header %}
    <div class="row noprint">
        <div class="col-sm-8 col-md-9">
            <ol class="breadcrumb">
                <li><a href="{% url 'plugins:phonebox_plugin:list_view' %}">Numbers</a></li>
                <li>{{ object }}</li>
            </ol>
        </div>
        <div class="col-sm-4 col-md-3">
            <form action="{% url 'plugins:phonebox_plugin:list_view' %}" method="get">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" placeholder="Search Numbers" />
                    <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">
        {% if perms.phonebox_plugin.change_number %}
            <a href="{% url 'plugins:phonebox_plugin:number_edit' pk=object.pk %}" class="btn btn-warning">
                <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
            </a>
        {% endif %}
        {% if perms.phonebox_plugin.delete_number %}
            <a href="{% url 'plugins:phonebox_plugin:number_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>
    <ul class="nav nav-tabs">
        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
            <a href="{{ object.get_absolute_url }}">Number</a>
        </li>
    </ul>
{% endblock %}

{% block content %}
<div class="row">
	<div class="col-md-4">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Number</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>Tenant</td>
                    <td>
                        {% if object.tenant %}
                            {% if object.tenant.group %}
                                <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
                            {% endif %}
                            <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Region</td>
                    <td>
                        {% if object.region %}
                            <a href="{{ object.region.get_absolute_url }}">{{ object.region }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Provider</td>
                    <td>
                        {% if object.provider %}
                            <a href="{{ object.provider.get_absolute_url }}">{{ object.provider }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Forward To</td>
                    <td>
                        {% if object.forward_to %}
                            <a href="{{ object.forward_to.get_absolute_url }}">{{ object.forward_to }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>{{ object.description }}</td>
                </tr>
            </table>
        </div>
        {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='plugins:phonebox_plugin:list_view' %}
    </div>
</div>

{% endblock %}
