{% extends '_base.html' %}
{% load form_helpers %}

{% block title %}Assign a New IP Address{% endblock %}

{% block content %}
<form action="." method="post" class="form form-horizontal">
    {% csrf_token %}
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            {% if form.non_field_errors %}
                <div class="panel panel-danger">
                    <div class="panel-heading"><strong>Errors</strong></div>
                    <div class="panel-body">
                        {{ form.non_field_errors }}
                    </div>
                </div>
            {% endif %}
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>IP Address</strong>
                </div>
                <div class="panel-body">
                    {% render_field form.address %}
                    {% render_field form.vrf %}
                    {% render_field form.tenant %}
                    {% render_field form.status %}
                    {% render_field form.description %}
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Interface Assignment</strong>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <label class="col-md-3 control-label">Device</label>
                        <div class="col-md-9">
                            <p class="form-control-static">{{ device }}</p>
                        </div>
                    </div>
                    {% render_field form.interface %}
                    {% render_field form.set_as_primary %}
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading"><strong>Custom Fields</strong></div>
                <div class="panel-body">
                    {% render_custom_fields form %}
                </div>
            </div>
		    <div class="form-group">
                <div class="col-md-9 col-md-offset-3">
                    <button type="submit" name="_create" class="btn btn-primary">Create</button>
                    <button type="submit" name="_addanother" class="btn btn-primary">Create and Add More</button>
                    <a href="{{ return_url }}" class="btn btn-default">Cancel</a>
                </div>
		    </div>
        </div>
    </div>
</form>
{% endblock %}
