{% extends 'oscar/dashboard/layout.html' %}
{% load dashboard_tags %}
{% load i18n %}
{% load render_table from django_tables2 %}

{% block body_class %}{{ block.super }} users{% endblock %}

{% block title %}
    {% trans "Customers" %} | {{ block.super }}
{% endblock %}

{% block header %}
    <div class="page-header">
        <h1>{% trans "Customers" %}</h1>
    </div>
{% endblock header %}

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% trans "Customers" %}</li>
        </ol>
    </nav>
{% endblock %}

{% block dashboard_content %}
    <div class="table-header">
        <h3><i class="fas fa-search"></i> {% trans "Search" %}</h3>
    </div>
    <div class="card card-body">
        <form method="get" class="form-inline">
            {% include "oscar/dashboard/partials/form_fields_inline.html" with form=form %}
            <button type="submit" name="search" class="btn btn-primary mr-2" data-loading-text="{% trans 'Searching...' %}">{% trans "Search" %}</button>
            <a href="{% url 'dashboard:users-index' %}" class="btn btn-secondary">{% trans "Reset" %}</a>
        </form>
    </div>

    {% block users_list %}
        {% if users.data %}
            <form id="user_list_form" method="post" class="form-inline">
                {% csrf_token %}
                {% render_table users %}
            </form>
        {% else %}
            <table class="table table-striped table-bordered table-hover">
                <caption>{{ queryset_description }}</caption>
                <tr><td>{% trans "No customers found." %}</td></tr>
            </table>
        {% endif %}
    {% endblock %}

{% endblock dashboard_content %}
