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


{% block form_fields %}
{% render_field form.name %}
{% render_field form.slug %}
{% render_field form.manufacturer %}

<div class="form-group{% if form.network_driver.errors %} has-error{% endif %}">
    <label class="col-md-3 control-label" for="id_network_driver">Network driver</label>
    <div class="col-md-9">
        {{ form.network_driver }}
        <span class="help-block">
            The <a href="https://netutils.readthedocs.io/en/latest/user/lib_use_cases_lib_mapper/">normalized network driver</a> to use when interacting with devices
            <i class="mdi mdi-help-circle-outline"></i> <a href="#network_driver_choices" data-toggle="modal" data-target="#network_driver_choices">Show Configured Choices</a>
        </span>
    {% if form.network_driver.errors %}
        <ul>
            {% for error in form.network_driver.errors %}
                {# Embed an HTML comment indicating the error for extraction by tests #}
                <!-- FORM-ERROR {{ form.network_driver.name }}: {{ error }} -->
                <li class="text-danger">{{ error }}</li>
            {% endfor %}
        </ul>
    {% endif %}
    </div>
</div>
<div class="modal fade" id="network_driver_choices" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title"><code>Network driver</code> Choices</h4>
            </div>
            <div class="modal-body">
                <p>Drivers selected from the below list can be used to automatically map to a driver name in supported tools using the platform's <a href="{% static 'docs/models/dcim/platform.html' %}"><code>network_driver_mappings</code></a> property. For advanced automation purposes, the network driver field may be set to a value not present in this list but will not provide automatic mapping unless the <a href="{% static 'docs/configuration/optional-settings.html' %}#network_drivers"><code>NETWORK_DRIVERS</code></a> setting is updated to add the new value.</p>
                <table class="table table-striped">
                    {% for value in network_driver_names %}
                        {% if value %}<tr><td><samp>{{ value }}</samp></td></tr>{% endif %}
                    {% endfor %}
                </table>
            </div>

        </div>
    </div>
</div>
{% render_field form.napalm_driver %}
{% render_field form.napalm_args %}
{% render_field form.description %}
{% endblock %}
