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

{% block form %}
    <div class="field-group">
        <h4 class="mb-3">Interface</h4>
            {% if form.instance.device %}
                <div class="form-floating mb-3">
                    <input class="form-control" value="{{ form.instance.device }}" disabled />
                    <label class="form-label required" for="id_device">Device</label>
                </div>
            {% endif %}
        {% render_field form.name %}
        {% render_field form.label %}
        {% render_field form.type %}
        {% render_field form.enabled %}
        {% render_field form.parent %}
        {% render_field form.lag %}
        {% render_field form.mac_address %}
        {% render_field form.mtu %}
        {% render_field form.mgmt_only %}
        {% render_field form.mark_connected %}
        {% render_field form.description %}
        {% render_field form.tags %}
    </div>
    <div class="field-group">
        <h4 class="mb-3">802.1Q Switching</h4>
        {% render_field form.mode %}
        {% render_field form.untagged_vlan %}
        {% render_field form.tagged_vlans %}
    </div>
    {% if form.custom_fields %}
        <div class="field-group">
            <h4 class="mb-3">Custom Fields</h4>
            {% render_custom_fields form %}
        </div>
    {% endif %}
{% endblock %}

{% block buttons %}
    <a href="{{ return_url }}" class="btn btn-outline-danger">Cancel</a>
    {% if obj.pk %}
        <button type="submit" formaction="?return_url={% url 'dcim:interface_edit' pk=obj.pk %}" class="btn btn-outline-primary">Save & Continue Editing</button>
        <button type="submit" name="_update" class="btn btn-primary">Save</button>
    {% else %}
        <button type="submit" name="_addanother" class="btn btn-outline-primary">Create & Add Another</button>
        <button type="submit" name="_create" class="btn btn-primary">Create</button>
    {% endif %}
{% endblock %}
