76 lines
3.5 KiB
Twig
76 lines
3.5 KiB
Twig
|
|
{% set counter = 0 %}
|
|
{% for calendar_month in calendar %}
|
|
{% set counter = counter + 1 %}
|
|
{% if counter%2 != 0 %}
|
|
<div class="row" style="">
|
|
{% endif %}
|
|
|
|
|
|
<div class="col-xs-12 col-sm-6">
|
|
<table class="table calendar-table">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="7">
|
|
{{ calendar_month['monthName'] }} {{ calendar_month['year'] }}
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th>Mo</th>
|
|
<th>Di</th>
|
|
<th>Mi</th>
|
|
<th>Do</th>
|
|
<th>Fr</th>
|
|
<th>Sa</th>
|
|
<th>So</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for weekIndex in 0..5 %}
|
|
<tr>
|
|
{% 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 #}
|
|
|
|
<td class="{{ dayState.getCssClass }} {% if dayState.isBookable %}active{% endif %}">
|
|
{% if dayState.isReserved or dayState.isReservationBegin %}
|
|
{% if dayState.reservation.id is defined %}
|
|
<a class="link" href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/{{ dayState.reservation.id }}">
|
|
{{ dayState.day }}
|
|
</a>
|
|
{% else %}
|
|
ID
|
|
{% endif %}
|
|
|
|
{% elseif dayState.isBookable and not is_past_date %}
|
|
<a class="link" href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/new/{{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar_month['monthNumber'] < 10 ? '0':'' }}{{calendar_month['monthNumber']}}{{calendar_month['year']}}">
|
|
{{ dayState.day }}
|
|
</a>
|
|
{% elseif dayState.day == 0 %}
|
|
|
|
{% else %}
|
|
{% if dayState.isPastDate %}
|
|
<del style="color:#989898;">{{ dayState.day }}</del>
|
|
{% else %}
|
|
{{ dayState.day }}
|
|
{% endif %}
|
|
{% endif %}
|
|
</td>
|
|
{% endfor %}
|
|
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if counter%2 == 0 or calendar|length ==counter %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% endfor %}
|