{% extends 'base.html' %}
{% block content %}

{% if conf_error %}
    <table bgcolor='#d98797'>
        <tr>
            <td>
                {{ conf_error }}
            </td>
        </tr>
    </table>
{% endif %}


        <form class="pure-form pure-form-aligned" action='{{url_for('myCar_conf_save')}}' method='post'>
            <fieldset>
            {% for section in sections %}
                <h1>Configuration Section <i>{{ section }}</i></h1>
                
                
                {% for confval in config[section] %}

                    <div class="pure-control-group">
                                <label for="[{{ section }}][{{ confval }}]">{{ confval }}</label>

                                {% if config[section][confval] == "True" %}
                                     <input name="[{{ section }}][{{ confval }}]" id="[{{ section }}][{{ confval }}]" type="radio" value="True" checked><label for="[{{ section }}][{{ confval }}]">True</label>
                                     <input name="[{{ section }}][{{ confval }}]" id="[{{ section }}][{{ confval }}]" type="radio" value="False"><label for="[{{ section }}][{{ confval }}]">False</label> 
                                {% elif config[section][confval] == "False" %}
                                     <input name="[{{ section }}][{{ confval }}]" id="[{{ section }}][{{ confval }}]" type="radio" value="True"><label for="[{{ section }}][{{ confval }}]">True</label> 
                                     <input name="[{{ section }}][{{ confval }}]" id="[{{ section }}][{{ confval }}]" type="radio" value="False" checked><label for="[{{ section }}][{{ confval }}]">False</label>
                                {% else %}
                                    <input name="[{{ section }}][{{ confval }}]" id="[{{ section }}][{{ confval }}]" value="{{ config[section][confval] }}" placeholder="{{ confval }}">
                                {% endif %}
                    </div>
              
                {% endfor %}
            
            {% endfor %}

                <input type="hidden" name="testval" value="testA">
                <input type="hidden" name="[A][B]" value="testB">
                <button name='configsend' value='nosave' class="pure-button"><img src='{{ url_for('static', filename='img/nosave.png') }}' width='30px' height='30px'></button>
                <button name='configsend' value='save' class="pure-button"><img src='{{ url_for('static', filename='img/save.png') }}' width='30px' height='30px'></button>

            </fieldset>
        
        </form>
        

{% endblock %}
