{% extends 'console/metrics_base.html' %}
{% load console_tags %}

{% block content %}

    <h3>Domain <b>{{ domain.name }}</b></h3>

    <ul class="nav nav-tabs">
      <li class="{% if not active_panel %}active{% endif %}">
          <a href="#infos" data-toggle="tab">Info</a>
      </li>
      <li{% if active_panel == 'metrics' %} class="active"{% endif %}>
          <a href="#metrics" data-toggle="tab">Metrics</a>
      </li>
    </ul>


    <!-- Tab panes -->
    <div class="tab-content">

        <!-- INFO -->
        <div class="tab-pane{% if not active_panel %} active{% endif %}" id="infos">
            <div class="table-responsive">
                <form id="domain-form" class="form-inline" role="form" action="{% url 'console_domain' domain.id %}" method="post">
                    {% csrf_token %}
                    <table class="table table-hover table-bordered">
                    {% for k, v in domain.items %}
                        <tr>
                            <td>{{ k|get_title }}</td>
                            <td>{{ v }}</td>
                        </tr>
                    {% endfor %}
                        {{ domainform }}
                    </table>
                    <button id="update-domain" type="submit" data-loading-text="Loading..." class="btn btn-primary submit-domain-form"onclick="$('#update-domain').button('loading');">
                        Update
                    </button>
                </form>
                {# <a href="?del={{ d.0.name }}"><span class="glyphicon glyphicon-remove-circle" style="position:right"></span>Delete Domain</a> #}
            </div>
        </div>


       <div class="tab-pane{% if active_panel == 'metrics' %} active{% endif %}" id="metrics">
            {% get_metrics_list domain as metrics %}
            {% include "console/metrics.html" with arg=domain.id id='domain' %}
        </div>
    </div>
{% endblock %}

{% block footer_js %}
    <script>
        var subject = '{{ domain.name }}';
    </script>
    {{ block.super }}
    <script src="{{ STATIC_URL }}console/js/multiple_metrics.js"></script>

{% endblock %}

