{% load django_tables2 django_tableaux %}
{% if table.show_header %}
  {#  sort attributes and filter row #}
  <thead {{ table.attrs.thead.as_html }} style="margin: 0px;" {% if view.sticky_header %} class="sticky" {% endif %} >
  <tr class="bg-white">
    {% for column in table.columns %}
      {% if column.name in table.columns_visible %}
        <th {{ column.attrs.th.as_html }} style="margin: 0px">
          {% if column.name == "selection" %}
            <input type="checkbox" id="select_all_page" name="select_all_page" class="ml-2">
          {% else %}
            {% if column.orderable %}
              <a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">
                <span class="float-right text-white">{% if "-" in column.order_by.0 %}&#9651;{% else %}&#9661;{% endif %}</span>
                {{ column.header }}
              </a>
            {% else %}
              {{ column.header }}
            {% endif %}
          {% endif %}
        </th>
      {% endif %}
    {% endfor %}
  </tr>
  {% if table.filter.style == table.filter.style.HEADER %}
    <tr class="bg-light">
      {% for field in table.header_fields %}
        <th>
          {% if field %}
            {% include templates.tb_filter_field with field=field header=True %}
          {% endif %}
        </th>
      {% endfor %}
    </tr>
  {% endif %}
  </thead>
{% endif %}
