{% extends 'cmdb/ci_details.html' %}
{% load icons %}
{% load query %}

{% block ci_content %}
<div class="tab-pane" id="relations">
    <div class='span12' style='padding-top: 4px;margin-top: 10px; '>
        <div>
            <table style='cell-padding: 10px' class="row-fluid">
                <tr  class="row-fluid">
                    <td style='vertical-align: top; padding-right: 10px' class="span6">
                        {% include 'cmdb/include_relations.html' with span_number=span_number label='Contains' relations=relations_contains editable=editable %}
                        {% include 'cmdb/include_relations.html' with span_number=span_number label='Has roles' relations=relations_hasrole editable=editable %}
                        {% include 'cmdb/include_relations.html' with span_number=span_number label='Requires' relations=relations_requires editable=editable %}
                       {% if editable and edit_configuration_item_relations_perm and ci_id %}
                       <p>
                          <a class='btn btn-primary'
                              href="/cmdb/relation/add/{{ ci_id }}?rel_parent={{ ci_id }}">
                              <i class='icon-edit icon-white'></i>
                              Add new child relation
                          </a>
                       </p>
                       {% endif %}
                        </td>

                      <td style='vertical-align: top;' class="span6">
                          {% include 'cmdb/include_relations.html' with span_number=span_number label='Is part of' relations=relations_parts editable=editable %}
                          {% include 'cmdb/include_relations.html' with span_number=span_number label='Is role for' relations=relations_isrole editable=editable %}
                          {% include 'cmdb/include_relations.html' with span_number=span_number label='Is required by' relations=relations_isrequired editable=editable %}

                          {% if editable and edit_configuration_item_relations_perm and ci_id %}
                          <p>
                                <a class='btn btn-primary'
                                    href="/cmdb/relation/add/{{ ci_id }}?rel_child={{ ci_id }}">
                                   <i class='icon-edit icon-white'></i>
                                   Add new parent relation
                               </a>
                          </p>
                          {% endif %}
                      </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="row-fluid">
        <div class='span12'>
            <div class='span2'>
                {% if not editable %}
                    <a class='btn btn-info btn-large' href='/cmdb/ci/edit/{{ ci_id}}/relations/'> Edit this CI </a>
                {% endif %}
            </div>
        </div>
    </div>
</div>
{% endblock %}
