{% extends '@SyliusShop/layout.html.twig' %}

{% block content %}
    <div class="order-thank-you-container container">
        {% set lastPayment = order.payments.last() %}
        <h1>
            <i class="circular rocket icon"></i>&nbsp;{{ 'sylius.ui.thank_you'|trans }}
        </h1>

        <p id="sylius-thank-you" {{ sylius_test_html_attribute('thank-you') }}>
            {{ 'sylius.ui.placed_an_order'|trans }}
        </p>

        <hr>

        {% include '@SyliusShop/Common/Order/_summary.html.twig' %}

        <hr>

        {{ sylius_template_event('sylius.shop.order.thank_you.after_message', {'order': order}) }}

        {% if lastPayment != false %}
            {%  if lastPayment.method.instructions is not null %}
                <div id="sylius-payment-method-instructions" {{ sylius_test_html_attribute('payment-method-instructions') }}>
                    {{ lastPayment.method.instructions }}
                </div>
            {% endif %}
        {% endif %}

        {% if order.customer.user is not null %}
            <a href="{{ path('sylius_shop_account_order_show', {'number': order.number}) }}" id="sylius-show-order-in-account" class="btn btn-info" {{ sylius_test_html_attribute('show-order-in-account') }}>{{ 'sylius.ui.view_order'|trans }}</a>
        {% else %}
            <a href="{{ path('sylius_shop_order_show', {'tokenValue': order.tokenValue}) }}" id="payment-method-page" class="btn btn-primary btn-block" {{ sylius_test_html_attribute('payment-method-page') }}>{{ 'sylius.ui.change_payment_method'|trans }}</a>
            <a href="{{ path('sylius_shop_register_after_checkout', {'tokenValue': order.tokenValue}) }}" class="btn btn-success" {{ sylius_test_html_attribute('create-an-account') }}>
                <i class="fa fa-edit"></i>&nbsp;{{ 'sylius.ui.create_an_account'|trans }}
            </a>
        {% endif %}
    </div>
{% endblock %}
