{namespace ot=Opentalent\OtTemplating\ViewHelpers}

<f:comment><!-- All events --></f:comment>

<div class="ot-all-events">
    <div class="events-controls">
        <div class="event-search">
            <h3>Rechercher un évènement: </h3>
            <form>
                <input type="text"
                       name="search-loc"
                       placeholder="Où?"
                       value="{ot:request.getArgument(argument: 'search-loc')}"/>
                <input type="text"
                       name="search-name"
                       placeholder="Quoi?"
                       value="{ot:request.getArgument(argument: 'search-name')}" />
                <input type="text"
                       name="search-datestart"
                       placeholder="Depuis le..."
                       class="datepicker datetimepicker"
                       value="{ot:request.getArgument(argument: 'search-datestart')}" />
                <input type="text"
                       name="search-dateend"
                       placeholder="Jusqu'au..."
                       class="datepicker datetimepicker"
                       value="{ot:request.getArgument(argument: 'search-dateend')}" />

                <button name="search-submit">Rechercher</button>
            </form>
        </div>

        <div id="event-map" data-records="">
            <f:for each="{events}" as="event">
                <f:if condition="{event.longitude}">
                    <f:then>
                        <i class="item-geodata" style="display: none;"
                           data-id="{event.id}"
                           data-long="{event.longitude}"
                           data-lat="{event.latitude}"
                           data-label="<b>{event.name}</b><br/>{event.streetAdress}">
                        </i>
                    </f:then>
                </f:if>
            </f:for>
        </div>
    </div>

    <div class="events-results">
        <f:if condition="{events -> f:count()} == 0">
            <span>Aucun résultat</span>
        </f:if>

        <f:for each="{events}" as="event">
            <div class="event" data-id="{event.id}">
                <div class="event-preview">

                    <div class="event-poster">
                        <f:if condition="{event.image}">
                            <f:then>
                                <img src='{event.image}' alt="poster" />
                            </f:then>
                            <f:else>
                                <f:image src="EXT:ot_templating/Resources/Public/media/event-default.jpg" alt="poster" />
                            </f:else>
                        </f:if>
                    </div>

                    <div class="event-summary">
                <span class="event-name">
                    {event.name}
                </span>
                        <span class="event-loc-date">
                    {event.locAndDate}
                </span>
                        <span class="event-description">
                    {event.shortDescription}
                </span>
                    </div>
                </div>

                <f:link.page class="event-see"
                             additionalParams="{eventId: event.id}">
                    <i class="fa fa-plus" style="margin-right: 5px;"></i>
                    <span>Plus d'infos</span>
                </f:link.page>
            </div>
        </f:for>
    </div>
</div>
