{% extends 'generic/object.html' %}
{% load render_table from django_tables2 %}

{% block extra_controls %}
<div class="dropdown">
    <button id="add-device-components" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
        <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Components
    </button>
    <ul class="dropdown-menu" aria-labeled-by="add-device-components">
        <li>
            <a class="dropdown-item" href="{% url 'plugins:nb_itsm:configurationitem_add' %}?service={{ object.pk }}&return_url={{ object.get_absolute_url }}">
                Configuration Item
            </a>
        </li>
        <li>
            <a class="dropdown-item" href="{% url 'plugins:nb_itsm:pentest_add' %}?service={{ object.pk }}&return_url={{ object.get_absolute_url }}">
                Vulnerability assessment
            </a>
        </li>
        <li>
            <a class="dropdown-item" href="{% url 'plugins:nb_itsm:relation_add' %}?service={{ object.pk }}&return_url={{ object.get_absolute_url }}">
                Configuration Item Relationship
            </a>
        </li>
    </ul>
</div>
{% endblock %}


{% block content %}
    <div class="row mb-3">
        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header">Service</h5>
                <div class="card-body">
                    <table class="table table-hover panel-body attr-table">
                        <tr>
                            <td>Name</td>
                            <td>{{ object.name }}</td>
                        </tr>
                        <tr>
                            <td>Slug</td>
                            <td>{{ object.slug }}</td>
                        </tr>
                        <tr>
                            <td>Type</td>
                            <td>{{ object.get_type_display }}</td>
                        </tr>
                        <tr>
                            <td>Status</td>
                            <td><span style="">{{ object.get_status_display }}</span></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>

        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header">Client Individuals</h5>
                <div class="card-body">
                    {% render_table tenant_table %}
                </div>
                <h5 class="card-header">Client Groups</h5>
                <div class="card-body">
                    {% render_table tenant_groups_table %}
                </div>
            </div>
        </div>
    </div>

    <div class="row mb-3">
        <div class="col col-md-6">
            {% include 'inc/panels/comments.html' %}
            {% include 'inc/panels/custom_fields.html' %}
            {% include 'inc/panels/tags.html' %}
        </div>

        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header">Vulnerability assessments</h5>
                <div class="card-body">
                    {% render_table vuln_table %}
                </div>
            </div>
        </div>
    </div>

{% endblock %}
