{% sw_extends '@Storefront/storefront/page/checkout/confirm/index.html.twig' %}


{% block page_checkout_confirm_tos %}
{% endblock %}

{% block page_checkout_confirm_product_table %}
{% endblock %}

{% block page_checkout_additional %}
    {% if config('core.cart.showCustomerComment') %}
        <div class="checkout-additional">
            <div class="confirm-product">
                {% block page_checkout_confirm_table_container %}
                    <div class="card">
                        <div class="card-body">
                            {% block page_checkout_confirm_table_header %}
                                {% sw_include '@Storefront/storefront/page/checkout/confirm/confirm-product-header.html.twig' %}
                            {% endblock %}

                            {% block page_checkout_confirm_table_items %}
                                {% for lineItem in page.cart.lineItems %}
                                    {% block page_checkout_confirm_table_item %}
                                        {% sw_include '@Storefront/storefront/page/checkout/confirm/confirm-item.html.twig' %}
                                    {% endblock %}
                                {% endfor %}
                            {% endblock %}
                        </div>
                    </div>
                {% endblock %}
            </div>
            {% block page_checkout_finish_customer_comment %}
                <div class="card checkout-card">
                    <div class="card-body">
                        {% block page_checkout_confirm_customer_comment_header %}
                            <div class="card-title">
                                {{ "checkout.customerCommentHeader"|trans|sw_sanitize }}
                            </div>
                        {% endblock %}

                        {% block page_checkout_confirm_customer_comment_control %}
                            <div class="checkout-customer-comment-control">
                                {% block page_checkout_confirm_customer_comment_control_textfield_label %}
                                    <label class="form-label" for="{{ constant('Shopware\\Core\\Checkout\\Order\\SalesChannel\\OrderService::CUSTOMER_COMMENT_KEY') }}">
                                        {{ "checkout.customerCommentLabel"|trans|sw_sanitize }}
                                    </label>
                                {% endblock %}

                                {% block page_checkout_confirm_customer_comment_control_textfield %}
                                    <textarea class="form-control"
                                              placeholder="{{ "checkout.customerCommentPlaceholder"|trans|sw_sanitize }}"
                                              id="{{ constant('Shopware\\Core\\Checkout\\Order\\SalesChannel\\OrderService::CUSTOMER_COMMENT_KEY') }}"
                                              form="confirmOrderForm"
                                              name="{{ constant('Shopware\\Core\\Checkout\\Order\\SalesChannel\\OrderService::CUSTOMER_COMMENT_KEY') }}"></textarea>
                                {% endblock %}
                            </div>
                        {% endblock %}
                    </div>
                </div>
            {% endblock %}
        </div>
    {% endif %}
{% endblock %}

{% block page_checkout_aside_actions %}
    <div class="checkout-aside-action">
        {% block page_checkout_confirm_tos_control %}
            <div class="custom-control custom-checkbox">
                {% block page_checkout_confirm_tos_control_checkbox %}
                    <input type="checkbox"
                            class="checkout-confirm-tos-checkbox custom-control-input{% if formViolations.getViolations('/tos') is not empty %} is-invalid{% endif %}"
                            required="required"
                            id="tos"
                            form="confirmOrderForm"
                            name="tos"/>
                {% endblock %}

                {% block page_checkout_confirm_tos_control_label %}
                    <label for="tos"
                            class="checkout-confirm-tos-label custom-control-label">
                        {{ "checkout.confirmTerms"|trans({
                            '%url%': path('frontend.cms.page',{ id: config('core.basicInformation.tosPage') })
                        })|raw }}
                    </label>
                {% endblock %}
            </div>
        {% endblock %}
        <form id="confirmOrderForm"
              action="{{ path('frontend.checkout.finish.order') }}"
              data-form-csrf-handler="true"
              data-form-preserver="true"
              data-form-submit-loader="true"
              method="post">

            {% block page_checkout_aside_actions_csrf %}
                {{ sw_csrf('frontend.checkout.finish.order') }}
            {% endblock %}

            {% block page_checkout_confirm_form_submit %}
                <button id="confirmFormSubmit"
                        class="btn btn-primary btn-block btn-lg"
                        form="confirmOrderForm"
                    {% if page.cart.errors.blockOrder %}
                        disabled
                    {% endif %}
                        type="submit">
                    {{ "checkout.confirmSubmit"|trans|sw_sanitize }}
                </button>
            {% endblock %}
        </form>
    </div>
{% endblock %}