{namespace vh=Newland\NeosViewHelpers\ViewHelpers}
{namespace common=Newland\Toubiz\Common\Neos\ViewHelpers}

<common:slot.render slot="aboveListResults" context="{ articles: articles, filter: filter }" />

<vh:render renderable="{filter.statusIndicators}" />

<div class="mb-6 sm:flex">
    <p class="flex-shrink-0 block sm:inline">
        <vh:translate
            id="filters.results"
            package="Newland.Toubiz.Poi.Neos"
            source="Views/FilteredLists"/>:

        <span class="font-bold mr-1">
            <f:if condition="{pagination.count.items} <= 12">
                <f:then>
                    <f:if condition="{pagination.count.items} < 2">
                        <f:then>
                            <f:comment><!-- 0 or 1 items existing on first page --></f:comment>
                            {pagination.count.items}
                        </f:then>
                        <f:else>
                            <f:comment><!-- less or equal 12 items on first page but not 0 or 1 --></f:comment>
                            1-{pagination.count.items}
                        </f:else>
                    </f:if>
                </f:then>
                <f:else>
                    <f:if condition="{pagination.page} == {pagination.count.pages}">
                        <f:then>
                            <f:comment><!-- last page --></f:comment>
                            {pagination.page * 12 - 11}-{pagination.count.items}
                        </f:then>
                        <f:else>
                            <f:comment><!-- Any page in between --></f:comment>
                            {pagination.page * 12 - 11}-{12 * pagination.page}
                        </f:else>
                    </f:if>
                </f:else>
            </f:if>

            <f:comment><!-- only show if not 0 or 1 items are displayed --></f:comment>
            <f:if condition="{pagination.count.items} > 1">
                <f:then>
                    <span>
                        von {pagination.count.items}
                    </span>
                </f:then>
            </f:if>
        </span>
    </p>
</div>

<f:if condition="{articles -> f:count()} > 0">
    <f:then>
        <vh:render
            partial="FilteredLists/FilteredList"
            arguments="{
                articles: articles,
                pagination: pagination,
                targetNode: targetNode,
                node: node,
                query: query,
                layout: layout
            }"/>

    </f:then>
    <f:else>
        <p>Für Ihre Suche konnten leider keine Ergebnisse gefunden werden</p>
    </f:else>
</f:if>
<common:slot.render slot="belowListResults" context="{ articles: articles, filter: filter }" />
