{% extends '@SyliusShop/layout.html.twig' %}
{% set taxon = get_taxon_by_slug(app.request.attributes.get('slug'), sylius.localeCode) %}
{% set menuTaxons = get_menu_taxon_by_slug(taxon, sylius.localeCode) %}
{% block stylesheets %}
{{ parent() }}
{{ encore_entry_link_tags('shop-category-view', null, 'bootstrapTheme') }}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{{ encore_entry_script_tags('shop-category-view', null, 'bootstrapTheme') }}
{% endblock %}
{% block title %}
{{ sylius_template_event('dedi_sylius_seo_plugin.title', { resource: taxon ?? product ?? sylius.channel, title: taxon }) }}
{% endblock %}
{% block breadcrumb %}
{% include '@SyliusShop/Taxon/_breadcrumb.html.twig' %}
{% endblock %}
{% block content %}
{#{% include '@SyliusShop/Product/Index/_header.html.twig' %}#}
{% if taxon.isRoot() %}
<div class="catalog catalog-all">
{% include '@SyliusShop/Product/Index/_all_categories.html.twig' with { 'taxon': taxon } %}
</div>
{% elseif taxon.parent and not taxon.parent.isRoot() %}
<div class="row taxons">
<div class="d-none d-md-block col-md-4 col-lg-3 col-xl-3 col-xxl-2">
{% include '@SyliusShop/Product/Index/_sidebar.html.twig' %}
</div>
<div class="col-12 col-md-8 col-lg-9 col-xxl-10">
<h1 class="taxon-title">{{ taxon.name }}</h1>
{% if taxon.description %}
<div class="taxon-description">{{ taxon.description }}</div>
{% endif %}
{% set taxonChildren = taxon.children %}
{% if taxonChildren|length %}
<h4 class="title d-md-none">{{ 'app.ui.taxon.subtaxons' | trans }}</h4>
<div class="subtaxons row row-cols-2 g-3 mb-5 row-cols-sm-3 d-md-none">
{% for child in taxonChildren %}
{% if child.enabled %}
<div class="subtaxons-item col">
<a class="subtaxons-link d-flex align-items-center h-100 p-3 border rounded link-no-decoration cfs-7 lh-1 fw-normal" href="{{ path('sylius_shop_product_index', {'slug': child.redirect ?: child.slug, '_locale': child.translation.locale}) }}">{{ child.name }}</a>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% include '@SyliusShop/Product/Index/_main.html.twig' with { 'taxon': taxon } %}
</div>
</div>
{% elseif taxon.parent and taxon.parent.isRoot() %}
<div class="catalog catalog-taxon">
{#{{ dump(taxon) }}#}
<div class="taxon mb-4">
<h1 class="custom-display-4 text-center">{{ taxon.name }}</h1>
{% if taxon.description is not empty %}
<div class="description">
{{ taxon.description|raw }}
</div>
{% endif %}
</div>
{% for taxonItem in menuTaxons %}
{#{{ dump(taxonItem) }}#}
{% set taxonItemImage = taxonItem.imagesByType('catalog') is not empty %}
<div class="taxon-item row py-4{% if not loop.first %} mt-6{% endif%}{% if loop.index is odd %} bg-light{% endif %}">
{% if taxonItem.imagesByType('catalog') is not empty %}
<div class="taxon-item-img-wrap d-none d-lg-block col-lg-6 col-xxxxl-5 col-xxxxxl-4 ps-lg-4">
<a href="{{ path('sylius_shop_product_index', {'slug': taxonItem.redirect ?: taxonItem.slug, '_locale': taxonItem.translation.locale}) }}">
{#<picture>#}
{# <source srcset="{{ taxonItem.imagesByType('catalog').first.path|imagine_filter('app_shop_taxon_catalog_desktop') }}" media="(min-width: 992px)">#}
{# <source srcset="{{ taxonItem.imagesByType('catalog').first.path|imagine_filter('app_shop_taxon_catalog_mobile') }}">#}
{# <img class="taxon-item-img" src="{{ taxonItem.imagesByType('catalog').first.path|imagine_filter('app_shop_original') }}" alt="{{ taxonItem.name }}">#}
{#</picture>#}
<img class="taxon-item-img lazy" src="{{ taxonItem.imagesByType('catalog').first.path|imagine_filter('app_shop_taxon_catalog_desktop_small') }}" data-src="{{ taxonItem.imagesByType('catalog').first.path|imagine_filter('app_shop_taxon_catalog_desktop') }}" alt="{{ taxonItem.name }}">
</a>
</div>
{% endif %}
<div class="taxon-item-text d-flex flex-column justify-content-center col-lg-6 col-xxxxl-7 col-xxxxxl-8{% if loop.index is odd %} order-lg-first{% endif %}">
<div class="taxon-item-text-content{# p-4#}">
<h2 class="taxon-item-title custom-display-7 mb-0 text-center d-flex flex-column justify-content-center text-lg-start"
onclick="window.location.href='{{ path('sylius_shop_product_index', {'slug': taxonItem.redirect ?: taxonItem.slug, '_locale': taxonItem.translation.locale}) }}'"
{% if taxonItemImage %}style="background-image: url({{ taxonItem.imagesByType('catalog').first.path|imagine_filter('app_shop_taxon_catalog_mobile') }});"{% endif %}
>
<span class="taxon-item-title-text">{{ taxonItem.name }}</span>
</h2>
{% if taxonItem.description is not empty %}
<div class="description fw-normal mt-3">{{ taxonItem.description|raw }}</div>
{% endif %}
{{ render(url('app_shop_products_by_label_code_and_taxon_slug', {
'labelCode': 'top',
'taxonSlug': taxonItem.redirect ?: taxonItem.slug,
'count': 20,
'template': '@SyliusShop/Product/Box/_top_products_slider.html.twig'
})) }}
</div>
</div>
{#<div class="link">#}
{# <a href="{{ path('sylius_shop_product_index', {'slug': taxonItem.slug, '_locale': taxonItem.translation.locale}) }}">{{ 'app.ui.taxon.view' | trans }}</a>#}
{#</div>#}
{# <div class="col-12 mt-4 text-end">#}
{# <a class="btn btn-lg btn-outline-primary d-inline-flex align-items-center" href="{{ path('sylius_shop_product_index', {'slug': taxonItem.slug, '_locale': taxonItem.translation.locale}) }}">{{ 'app.ui.taxon.view'|trans }}<svg class="icon icon-xl bi-arrow-right-short ms-2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path fill-rule="evenodd" d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z"/></svg></a>#}
{# </div>#}
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}