{% import 'appbuilder/general/lib.html' as lib %}

{# macro list(route_base, label_columns, include_columns, value_columns, order_columns, pks, filters, generalview_name) #}

        {% set can_add = "can_add" | is_item_visible(generalview_name) %}
        {% set can_show = "can_show" | is_item_visible(generalview_name) %}
        {% set can_edit = "can_edit" | is_item_visible(generalview_name) %}
        {% set can_delete = "can_delete" | is_item_visible(generalview_name) %}
        <div class="well well-sm">
                {% if can_add %}
                        {% set path = route_base + '/add?next=' + request.path %}
                        {% set path = path | set_link_filters(filters) %}
                        {{ lib.lnk_add(path) }}
                {% endif %}
                {{ lib.lnk_back() }}
        </div>
                
        {% if value_columns %}
        <div class="container">
        <div class="row">        
                
        {% for item in value_columns %}
        	<div class="col-sm-12 col-md-6 col-lg-6">
                <div class="thumbnail">
                {% set outer_loop = loop %}
                        <div class="btn-group btn-group-xs">
                        {% if can_show %}
                                {% set path = route_base ~ '/show/' ~ pks[loop.index-1] ~ '?next=' ~ request.path %}
                                {% set path = path | set_link_filters(filters) %}
                                {{ lib.lnk_show(path) }}
                        {% endif %}
                        {% if can_edit %}
                                {% set path = route_base ~ '/edit/' ~ pks[loop.index-1] ~ '?next=' ~ request.path %}
                                {% set path = path | set_link_filters(filters) %}
                                {{ lib.lnk_edit(path) }}
                        {% endif %}
                        {% if can_delete %}
                                {{ lib.lnk_delete(route_base ~ '/delete/' ~ pks[loop.index-1] ~ '?next=' + request.path) }}
                        {% endif %}
                        </div>
                {% for value in include_columns %}
                        <dl class="dl-horizontal">
                        		<dt>{{label_columns.get(include_columns[loop.index -1])}}</dt>
                                <dd>{{ item[value]|safe }}</dd>                
                        </dl>                        
                {% endfor %}
                
                </div>
        		</div>
        		
        {% endfor %}                        
        </div>
        </div>
        {% else %}
        <b> {{_("No records found")}}</b>
        {% endif %}
