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

{% block content %}
<div class="row noprint">
    <div class="col-sm-8 col-md-9">
        <ol class="breadcrumb">
            <li><a href="{% url 'ipam:service_list' %}">Services</a></li>
            <li><a href="{{ service.parent.get_absolute_url }}">{{ service.parent }}</a></li>
            <li>{{ service }}</li>
        </ol>
    </div>
    <div class="col-sm-4 col-md-3">
        <form action="{% url 'ipam:service_list' %}" method="get">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search Services" />
                <span class="input-group-btn">
                    <button type="submit" class="btn btn-primary">
                        <span class="fa fa-search" aria-hidden="true"></span>
                    </button>
                </span>
            </div>
        </form>
    </div>
</div>
<div class="pull-right">
    {% plugin_buttons service %}
    {% if perms.dcim.change_service %}
        {% edit_button service %}
    {% endif %}
    {% if perms.dcim.delete_service %}
        {% delete_button service %}
    {% endif %}
</div>
<h1>{% block title %}{{ service }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=service %}
<div class="pull-right noprint">
    {% custom_links service %}
</div>
<div class="row">
	<div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Service</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>Name</td>
                    <td>{{ service.name }}</td>
                </tr>
                <tr>
                    <td>Parent</td>
                    <td>
                        <a href="{{ service.parent.get_absolute_url }}">{{ service.parent }}</a>
                    </td>
                </tr>
                <tr>
                    <td>Protocol</td>
                    <td>{{ service.get_protocol_display }}</td>
                </tr>
                <tr>
                    <td>Port</td>
                    <td>{{ service.port }}</td>
                </tr>
                <tr>
                    <td>IP Addresses</td>
                    <td>
                        {% for ipaddress in service.ipaddresses.all %}
                            <a href="{{ ipaddress.get_absolute_url }}">{{ ipaddress }}</a><br />
                        {% empty %}
                            <span class="text-muted">None</span>
                        {% endfor %}
                    </td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>{{ service.description|placeholder }}</td>
                </tr>
		    </table>
        </div>
        {% include 'inc/custom_fields_panel.html' with obj=service %}
        {% include 'extras/inc/tags_panel.html' with tags=service.tags.all url='ipam:service_list' %}
        {% plugin_left_page service %}
    </div>
    <div class="col-md-6">
        {% plugin_right_page service %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% plugin_full_width_page service %}
    </div>
</div>
{% endblock %}
