{namespace neos=Neos\Neos\ViewHelpers}

<div class="tb-event-teaser-list block">
    <f:if condition="{eventDates}">
        <ul class="tb-event-teaser-list__items m-0 p-0">
            <f:for each="{eventDates}" as="eventDate" iteration="iteration">
                <li class="tb-event-teaser-list-item m-0 m-0 {f:if(condition: iteration.isFirst, else: 'mt-2 pt-2 border-t border-grey-lighter')}">
                    <p class="tb-event-teaser-list-item__topline m-0 text-sm">
                        <f:format.date
                            date="{eventDate.beginsAt}"
                            cldrFormat="E, dd. MMMM y"
                            forceLocale="{targetNode.context.dimensions.language.0}" />

                        <f:if condition="{eventDate.beginsAtSpecificTime}">
                            |
                            {eventDate.beginsAt -> f:format.date(format: 'H:i')}
                            {f:translate(id: 'views._shared.word.clock', package: 'Newland.Toubiz.Events.Neos')}
                        </f:if>
                    </p>

                    <h3 class="tb-event-teaser-list-item__title m-0 text-lg">
                        <f:if condition="{targetNode}">
                            <f:then>
                                <neos:link.node
                                    node="{targetNode}"
                                    arguments="{
                                        --newland_toubiz_events_neos-full: {
                                            '@package': 'newland.toubiz.events.neos',
                                            '@controller': 'events',
                                            '@action': 'show',
                                            event: eventDate.event
                                        }
                                    }"
                                    class="tb-event-teaser-list-item__link">

                                    {eventDate.event.title}
                                </neos:link.node>
                            </f:then>
                            <f:else>
                                {eventDate.event.title}
                            </f:else>
                        </f:if>
                    </h3>
                    <p class="tb-event-teaser-list-item__subline m-0 text-sm">{eventDate.event.location.city}</p>
                </li>
            </f:for>
        </ul>
    </f:if>
</div>
