{% for calendar_month in calendar %}
{% for weekIndex in 0..5 %} {% for dayIndex in 0..6 %} {# @var dayState \AppBundle\Util\CalendarDayState #} {% set dayState = calendar_month['data'][(weekIndex * 7) + dayIndex] %} {% set is_past_date = dayState.date is not empty and date(dayState.date) < date('now') %} {# Set cell class #} {% if is_past_date or (dayState.isReserved and not dayState.isReservationBegin and not dayState.isReservationEnd) or not dayState.isInSeason %} {% set cell_class = 'calendar-day-disabled' %} {% elseif dayState.isReservationBegin %} {% set cell_class = 'calendar-day-reservation-begin' %} {% elseif dayState.isReservationEnd %} {% set cell_class = 'calendar-day-reservation-end' %} {% else %} {% set cell_class = '' %} {% endif %} {% endfor %} {% endfor %}
{{ calendar_month['monthName'] }} {{ calendar_month['year'] }}
Mo Di Mi Do Fr Sa So
{% if dayState.isBookable and not is_past_date %} {{ dayState.day }} {% elseif dayState.day == 0 %} - {% elseif cell_class == '' %} {{ dayState.day }} {% else %} {{ dayState.day }} {% endif %}
{% endfor %}