<html
  xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
  xmlns:cal="http://typo3.org/ns/Ig/IgReservations/ViewHelpers"
  xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
  data-namespace-typo3-fluid="true">
<div class="timeslot-name" title="Reserviert: {event.reservations->f:count()}
Frei: {event.freePlaces->f:count()}">{event.timeslot.name}</div>
<div class="timeslot-reservations entry-reservations">
  <f:spaceless>
        <f:for each="{event.reservations}" as="reservation" iteration="iterator">
            <cal:reservation.canRemove reservation="{reservation}">
                <f:then>
                    <cal:reservation.remove reservation="{reservation}" confirm-button-ok-text="Eintrag löschen" confirm-title="Eintrag löschen?"
                        confirm-content="Reservation von: {reservation.frontendUser.lastName} {reservation.frontendUser.firstName}{f:if(condition: reservation.name, then: '<br />Gast: {reservation.name}')}">
                        <f:render partial="Reservation/Item" arguments="{_all}" />
                    </cal:reservation.remove>
                </f:then>
                <f:else>
                    <f:render partial="Reservation/Item" arguments="{_all}" />
                </f:else>
            </cal:reservation.canRemove>
        </f:for>

        <f:for each="{event.freePlaces}" as="freePlace">
            <span class="entry-reservation free-place" title="Freier Platz"></span>
        </f:for>
    </f:spaceless>
</div>
<div class="timeslot-action">

    <f:comment>*** Buchen ***</f:comment>
    <cal:calendar.isAdmin calendar="{calendar}">
      <cal:event.canAdminBook event="{event}">
	<f:then>
          <cal:event.menu event="{event}" class="button button-menu">
                <core:icon identifier="actions-menu-alternative" size="small" alternativeMarkupIdentifier="inline" />
          </cal:event.menu>
	  </f:then>
	<f:else>
          <cal:event.command action="eventShow" event="{event}" lightbox="1" class="button button-show"><core:icon identifier="actions-view" size="small" alternativeMarkupIdentifier="inline" /></cal:event.command>
        </f:else>
        </cal:event.canAdminBook>
    </cal:calendar.isAdmin>
    <cal:event.canAddReservation event="{event}">
        <f:then>

            <cal:reservation.add event="{event}" class="button button-new">
                <core:icon identifier="actions-add" size="small" alternativeMarkupIdentifier="inline" /><span class="label">
                    <f:translate key="events.new" /></span></cal:reservation.add>
            <f:comment>
                <f:link.action class="button button-new" action="new" pluginName="Publiccalendar" controller="Reservation"
                    arguments="{search: search, date: '{event.date->f:format.date(format: \'%Y-%m-%d\')}', timeslot: event.timeslot, calendar: event.calendar}" title="{f:translate(key: 'events.new')}">
                    <core:icon identifier="actions-add" size="small" alternativeMarkupIdentifier="inline" /><span class="label">
                        <f:translate key="events.new" /></span></f:link.action>
            </f:comment>
        </f:then>
        <f:else>
        </f:else>
    </cal:event.canAddReservation>
    <f:comment>*** Abmelden ***</f:comment>
    <cal:event.canRemoveReservation event="{event}">
        <f:then>
            <cal:reservation.remove reservation="{event.userReservation.0}" class="button button-delete">
                <core:icon identifier="actions-delete" size="small" alternativeMarkupIdentifier="inline" /><span class="label">
                    <f:translate key="events.unregister" /></span>
            </cal:reservation.remove>
            <f:comment>
                <f:link.action data="{confirm-title: 'Reservation wirklich löschen?'}" class="button button-delete delete-link" action="delete" pluginName="Publiccalendar" controller="Reservation"
                    arguments="{search: search, reservation: event.userReservation.0}" title="{f:translate(key: 'events.unregister')}">
                    <core:icon identifier="actions-delete" size="small" alternativeMarkupIdentifier="inline" /><span class="label">
                        <f:translate key="events.unregister" /></span></f:link.action>
            </f:comment>
        </f:then>
        <f:else>
        </f:else>
    </cal:event.canRemoveReservation>
</div>

</html>
