{% extends "procmail/base.html" %}
{% load i18n %}
{% block content %}
  <h1>{% trans "Simple editor" %}</h1>
  <form action="" method="post">
    {% csrf_token %}
    <h2>{% trans "Metadata" %}</h2>
    {% include "procmail/form.html" with form=form_meta %}
    <h2>{% trans "Conditions" %}</h2>
    {% include "procmail/form.html" with form=form_cond_kind %}
    {% include "procmail/form.html" with form=form_cond table_id="conditions_table" %}
    <h2>{% trans "Actions" %}</h2>
    {% include "procmail/form.html" with form=form_action %}

    <div style="white-space: nowrap;">
        <div style="display: inline-block;width:33%;">
            <input type="submit" value="{% trans "Submit" %}" class="btn btn-primary"/>
        </div>
        <div style="display: inline-block;width:34%;text-align:center;">
            <a href="{% url "procmail:edit" curr_stmt.id %}" class="btn btn-warning keep_scroll_list">
              {% trans "Go to advanced edition page" %}
            </a>
        </div>
        <div style="display: inline-block;width:33%;text-align:right;">
            <input 
              type="submit"
              value="{% trans "Delete" %}"
              name="delete_stmt"
              class="btn btn-danger"
            />
        <div>
    </div>
  </form>
  <p class="text-center">
    
  </p>
<script>
$(document).ready(function() {
    var show_conditions = function() {
        if(this.checked){
            if (this.value == 'all')
                $('#conditions_table').hide()
            else
                $('#conditions_table').show()
        }
    }
    $('input[type=radio][name={{form_cond_kind.kind.html_name}}]').each(show_conditions);
    $('input[type=radio][name={{form_cond_kind.kind.html_name}}]').change(show_conditions);
});

</script>
{% endblock %}

