{% extends '/web/base.html.twig' %}
{% block description %}{{ category.description }}{% endblock %}
{% block body %}
<section class="mt-0">
<div class="container">
{% block breadcrumbs %}
{{ render(path('fragment_category_breadcrumbs', {'category' : category.id})) }}
{% endblock %}
<h1>{{ category.name|raw }}</h1>
{{ category.html|raw }}
{# {{ dump(categories) }} #}
{% block categories %}
{% if categories|length > 0 %}
{% for category in categories %}
<section class="mt-10">
<h2>{{ category.name }}</h2>
<div class="grid grid--5 mt-5">
{% for subcategoryRelation in category.categoryCategories %}
<div class="category-card">
{% set subcategory = subcategoryRelation.categorySub %}
{% if subcategory.upload and subcategory.upload.path %}
<img src="{{ subcategory.upload.path }}" alt="{{ subcategory.name }}" class="category-card__image">
{% endif %}
<a href="{{ path('shop_category_detail', {'slug':subcategory.slug}) }}" class="category-card__title">
{{ subcategory.name }}
</a>
{# {% if subcategory.description %}
<div class="category-card__description">
{{ subcategory.description }}
</div>
{% endif %} #}
{% set subsubcategories = find_sub_categories_with_type(subcategory.id, 6) %}
{% if subsubcategories|length > 0 %}
<ul class="category-card__subcategories">
{% for subsubcategory in subsubcategories|slice(0, 2) %}
<li>
<a href="{{ path('shop_category_detail', {'slug':subsubcategory.slug}) }}">
{{ subsubcategory.name }}
</a>
</li>
{% endfor %}
{% if subsubcategories|length > 2 %}
<li>
<a href="{{ path('shop_category_detail', {'slug':subcategory.slug}) }}">
{% trans %}a další{% endtrans %}
</a>
</li>
{% endif %}
</ul>
{% else %}
<ul class="category-card__subcategories">
{% for relation in subcategory.categoryProducts|slice(0, 2) %}
{% set product = relation.product %}
<li>
<a href="{{ path('shop_product', {'slug':product.slug}) }}">
{{ product.name }}
</a>
</li>
{% endfor %}
{% if subcategory.categoryProducts|length > 2 %}
<li>
<a href="{{ path('shop_category_detail', {'slug':subcategory.slug}) }}">
{% trans %}a další{% endtrans %}
</a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
{% endfor %}
</div>
<a href="{{ path('shop_category_detail', {'slug':category.slug}) }}" class="category-tile"></a>
</section>
{% endfor %}
{% endif %}
{% endblock %}
{#
{% block products %}
{% if products|length > 0 %}
{{ include('/shop/product/_product_tiles.html.twig', {products: products}) }}
{% endif %}
{% endblock %}
#}
</div>
</section>
{% set inspirations = get_information_blocks(category, 1, constant('App\\Enum\\InformationBlockType::Inspirations').value) %}
{% if inspirations|length > 0 %}
{% for inspiration in inspirations %}
{{ inspiration.text|raw }}
{% endfor %}
{% endif %}
{% set partners = get_information_blocks(category, 1, constant('App\\Enum\\InformationBlockType::Partners').value) %}
{% if partners|length > 0 %}
<section>
<div class="container">
{% for partner in partners %}
{{ partner.text|raw }}
{% endfor %}
</div>
</section>
{% endif %}
{% endblock %}