{% load currency_filters %}
{% load category_tags %}
{% load i18n %}

<div class="navbar primary navbar-static-top navbar-inverse">
    <div class="navbar-inner">

        {# This is used in mobile view #}
        <a class="btn btn-navbar btn-nav-collapse" data-toggle="collapse" data-target=".primary-collapse">
            <span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </span>
        </a>

        <a class="btn btn-navbar btn-cart visible-phone" href="{% url 'basket:summary' %}">
            <i class="icon-shopping-cart"></i>
            {% trans "Basket" %}
            {% if not request.basket.is_empty %}
                {% if request.basket.is_tax_known %}
                    {% blocktrans with total=request.basket.total_incl_tax|currency:request.basket.currency %}
                        Total: {{ total }}
                    {% endblocktrans %}
                {% else %}
                    {% blocktrans with total=request.basket.total_excl_tax|currency:request.basket.currency %}
                        Total: {{ total }}
                    {% endblocktrans %}
                {% endif %}
            {% endif %}
        </a>

        <div class="nav-collapse primary-collapse collapse">
            {% block nav_dropdown %}
                <ul id="browse" class="nav">
                    <li class="dropdown active {% if expand_dropdown %}open{% endif %}">
                        <a href="#" class="dropdown-toggle" {% if not expand_dropdown %} data-toggle="dropdown"{% endif %}>
                            {% trans "Browse store" %}
                            <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu" data-navigation="dropdown-menu">
                            {% category_tree depth=2 as tree_categories %}
                            <li><a tabindex="-1" href="{% url 'catalogue:index' %}">{% trans "All products" %}</a></li>
                            {% if tree_categories %}
                                <li class="divider"></li>
                                {% for tree_category, info in tree_categories %}
                                    {% if info.has_children %}
                                        <li class="dropdown-submenu">
                                            <a tabindex="-1" href="{{ tree_category.get_absolute_url }}">{{ tree_category.name }}</a>
                                            <ul class="dropdown-menu">
                                            {% else %}
                                                <li><a tabindex="-1" href="{{ tree_category.get_absolute_url }}">{{ tree_category.name }}</a></li>
                                            {% endif %}

                                            {% for close in info.num_to_close %}
                                                </ul></li>
                                            {% endfor %}
                                {% endfor %}
                            {% endif %}
                            <li class="divider"></li>
                            {% block nav_dropdown_extra_items %}
                                <li><a href="{% url 'offer:list' %}">{% trans "Offers" %}</a></li>
                            {% endblock %}
                        </ul>
                    </li>
                    {% block nav_extra %}
                    {% endblock %}
                </ul>
            {% endblock %}
            {% include "partials/search.html" %}
        </div><!-- /nav-collapse -->

    </div><!-- /navbar-inner -->
</div><!-- /navbar -->
