{namespace neos=Neos\Neos\ViewHelpers}
{namespace vh=Newland\NeosViewHelpers\ViewHelpers}
{namespace poi=Newland\Toubiz\Poi\Neos\ViewHelpers}

<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="SplitScreenWrapper" arguments="{_all}" contentAs="content">
                            <vh:render partial="FilteredLists/ResultsContainer" arguments="{_all}"/>
                        </vh:render>
                    </f:then>
                    <f:else>
                        <vh:render renderable="{filter}" />
                        <vh:render partial="FilteredLists/ResultsContainer" arguments="{_all}"/>
                    </f:else>
                </f:if>
            </poi:splitscreen.configuration>

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


<f:section name="SplitScreenWrapper">
    <div
        class="tb-map-list-splitscreen"
        data-toubiz-results.splitscreen.active-classes="tb-map-list-splitscreen--is-active">

        <f:if condition="{splitScreenEnabled}">
            <div class="tb-map-list-splitscreen__toggle-wrapper">
                <a
                    href="#"
                    class="tb-splitscreen-trigger"
                    data-toubiz-results.splitscreen.trigger
                    data-toubiz-results.splitscreen.active-classes="tb-splitscreen-trigger--is-active">

                    <span class="tb-splitscreen-trigger__label tb-splitscreen-trigger__label--show">
                        <f:translate id="action.show" source="Views/Splitscreen" package="Newland.NeosFiltering" />
                    </span>
                    <span class="tb-splitscreen-trigger__label tb-splitscreen-trigger__label--hide">
                        <f:translate id="action.hide" source="Views/Splitscreen" package="Newland.NeosFiltering" />
                    </span>
                </a>
            </div>
        </f:if>

        <div class="tb-map-list-splitscreen__header">
            <vh:render renderable="{filter}" />
        </div>

        <div class="tb-map-list-splitscreen__body">
            <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="SplitscreenMapAttributes">
    data-toubiz-results.splitscreen.map-container
    data-toubiz-results.splitscreen.map-type="{split.mapType}"
    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>
