{# /***************************************************************************** File name: reservation.html.twig Project: Villas3.com Copyright 2024 Michael J. Miller, All rights reserved Purpose: page content for manage reservations Requires: reservation_count found_count mode - selection criteria sort - sort method reservations - list of reservations to show Revision History: Date Version Details -------- ------ ------------------------------------------------- 4/29/24 3.0a created 5/28/25 3.0 Added no matches line if there are no reservations ******************************************************************************/ #}

Manage Reservations

{% set formName = "reservation-list-header" %}
{% set disabled = command|default =='name_selection' ? 'disabled' : '' %} {% if enable_channel %} {% endif %}
{% include 'includes/db-paging-control.html.twig' %}
{% if db_pagination.sort_selection == 'villa' %}
Source
{% else %}
Property
{% endif %}
Reservation
Checkin
Nights
Name
Status
Total
Balance
Created
{% set breakTitle = '' %} {% set newTitle = '' %} {% set sub_nights = 0 %} {% set sub_total = 0 %} {% set sub_balance = 0 %} {% set grand_nights = 0 %} {% set grand_total = 0 %} {% set grand_balance = 0 %} {% set show_totals = 'phone-hide' %} {% set currency_code = globals.base_currency_code %} {% for reservation in reservations %} {% set currency_code = reservation.currency_code %} {% if db_pagination.sort_selection == 'villa' %} {% set newTitle = reservation.title_short %} {% elseif db_pagination.sort_selection == 'source' %} {% set newTitle = reservation.source %} {% elseif db_pagination.sort_selection == 'created' %} {% set newTitle = 'Created ' ~ reservation.created|date("F Y") %} {% elseif db_pagination.sort_selection == 'checkin' or db_pagination.sort_selection == 'checkin-reverse' %} {% set newTitle = 'Check In ' ~ reservation.starts|date("F Y") %} {% elseif db_pagination.sort_selection == 'checkout' %} {% set newTitle = 'Check Out ' ~ reservation.ends|date("F Y") %} {% elseif db_pagination.sort_selection == 'cancel' %} {% set newTitle = 'Cancelled ' ~ reservation.cancel_date|date("F Y") %} {% elseif db_pagination.sort_selection == 'balance' %} {% set newTitle = 'Balance' %} {% endif %} {% set selected = page_state.selected_reservation is defined and reservation.reservation_id == page_state.selected_reservation ? ' selected ' : '' %} {% if breakTitle != newTitle %} {% if sub_nights > 0 %}
 
 
 
{{sub_nights}}
 
 
{{(sub_total / 100)|format_currency(currency_code, {grouping_used:true}, 'en')}}
{{(sub_balance / 100)|format_currency(currency_code, {grouping_used:true}, 'en')}}
 
{% endif %} {% set sub_nights = 0 %} {% set sub_total = 0 %} {% set sub_balance = 0 %} {% set breakTitle = newTitle %}
{{breakTitle}}
{% endif %} {% if reservation.state != 'cancelled' %} {% set deposit = reservation.collect_deposit|default(1) ? reservation.deposit : 0 %} {% set sub_nights = sub_nights + reservation.nights %} {% set sub_total = sub_total + (reservation.total + deposit) %} {% set sub_balance = sub_balance + reservation.balance_due %} {% set grand_nights = grand_nights + reservation.nights %} {% set grand_total = grand_total + (reservation.total + deposit) %} {% set grand_balance = grand_balance + reservation.balance_due %} {% endif %} {% set canc = (reservation.state == 'cancelled') ? 'cancelled' : '' %} {% set bk = (reservation.calendar_state == 'blocked' and reservation.state != 'cancelled') ? 'double-booked' : '' %} {% set classlist = selected ~ "clickable " ~ reservation.source ~' '~ canc ~' '~ bk %} {% set rowid = 'data-resid='~reservation.reservation_id %}
{% if reservation.starts <= today and reservation.ends >= today>= today and canc != 'cancelled' %} {% endif %}
{% if db_pagination.sort_selection == 'villa' %}
{{reservation.source}}
{% else %}
{{reservation.title_abbrev ?: reservation.title_short}}
{% endif %} {{reservation.title_abbrev ?: reservation.title_short}}
{{reservation.starts|date("y-m-d")}}
{{reservation.nights}}
{% if reservation.collect_deposit|default(1) and reservation.source != 'airbnb' %} {% endif %} {{reservation.name_full|title}} {{reservation|format_status(false)}}
{% if reservation.state == 'cancelled' %}
{{reservation|format_status(false)}}
{% else %}
{% if deposit > 0 and reservation.total_paid > reservation.total and reservation.collect_deposit|default(1) and reservation.ends < today %} return deposit {{((reservation.total_paid - reservation.total) / 100)|format_currency(currency_code, {grouping_used:true}, 'en')}} {% else %} {{reservation|format_status(false)}} {% endif %}
{{((reservation.total + deposit)/100)|format_currency(currency_code, {grouping_used:true}, 'en')}}
{% endif %} {% if reservation.state != 'cancelled' and reservation.calendar_state != 'blocked' %}
{{(reservation.balance_due / 100)|format_currency(currency_code, {grouping_used:true}, 'en')}}
{% else %}
---
{% endif %}
{{reservation.created|date("y-m-d")}}
{% else %}
No matches found!
{% endfor %} {% if sub_nights != grand_nights %}
 
 
 
{{sub_nights}}
 
 
{{(sub_total / 100)|format_currency(currency_code, {grouping_used:true}, 'en')}}
{{(sub_balance / 100)|format_currency(currency_code, {grouping_used:true}, 'en')}}
 
{% endif %}
 
 
Grand Total
{{grand_nights}}
 
 
{{(grand_total / 100)|format_currency(globals.base_currency_code, {grouping_used:true}, 'en')}}
{{(grand_balance / 100)|format_currency(globals.base_currency_code, {grouping_used:true}, 'en')}}