{% extends 'utilities/obj_edit.html' %}
{% load static from staticfiles %}
{% load form_helpers %}

{% block form %}
    <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 %}
            {% if obj %}
                <div class="form-group">
                    <label class="col-md-3 control-label">Device</label>
                    <div class="col-md-9">
                        <p class="form-control-static">
                            {% if obj.interface %}
                                <a href="{% url 'dcim:device' pk=obj.interface.device.pk %}">{{ obj.interface.device }}</a>
                            {% else %}
                                <span>None</span>
                            {% endif %}
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">Interface</label>
                    <div class="col-md-9">
                        <p class="form-control-static">{{ obj.interface }}</p>
                    </div>
                </div>
            {% endif %}
            {% render_field form.description %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>NAT IP (Inside)</strong></div>
        <div class="panel-body">
            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="active"><a href="#select" aria-controls="home" role="tab" data-toggle="tab">By Device</a></li>
                <li role="presentation"><a href="#search" aria-controls="search" role="tab" data-toggle="tab">By IP</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" id="select">
                    {% render_field form.nat_site %}
                    {% render_field form.nat_device %}
                </div>
                <div class="tab-pane" id="search">
                    {% render_field form.livesearch %}
                </div>
            </div>
            {% render_field form.nat_inside %}
        </div>
    </div>
{% endblock %}

{% block javascript %}
<script src="{% static 'js/livesearch.js' %}"></script>
{% endblock %}
