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

	{% set can_add = "can_add" | is_item_visible(modelview_name) %}
	{% set can_show = "can_show" | is_item_visible(modelview_name) %}
    {% set can_edit = "can_edit" | is_item_visible(modelview_name) %}
	{% set can_delete = "can_delete" | is_item_visible(modelview_name) %}

    {{ lib.render_list_header(can_add, page, page_size, count, filters, actions, modelview_name) }}

	{% if value_columns %}
	<div class="table-responsive">
	<table class="table table-bordered table-hover">
	<thead>
	<tr>
    {% if can_show or can_edit or can_delete %}
        <th class="col-md-1 col-lg-1 col-sm-1" ></th>
    {% endif %}

	{% for item in include_columns %}
		{% if item in order_columns %}
			{% set res = item | get_link_order(modelview_name) %}
        		{% if res == 2 %}
				<th><a href={{ item | link_order(modelview_name) }}>{{label_columns.get(item)}}
				<i class="fa fa-chevron-up pull-right"></i></a></th>
			{% elif res == 1 %}
                <th><a href={{ item | link_order(modelview_name) }}>{{label_columns.get(item)}}
				<i class="fa fa-chevron-down pull-right"></i></a>
			{% else %}
                <th><a href={{ item | link_order(modelview_name) }}>{{label_columns.get(item)}}
				<i class="fa fa-arrows-v pull-right"></i></a>
			{% endif %}
		{% else %}
			<th>{{label_columns.get(item)}}</th>
		{% endif %}
	{% endfor %}
	</tr>
	</thead>
	
	{% for item in value_columns %}
	    <tr>
            {% if can_show or can_edit or can_delete %}
                <td><center>
                {% set pk = pks[loop.index-1] %}
                {{ lib.btn_crud(can_show, can_edit, can_delete, pk, modelview_name, filters) }}
                </center></td>
            {% endif %}
            {% for value in include_columns %}
			    <td> {{ item[value]|safe }}</td>
		    {% endfor %}
	    </tr>
	{% endfor %}
	</table>
    
	</div>
	{% else %}
	    <b> {{_("No records found")}}</b>
	{% endif %}
