{% extends 'base.html' %}
{% load render_table from django_tables2 %}
{% load nb_buttons %}
{% load static %}
{% load helpers %}
{% load custom_links %}
{% load plugins %}

{% block title %}{{ object }}{% endblock %}

{% block header %}
    <div class="row noprint">        
    </div>
    <div class="pull-right noprint">
        {% if permissions.add  %}
            <div class="btn-group">
                <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Components <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="{% url 'plugins:nb_service:IC_add' %}?service={{ object.pk }}&return_url={{ object.get_absolute_url }}">Configuration Item</a></li>
                    <li><a href="{% url 'plugins:nb_service:pentest_add' %}?service={{ object.pk }}&return_url={{ object.get_absolute_url }}">Vulnerability assessment</a></li>
                    <li><a href="{% url 'plugins:nb_service:relation_add' %}?service={{ object.pk }}&return_url={{ object.get_absolute_url }}">Configuration Item Relationship</a></li>
                </ul>
            </div>
            {% edit_button object %}
        {% endif %}
        {% delete_button object %}
    </div>
    <h1>{{ object }}</h1>
    <ul class="nav nav-tabs">
        <li role="presentation" class="active">
            <a href="{{ object.get_absolute_url }}">Service</a>
        </li>
        <li role="presentation">
            <a href="{% url 'plugins:nb_service:service_IC' pk=object.pk %}">Configuration Itens</a>
        </li>
        <li role="presentation">
            <a href="{% url 'plugins:nb_service:service_relation' pk=object.pk %}">Relationships</a>
        </li>
        <li role="presentation">
            <a href="{% url 'plugins:nb_service:service_diagram' pk=object.pk %}">Diagram</a>
        </li>
    </ul>
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-12">
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="details">
                    <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>{{ object.name }}</td>
                                    </tr>
                                    <tr>
                                        <td>Backup Profile</td>
                                        <td>{{ object.backup_profile }}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <strong>Clients</strong>
                                </div>
                                {% render_table tenant_table %}
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <strong>Comments</strong>
                                </div>
                                <div>
                                    <p>{{ object.comments }}</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <strong>Vulnerability assessments</strong>
                                </div>
                                {% render_table vuln_table %}
                            </div>
                        </div>
                        
                    </div>             
                </div>
            </div>
        </div>
    </div>
{% endblock %}
