{% sw_extends '@Storefront/storefront/layout/navbar/navbar.html.twig' %}
{% block layout_navbar %}
<div class="main-navigation">
    <div class="container">
        {% set navbarOptions = {
            pathIdList: shopware.navigation.pathIdList
        } %}

        {% block layout_navbar_nav_element %}
            <nav class="navbar navbar-expand-lg main-navigation-menu"
                 id="main-navigation-menu"
                 itemscope="itemscope"
                 itemtype="https://schema.org/SiteNavigationElement"
                 data-navbar="true"
                 data-navbar-options="{{ navbarOptions|json_encode }}"
                 aria-label="{{ 'header.navigationAriaLabel'|trans|striptags }}">
                <div class="collapse navbar-collapse" id="main_nav">
                    <ul class="navbar-nav main-navigation-menu-list flex-wrap">
                        {% set homeLabel = context.salesChannel.translated.homeName|default('general.homeLink'|trans) %}
						{% set activateHomeLinkshow = theme_config('bct-nav-main-home-link-show') %}	 
						{% if activateHomeLinkshow %}
							{% block layout_navbar_menu_home %}
								{{ parent() }}
							{% endblock %}
						{% endif %}

                        {% block layout_navbar_menu_items %}

                            {% for treeItem in header.navigation.tree %}
                                {% set category = treeItem.category %}
                                {% set id = category.id %}
                                {% set name = category.translated.name %}
                                {% set hasChildren = treeItem.children|length > 0 %}

                                {% block layout_navbar_menu_item %}
                                    {% if category.type == 'folder' %}
                                        <li class="nav-item nav-item-{{ id }}">
                                            <a class="nav-link nav-item-{{ id }}-link root main-navigation-link p-2{% if hasChildren %} dropdown-toggle{% endif %}"
                                               href="javascript:void(0)"
                                               {% if hasChildren %}data-bs-toggle="dropdown"{% endif %}
                                               data-flyout-menu-trigger="{{ id }}"
                                               itemprop="url"
                                               title="{{ name }}">
                                                <span itemprop="name" class="main-navigation-link-text">{{ name }}</span>
                                            </a>

                                            {% if hasChildren %}
                                            <div class="container submega-menu-one">
                                                <div class="dropdown-menu w-100 p-4 navigation-flyout animated is-open">
                                                    {% sw_include '@Storefront/storefront/layout/navbar/content.html.twig' with {
                                                        themeIconConfig: themeIconConfig,
                                                        navigationTree: treeItem,
                                                        level: level+1,
                                                        page: page
                                                    } only %}
                                                </div>
                                            </div>
                                            {% endif %}
                                        </li>
                                    {% else %}
                                        <li class="nav-item nav-item-{{ id }} {% if hasChildren %}dropdown position-static{% endif %}">
                                            <a class="nav-link nav-item-{{ id }}-link root main-navigation-link p-2{% if hasChildren %} dropdown-toggle{% endif %}"
                                               href="{{ seoUrl('frontend.navigation.page', { navigationId: category.id }) }}"
                                               {% if hasChildren %}data-bs-toggle="dropdown"{% endif %}
                                               {% if category_linknewtab(category) %}target="_blank"{% endif %}
                                               itemprop="url"
                                               title="{{ name }}">
                                                <span itemprop="name" class="main-navigation-link-text">{{ name }}</span>
                                            </a>
                                            {% if hasChildren %}
                                                <div class="dropdown-menu w-100 p-4 navigation-flyout animated is-open">
                                                    <div class="container  submega-menu-two">
                                                    {% sw_include '@Storefront/storefront/layout/navbar/content.html.twig' with {
                                                        themeIconConfig: themeIconConfig,
                                                        navigationTree: treeItem,
                                                        level: level+1,
                                                        page: page
                                                    } only %}
                                                    </div>
                                                </div>
                                            {% endif %}
                                        </li>
                                    {% endif %}
                                {% endblock %}
                            {% endfor %}
                        {% endblock %}
                    </ul>
                </div>
            </nav>
        {% endblock %}         
    </div>   
</div>
{% endblock %}

