{% extends "layouts/" + render_mode + ".html" %}
{% block title %}{{_("Filters")}}{% endblock %}
{% block content %}
<div id="filters-list" class="content-normal clearfix">
  {% set tags = mailpile("tags", "display=*", "mode=flat").result.tags %}
  {% if result %}
  <ul class="items">
    {% for filter in result %}
    {% set tag_groups = make_filter_groups(filter.tags) %}
    <li class="separate">
      <h3>{{ filter.comment }}</h3>
      <p><small>Type: <strong>{{ filter.type }}</strong></small></p>

      <div id="filter-tags-add-{{filter.fid}}" class="filter-tags-add">
        <em><span class="icon-plus"></span> Add</em>
        {% for tid in tag_groups.add %}
        <a href="">{{tid}}</a>
        {% endfor %}
      </div>
      <div id="filter-tags-remove-{{filter.fid}}" class="filter-tags-remove">
        <em><span class="icon-minus"></span> Remove</em>
        {% for tid in tag_groups.remove %}
        <a href="">{{tid}}</a>
        {% endfor %}
      </div>
      <em>Search Terms:</em><br>
      <span class="icon-search"></span> <strong>{{ filter.terms }}</strong><br>
      <label><input type="checkbox"> Autotag</label>
      <ul class="horizontal right">
        <li><a href=""><span class="icon-settings"></span> {{_("Edit")}}</a></li>
        <li><a href=""><span class="icon-circle-x"></span> {{_("Delete")}}</a></li>
      </ul>
    </li>
    {% endfor %}
  </ul>
  {% else %}
  <h3>{{_("No Filters Exist")}} :)</h3>
  <p>{{_("Filters are clever rules that automatically apply tags, sort and otherwise handle your messages.")}}</p>
  <p>Current filters are only supported in the CLI (command line interface). You can <a href="{{ config.sys.http_path }}/help/filters/command-line-interface/">read the documentation</a>.</p>
  {% endif %}
</div>
{% endblock %}
