<h2 style="color: #333; font-size: 18px; margin-bottom: 15px;">Dettagli della prenotazione</h2>

<p style="color: #51545E; font-size: 15px; line-height: 1.8; margin-bottom: 20px;">
    <strong>Check-in:</strong> {{ reservation.stay.checkInDate|calendar_date('d/m/Y') }} (dalle {{ policies.checkInTime }})<br/>
    <strong>Check-out:</strong> {{ reservation.stay.checkOutDate|calendar_date('d/m/Y') }} (entro le {{ policies.checkOutTime }})<br/>
    <strong>Notti:</strong> {{ reservation.stay.los }} {{ plural(reservation.stay.los, ['notte', 'notti'], 'it') }}<br/>
    <strong>Ospiti:</strong> {{ reservation.stay.guests.adults }} {{ plural(reservation.stay.guests.adults, ['adulto', 'adulti'], 'it') }}{% if reservation.stay.guests.children|length > 0 %}, {{ reservation.stay.guests.children|length }} {{ plural(reservation.stay.guests.children|length, ['bambino', 'bambini'], 'it') }}{% endif %}<br/>
    <strong>Tariffa:</strong> {{ reservation.accommodation.ratePlan.name }}<br/>
    <strong>Alloggio:</strong> {{ reservation.accommodation.type.name }}<br/>
    <strong>Metodo di pagamento:</strong> {{ reservation.payment.method.name }}<br/>
    {% if reservation.specialRequest %}
        <strong>Richiesta speciale: </strong>{{ reservation.specialRequest }}
    {% endif %}
</p>

<table class="purchase" width="100%" cellpadding="0" cellspacing="0" role="presentation">
    <tr>
        <td colspan="2">
            <table class="purchase_content" width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <th class="purchase_heading" align="left">
                        <p class="f-fallback">Descrizione</p>
                    </th>
                    <th class="purchase_heading" align="right">
                        <p class="f-fallback">Importo</p>
                    </th>
                </tr>
                {% set isCancelled = reservation.status == 'CANCELLED' %}
                {% if isCancelled and reservation.cancellation.penalties.current %}
                    <tr>
                        <td width="60%" class="purchase_item"><span class="f-fallback">Penale di cancellazione</span></td>
                        <td class="align-right" width="20%" class="purchase_item"><span class="f-fallback">{{ reservation.cancellation.penalties.current / 100 }} {{ reservation.currency }}</span></td>
                    </tr>
                {% endif %}
                <tr>
                    <td width="60%" class="purchase_item"><span class="f-fallback">Alloggio</span></td>
                    <td class="align-right" width="20%" class="purchase_item">
                        <span class="f-fallback">
                            {% if isCancelled %}<s>{{ (totals.accommodationSubtotal / 100)|number_format(2) }} {{ totals.currency }}</s>{% else %}{{ (totals.accommodationSubtotal / 100)|number_format(2) }} {{ totals.currency }}{% endif %}
                        </span>
                    </td>
                </tr>
                {% if reservation.extras is defined and reservation.extras|length > 0 %}
                    {% for extra in reservation.extras %}
                        <tr>
                            <td width="60%" class="purchase_item"><span class="f-fallback">{{ extra.name }} × {{ extra.quantity }}</span></td>
                            <td class="align-right" width="20%" class="purchase_item">
                            <span class="f-fallback">
                                {% if extra.neutral %}
                                    {% if isCancelled %}<s>Incluso</s>{% else %}Incluso{% endif %}
                                {% else %}
                                    {% if isCancelled %}<s>{{ (extra.totalPrice / 100)|number_format(2) }} {{ totals.currency }}</s>{% else %}{{ (extra.totalPrice / 100)|number_format(2) }} {{ totals.currency }}{% endif %}
                                {% endif %}
                            </span>
                            </td>
                        </tr>
                    {% endfor %}
                {% endif %}
                {% for modifier in totals.modifiers %}
                    {% if modifier.type == 'taxes' %}
                        <tr>
                            <td width="60%" class="purchase_item"><span class="f-fallback">Tassa ({{ modifier.value }}%)</span></td>
                            <td class="align-right" width="20%" class="purchase_item">
                            <span class="f-fallback">
                                {% if isCancelled %}<s>{{ (modifier.amount / 100)|number_format(2) }} {{ totals.currency }}</s>{% else %}{{ (modifier.amount / 100)|number_format(2) }} {{ totals.currency }}{% endif %}
                            </span>
                            </td>
                        </tr>
                    {% elseif modifier.type == 'charges' %}
                        <tr>
                            <td width="60%" class="purchase_item"><span class="f-fallback">{{ modifier.name ?? 'Supplemento' }}</span></td>
                            <td class="align-right" width="20%" class="purchase_item">
                            <span class="f-fallback">
                                {% if isCancelled %}<s>{{ (modifier.amount / 100)|number_format(2) }} {{ totals.currency }}</s>{% else %}{{ (modifier.amount / 100)|number_format(2) }} {{ totals.currency }}{% endif %}
                            </span>
                            </td>
                        </tr>
                    {% elseif modifier.type == 'discounts' %}
                        <tr>
                          <td width="60%" class="purchase_item">Sconto <div class="f-fallback"><small>Codice promozionale: {{ modifier.name ?? '' }}</small></div></td>
                            <td class="align-right" width="20%" class="purchase_item">
                            <span class="f-fallback">
                                {% if isCancelled %}<s>-{{ (modifier.amount / 100)|number_format(2) }} {{ totals.currency }}</s>{% else %}-{{ (modifier.amount / 100)|number_format(2) }} {{ totals.currency }}{% endif %}
                            </span>
                            </td>
                        </tr>
                    {% endif %}
                {% endfor %}
                <tr>
                    <td width="60%" class="purchase_footer" valign="middle">
                        <p class="f-fallback purchase_total purchase_total--label">Totale</p>
                    </td>
                    <td width="40%" class="purchase_footer" valign="middle">
                        <p class="f-fallback purchase_total">
                            {% if isCancelled and reservation.cancellation.penalties.current %}
                                {{ (reservation.cancellation.penalties.current / 100)|number_format(2) }} {{ reservation.currency }}
                            {% else %}
                                {{ (totals.total / 100)|number_format(2) }} {{ totals.currency }}
                            {% endif %}
                        </p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<!-- Separator -->
<hr style="border: none; border-top: 1px solid #EAEAEC; margin: 30px 0;" />
