{% extends 'fittings/base.html' %}

{% load aa_i18n %}
{% load i18n %}
{% load humanize %}
{% load filters %}
{% load evelinks %}

{% block page_title %}{% translate "View All Fittings" %}{% endblock %}

{% block fittings_block %}
    {% if msg %}
        <div class="alert alert-{{ msg.0 }} alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="close">
                <span aria-hidden="true">&times</span>
            </button>

            {% if msg.0 != 'warning' %}
                <h4>
                    {% if msg.0 == 'danger' %}
                        {% translate "Oh No!" %}
                    {% elif msg.0 == 'success' %}
                        {% translate "Success!" %}
                    {% endif %}
                </h4>
            {% endif %}

            <p>{{ msg.1 }}</p>
        </div>
    {% endif %}

    <div>
        <div class="card card-default mb-3">
            <div class="card-header">
                <div class="card-title mb-0">{% translate "Fittings List" %}</div>
            </div>

            <div class="card-body">
                {% include "fittings/partials/fittings-list-table.html" %}
            </div>
        </div>
    </div>
{% endblock %}

{% block extra_javascript %}
    {% include 'bundles/datatables-js-bs5.html' %}

    {% get_datatables_language_static LANGUAGE_CODE as DT_LANG_PATH %}

    <script>
        $(document).ready(() => {
            {% if fits %}
                $('#fitTable').DataTable({
                    language: {
                        url: '{{ DT_LANG_PATH }}'
                    },
                });
            {% endif %}
        });
    </script>
{% endblock %}
