{% set viewShop = true %}
{% if config.hidePriceDefault and app.session.get('groupByDefault') == true %}
    {% set viewShop = false %}
{% endif %}
{% if app.request.session.get('blockShop') is defined %}
    {% set blockShop =  app.request.session.get('blockShop') %}
{% else %}
    {% set blockShop =  false %}
{% endif %}
{% if app.request.session.get('blockShopCountry') is defined %}
    {% set blockShopCountry =  app.request.session.get('blockShopCountry') %}
{% endif %}
<section class="shop theme3  {% if blockShop and app.session.get('groupByDefault') == true %}blockShop{% endif %}"
         data-text-soldout="{% trans %}shop.soldout{% endtrans %}"
         data-text-promo="{% trans %}shop.promo{% endtrans %}" data-text-new="{% trans %}shop.new{% endtrans %}"
         data-adding-to-cart="{% trans %}shop.adding_to_cart{% endtrans %}"
         data-field-city="{% if config.enabledCityField %}1{% else %}0{% endif %}">
    {% if blockShop != true or app.session.get('groupByDefault') == false %}
    {% if config.vacationOf and config.vacationAt is not null and date(config.vacationOf) < date() and date(config.vacationAt) > date() and config.disableShopForVacation %}
        <div class="grid-container">
            <div class="grid-x grid-margin-x">
                <div class="cell small-12 text-center blockShop-text">
                    {{ config.vacation|raw }}
                </div>
            </div>
        </div>
    {% else %}
        <div class="grid-container">
            <div class="grid-x grid-margin-x grid-margin-y small-up-3 medium-up-3 large-up-3 text-center align-center infos_bulle">
                {% for i in range(0,2) -%}
                    <div class="cell info_bulle {{ ('shop.bulles.'~i~'.class')|trans }}">
                        <div class="icon"><i class="{{ ('shop.bulles.'~i~'.icon')|trans }}"></i></div>
                        <span class="title">{{ ('shop.bulles.'~i~'.title')|trans }}</span>
                        <span class="descr">{{ ('shop.bulles.'~i~'.descr')|trans|raw }}</span>
                    </div>
                {%- endfor %}
            </div>
            <p class="text-center shop-out-order">{{ countriesShippingByGroup("shop.out-order"|trans({'%url%':  path('contact') }), app.session.get('groupPrice'))|raw }}</p>
            <div class="grid-container">
                {% set taxe = 'TTC' %}
                {% if priceGroups|length > 1 %}
                    {% if app.session.get('groupByDefault') != true %}
                        {% set taxe =  app.session.get('groupPrice')|get_ht_or_ttc %}
                    {% endif %}
                    {{ render(controller('CpCreation\\VitiCore\\Bridge\\Symfony\\Bundle\\Controller\\Site\\CartController::codePriceGroupAction')) }}
                {% endif %}
                {% if config.vacationOf and config.vacationAt is not null and date(config.vacationOf) < date() and date(config.vacationAt) > date() %}
                    <div class="shop-informations-supp">
                        {{ config.vacation|raw }}
                    </div>
                {% endif %}
                {% if config.viewOrderByCategory %}
                    {% include 'shop/order_by_category.html.twig' %}
                {% else %}
                    {% if config.viewCategory %}
                        {% include 'shop/categories_on_swipe.html.twig' %}
                    {% else %}
                        {% include 'shop/categories_off.html.twig' %}
                    {% endif %}
                {% endif %}

            </div>
        </div>
        <div id="my-order" class="grid-container form-cart">
            <h3>{% trans %}shop.my_command{% endtrans %}</h3>
            <div class="grid-x grid-margin-x header-form-cart">
                <div class="cell small-5">
                    {% trans %}shop.product{% endtrans %}
                </div>
                <div class="cell small-2">
                    {% trans %}shop.quantity{% endtrans %}
                </div>
                <div class="cell small-2">
                    {% trans %}shop.price{% endtrans %}
                </div>
                <div class="cell small-2">
                    {% trans %}shop.total{% endtrans %}
                </div>
                <div class="cell small-1">
                </div>
            </div>
            <p class="cart-empty">{% trans %}shop.empty_cart{% endtrans %}</p>
            <form id="cart_items_form" action="{{ path('shop') }}" name="cart" method="POST" autocomplete="off">
                {{ form_widget(form.items) }}
                <h3>{% trans %}shop.my_informations{% endtrans %}</h3>
                <div class="grid-x grid-margin-x">
                    <div class="cell small-12 medium-6 left-informations">
                        <h4 class="address">{% trans %}shop.address_invoice_shipping{% endtrans %}</h4>
                        <div class="calcul_shipping">
                            <span>{% trans %}shop.shipping_cost{% endtrans %}</span>
                            {{ form_row(form.invoiceAddress.country) }}
                            {{ form_row(form.invoiceAddress.postalCode) }}
                            {{ form_row(form.invoiceAddress.city) }}
                            {{ form_row(form.invoiceAddress.street) }}
                        </div>
                        <hr>
                        <div class="informations_customer">
                            <span>{% trans %}shop.billing-delivery_information{% endtrans %}</span>
                            {{ form_row(form.invoiceAddress.company) }}
                            {{ form_row(form.invoiceAddress.tvaNumber) }}
                            {{ form_row(form.invoiceAddress.lastname) }}
                            {{ form_row(form.invoiceAddress.firstname) }}
                            {{ form_row(form.invoiceAddress.email) }}
                            {{ form_row(form.invoiceAddress.phone) }}
                        </div>
                        {% if config.isDisableLogoBank == false %}
                            <div class="secure-logos show-for-medium">
                                {% for payment in form.cartCheckout.paymentMethod.vars.choices %}
                                    {% if payment.data.method == 'e-transactions' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/e-transactions.jpg') }}"
                                             alt="Paiement sécurisé - E-transactions">
                                    {% endif %}
                                    {% if payment.data.method == 'systempay' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/systempay.jpg') }}"
                                             alt="Paiement sécurisé - SystemPay">
                                    {% endif %}
                                    {% if payment.data.method == 'sherlock' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/sherlock.jpg') }}"
                                             alt="Paiement sécurisé - Sherlock">
                                    {% endif %}
                                    {% if payment.data.method == 'sogecommerce' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/logo-sogecommerce.jpg') }}"
                                             alt="Paiement sécurisé - SogeCommerce">
                                    {% endif %}
                                    {% if payment.data.method == 'monetico' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/monetico.jpg') }}"
                                             alt="Paiement sécurisé - Monetico">
                                    {% endif %}
                                {% endfor %}
                            </div>
                        {% endif %}
                    </div>
                    <div class="cell small-12 medium-6">
                        <h4 class="address">{% trans %}shop.address_shipping_other{% endtrans %}</h4>
                        {{ form_row(form.deliveryAddress.differentAddress) }}
                        <div class="form-address hidden">
                            <span>{% trans %}shop.shipping_cost{% endtrans %}</span>
                            {{ form_row(form.deliveryAddress.country) }}
                            {{ form_row(form.deliveryAddress.postalCode) }}
                            {{ form_row(form.deliveryAddress.city) }}
                            {{ form_row(form.deliveryAddress.street) }}
                            <hr>
                            <span>{% trans %}shop.delivery_information{% endtrans %}</span>
                            {{ form_row(form.deliveryAddress.lastname) }}
                            {{ form_row(form.deliveryAddress.firstname) }}
                            {{ form_row(form.deliveryAddress.email) }}
                            {{ form_row(form.deliveryAddress.phone) }}
                        </div>
                        {% if form.deliveryMethod.children|length > 0 %}
                            {{ form_widget(form.deliveryMethod,{ 'config' : config }) }}
                        {% endif %}
                        <div id="total-order" class="total-order">
                            <hr>
                            <div data-closable class="alert-box callout alert hidden alert-shipping-box">
                                <i class="fas fa-exclamation-triangle"></i> <span class="alert-shipping"></span>
                            </div>
                            <div class="grid-x">
                                <div class="small-6 total-order-label">
                                    <p>{% trans %}shop.total_product{% endtrans %} : </p>
                                    <p class="row-discount hidden">{% trans %}shop.discount{% endtrans %} : </p>
                                    <p class="row-degressive hidden">{% trans %}shop.degressive{% endtrans %} : </p>
                                    <p>{% trans %}shop.total_shipping{% endtrans %} : </p>
                                    <p>{% trans %}shop.total{% endtrans %} : </p>
                                    {% if taxe == 'HT' %}
                                        <p>{{ taxDefault.name }} :</p>
                                        <p>Total TTC :</p>
                                    {% endif %}
                                    <br/>
                                    {% if form.children.promo is defined %}
                                        <p>{% trans %}shop.discount_code{% endtrans %} : </p>
                                    {% endif %}
                                </div>
                                <div class="small-6 text-left total-order-price">
                                    <p><span class="total-order-products">0</span> € <sup>{{ taxe }}</sup></p>
                                    <p class="row-discount hidden"><span class="value-discount"
                                                                         data-value-amount="0"
                                                                         data-value-percent="0"
                                                                         data-withShipping="0">0</span>
                                        <sup>{{ taxe }}</sup></p>
                                    <p class="row-degressive hidden"><span class="value-degressive"
                                                                           data-value="0">0</span> €
                                        <sup>{{ taxe }}</sup></p>
                                    <p><span class="total-order-shipping">-</span> € <sup>{{ taxe }}</sup></p>
                                    <p><span class="total-order-total">0.00</span> € <sup>{{ taxe }}</sup></p>
                                    {% if taxe == 'HT' %}
                                        <p><span class="tax-value" data-value="{{ taxDefault.value }}">-</span> € </p>
                                        <p><span class="total-order-total-ttc">0.00</span> € <sup>TTC</sup></p>
                                    {% endif %}
                                    <br/>
                                    {% if form.children.promo is defined %}
                                        {{ form_widget(form.promo) }}
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="cartCheckout">
                            <div class="choice_payment">
                                {{ form_widget(form.cartCheckout.paymentMethod) }}
                            </div>
                            <hr>
                            {{ form_widget(form.cartCheckout.cgv) }}
                            {% if shippingConfig.shippingText is not null %}
                                <p class="shipping-info"><i
                                            class="fas fa-info-circle"></i> {{ shippingConfig.shippingText }}</p>
                            {% endif %}
                            <hr>
                            {{ form_row(form.comment) }}
                            <hr>
                        </div>
                        <p class="help">{% trans %}shop.field.required{% endtrans %}</p>
                        {{ form_rest(form) }}
                        <button type="submit" class="button">{% trans %}shop.order{% endtrans %}</button>
                        {% if config.isDisableLogoBank == false %}
                            <div class="secure-logos show-for-small-only">
                                {% for payment in form.cartCheckout.paymentMethod.vars.choices %}
                                    {% if payment.data.method == 'e-transactions' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/e-transactions.jpg') }}"
                                             alt="Paiement sécurisé - E-transactions">
                                    {% endif %}
                                    {% if payment.data.method == 'systempay' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/systempay.jpg') }}"
                                             alt="Paiement sécurisé - SystemPay">
                                    {% endif %}
                                    {% if payment.data.method == 'sherlock' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/sherlock.jpg') }}"
                                             alt="Paiement sécurisé - Sherlock">
                                    {% endif %}
                                    {% if payment.data.method == 'sogecommerce' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/logo-sogecommerce.jpg') }}"
                                             alt="Paiement sécurisé - SogeCommerce">
                                    {% endif %}
                                    {% if payment.data.method == 'monetico' %}
                                        <img src="{{ asset('bundles/cpcreationviticore/images/payment/monetico.jpg') }}"
                                             alt="Paiement sécurisé - Monetico">
                                    {% endif %}
                                {% endfor %}
                            </div>
                        {% endif %}
                    </div>
                </div>
            </form>
        </div>
        <div class="cd-panel cd-panel--from-right js-cd-panel-shop">
            <header class="cd-panel__header">
                <p id="cd-panel-title" aria-hidden="true"></p>
                <a href="#0" class="cd-panel__close js-cd-close">Close</a>
            </header>
            <div class="cd-panel__container">
                <div class="cd-panel__content" id="cd-panel-content"></div>
            </div>
        </div>
    {% endif %}
    {% else %}
    <div class="grid-container">
        {{ render(controller('CpCreation\\VitiCore\\Bridge\\Symfony\\Bundle\\Controller\\Site\\CartController:codePriceGroupAction')) }}
        <div class="grid-x grid-margin-x">
            {% set blockShopText = countryDisableDescription(blockShopCountry) %}
            {% if blockShopText is null %}
                {% set blockShopText = 'shop.blockShop'|trans({'%country%':  blockShopCountry|country_name }) %}
            {% endif %}
            <div class="cell small-12 text-center blockShop-text" data-blockshop-title="Informations"
                 data-blockshop-text="{{ blockShopText|raw }}">
                {{ blockShopText|raw }}
            </div>
        </div>
    </div>
    {% endif %}
</section>
