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

{% block form %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Circuit</strong></div>
        <div class="panel-body">
            {% render_field form.provider %}
            {% render_field form.cid %}
            {% render_field form.type %}
            {% render_field form.install_date %}
            <div class="form-group">
                <label class="col-md-3 control-label" for="id_commit_rate">{{ form.commit_rate.label }}</label>
                <div class="col-md-9">
                    <div class="input-group">
                        {{ form.commit_rate }}
                        {% include 'circuits/inc/speed_widget.html' with target_field='commit_rate' %}
                    </div>
                    <span class="help-block">{{ form.commit_rate.help_text }}</span>
                </div>
            </div>
            {% render_field form.description %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Tenancy</strong></div>
        <div class="panel-body">
            {% render_field form.tenant_group %}
            {% render_field form.tenant %}
        </div>
    </div>
    {% if form.custom_fields %}
        <div class="panel panel-default">
            <div class="panel-heading"><strong>Custom Fields</strong></div>
            <div class="panel-body">
                {% render_custom_fields form %}
            </div>
        </div>
    {% endif %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Comments</strong></div>
        <div class="panel-body">
            {% render_field form.comments %}
        </div>
    </div>
{% endblock %}

{% block javascript %}
<script type="text/javascript">
    $("a.set_speed").click(function(e) {
        e.preventDefault();
        $("#id_" + $(this).attr("target")).val($(this).attr("data"));
    });
</script>
{% endblock %}
