{% extends 'generic/object_edit.html' %}
{% load helpers %}
{% load form_helpers %}

{% block form %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Device</strong></div>
        <div class="panel-body">
            {% render_field form.name %}
            {% render_field form.role %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Hardware</strong></div>
        <div class="panel-body">
            {% render_field form.manufacturer %}
            {% render_field form.device_type %}
            {% render_field form.serial %}
            {% render_field form.asset_tag %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Location</strong></div>
        <div class="panel-body">
            {% render_field form.location %}
            {% render_field form.rack_group %}
            {% render_field form.rack %}
            {% if obj.device_type.is_child_device and obj.parent_bay %}
                <div class="form-group">
                    <label class="col-md-3 control-label">Parent device</label>
                    <div class="col-md-9">
                        <p class="form-control-static">
                            {{ obj.parent_bay.device|hyperlinked_object }}
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">Parent bay</label>
                    <div class="col-md-9">
                        <p class="form-control-static">
                            {{ obj.parent_bay.name }}
                            {% if perms.dcim.change_devicebay %}
                                <a href="{% url 'dcim:devicebay_depopulate' pk=obj.parent_bay.pk %}" class="btn btn-danger btn-xs">
                                    <i class="mdi mdi-close-thick" aria-hidden="true" title="Remove device"></i> Remove
                                </a>
                            {% endif %}
                        </p>
                    </div>
                </div>
            {% else %}
                {% render_field form.face %}
                {% render_field form.position %}
            {% endif %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>VRF Assignment</strong></div>
        <div class="panel-body">
            {% render_field form.vrfs %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Management</strong></div>
        <div class="panel-body">
            {% render_field form.status %}
            {% render_field form.platform %}
            {% if editing %}
                {% render_field form.primary_ip4 %}
                {% render_field form.primary_ip6 %}
            {% endif %}
            {% render_field form.secrets_group %}
            {% render_field form.device_redundancy_group %}
            {% render_field form.device_redundancy_group_priority %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Virtualization</strong></div>
        <div class="panel-body">
            {% render_field form.cluster_group %}
            {% render_field form.cluster %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Tenancy</strong></div>
        <div class="panel-body">
            {% render_field form.tenant_group %}
            {% render_field form.tenant %}
        </div>
    </div>
    {% include 'inc/extras_features_edit_form_fields.html' %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Local Config Context Data</strong></div>
        <div class="panel-body">
            {% render_field form.local_config_context_schema %}
            {% render_field form.local_config_context_data %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Comments</strong></div>
        <div class="panel-body">
            {% render_field form.comments %}
        </div>
    </div>
{% endblock %}
