{% extends "base_okconfig.html" %}
{% block title %}Add Host{% endblock %}
{% block smallheader %}Add{% endblock %}
{% block largeheader %}Host{% endblock %}
{% block nav2 %}<a href="{% url adagios.okconfig_.views.addhost %}">Add Host</a>{% endblock %}

{% block content %}
    <br/>
	<form action="#" method="post" class="form-horizontal">{% csrf_token %}
        {% include "bootstrap_fields.html" with fields=form %}
        <div class="form-actions">
            <button class="btn btn-primary" type="submit">Submit</button>
        </div>
	</form>
{% endblock %}



{% block footer %}
    {{ block.super }}
    <!-- DNS lookup for the address field -->
    <script>
        $('#id_host_name').focusout(function() {
            if ($('#id_address').val() == "") {
                $.getJSON('{% url rest/pynag %}json/dnslookup',
                        {
                            host_name: $(this).val()
                        },
                        function(data) {
                            $('#id_address').val(data['addresslist'][0]);
                        }
                );
            }
        });
    </script>

{% endblock %}
