{% from '@openform_front_templates/_includes/_icons.html.twig' import searchprev, searchnext %}
{% macro paginator(page, pages, entitiesCount) %}
{% if pages > 0 %}
<div class="search-result-list__pagination" id="load-more-container">
{% if page > 1 %}
<button class="search-result-list__pagination__btn" onClick="loadAjax({{ page-1 }})">
<span>{{ searchprev('PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span>{{'PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}}
</button>
{% else %}
<button class="search-result-list__pagination__btn" onClick="loadAjax({{ page-1 }})" disabled>
<span>{{ searchprev('PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span> {{'PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}}
</button>
{% endif %}
<div class="search-result-list__pagination__content">
{{ entitiesCount }} {{entitiesCount > 4 ? 'SEARCH_RESULTS'|trans({}, 'openform_front', app.request.locale) : entitiesCount < 5 and entitiesCount > 1 ? 'SEARCH_RESULTSS'|trans({}, 'openform_front', app.request.locale) : 'SEARCH_RESULT'|trans({}, 'openform_front', app.request.locale) }} / {{'SEARCH_PAGE'|trans({}, 'openform_front', app.request.locale)}} {{ page }} {{'SEARCH_OF'|trans({}, 'openform_front', app.request.locale)}} {{ pages }}
</div>
{% if page < pages %}
<button class="search-result-list__pagination__btn" onClick="loadAjax({{ page+1}})">
{{'NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}} <span>{{ searchnext('NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span>
</button>
{% else %}
<button class="search-result-list__pagination__btn" onClick="loadAjax({{ page+1}})" disabled>
{{'NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}} <span>{{ searchnext('NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span>
</button>
{% endif %}
</div>
{% endif %}
{% endmacro %}
{% import _self as macros %}
{{ _self.paginator(page, pages, entitiesCount) }}
<div class="search-result-list__items">
{% if entities|length == 0 %}
{{ 'T_NO_RESULTS'|trans({}, 'openform_front', app.request.locale) }}
{% endif %}
{% for search in entities %}
<div class="search-result-list__item">
{# ANTIQUE #}
{% if search.Antique %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Antique,
entityName: 'Antique',
url: toolkit_route_localizer.generate('antique_item', {'slug': search.Antique.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# ANTIQUE SUIT #}
{% if search.AntiqueSuit %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.AntiqueSuit,
entityName: 'AntiqueSuit',
url: toolkit_route_localizer.generate('antique_suit_item', {'slug': search.AntiqueSuit.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# MUSEUM #}
{% if search.Museum %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Museum,
entityName: 'Museum',
url: toolkit_route_localizer.generate('mak_item', {'makSlug':'muzea','slug': search.Museum.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# MUZEUM DEPARTMENT #}
{% if search.MuseumDepartment %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.MuseumDepartment,
entityName: 'MuseumDepartment',
url: toolkit_route_localizer.generate('mak_department_item', {'makSlug':'muzea','slug': search.MuseumDepartment.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# ARCHIVE #}
{% if search.Archive %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Archive,
entityName: 'Archive',
url: toolkit_route_localizer.generate('mak_item', {'makSlug':'archiwa','slug': search.Archive.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# ARCHIVE DEPARTMENT #}
{% if search.ArchiveDepartment %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.ArchiveDepartment,
entityName: 'ArchiveDepartment',
url: toolkit_route_localizer.generate('mak_department_item', {'makSlug':'archiwa','slug': search.ArchiveDepartment.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# PRIVATE COLLECTION #}
{% if search.PrivateCollection %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.PrivateCollection,
entityName: 'PrivateCollection',
url: toolkit_route_localizer.generate('mak_item', {'makSlug':'kolekcje-prywatne','slug': search.PrivateCollection.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# PRIVATE COLLECTION DEPARTMENT #}
{% if search.PrivateCollectionDepartment %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.PrivateCollectionDepartment,
entityName: 'PrivateCollectionDepartment',
url: toolkit_route_localizer.generate('mak_department_item', {'makSlug':'kolekcje-prywatne','slug': search.PrivateCollectionDepartment.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# NEWS #}
{% if search.News %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.News,
entityName: 'News',
url: toolkit_route_localizer.generate('news_item', {'slug': search.News.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# ABOUT US #}
{% if search.AboutUs %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.AboutUs,
entityName: 'AboutUs',
url: toolkit_route_localizer.generate('about_us_item', {'slug': search.AboutUs.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# PROPOSAL #}
{% if search.Proposal %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Proposal,
entityName: 'Proposal',
url: toolkit_route_localizer.generate('proposal_item', {'slug': search.Proposal.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# EXHIBITION #}
{% if search.Exhibition %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Exhibition,
entityName: 'Exhibition',
url: toolkit_route_localizer.generate('exhibition_item', {'slug': search.Exhibition.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# EXHIBITION DEPARTMENT #}
{% if search.ExhibitionDepartment %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.ExhibitionDepartment,
entityName: 'ExhibitionDepartment',
url: toolkit_route_localizer.generate('exhibition_department_item', {'slug': search.ExhibitionDepartment.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# RELICT #}
{% if search.Relict %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Relict,
entityName: 'Relict',
url: toolkit_route_localizer.generate('relict_item', {'slug': search.Relict.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# RELICT PACK #}
{% if search.RelictPack %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.RelictPack,
entityName: 'RelictPack',
url: toolkit_route_localizer.generate('relict_pack_item', {'slug': search.RelictPack.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# MENU PAGE #}
{% if search.MenuPage %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.MenuPage,
entityName: 'MenuPage',
url: toolkit_route_localizer.generate('menu_page', {
'slug': search.MenuPage.Translation[app.request.locale].slug,
'makSlug': search.MenuPage.getMakSlug(app.request.locale),
'rootParentSlug': search.MenuPage.rootParentSlug(app.request.locale),
}, app.request.locale)
} %}
{% endif %}
{# MISSION #}
{% if search.Mission %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Mission,
entityName: 'Mission',
url: toolkit_route_localizer.generate('mission_item', {'slug': search.Mission.Translation[app.request.locale].slug}, app.request.locale)
} %}
{% endif %}
{# PAGE #}
{% if search.Page %}
{% if search.Page.idName|length > 0 %}
{% set url = openform_front_util.pageUrlByIdName(search.Page.idName, app.request.locale) %}
{% else %}
{% set url = toolkit_route_localizer.generate('page', {'slug': search.Page.Translation[app.request.locale].slug}, app.request.locale) %}
{% endif %}
{% include "@openform_front_templates/Search/_search-item.html.twig" with {
entity: search.Page,
entityName: 'Page',
url: url
} %}
{% endif %}
</div>
{% endfor %}
</div>
{{ _self.paginator(page, pages) }}