{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}

{% block title %}{% trans 'List' %}{% endblock %}


{% block content %}

    {% if request.resolver_match.url_name in 'list_storage,list_recipe_import,list_sync_log' %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'data_sync' %}">{% trans 'External Recipes' %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{{ title }}</li>
        </ol>
    </nav>
    {% endif %}

    <div class="table-container">
        <span class="col col-md-9">
            <h3 style="margin-bottom: 2vh">{{ title }} {% trans 'List' %}
                {% if create_url %}
                    <a href="{% url create_url %}"> <i class="fas fa-plus-circle"></i>
                    </a>
                {% endif %}
            </h3>
        </span>

        {% if filter %}
            <br/>
            <br/>
            <form action="." method="get">
                {% csrf_token %}
                {{ filter.form|crispy }}
                <button type="submit" class="btn btn-success">{% trans 'Filter' %}</button>
            </form>
        {% endif %}

        {% if import_btn %}
            <a href="{% url 'data_batch_import' %}" class="btn btn-warning">{% trans 'Import all' %}</a>
            <br/>
            <br/>
        {% endif %}

        {% render_table table %}

    </div>

{% endblock content %}