{% set pagtoForma = null %}
{% if reserva.pagto.pagtoForma[0] and reserva.pagto.pagtoForma[0] is null and reserva.pagto.pagtoForma[1] is not null %}
    {% set pagtoForma = reserva.pagto.pagtoForma[1] %}
{% elseif reserva.pagto.pagtoForma[0] is not null %}
    {% if reserva.pagto.pagtoForma[0].tipo == 'PagtoNoHotel' %}
        {% set pagtoForma = reserva.pagto.pagtoForma[1] %}
    {% else %}
        {% set pagtoForma = reserva.pagto.pagtoForma[0] %}
    {% endif %}
{% endif %}

{% if reserva is empty and not stPreloader %}

    <div style="text-align: center;width: 100%;font-size: 20px;margin-top: 10%;" class="conteudo">
        {{ __('reservaNaoEncontrada') }}
    </div>
{% elseif not stPreloader %}

    {% if reserva.pagto is not null and pagtoForma.cartaoStatus == 'AUTORIZADO' %}
        <div style="background: #ffffde;padding: 17px;text-align: center;font-size: 15px;color: #000;margin: 0;border: 1px solid #e0e0e0;font-weight: bold;">
            {{ __('caroClienteOPagamentoDeSuaReservaEstaSendoProcessado')|raw }}
        </div>
    {% elseif pagtoForma.tipo == 'Boleto' %}
        <div style="background: #ffffde;padding: 17px;text-align: center;font-size: 15px;color: #000;margin: 0;border: 1px solid #e0e0e0;font-weight: bold;">
            {{ __('oBoletoSeraEncaminhadoParaOEmailCadastrado')|raw }}
        </div>
    {% elseif pagtoForma.tipo == 'Financiamento' and pagtoForma.pagtoStatus == 'PENDENTE' %}
        <div style="background: #ffffde;padding: 17px;text-align: center;font-size: 15px;color: #000;margin: 0;border: 1px solid #e0e0e0;font-weight: bold;">
            {{ __('caroClienteOPagamentoDeSuaReservaEstaSendoProcessadoFinanciamento')|raw }}
        </div>
    {% endif %}

    <div class="container">
        <div class="page-voucher">
            <div class="row">
                <div class="col-md-12 col-sm-12 col-lg-9 p0">

                    <div class="box">

                        <div>
                            {% include 'reserva/includes/descricao.twig' %}

                            {% if stTermometroReserva() %}
                                {% include 'reserva/includes/termometro.twig' %}
                            {% endif %}

                            {% include 'reserva/includes/contato.twig' %}

                            {% if reserva.reservaPacoteList %}
                                {% for pacote in reserva.reservaPacoteList %}

                                    {% set hotelList = pacote.reservaHotelList %}
                                    {% include 'reserva/includes/hotel.twig' %}

                                    {% set aereoList = pacote.reservaAereoList %}
                                    {% include 'reserva/includes/aereo.twig' %}


                                    {% set rodoList = pacote.reservaRodoList %}
                                    {% include 'reserva/includes/rodo.twig' %}

                                    {% set servicoList = pacote.reservaServico %}
                                    {% include 'reserva/includes/servicos.twig' %}
                                {% endfor %}
                            {% endif %}

                            {% set hotelList = reserva.reservaHotelList %}
                            {% include 'reserva/includes/hotel.twig' %}

                            {% set aereoList = reserva.reservaAereoList %}
                            {% include 'reserva/includes/aereo.twig' %}

                            {% set rodoList = reserva.reservaRodoList %}
                            {% include 'reserva/includes/rodo.twig' %}

                            {% set servicoList = reserva.reservaServicoList %}
                            {% include 'reserva/includes/servicos.twig' %}

                            {% include 'reserva/includes/pagamento.twig' %}

                            {% if  getStOrcamento() == true %}
                                <div class="col-md-4 offset-md-8">
                                    <p class="text-right" style="font-size: 20px;color: black;">
                                        <b>{{ __('total') }}: </b>
                                        <span data-b2c-preco-orcamento> </span>
                                    </p>
                                </div>
                            {% endif %}
                        </div>

                        {% if reserva.reservaHotelList is not empty and reserva.reservaPacoteList is empty and not (true) and  getStOrcamento() != true %}
                            <div class="btn pula-botao fl-wrap btn-recomprar hidden" hidden>
                                <p><i class="fal fa-undo-alt"></i>{{ __('reservarNovamente') }}</p>
                            </div>
                        {% endif %}
                    </div>

                </div>

                <div class="col-md-12 col-sm-12 col-lg-3">

                    <div class="box">
                        <h6 class="text-center">
                            <i class="fas fa-lock"></i>
                            {{ __('esteEUmSiteSeguro') }}

                        </h6>
                        <p>
                            {{ __('utilizamosConexoesSeguras')|raw }}
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        if(typeof B2C != "undefined"){
            B2C.finalizacao.response = {{ reserva|json_encode|raw }};
            B2C.scripts.finalizacao();
        }
    </script>

{% endif %}
