<!DOCTYPE html>
<html lang="{{ str_replace('_','-',app()->getLocale()) }}">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>{{ $title }}</title>

    <style>
      /* General Styles */
        body {
            font-family: DejaVu Sans, sans-serif;
            font-size: 0.65rem;
            color: #222;
        }

        @page {
            margin: 2rem 1.8rem;
        }

        /* Text */
        small {
            font-size: 0.65rem;
            color: #555;
        }

        u {
            text-decoration: underline;
        }

        /* Table */
        table {
            width: 100%;
            border-collapse: collapse;
        }

        th,
        td {
            border-bottom: 1px solid #cbcbcb;
            padding: 0.2rem 0.4rem;
        }

        /* Separators */
        hr {
            border: 0;
            height: 1px;
            background: #e5e5e5;
            margin: 0.9rem 0;
        }

        /* Lists */
        ul {
            margin: 4pt 0 0 12pt;
            padding-left: 0;
        }

        li {
            margin-top: 3.5pt;
            margin-bottom: 3.5pt;
        }

      /* Custom Clases */
        /* Containers */
        .container {
            width: 100%;
        }

        .row {
            display: table;
            width: 100%;
            table-layout: fixed;
        }

        .header-section {
            line-height: 0.5;
        }

        .stay-section {
            line-height: 0.8;
        }

        .section-title {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: .5pt;
            margin: 1rem 0 0.2rem;
        }

        .w-50 {
            width: 50%;
        }

        .col-1 {
            display: table-cell;
            width: 8.333%;
            vertical-align: top;
        }

        .col-2 {
            display: table-cell;
            width: 16.666%;
            vertical-align: top;
        }

        .col-3 {
            display: table-cell;
            width: 25%;
            vertical-align: top;
        }

        .col-4 {
            display: table-cell;
            width: 33.333%;
            vertical-align: top;
        }

        .col-5 {
            display: table-cell;
            width: 41.666%;
            vertical-align: top;
        }

        .col-6 {
            display: table-cell;
            width: 50%;
            vertical-align: top;
        }

        .col-7 {
            display: table-cell;
            width: 58.333%;
            vertical-align: top;
        }

        .col-8 {
            display: table-cell;
            width: 66.666%;
            vertical-align: top;
        }

        .col-9 {
            display: table-cell;
            width: 75%;
            vertical-align: top;
        }

        .col-10 {
            display: table-cell;
            width: 83.333%;
            vertical-align: top;
        }

        .col-11 {
            display: table-cell;
            width: 91.666%;
            vertical-align: top;
        }

        .col-12 {
            display: table-cell;
            width: 100%;
            vertical-align: top;
        }

        /* Text */
        .harsi-color {
            color: #0d6889e7;
        }

        .hotel-title-data {
            font-size: 0.8rem;
            font-weight: 600;
        }

        .text-center {
            text-align: center;
        }

        .text-end {
            text-align: right;
        }

        .text-start {
            text-align: left;
        }

        .text-capitalize {
            text-transform: capitalize;
        }

        .sub-table-header {
            font-size: .875em;
            color: #212529bf;

            border-bottom: 1px solid #828282;
        }

        .small {
            font-size: .875em;
        }

        .fw-bold {
            font-weight: bold
        }

        .text-muted {
            color: #212529bf;
        }

        .fst-italic {
            font-style: italic;
        }

        /* Spacers */
        .m-auto {
            margin: auto;
        }

        .mt-2 {
            margin-top: 10pt;
        }

        .mt-3 {
            margin-top: 14pt;
        }

        .mt-4 {
            margin-top: 18pt;
        }

        .mb-0 {
            margin-bottom: 0pt;
        }

        .mb-1 {
            margin-bottom: 6pt;
        }

        .mb-2 {
            margin-bottom: 10pt;
        }

        .mb-3 {
            margin-bottom: 13pt;
        }

        .mb-4 {
            margin-bottom: 18pt;
        }

        .pb-0 {
            padding-bottom: 0pt;
        }

        .pt-0_5 {
            padding-top: 3pt;
        }

        .pt-2 {
            padding-top: 8pt;
        }

        .pb-0_5 {
            padding-bottom: 3pt;
        }

        .pe-3 {
            padding-right: 10pt;
        }

        .ps-3 {
            padding-left: 10pt;
        }

        .py-1 {
            padding-top: 6pt;
            padding-bottom: 6pt;
        }

        .py-0_5 {
            padding-top: 3pt;
            padding-bottom: 3pt;
        }


        /* Decorators */
        .border_blue_left {
            border-left: 2.5px solid #0c5f7d;
        }

        .border_blue_right {
            border-right: 2.5px solid #0c5f7d;
        }

        .border_gray_bottom {
            border-bottom: 1px solid #828282 ;
        }

        .harsi-border {
            border: 1.4px solid #0d6889a7;
        }

        .signature-border {
            border-top: 0.4px solid #0b5772;
        }

        /* Tables */
        .harsi-table th {
            border-bottom: 1px solid #0d6889;
            background: #f2f2f2;
        }

        .table-light th {
            border-bottom: 1px solid #0d6889;
            background: #f9f9f9;
        }

        .table-borderless,
        .table-borderless th,
        .table-borderless td {
            border: none !important;
        }

        /* Resources */
        .logo {
            max-height: 3.8rem;
            max-width: 7.5rem;
            object-fit: contain;

            padding: 0rem;
        }

    </style>
