{namespace neos=Neos\Neos\ViewHelpers}
{namespace vh=Newland\NeosViewHelpers\ViewHelpers}
{namespace poi=Newland\Toubiz\Poi\Neos\ViewHelpers}
<f:comment>
    @todo Pass hideFilters as argument to renderable to remove filters form markup instead of hiding via CSS
</f:comment>

<f:layout name="Default"/>

<f:section name="Content">
    <f:if condition="{format} === 'ajax'">
        <f:then>
            <vh:render partial="FilteredLists/Result" arguments="{_all}"/>
        </f:then>
        <f:else>
            <poi:splitscreen.configuration mainType="{node.properties.articleType}" configurationAs="split">
                <f:if condition="{split.enabled}">
                    <f:then>
                        <vh:render section="WrapperWithSplitScreen" arguments="{_all}" contentAs="content">
                            <vh:render partial="FilteredLists/ResultsContainer" arguments="{_all}"/>
                        </vh:render>
                    </f:then>
                    <f:else>
                    <vh:render section="WrapperWithoutSplitScreen" arguments="{_all}" contentAs="content">
                        <vh:render partial="FilteredLists/ResultsContainer" arguments="{_all}"/>
                    </vh:render>
                    </f:else>
                </f:if>
            </poi:splitscreen.configuration>

        </f:else>
    </f:if>
</f:section>


<f:section name="WrapperWithSplitScreen">
    <div
        class="tb-map-list-splitscreen tb-results{f:if(condition: hideFilters, then: ' tb-results--filter-hidden')}"
        data-toubiz-results.splitscreen.active-classes="tb-map-list-splitscreen--is-active">

        <div class="tb-map-list-splitscreen__header">
            <vh:render renderable="{filter}" />
            <vh:render partial="FilteredLists/SplitscreenToggle" arguments="{_all}"/>
        </div>

        <div class="tb-map-list-splitscreen__body" data-toubiz-results.splitscreen.scroll-container>
            <div class="tb-map-list-splitscreen__map" {vh:render(section: 'SplitscreenMapAttributes')}></div>
            <div class="tb-map-list-splitscreen__list">
                {content -> f:format.raw()}
            </div>
        </div>
    </div>
</f:section>

<f:section name="WrapperWithoutSplitScreen">
    <div class="tb-results{f:if(condition: hideFilters, then: ' tb-results--filter-hidden')}">
        <div class="tb-results__header">
            <vh:render renderable="{filter}" />
        </div>

        {content -> f:format.raw()}
    </div>
</f:section>

<f:section name="SplitscreenMapAttributes">
    data-toubiz-results.splitscreen.map-container
    data-toubiz-results.splitscreen.map-type="{split.mapType}"
    data-toubiz-results.splitscreen.link-target="_self"
    data-toubiz-results.splitscreen.map.clustering.color="{split.clustering.color}"
    data-toubiz-results.splitscreen.map.clustering.background-color="{split.clustering.backgroundColor}"
    data-toubiz-results.splitscreen.map.google-maps-api-key="{split.apiKeys.googleMaps}"
    data-toubiz-results.splitscreen.map.toursprung-api-key="{split.apiKeys.toursprung}"

    <f:for each="{split.toursprungMapStyle}" as="style" iteration="i">
        data-toubiz-results.splitscreen.map.toursprung-map-style.{i.index}.identifier="{style.identifier}"
    </f:for>

    <f:for each="{split.googleMapStyle}" as="style" iteration="i">
        data-toubiz-results.splitscreen.map.google-map-style.{i.index}.identifier="{style.identifier}"
    </f:for>
</f:section>
