{% extends "edit_object.html" %}
{% block title %}{{  block.super }}{% endblock %}

{% block head %}{{ block.super }} {% endblock %}

{% block footer %}{{ block.super }}{% endblock %}

{% block sidebar %}{{ block.super }}{% endblock %}

{% block content %}

    {% if my_object %}
            <!-- wrapper for scrollable items -->
            <ul class="nav nav-tabs" id="objecttab">
                <li><a href="#general" data-toggle="tab">General</a></li>
			    <li><a href="#memberof" data-toggle="tab">Member Of</a></li>
			    <li><a href="#notifications_tab" data-toggle="tab">Notifications</a></li>
			    <li><a href="#advanced" data-toggle="tab">Advanced</a></li>
		    </ul>
        <form class="form-horizontal" action="#" method="POST">
            {% csrf_token %}
            <div class="tab-content">


                    <div class="tab-pane" id="general">
                        <fieldset>
                            {% include "bootstrap_field.html" with field=form.contact_name %}
                            {% include "bootstrap_field.html" with field=form.alias %}
                            {% include "bootstrap_field.html" with field=form.use %}
                            {% include "bootstrap_field.html" with field=form.email %}
                            {% include "bootstrap_field.html" with field=form.pager %}
                        </fieldset>

                        <div class="form-actions">
                            <button class="btn btn-primary" type="submit">Save changes</button>
                        </div>
                    </div>

                    <div class="tab-pane" id="memberof">
                        <fieldset>
                            {% include "bootstrap_field.html" with field=form.contactgroups %}

                            <!-- Display All Contactgroups if this is that kind of an object -->
                            <div class="effective_contactgroups">
                            <fieldset id="id_effective_contactgroups" class="attribute_{{object_type}}">
                              <legend>Effective Contactgroups for this contact</legend>
                                    Group membership can be defined in multiple ways, for example by editing the contactgroups "members" attribute.
                                    For your convenience following is a list of all contactgroups that this contact is "effectively" a member of.
                                    <p></p>
                                    {% if effective_contactgroups %}
                                      <p>
                                    {% for group in effective_contactgroups %}
                                        <label><a href="id={{ group.id }}">{{group.contactgroup_name}}</a></label>
                                    {% endfor %}
                                      </p>
                                    {% endif %}
                            </fieldset>
                            </div>

                        </fieldset>

                        <div class="form-actions">
                            <button class="btn btn-primary" type="submit">Save changes</button>
                            <button class="btn">Cancel</button>
                        </div>
                    </div>


                    <div class="tab-pane" id="notifications_tab">
                        <fieldset>
                            {% include "bootstrap_field.html" with field=form.host_notifications_enabled %}
                            {% include "bootstrap_field.html" with field=form.host_notification_commands %}
                            {% include "bootstrap_field.html" with field=form.host_notification_period %}
                            {% include "bootstrap_field.html" with field=form.service_notifications_enabled %}
                            {% include "bootstrap_field.html" with field=form.service_notification_commands %}
                            {% include "bootstrap_field.html" with field=form.service_notification_period %}
                        </fieldset>

                        <div class="form-actions">
                            <button class="btn btn-primary" type="submit">Save changes</button>
                            <button class="btn">Cancel</button>
                        </div>
                    </div>
                </form>
                    <div class="tab-pane" id="advanced">
                        <!-- All Attributes -->
                        <h2>All Attributes</h2>
                        <form action="{% url objectbrowser.views.advanced_edit my_object.id %}" method="post" class="form-horizontal">{% csrf_token %}
                            {% include "bootstrap_fields.html" with fields=advanced_form %}
                            <div class="form-actions">
                                <button class="btn btn-primary" type="submit">Submit</button>
                            </div>
                        </form>
                    </div>
                </div>



{% else %}
	<p>Object not found </p>
{% endif %}




{% endblock %}