</head>

<body>
    @php
      // Imports
        use \App\Helpers\Formats\FormatCurrencyHelper;

      // Dynamic Lang
        $reservation_ticket = __('tickets')['hotel']['reservation_tickets'];
    @endphp

    <div class="container">

        <!-- Header -->
        <div class="row">
            <!-- Logo -->
            <div class="col-3">
                <img class="logo" src="{{ $logo_src }}" alt="Hotel Logo">
            </div>

            <!-- Establishment Data -->
            <div class="pb-0 col-9 text-end border_blue_right pe-3 header-section">
                <p class="mb-1 hotel-title-data harsi-color"><b>{{ $business->business_name ?? '—' }}</b></p>

                @if (isset($business->tax_id) && !is_null($business->tax_id))
                    <p class="hotel-data">{{ $business->tax_id }}</p>
                @endif

                <p>{{ $business->business_address }}</p>
                <p class="mb-0">
                    <u>{{ config('mail.hotel_address') }}</u> |
                    <u>{{ $business->business_phone }}</u>
                </p>
            </div>
        </div>

        <hr>

        <!-- Reservation Simple Summary -->
        <div class="mb-0 row stay-section">

            <!-- Cliente - Habitación - Hosting Control -->
            <div class="col-7 border_blue_left ps-3">
                <!-- Client -->
                <b class="harsi-color">{{ $reservation_ticket['guest_section'] }}</b>
                {{ $reservation->client_reference }}

                <ul class="mb-1">
                    {{-- Phone --}}
                    @if (!in_array($reservation->client->client_phone, [null, __('neutral_words')['none_2']]))
                        <li><b>{{ __('entity_fields')['common']['phone'] }}:</b>
                            {{ $reservation->client->client_phone }}
                        </li>
                    @endif

                    {{-- Email --}}
                    @if (!in_array($reservation->client->client_email, [null, __('neutral_words')['none_2']]))
                        <li><b>{{ __('entity_fields')['common']['email'] }}:</b>
                            {{ $reservation->client->client_email }}
                        </li>
                    @endif

                    {{-- Country --}}
                    @if (!in_array($reservation->client->client_state, [null, __('neutral_words')['none_2']]))
                        <li class="text-capitalize"><b>{{ $reservation_ticket['guest_origin'] }}</b>
                            {{ strtolower($reservation->client->client_state) }}
                        </li>
                    @endif

                </ul>

                <!-- Room Data -->
                <b class="harsi-color">{{ $reservation_ticket['room_section'] }}</b>
                <ul class="mb-1">
                    <li><b>{{ $reservation_ticket['room_type'] }}</b>
                        {{ $reservation->roomType->tr_name }}</li>
                    <li><b>{{ $reservation_ticket['room_number'] }}</b>
                        {{ $reservation->room->room_name }}</li>
                </ul>

                <!-- Hosting Control -->
                <b class="harsi-color">{{ $reservation_ticket['lodging_section'] }}</b>
                <ul class="mb-0">
                    <li>
                        {{-- Stay --}}
                        <b>{{ $reservation_ticket['length_of_stay'] }}</b>
                        @if ($reservation->is_express)
                            {{ $reservation->number_hours }} {{ trans_choice($reservation_ticket['number_hours'], $reservation->number_hours) }}
                        @elseif ($has_control_hours)
                            {{ $reservation->number_nights }} {{ trans_choice($reservation_ticket['number_nights'], $reservation->number_nights) }},
                            {{ $reservation->number_hours }} {{ trans_choice($reservation_ticket['number_hours'], $reservation->number_hours) }}
                        @else
                            {{ $reservation->number_nights }} {{ trans_choice($reservation_ticket['number_nights'], $reservation->number_nights) }}
                        @endif

                        {{-- Divider --}}
                        &nbsp;|&nbsp;

                        {{-- PAX --}}
                        <b>{{ $reservation_ticket['adults'] }}</b>
                            {{ $reservation->number_adults }} &nbsp;|&nbsp;
                        <b>{{ $reservation_ticket['children'] }}</b>
                            {{ $reservation->number_children }}
                    </li>
                </ul>
            </div>

            <!-- Folio - Entrada - Salida - Fuente de Reserva - Estado de Pago -->
            <div class="col-5 text-end border_blue_right pe-3">
                <b class="harsi-color">{{ $reservation_ticket['internal_folio'] }}</b>
                <b>{{ $reservation->id }}</b>

                <p class="mt-3 mb-1"><b>{{ $reservation_ticket['entry_date'] }}</b>
                    {{ $reservation->date_entry }} @if($has_control_hours ?? false) {{ __('neutral_words')['at'] }} {{ $reservation->hour_entry }} @endif</p>
                <b class="mb-2">{{ $reservation_ticket['departure_date'] }}</b>
                    {{ $reservation->date_departure }} @if($has_control_hours ?? false) {{ __('neutral_words')['at'] }} {{ $reservation->hour_departure }} @endif

                <p class="mt-3 mb-1">
                    @if ($reservation->source_id != "3")
                        <b class="harsi-color">{{ $reservation_ticket['reservation_source'] }}</b>
                        {{ $reservation->source->source_name }}
                    @else
                        <b class="harsi-color">{{ $reservation_ticket['agency'] }}</b>
                        {{ $reservation->agency->agency_name }}
                    @endif
                </p>

                <b>{{ $reservation_ticket['payment_status'] }}</b>
                @switch($reservation->payment_status)
                    @case('#fd2319')
                    @default {{ __('neutral_words')['due'] }} @break

                    @case('#ffcf00') {{ __('neutral_words')['advance'] }} @break

                    @case('#37f00f') {{ __('neutral_words')['paid'] }} @break
                @endswitch
            </div>

        </div>

        <!-- Reservation Charges & Payments Summary -->
        <div>
            <!-- Header Title -->
            <h5 class="text-center harsi-color section-title">
                {{ $reservation_ticket['charges_section'] }}
            </h5>

            @php
              // Relationships
                $lodging_payments = $reservation->lodgingPayments->where('status', 'Activo');

                $consumption_charges = $reservation->consumptionCharges->where('status', 'Activo');
                $consumption_payments = $reservation->consumptionPayments->where('status', 'Activo');

                $extra_charges = $reservation->extraCharges->where('status', 'Activo');
                $extra_payments = $reservation->extraPayments->where('status', 'Activo');

              // Totals
                $consumption_total_charges = $consumption_charges->sum('consumption_price');
                $extra_total_charges = $extra_charges->sum('extras_price');

                $lodging_total_payments = $lodging_payments->sum('payment_price');
                $consumption_total_payments = $consumption_payments->sum('payment_price');
                $extra_total_payments = $extra_payments->sum('payment_price');

                $lodging_remaining_balance = $reservation->total_price - $lodging_total_payments;
                $consumption_remaining_balance = $consumption_total_charges - $consumption_total_payments;
                $extra_remaining_balance = $extra_total_charges - $extra_total_payments;

                $total_charges = $reservation->total_price + $extra_total_charges + $consumption_total_charges;
                $total_paid = $lodging_total_payments + $consumption_total_payments + $extra_total_payments;

                $remaining_balance = $total_charges - $total_paid;

              // Support
                $empty_payments = '<tr class="text-center">'
                    . str_repeat('<td class="py-1">-- -- --</td>', 4)
                    . '</tr>';
            @endphp

            <!-- Lodging -->
            <div class="mt-2 harsi-border">
                <!-- General Summary -->
                <table>
                    <!-- Main Header -->
                    <thead>
                        <tr class="harsi-table">
                            <th colspan="4" class="text-center">
                                {{ $reservation_ticket['lodging_charges'] }}</th>
                        </tr>
                    </thead>

                    <!-- Charges Sections -->
                    <thead>
                        <tr>
                            <th colspan="4" class="text-center py-0_5 sub-table-header">
                                {{ $reservation_ticket['charges'] }}
                            </th>
                        </tr>
                        <tr>
                            <th width="15%" class="text-center">{{ $reservation_ticket['date'] }}</th>
                            <th width="35%" class="text-center">{{ $reservation_ticket['description'] }}</th>

                            @if ($reservation->is_express)
                                <th width="25%" class="text-center">{{ $reservation_ticket['rate_price'] }}</th>
                            @else
                                <th width="25%" class="text-center">{{ $reservation_ticket['lodging_nightly_price'] }}</th>
                            @endif

                            <th width="25%" class="text-center">Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="text-center">
                                {{ $reservation->date_entry }}</td>
                            <td class="text-center">
                                {{ $reservation_ticket['lodging_description'] }}

                                @if ($reservation->is_express)
                                    {{ $reservation->number_hours }} {{ trans_choice($reservation_ticket['number_hours'], $reservation->number_hours) }}
                                @elseif ($has_control_hours)
                                    {{ $reservation->number_nights }} {{ trans_choice($reservation_ticket['number_nights'], $reservation->number_nights) }},
                                    {{ $reservation->number_hours }} {{ trans_choice($reservation_ticket['number_hours'], $reservation->number_hours) }}
                                @else
                                    {{ $reservation->number_nights }} {{ trans_choice($reservation_ticket['number_nights'], $reservation->number_nights) }}
                                @endif
                                <br>

                                @if ($has_pax_pricing)
                                    @php
                                        $total_pax = (int) $reservation->number_adults;

                                        if ($reservation->include_children_in_pax)
                                            $total_pax += $reservation->number_children;
                                    @endphp

                                    ({{ $total_pax }} pax)
                                @endif
                            </td>
                            <td class="text-center">
                                {{ FormatCurrencyHelper::formatCurrency($reservation->final_price) }}</td>
                            <td class="text-center"><u>
                                {{ FormatCurrencyHelper::formatCurrency($reservation->total_price) }}
                            </u></td>
                        </tr>
                    </tbody>

                    <!-- Payments Sections -->
                    <thead>
                        <tr>
                            <th colspan="4" class="text-center py-0_5 sub-table-header">
                                {{ $reservation_ticket['payments'] }}
                            </th>
                        </tr>
                        <tr>
                            <th scope="col" width="15%" class="text-center">
                                {{ $reservation_ticket['date'] }}</th>
                            <th scope="col" width="35%" class="text-center">
                                {{ $reservation_ticket['concept'] }}</th>
                            <th scope="col" width="25%" class="text-center">
                                {{ $reservation_ticket['payment_method'] }}</th>
                            <th scope="col" width="25%" class="text-center">
                                {{ $reservation_ticket['amount'] }}</th>
                        </tr>
                    </thead>
                    <tbody>
                        @forelse ($lodging_payments as $payment)
                            <tr>
                                <td class="text-center">{{ $payment->payment_date->format('Y-m-d H:i') }}</td>
                                <td class="text-center text-capitalize">{{ $payment->payment_concept }}</td>
                                <td class="text-center">{{ $payment->payment_method }}</td>
                                <td class="text-center">{{ FormatCurrencyHelper::formatCurrency($payment->payment_price) }}</td>
                            </tr>
                        @empty
                            {!! $empty_payments !!}
                        @endforelse
                    </tbody>
                </table>

                <!-- Remaining Summary -->
                <table class="mt-1 table-borderless">
                    <tfoot class="small">
                        <tr>
                            <td scope="col" width="61%"></td>
                            <td scope="col" width="23%" class="pt-1 pb-0 fw-bold text-muted">
                                {{ $reservation_ticket['amount_paid'] }}
                            </td>
                            <td class="pt-1 pb-0 fst-italic"><u>
                                {{ FormatCurrencyHelper::formatCurrency( number_format($lodging_total_payments, 2) ) }}
                            </u></td>
                        </tr>
                        <tr>
                            <td scope="col" width="61%"></td>
                            <td scope="col" width="23%" class="pt-1 pb-0_5 fw-bold text-muted">
                                {{ $reservation_ticket['due_balance'] }}
                            </td>
                            <td class="pt-1 pb-0_5 fst-italic">
                                {{ FormatCurrencyHelper::formatCurrency( number_format($lodging_remaining_balance, 2) ) }}
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>

            <!-- Consumption -->
            @if (count($consumption_charges))
                <div class="mt-3 harsi-border">

                    <!-- Charges Section -->
                    <table>
                        <!-- Main Header -->
                        <thead>
                            <tr class="harsi-table">
                                <th colspan="3" class="text-center">
                                    {{ $reservation_ticket['consumption_charges'] }}</th>
                            </tr>
                        </thead>
                        <!-- Secondary Header -->
                        <thead>
                            <tr>
                                <th colspan="3" class="text-center py-0_5 sub-table-header">
                                    {{ $reservation_ticket['charges'] }}
                                </th>
                            </tr>
                            <tr>
                                <th width="30%" class="text-center">{{ $reservation_ticket['date'] }}</th>
                                <th width="40%" class="text-center">
                                    {{ $reservation_ticket['description'] }}</th>
                                <th width="30%" class="text-center">Total</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($consumption_charges as $c)
                                <tr>
                                    <td class="text-center">{{ $c->consumption_date->format('Y-m-d H:i') }}</td>
                                    <td class="text-center text-capitalize">{{ $c->consumption_concept }}</td>
                                    <td class="text-center">
                                        {{ FormatCurrencyHelper::formatCurrency($c->consumption_price) }}</td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>

                    <!-- Charges Summary -->
                    <table>
                        <tfoot class="small">
                            <tr>
                                <td scope="col" width="61%"></td>
                                <td scope="col" width="23%" class="pt-1 pb-0_5 fw-bold text-muted">
                                    {{ $reservation_ticket['total_charge'] }}
                                </td>
                                <td class="pt-1 pb-1 fst-italic"><u>
                                    {{ FormatCurrencyHelper::formatCurrency( number_format($consumption_total_charges, 2) ) }}
                                </u></td>
                            </tr>
                        </tfoot>
                    </table>

                    <!-- Payments Sections -->
                    <table>
                        <thead>
                            <tr>
                                <th colspan="4" class="text-center py-0_5 sub-table-header">
                                    {{ $reservation_ticket['payments'] }}
                                </th>
                            </tr>
                            <tr>
                                <th scope="col" width="15%" class="text-center">{{ $reservation_ticket['date'] }}</th>
                                <th scope="col" width="35%" class="text-center">{{ $reservation_ticket['concept'] }}</th>
                                <th scope="col" width="25%" class="text-center">{{ $reservation_ticket['payment_method'] }}</th>
                                <th scope="col" width="25%" class="text-center">{{ $reservation_ticket['amount'] }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            @forelse ($consumption_payments as $payment)
                                <tr>
                                    <td class="text-center">{{ $payment->payment_date->format('Y-m-d H:i') }}</td>
                                    <td class="text-center text-capitalize">{{ $payment->payment_concept }}</td>
                                    <td class="text-center">{{ $payment->payment_method }}</td>
                                    <td class="text-center">{{ FormatCurrencyHelper::formatCurrency($payment->payment_price) }}</td>
                                </tr>
                            @empty
                                {!! $empty_payments !!}
                            @endforelse
                        </tbody>
                    </table>

                    <!-- Remaining Summary -->
                    <table class="mt-1 table-borderless">
                        <tfoot class="small">
                            <tr>
                                <td scope="col" width="61%"></td>
                                <td scope="col" width="23%" class="pt-1 pb-0 fw-bold text-muted">
                                    {{ $reservation_ticket['amount_paid'] }}
                                </td>
                                <td class="pt-1 pb-0 fst-italic"><u>
                                    {{ FormatCurrencyHelper::formatCurrency( number_format($consumption_total_payments, 2) ) }}
                                </u></td>
                            </tr>
                            <tr>
                                <td scope="col" width="61%"></td>
                                <td scope="col" width="23%" class="pt-1 pb-0_5 fw-bold text-muted">
                                    {{ $reservation_ticket['due_balance'] }}
                                </td>
                                <td class="pt-1 pb-0_5 fst-italic">
                                    {{ FormatCurrencyHelper::formatCurrency( number_format($consumption_remaining_balance, 2) ) }}
                                </td>
                            </tr>
                        </tfoot>
                    </table>

                </div>
            @endif

            <!-- Extras -->
            @if (count($consumption_charges))
                <div class="mt-3 harsi-border">

                    <!-- Charges Section -->
                    <table>
                        <!-- Main Header -->
                        <thead>
                            <tr class="harsi-table">
                                <th colspan="3" class="text-center">
                                    {{ $reservation_ticket['extra_charges'] }}</th>
                            </tr>
                        </thead>
                        <!-- Secondary Header -->
                        <thead>
                            <tr>
                                <th colspan="3" class="text-center py-0_5 sub-table-header">
                                    {{ $reservation_ticket['charges'] }}
                                </th>
                            </tr>
                            <tr>
                                <th width="30%" class="text-center">{{ $reservation_ticket['date'] }}</th>
                                <th width="40%" class="text-center">
                                    {{ $reservation_ticket['description'] }}</th>
                                <th width="30%" class="text-center">Total</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($extra_charges as $e)
                                <tr>
                                    <td class="text-center">{{ $e->extras_date->format('Y-m-d H:i') }}</td>
                                    <td class="text-center text-capitalize">{{ $e->extras_concept }}</td>
                                    <td class="text-center">
                                        {{ FormatCurrencyHelper::formatCurrency($e->extras_price) }}</td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>

                    <!-- Charges Summary -->
                    <table>
                        <tfoot class="small">
                            <tr>
                                <td scope="col" width="61%"></td>
                                <td scope="col" width="23%" class="pt-1 pb-0_5 fw-bold text-muted">
                                    {{ $reservation_ticket['total_charge'] }}
                                </td>
                                <td class="pt-1 pb-1 fst-italic"><u>
                                    {{ FormatCurrencyHelper::formatCurrency( number_format($extra_total_charges, 2) ) }}
                                </u></td>
                            </tr>
                        </tfoot>
                    </table>

                    <!-- Payments Sections -->
                    <table>
                        <thead>
                            <tr>
                                <th colspan="4" class="text-center py-0_5 sub-table-header">
                                    {{ $reservation_ticket['payments'] }}
                                </th>
                            </tr>
                            <tr>
                                <th scope="col" width="15%" class="text-center">{{ $reservation_ticket['date'] }}</th>
                                <th scope="col" width="35%" class="text-center">{{ $reservation_ticket['concept'] }}</th>
                                <th scope="col" width="25%" class="text-center">{{ $reservation_ticket['payment_method'] }}</th>
                                <th scope="col" width="25%" class="text-center">{{ $reservation_ticket['amount'] }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            @forelse ($extra_payments as $payment)
                                <tr>
                                    <td class="text-center">{{ $payment->payment_date->format('Y-m-d H:i') }}</td>
                                    <td class="text-center text-capitalize">{{ $payment->payment_concept }}</td>
                                    <td class="text-center">{{ $payment->payment_method }}</td>
                                    <td class="text-center">{{ FormatCurrencyHelper::formatCurrency($payment->payment_price) }}</td>
                                </tr>
                            @empty
                                {!! $empty_payments !!}
                            @endforelse
                        </tbody>
                    </table>

                    <!-- Remaining Summary -->
                    <table class="mt-1 table-borderless">
                        <tfoot class="small">
                            <tr>
                                <td scope="col" width="61%"></td>
                                <td scope="col" width="23%" class="pt-1 pb-0 fw-bold text-muted">
                                    {{ $reservation_ticket['amount_paid'] }}
                                </td>
                                <td class="pt-1 pb-0 fst-italic"><u>
                                    {{ FormatCurrencyHelper::formatCurrency( number_format($extra_total_payments, 2) ) }}
                                </u></td>
                            </tr>
                            <tr>
                                <td scope="col" width="61%"></td>
                                <td scope="col" width="23%" class="pt-1 pb-0_5 fw-bold text-muted">
                                    {{ $reservation_ticket['due_balance'] }}
                                </td>
                                <td class="pt-1 pb-0_5 fst-italic">
                                    {{ FormatCurrencyHelper::formatCurrency( number_format($extra_remaining_balance, 2) ) }}
                                </td>
                            </tr>
                        </tfoot>
                    </table>

                </div>
            @endif

            <!-- Total -->
            <table class="mt-4">
                <thead>
                    <tr>
                        <th scope="col" width="48%"></th>
                        <th scope="col" width="24%" class="text-end">
                            {{ $reservation_ticket['total_amount'] }}
                        </th>

                        <th scope="col"><u>
                            {{ FormatCurrencyHelper::formatCurrency(number_format($total_charges,2,'.',','), false) }}
                        </u></th>
                    </tr>
                    <tr>
                        <th scope="col" width="48%"></th>
                        <th scope="col" width="24%" class="text-end">
                            {{ $reservation_ticket['total_amount_paid'] }}
                        </th>

                        <th scope="col" class="fw-normal">
                            {{ FormatCurrencyHelper::formatCurrency(number_format($total_paid,2,'.',','), false) }}
                        </th>
                    </tr>
                    <tr>
                        <th scope="col" width="48%"></th>
                        <th scope="col" width="24%" class="text-end">
                            {{ $reservation_ticket['total_due_balance'] }}
                        </th>

                        <th scope="col" class="fw-normal">
                            {{ FormatCurrencyHelper::formatCurrency(number_format($remaining_balance,2,'.',','), false) }}
                        </th>
                    </tr>
                </thead>
            </table>
        </div>

        <!-- Footer -->
        <div class="mt-2 ps-3">
            <!-- Receptionist -->
            <small class="text-capitalize">
                {{ $reservation_ticket['receptionist'] }}
                <b class="harsi-color">{{ $reservation->user->name }}</b>
            </small><br>

            <!-- Acknowledgments -->
            <small><i>{{ $reservation_ticket['acknowledgments'] }}</i></small>

            <!-- Notes -->
            <ul class="pt-1 mt-2 small">
                <li>{{ $reservation_ticket['notes']['contract_breach'] }}</li>
                <li>{{ $reservation_ticket['notes']['billing_assistance'] }}</li>
                <li>{{ $reservation_ticket['notes']['agreement'] }}</li>
            </ul>

            {{-- Signature --}}
            @if ($display_signature)
                <div class="pt-2 m-auto mt-4 w-50">
                    <p class="mt-4 text-center signature-border">
                        {{ $reservation_ticket['notes']['signature'] }}
                    </p>
                </div>
            @endif
        </div>

    </div>
</body>

</html>
