{% extends "@openform_front_templates/base.html.twig" %}
{% block bodyAttr %}data-page="detail-page"{% endblock %}
{% block contentClass %}{{entity.menuVariant is defined and entity.menuVariant ? 'header-mak' : ''}}{% endblock %}
{% set pageSubTitle = entity.Translation[app.request.locale].title %}
{% set metaTitle = entity.Translation[app.request.locale].metaTitle ? entity.Translation[app.request.locale].metaTitle : entity.Translation[app.request.locale].title %}
{% set metaDescription = entity.Translation[app.request.locale].metaDescription %}
{% set metaKeywords = entity.Translation[app.request.locale].metaKeywords %}
{% set pageImage = entity.imagePath ? openform_front_util.getImagePathByType(entity.Thumb,'list') : '' %}
{% block header %}
{% include "@openform_front_templates/_includes/_header_mak.html.twig" with {'langLinks' : (langLinks is defined ? langLinks), item : entity} %}
{% endblock %}
{% block content %}
{% set mobile = openform_front_util.isMobileDevice() %}
{% if mobile %}
{% if rootParent.isExhibition is defined %}
{% set href = toolkit_route_localizer.generate('exhibition_item', { 'slug': rootParent.Translation[app.request.locale].slug}, app.request.locale) %}
{% elseif rootParent.isMak is defined %}
{% set href = toolkit_route_localizer.generate('mak_item', {'makSlug': rootParent.getMakSlug(app.request.locale), 'slug': rootParent.Translation[app.request.locale].slug}, app.request.locale) %}
{% endif %}
{% if href is defined %}
<a href="{{href}}" class="index-news__title--mobile-mak">{{rootParent.Translation[app.request.locale].titleHtml|raw}}</a>
{% endif %}
{% endif %}
{% if isDepartment == false %}
{% include "@openform_front_templates/_blocks_sections/block.html.twig" with { sections: openform_front_util.getSections(entity)|length > 0 ? openform_front_util.getSections(entity)|slice(0, 1) : '' } %}
{% endif %}
<section class="index-news">
<div class="index-news__wrapper index-news__wrapper--exh js-list-data container">
{# {% if isDepartment %} #}
<h1 class="index-news__title index-news__title--mak">{{ entity.Translation[app.request.locale].titleHtml|raw }}</h1>
{% if (entity.Translation[app.request.locale].text is defined and entity.Translation[app.request.locale].text) or (openform_front_util.getImagePathByType(entity.Thumb ?? '', 'detail')) %}
<div class="mak-block block-image block-image--position-left">
<div class="block-image__container">
<div class="block-image__text index-news__text-mak">
{% if entity.Translation[app.request.locale].text is defined %}
<div class="block__text">{{ entity.Translation[app.request.locale].text|raw }}</div>
{% endif %}
</div>
<div class="block-image__image">
{% set img = openform_front_util.getImagePathByType(entity.Thumb ?? '', 'detail') %}
{% if img %}
<img class="block-image__image__img" loading="lazy" src="{{ asset(img) }}" alt="{{ entity.Translation[app.request.locale].alt }}">
{% endif %}
</div>
</div>
</div>
{% endif %}
{# {% endif %} #}
{% set departments = entity.getVisibleDepartments(app.request.locale) %}
{% set hideDepartments = true %}
{% for department in departments|filter(department => department.isSkipped == false and department.Parent) %}
{% set hideDepartments = false %}
{% endfor %}
{% if entity.getVisibleDepartments(app.request.locale) is defined and entity.getVisibleDepartments(app.request.locale)|length > 0 and not hideDepartments %}
{% if isDepartment %}
<h1 class="index-news__title index-news__title--mak">{{ 'T_SUBDEPARTMENTS'|trans({}, 'openform_front', app.request.locale) }}</h1>
{% else %}
<h1 class="index-news__title index-news__title--mak">{{ 'T_DEPARTMENTS'|trans({}, 'openform_front', app.request.locale) }}</h1>
{% endif %}
{% endif %}
<div class="index-news__items js-result-content">
{# listowanie działów nie-ukrytych #}
{% for department in departments %}
{% if department.isSkipped == false and department.Parent %}
{% set departmentHref = toolkit_route_localizer.generate('exhibition_department_item',{ 'slug' : department.Translation[app.request.locale].slug }, app.request.locale) %}
{% set img = openform_front_util.getImagePathByType(department.Thumb ?? '', 'list') %}
<a class="news-item news-item--mak" href="{{ departmentHref }}" aria-label="{{ 'T_READ_MORE'|trans({}, 'openform_front', app.request.locale) }} {{ department.Translation[app.request.locale].title }}">
{% if img %}
<img class="news-item__image news-item__image--mak" loading="lazy" src="{{ asset(img) }}" alt="{{ department.Translation[app.request.locale].alt }}" />
{% endif %}
<div class="news-item__content">
<h2 class="news-item__title news-item__title--mak">{{ department.Translation[app.request.locale].titleHtml|raw }}</h2>
{#
<div class="news-item__date-wrapper">
<time class="news-item__date">
{{ department.publishDate|explodedDate(app.request.locale).D }}
{{ department.publishDate|explodedDate(app.request.locale).month }}
{{ department.publishDate|explodedDate(app.request.locale).y }}
</time>
</div>
#}
<p class="news-item__text news-item__text--mak">{{ department.Translation[app.request.locale].shortLead }}</p>
</div>
</a>
{% endif %}
{% endfor %}
</div>
{% if (entity.getVisibleRelictPacks is defined and entity.getVisibleRelictPacks(app.request.locale)|length > 0) %}
<h1 class="{{ hideDepartments ? 'index-news__title index-news__title--mak' : 'index-news__title mak__title index-news__title--mak' }}">{{ 'T_COLLECTIONS'|trans({}, 'openform_front', app.request.locale) }}</h1>
{% endif %}
<div class="mak__items mak__items--small-gap js-result-content">
{# listowanie kolekcji z działu aktualnego #}
{% if entity.getVisibleRelictPacks is defined %}
{% set relictPacks = entity.getVisibleRelictPacks(app.request.locale) %}
{% for relictPack in relictPacks %}
{% set relictPackHref = toolkit_route_localizer.generate('relict_pack_item', {'slug' : relictPack.Translation[app.request.locale].slug }, app.request.locale) %}
{% set img = openform_front_util.getImagePathByType(relictPack.Thumb ?? '', 'list') %}
<a class="news-item news-item--mak" href="{{ relictPackHref }}" aria-label="{{ 'T_READ_MORE'|trans({}, 'openform_front', app.request.locale) }} {{ relictPack.Translation[app.request.locale].title }}">
{% if img %}
<img class="news-item__image news-item__image--mak" loading="lazy" src="{{ asset(img) }}" alt="{{ relictPack.Translation[app.request.locale].alt }}">
{% endif %}
<div class="news-item__content">
<h2 class="news-item__title news-item__title--mak">{{ relictPack.Translation[app.request.locale].titleHtml|raw }}</h2>
{#
<div class="news-item__date-wrapper">
<time class="news-item__date">
{{ relictPack.publishDate|explodedDate(app.request.locale).D }}
{{ relictPack.publishDate|explodedDate(app.request.locale).month }}
{{ relictPack.publishDate|explodedDate(app.request.locale).y }}
</time>
</div>
#}
<p class="news-item__text news-item__text--mak">{{ relictPack.Translation[app.request.locale].shortLead }}</p>
</div>
</a>
{% endfor %}
{% endif %}
{# listowanie kolekcji z podrzędnych działów ukrytych #}
{% for key, department in departments %}
{% if department.isSkipped == true %}
{% set relictPacks = department.getVisibleRelictPacks(app.request.locale) %}
{% if entity.getVisibleRelictPacks is defined and entity.getVisibleRelictPacks(app.request.locale)|length > 0 %}
<h1 class="index-news__title mak__title index-news__title--mak">{{ 'T_COLLECTIONS'|trans({}, 'openform_front', app.request.locale) }}</h1>
{% elseif not hideDepartments %}
<h1 class="index-news__title mak__title index-news__title--mak">{{ 'T_COLLECTIONS'|trans({}, 'openform_front', app.request.locale) }}</h1>
{% else %}
<h1 class="{{ key == 0 ? 'index-news__title index-news__title--mak' : 'index-news__title mak__title index-news__title--mak' }}">{{ 'T_COLLECTIONS'|trans({}, 'openform_front', app.request.locale) }}</h1>
{% endif %}
{% for relictPack in department.RelictPack %}
{% set relictPackHref = toolkit_route_localizer.generate('relict_pack_item',{ 'slug' : relictPack.Translation[app.request.locale].slug }, app.request.locale) %}
{% set img = openform_front_util.getImagePathByType(relictPack.Thumb ?? '','list') %}
<a class="news-item news-item--mak" href="{{ relictPackHref }}" aria-label="{{ 'T_READ_MORE'|trans({}, 'openform_front', app.request.locale) }} {{ relictPack.Translation[app.request.locale].title }}">
{% if img %}
<img class="news-item__image news-item__image--mak" loading="lazy" src="{{asset(img)}}" alt="{{ relictPack.Translation[app.request.locale].alt }}">
{% endif %}
<div class="news-item__content">
<h2 class="news-item__title news-item__title--mak">{{ relictPack.Translation[app.request.locale].titleHtml|raw }}</h2>
{#
<div class="news-item__date-wrapper">
<time class="news-item__date">
{{ relictPack.publishDate|explodedDate(app.request.locale).D }}
{{ relictPack.publishDate|explodedDate(app.request.locale).month }}
{{ relictPack.publishDate|explodedDate(app.request.locale).y }}
</time>
</div>
#}
<p class="news-item__text news-item__text--mak">{{ relictPack.Translation[app.request.locale].shortLead }}</p>
</div>
</a>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
</section>
{% if isDepartment %}
{% include "@openform_front_templates/_blocks_sections/block.html.twig" with { sections: openform_front_util.getSections(entity)|length > 0 ? openform_front_util.getSections(entity):''} %}
{% else %}
{% include "@openform_front_templates/_blocks_sections/block.html.twig" with { sections: openform_front_util.getSections(entity)|length > 0 ? openform_front_util.getSections(entity)|slice(1, openform_front_util.getSections(entity)|length) : '' } %}
{% endif %}
{% endblock %}