{# /************************************************************************* File name: calendar-month.html.twig Project: Villas3.com Copyright 2022-2024 Michael J. Miller, All rights reserved Purpose: creates markup for an admin calendar page Requires: calendar - array of calendar records for month Date Version Details -------- ------ ------------------------------------------------- 6/18/24 3.0a Modified for new version. **************************************************************************/ #} {% set lastRes = '' %} {% set i = 0 %} {% set month = date|date("m") %}
{{ date|date("F Y") }}
{% for day_name in WEEK_DAY_NAMES %}
{{ day_name }}
{% endfor %} {% for day in calendar_page %}
= today ? 'clickable' : '') }} {{ calendar_page[i].state != 'open' ? 'cal-blocked' }} {{ calendar_page[i].min_stay ? 'cal-min-stay' }} " data-date="{{ day.date }}" data-dow="{{ day.dow }}" data-id="{{ day.calendar_id }}" > {% set show_details = (day.state != 'booked' and day.state != 'min-stay') %} {% if (day.date|date("m")) == month %}
 {{ day.date|date("d") }} {% if day.date >= today and show_details %} {{ ((day.price > 0 ? day.price : villa.rate_daily)/100) |format_currency(villa.currency_code,{fraction_digit:0}) }} {% endif %}
{% if (i > 0 and calendar_page[i - 1].ends == day.date) or day.ends_day %} {% set dayclass = "book book--end" %} {% elseif (day.date > day.starts) and (day.date < day.ends) %} {% set dayclass = "book" %} {% else %} {% set dayclass = "book book--not" %} {% endif %} {% set resid = day.reservation_id ? "data-reservation-id=" ~ day.reservation_id : '' %}
{% if (( (day.date|date('j') == 1 and day.date != day.ends and day.date != day.starts) or day.starts == calendar_page[loop.index0 - 1].date) or (day.dow == 0 and day.date > day.starts and day.date < day.ends)) and day.reservation_id %} {{ day.name_full|title }} - {{ (day.total / 100)|format_currency(villa.currency_code,{fraction_digit:0,grouping_used:true}) }}   {% else %}   {% endif %}
{% if day.reservation_id is empty %} {% set dayclass = "book book--not" %} {% elseif day.date == day.starts %} {% set dayclass = "book book--start" %} {% elseif day.date != day.ends %} {% set dayclass = "book" %} {% else %} {% set dayclass = "" %} {% endif %}
{# {% if (i == 0 and ((day.date|date("d")) != 1) or (day.starts == day.date and day.dow != 6) ) %}#} {# {{ day.name_full|title }} - {{ (day.total / 100)|format_currency(villa.currency_code,{fraction_digit:0,grouping_used:true}) }} #} {# {% else %}#}   {# {% endif %}#}
{% set show_details = (day.state != 'booked' and day.state != 'min-stay' and day.date >= today) %}
{% if show_details %}
{% if not day.markup %} -% {% else %} {{ (day.markup / 100)|format_number(style='percent') }} {% endif %}
{% endif %} {% if show_details %}
{% if not day.cancel_policy_id %} default {% else %} {{ day.policy_name }} {% endif %}
{% endif %} {% set text = day.min_stay ? 'Not available due to minimum stay requirements.' : (day.state == 'blocked' ? 'Not available because it is manually blocked or is a blocked check out day' : (day.state == 'booked' ? 'Not available because it is reserved.' :'Available for booking.')) %} {% if day.date >= today %}
{{ day.min_stay ? ((day.pre_res_id is not null ? '•')~ 'min stay'~(day.post_res_id is not null ? '•')) : day.state }}
{% endif %}
{% else %} {% endif %}
{% set i = i + 1 %} {% endfor %}