{% extends 'taxsystem/base.html' %}
{% load i18n %}
{% load taxsystem %}
{% load bootstrap %}

{% block page_title %}
    {{ title }}
{% endblock %}

{% block page_topic %}
    <h1 class="page-header text-center">
        {{ title }}
    </h1>
{% endblock page_topic %}

{% block taxsystem_block %}
    <div class="card">
        <div class="card-header bg-primary rounded-top d-flex align-items-center">
            <h3 class="me-3">{% translate "Filter Sets" %}</h3>
        </div>
        <div class="card-body">
            {% include 'taxsystem/partials/manage/filter.html' with filter_sets=filter_sets %}
        </div>
    </div>

    <div class="card mt-3">
        <div class="card-header bg-primary rounded-top d-flex align-items-center">
            <h3 class="me-3">{% translate "Filter Setup" %}</h3>
        </div>

        <div class="card-body">
            <div class="row">
                {% if forms.filter %}
                    <div class="col-md-6">
                        <form method="post">
                            {% csrf_token %}
                            <fieldset class="tax-filter-form">
                                {{ forms.filter|bootstrap }}
                            </fieldset>
                            <button type="submit" class="btn btn-success mt-3">
                                <i class="fa-solid fa-plus"></i> {% translate "Add Filter" %}
                            </button>
                        </form>
                    </div>
                {% endif %}
                {% if forms.filter_set %}
                    <div class="col-md-6">
                        <form method="post">
                            {% csrf_token %}
                            <fieldset class="tax-filter-form">
                                {{ forms.filter_set|bootstrap }}
                            </fieldset>
                            <button type="submit" class="btn btn-success mt-3">
                                <i class="fa-solid fa-plus"></i> {% translate "Add Filter Set" %}
                            </button>
                        </form>
                    </div>
                {% endif %}
                {% if forms.edit_filter_set %}
                    <div class="col-md-6">
                        <form method="post">
                            {% csrf_token %}
                            <fieldset class="tax-filter-form">
                                {{ forms.edit_filter_set|bootstrap }}
                            </fieldset>
                            <button type="submit" class="btn btn-success mt-3">
                                <i class="fa-solid fa-plus"></i> {% translate "Edit Filter Set" %}
                            </button>
                        </form>
                    </div>
                {% endif %}
            </div>
        </div>

    </div>
<!-- Tab Session -->
{% include 'taxsystem/modals/modal.html' with name="ViewFilter" %}
{% endblock %}

{% block extra_css %}
{% endblock %}

{% block extra_javascript %}
    <!-- load modals -->
    {% include 'taxsystem/bundles/modal-js.html' %}
    {% include 'taxsystem/modals/filter-delete.html' %}
    <script>
        setupModal('#modalViewFilterContainer', 'ajax_filter', '#modalViewFilterContent', '#modalViewFilterLoader');
    </script>
    <!-- load the datatables-js-bs5.html bundle -->
    {% include 'bundles/datatables-js-bs5.html' %}
    {% include "bundles/filterdropdown-js.html" %}
    {% include 'bundles/moment-js.html' with locale=True %}
    <!-- load the settings bundle -->
    {% include "taxsystem/bundles/settings-css.html" %}
    {% include 'taxsystem/bundles/settings-js.html' %}
    {% include 'taxsystem/bundles/filter-bundle.html' %}
{% endblock extra_javascript %}

{% block extra_script %}
{% endblock extra_script %}
