{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% load custom_tags %}

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


{% block content %}

    <div id="app">

        <settings-view></settings-view>
    </div>


{% endblock %}


{% block script %}
    {% if debug %}
        <script src="{% url 'js_reverse' %}"></script>
    {% else %}
        <script src="{% static 'django_js_reverse/reverse.js' %}"></script>
    {% endif %}

    <script type="application/javascript">
        window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
        window.USER_ID = {{ request.user.pk }}
        window.SHOPPING_MIN_AUTOSYNC_INTERVAL = {{ SHOPPING_MIN_AUTOSYNC_INTERVAL }}

        <!--TODO build custom API endpoint for this -->
        {% get_available_languages as LANGUAGES %}
        {% get_language_info_list for LANGUAGES as languages %}
        window.AVAILABLE_LANGUAGES = [
            {% for language in languages %}
                ['{{ language.name_local }}', '{{ language.code }}'],
            {% endfor %}
        ]

    </script>

    {% render_bundle 'settings_view' %}
{% endblock %}