{% sw_extends '@Storefront/storefront/layout/navigation/navigation.html.twig' %}
{% block layout_main_navigation_menu_items %}
{% if page.product is defined %}
{% set activePath = page.product.categoryTree %}
{% else %}
{% set activePath = page.header.navigation.active.path %}
{% endif %}
{% for treeItem in page.header.navigation.tree %}
{% set category = treeItem.category %}
{% set name = category.translated.name %}
{# @deprecated tag:v6.5.0 - Use "category.id" directly instead. #}
{% set categorId = category.id %}
{% block layout_main_navigation_menu_item %}
{% if category.type == 'folder' %}
<div
class="nav-link main-navigation-link{% if category.id == page.header.navigation.active.id or category.id in activePath %} active{% endif %}"
{% if treeItem.children|length > 0 %}
data-flyout-menu-trigger="{{ category.id }}"
{% endif %}
title="{{ name }}">
<div class="main-navigation-link-text">
<span itemprop="name">{{ name }}</span>
</div>
</div>
{% else %}
<a class="nav-link main-navigation-link{% if category.id == page.header.navigation.active.id or category.id in activePath %} active{% endif %}"
href="{{ category_url(category) }}"
itemprop="url"
{% if treeItem.children|length > 0 %}data-flyout-menu-trigger="{{ category.id }}"{% endif %}
{% if category_linknewtab(category) %}target="_blank"{% endif %}
title="{{ name }}">
<div class="main-navigation-link-text">
<span itemprop="name">{{ name }}</span>
</div>
</a>
{% endif %}
{% endblock %}
{% endfor %}
{% block layout_nav_actions_account %}
<div class="account-menu cio-account-display d-flex ml-auto">
{% if cio_budgets_show %}
{% if checkCustomerPermission('ALLOW_ADD_TO_CART', context) %}
<div class="col-auto">
<div class="header-budget">
<div class="dropdown">
<button class="btn budget-menu-btn header-actions-btn"
type="button"
id="budgetWidget"
data-toggle="dropdown"
aria-expanded="false"
title="{{ 'header.btnMenuTitle' | trans }}">
<span class="icon"><?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 53 53" xmlns="http://www.w3.org/2000/svg">
<path
d="m28 14v-7.8c-0.3-4.1-7.2-6.2-14-6.2s-13.6 2.1-14 6.2v37.8c0 4.3 7 6.5 14 6.5 4.3 0 8.6-0.9 11.3-2.5 1.4 3.3 7.6 5 13.7 5 7 0 14-2.2 14-6.5v-15.3c-0.3-4.1-7.2-6.2-14-6.2-4.1 0-8.3 0.8-11 2.3v-5.8zm22 25c0 1.2-3.9 3.5-11 3.5s-11-2.3-11-3.5v-3.3c2.7 1.5 6.9 2.3 11 2.3s8.3-0.8 11-2.3zm-25-25c0 1.2-3.9 3.5-11 3.5s-11-2.3-11-3.5v-3.3c2.7 1.5 6.9 2.3 11 2.3s8.3-0.8 11-2.3zm-11 6.5c4.1 0 8.3-0.8 11-2.3v3.3c0 1.2-3.9 3.5-11 3.5s-11-2.3-11-3.5v-3.3c2.7 1.5 6.9 2.3 11 2.3zm-11 12.7c2.7 1.5 6.9 2.3 11 2.3s8.3-0.8 11-2.3v3.3c0 1.2-3.9 3.5-11 3.5s-11-2.3-11-3.5zm22-4.2c0 1.2-3.9 3.5-11 3.5s-11-2.3-11-3.5v-3.3c2.7 1.5 6.9 2.3 11 2.3s8.3-0.8 11-2.3zm-11-26c7.1 0 11 2.3 11 3.5s-3.9 3.5-11 3.5-11-2.3-11-3.5 3.9-3.5 11-3.5zm0 44.5c-7.1 0-11-2.3-11-3.5v-3.3c2.7 1.5 6.9 2.3 11 2.3s8.3-0.8 11-2.3v3.3c0 1.2-3.9 3.5-11 3.5zm25 2.5c-7.1 0-11-2.3-11-3.5v-3.3c2.7 1.5 6.9 2.3 11 2.3s8.3-0.8 11-2.3v3.3c0 1.2-3.9 3.5-11 3.5zm0-22c7.1 0 11 2.3 11 3.5s-3.9 3.5-11 3.5-11-2.3-11-3.5 3.9-3.5 11-3.5z"
fill="currentColor"/>
</svg>
</span>
<span
class="d-none d-xl-inline-block text-left text-wrap align-middle">{{ cio_currently_selected_budget.budget.name|slice(0,10) }}
{% if checkCustomerPermission('ALLOW_SHOW_TOTAL_POINTS', context) %}
<span class="text-nowrap" style="display: none;">
({{ cio_currently_selected_budget.currentState|number_format(0, ',', '.') }} {{ 'header.currency' | trans }})
</span>
{% endif %}
</span>
</button>
<div
class="dropdown-menu dropdown-menu-right account-menu-dropdown js-account-menu-dropdown"
aria-labelledby="budgetWidget">
<div class="card">
<div class="list-group list-group-flush">
{% for budget in cio_avaivable_budgets %}
<a class="list-group-item-action account-aside-item" {% if not loop.first %} style="border-top: 1px solid gray;" {% endif %}
href="{{ url('storefront.account.budgets.select', {
id: budget.budget.id,
redirectTo: cio_avaivable_budgets_redirect,
redirectToParams: cio_avaivable_budgets_redirect_params | json_encode
}) }}"><span><strong>{{ budget.storeName }}</strong></span>{% if budget.storeName %}   {% endif %}
<span>{{ budget.externalId }} - {{ budget.budget.name }}</span>
{% if checkCustomerPermission('ALLOW_SHOW_TOTAL_POINTS', context) and checkCustomerPermission('ALLOW_ADD_TO_CART', context) %}({{ budget.currentState|number_format(0, ',', '.') }} VPP){% endif %}
</a>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
{% sw_include '@Storefront/storefront/layout/header/actions/account-widget.html.twig' %}
</div>
{% endblock %}
{% endblock %}