{% load i18n utils permissions %}

{% block inline-table %}
	<div class="table-inline-responsive">
		{% block tabs-menu-wrapper %}{% endblock %}
		{% block table-paginator %}
			{% if paginator_type == 'offset-based-paginator' %}
				<div class="row paginator {{ paginator_type }}"
					 style="visibility: hidden"
					 data-base="{{ list_per_page }}"
					 data-paging="simple"
					 data-base-type="custom"
					 data-base-range="[1, 100]"
					 data-custom-base-label="{% trans 'Display number of row' %}"
					 data-custom-base-error-message="{% trans 'Row number has to be between %s and %s' %}">
					<div class="col-sm-4">
						<span class="result-displayed">
							<span class="result-caption">{% trans 'Displayed' %}</span>
							<span class="result-number">{% trans '&#37;d to &#37;d' %}</span>
						</span>
						<span class="result-total">
							<span class="result-caption">{% trans 'of' %}</span>
							<span class="result-number">%d</span>
						</span>
					</div>
					<div class="col-sm-8">
						<div class="paging">
							<ul class="pagination">
								<li class="previous" title="{% trans 'Previous' %}"><span><i class="fa fa-angle-left"></i><span class="caption">{% trans 'Previous' %}</span></span></li>
								<li class="next" title="{% trans 'Next' %}"><span><span class="caption">{% trans 'Next' %}</span><i class="fa fa-angle-right"></i></span></li>
							</ul>
						</div>
					</div>
				</div>
			{% endif %}
			{% if paginator_type == 'cursor-based-paginator' %}
				<div class="row paginator {{ paginator_type }}"
					 style="visibility: hidden"
					 data-base="{{ list_per_page }}"
					 data-paging="simple"
					 data-base-type="custom"
					 data-base-range="[1, 100]"
					 data-custom-base-label="{% trans 'Display number of row' %}"
					 data-custom-base-error-message="{% trans 'Row number has to be between %s and %s' %}">
					<div class="col-sm-4">
						<span class="result-displayed">
						</span>
					</div>
					<div class="col-sm-8">
						<div class="paging">
							<ul class="pagination">
								<li class="next" title="{% trans 'Next' %}"><span><span class="caption">{% trans 'Next' %}</span><i class="fa fa-angle-right"></i></span></li>
							</ul>
						</div>
					</div>
				</div>
			{% endif %}
		{% endblock %}

        {% block inline-table-buttons %}
			<ul class="inline-list">
				{% block column-manager %}
					{% if enable_column_manager %}
					<li>
						<div class="dropdown columns-dropdown">
							<span class="btn btn-primary dropdown-toggle" data-toggle="dropdown">{% trans "Columns" %}<span class="caret"></span></span>
							<div class="dropdown-menu columns-manager" id="columns-manager-{{ table_slug }}"></div>
						</div>
					</li>
					{% endif %}
				{% endblock %}

				{% block inline-table-rest-buttons %}{% endblock %}
			</ul>
			<ul class="inline-list inline-list-right table-buttons">
				<li><button type="button" class="btn btn-secondary dynamic reset-filters" title="{% trans 'Clear filters' %}"><i class="fa fa-ban"></i></button></li>
				<li><button type="button" class="btn btn-secondary dynamic reload" title="{% trans 'Reload data' %}"><i class="fa fa-sync"></i></button></li>
				<li><button type="button" class="btn btn-secondary dynamic reload-count" title="{% trans 'Reload data and total number of rows' %}"><b>&#8721;</b></button></li>
			</ul>

			{% if enable_column_manager %}
				<div class="alert alert-info columns-filtering-text" id="columns-filtering-text-table-{{ table_slug }}" style="display: none">
					{% blocktrans with '%(columns)s' as columns %}There are some filters on hidden fields: <span class="columns">{{ columns }}</span>. Do you want to <span class="delete-filtering">delete filtering</span>?{% endblocktrans%}
				</div>
			{% endif %}
        {% endblock %}

		{% block table %}
            <table class="{% block table-classes %}grid js-grid table table-striped{% endblock %}" data-resource="{{ api_url }}{% if query_string_filter %}?{{ query_string_filter }}{% endif %}" data-model="{{ module_name|capfirst }}" data-cols="{{ fields|join:',' }}" data-rest-fields="{{ rest_fieldset }}" data-confirm="{% trans 'Do you really want to delete &#37;s?' %}" data-btn-yes="{% trans 'Yes' %}" data-btn-no="{% trans 'No' %}" data-context="{{ menu_group_pattern_name }}" data-confirm-title="{% trans 'Are you sure?' %}"{% if enable_column_manager %} data-columns-manager="columns-manager-{{ table_slug }}"{% endif %} id="table-{{ table_slug }}" {% block table-attributes %}{% endblock %}>
				<thead>
					{% block table-header %}
                    <tr>
                        {% for header in headers %}
                        <th class="{{ header.field_name }}">
                            <span{% if header.order_by %} class="sortable" data-col="{{ header.order_by }}"{% endif %}>{{ header.text|capfirst }}</span>
                            <div class="sort-direction"><div class="triangle"></div></div>
                            {{ header.filter }}
                        </th>
                        {% endfor %}
                        {% if render_actions %}<th class="actions">{% trans 'Actions' %}</th>{% endif %}
                    </tr>
					{% endblock %}
				</thead>
				<tbody>
				</tbody>
			</table>
		{% endblock %}

		{% block table-empty %}
			<div class="table-empty" style="display: none">
				<div class="alert alert-info"><span class="msg-text">{% trans 'There are no items.' %}</span></div>
			</div>
		{% endblock %}

	</div>
{% endblock %}
