{###############################################################################}
{##}
{#   Copyright (C) <2016>  <Florian Alu - Prolibre - http://prolibre.com>#}
{##}
{#    This program is free software: you can redistribute it and/or modify#}
{#    it under the terms of the GNU Affero General Public License as published#}
{#    by the Free Software Foundation, either version 3 of the License.#}
{#    #}
{##}
{#    This program is distributed in the hope that it will be useful,#}
{#    but WITHOUT ANY WARRANTY; without even the implied warranty of#}
{#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#}
{#    GNU Affero General Public License for more details.#}
{##}
{#    You should have received a copy of the GNU Affero General Public License#}
{#    along with this program.  If not, see <http://www.gnu.org/licenses/>.#}
{##}
{###############################################################################}

{% load crispy_forms_filters %}
{% load startwith %}
{% load l10n %}

<div class="controls {{ field_class }}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
    {% include 'bootstrap3/layout/field_errors_block.html' %}
    {% for a in list_group_act.items %}
        <fieldset style="margin-bottom: 7px">
            <legend style="margin-bottom: 1px">{{ a.0 }}</legend>
            {% for choice in field.field.choices %}

                {% if choice.0 in a.1 %}
                <label class="{% if inline_class %}checkbox-{{ inline_class }}{% endif %}">

                    <input type="checkbox"
                            {% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|stringformat:"s" %}
                           checked="checked"{% endif %} name="{{ field.html_name }}"
                           id="id_{{ field.html_name }}_{{ forloop.counter }}"
                           value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>
                    {{ choice.1|unlocalize }}
                </label>

                {% endif %}
            {% endfor %}
        </fieldset>
    {% endfor %}

    {% include 'bootstrap3/layout/help_text.html' %}
</div>
