{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% load sekizai_tags %}

{% block breadcrumb %}
    <ol class="breadcrumb">
        <li><a href="{% url 'projects_project_list' %}">Projects</a></li>
        <li><a href="{% url 'projects_project_view' object.project.pk %}">{{ object.project.name }}</a></li>
        <li class="active">Update Configuration</li>
    </ol>
{% endblock breadcrumb %}

{% block content %}
    <h1>{% block action %}Update{% endblock action %} Configuration</h1><br/>

    {% crispy form %}

    {% addtoblock 'js' %}
        <script>
            function set_data_type_field(){
                var data_type = $('#id_data_type').val();
                $('#div_id_value_boolean, #div_id_value, #div_id_value_number').hide();

                if(data_type == 'boolean'){
                    $('#div_id_value_boolean').show();
                }else if(data_type == 'number'){
                    $('#div_id_value_number').show();
                }else{
                    $('#div_id_value').show();
                }
            }
            $(function(){
                set_data_type_field();
                $('#id_data_type').change(set_data_type_field);
            });
        </script>
    {% endaddtoblock %}
{% endblock %}