templates/front-office/command/basket.html.twig line 1

Open in your IDE?
  1. {% extends "front-office/_base.html.twig" %}
    
    {% block header %}
    
        {% include "front-office/partials/_header_command.html.twig" %}
    
    {% endblock %}
    
    
    {% block script %}
    
        <script defer src="{{ asset('assets/js/command/basket.js') }}"></script>
    
    {% endblock %}
    
    {% block content %}
    
        {% if commonVarBasket is empty %}
            {% set sewings = [] %}
            {% set formations = [] %}
        {% else %}
            {% set sewings = commonVarBasket['sewing'] %}
            {% set formations = commonVarBasket['formation'] %}
        {% endif %}
    
    
        <section class="basket meli-section-85">
    
            <h1 class="txt-century txt-bold txt-size30 txt-green">RÉCAPITULATIF DE LA COMMANDE</h1>
    
            <div class="divider bgc-orange"></div>
    
            <div class="list-box">
                {% set total = 0 %}
                {% for sewing in sewings %}
                    {% set s = sewing["entity"] %}
                    {% set quantity = sewing["quantity"] %}
    
                    <div id="js-product-sewing-{{ s.id }}">
                        <div class="meli-between-center">
                            <div class="img-box meli-width-20">
                                <img src="{{ asset('uploads/sewings/sewing-'~s.id~'/'~s.picture) }}" alt="{{ s.pictureAlt }}">
                            </div>
    
                            <div class="title-box">
                                <h2 class="txt-dancing txt-bold txt-size20 txt-green">{{ s.name }}</h2>
                                {% if quantity > 1 %}
                                    <p class="txt-century txt-regular txt-size15 txt-green">x {{ quantity }} </p>
                                {% endif %}
                                {% if s in checkBasket %}
                                    <p class="txt-century txt-regular txt-size12 txt-red">
                                        Vous possédez déjà ce patron
                                    </p>
                                {% endif %}
                                <p>
                                    <a href="{{ path('sewing_read',{"id":s.id,"slug":s.name|url}) }}"
                                      class="txt-century txt-regular txt-size12 txt-underline txt-green">
                                        Voir le produit
                                    </a>
                                </p>
    
                            </div>
    
                            <div class="price-box">
                                <p class="txt-century txt-bold txt-green txt-size20">
                                    {% set currentPrice = s.priceHt*quantity*(1+s.tva) %}
                                    {% set total = total + currentPrice %}
                                    {{ currentPrice|number_format(2,","," ") }} € TTC
                                </p>
                            </div>
    
                            <div class="remove-box meli-width-40">
                                <span class="remove-icon js-basket-remove-btn"
                                      data-url="{{ path('ajax_basket_remove_basket',{'type':'sewing','id':s.id}) }}"
                                      data-line="js-product-sewing-{{ s.id }}"
                                      data-price="{{ currentPrice }}"
                                ></span>
                            </div>
    
                        </div>
    
                        <div class="divider bgc-orange"></div>
                    </div>
    
    
                {% endfor %}
    
    
                {% for f in formations %}
    
                    <div id="js-product-formation-{{ f.id }}">
                        <div class="meli-between-center">
                            <div class="img-box meli-width-20">
                                <img src="{{ asset('uploads/formations/formation-'~f.id~'/'~f.picture) }}" alt="{{ f.pictureAlt }}">
                            </div>
    
                            <div class="title-box">
                                <h2 class="txt-dancing txt-bold txt-size20 txt-green">{{ f.name }}</h2>
                                {% if f in checkBasket %}
                                    <p class="txt-century txt-regular txt-size12 txt-red">
                                        Vous possédez déjà cette formation
                                    </p>
                                {% endif %}
                            </div>
    
                            <div class="price-box">
                                <p class="txt-century txt-bold txt-green txt-size20">
                                    {% set currentPrice = f.priceHt*(1+f.tva) %}
                                    {% set total = total + currentPrice %}
                                    {{ currentPrice|number_format(2,","," ") }} € TTC
                                </p>
                            </div>
    
                            <div class="remove-box meli-width-40">
                            <span class="remove-icon js-basket-remove-btn"
                                  data-url="{{ path('ajax_basket_remove_basket',{'type':'formation','id':f.id}) }}"
                                  data-line="js-product-formation-{{ f.id }}"
                                  data-price="{{ currentPrice }}"
                            ></span>
                            </div>
    
                        </div>
    
                        <div class="divider bgc-orange"></div>
                    </div>
    
    
                {% endfor %}
    
    
            </div>
    
            {% if total != 0 %}
                <div class="total-box meli-end-center">
                    <p class="txt-century txt-bold txt-size20 txt-green">
                        TOTAL DU PANIER
                        <span id="js-basket-total"
                              data-init="{{ total }}"
                        >{{ total|number_format(2,",","") }}</span> € TTC
                    </p>
                </div>
            {% else %}
                <div class="total-box meli-end-center">
                    <p class="txt-century txt-bold txt-size20 txt-green">
                        VOTRE PANIER EST VIDE
                    </p>
                </div>
            {% endif %}
    
    
            <div class="actions-box meli-between-center">
                <div class="back-box">
                    <a href="{{ path('home') }}">
                    <span class="">
                        <span class="back-icon"></span>
                        <span class="txt-century txt-regular txt-size15 txt-orange">
                            Continuer mes achats
                        </span>
                    </span>
    
                    </a>
                </div>
    
                {% if checkBasket is empty %}
                    {% if total != 0 and readyPay %}
                        <div class="valid-box">
                            <form method="POST" action="{{ path('payment_process') }}">
                                <input type="hidden" name="PBX_SITE" value="{{ pbx_site }}">
                                <input type="hidden" name="PBX_RANG" value="{{ pbx_rang }}">
                                <input type="hidden" name="PBX_IDENTIFIANT" value="{{ pbx_identifiant }}">
                                <input type="hidden" name="PBX_TOTAL" value="{{ pbx_total }}">
                                <input type="hidden" name="PBX_DEVISE" value="978">
                                <input type="hidden" name="PBX_CMD" value="{{ pbx_cmd }}">
                                <input type="hidden" name="PBX_PORTEUR" value="{{ pbx_porteur }}">
                                <input type="hidden" name="PBX_REPONDRE_A" value="{{ pbx_repondre_a }}">
                                <input type="hidden" name="PBX_RETOUR" value="{{ pbx_retour }}">
                                <input type="hidden" name="PBX_EFFECTUE" value="{{ pbx_effectue }}">
                                <input type="hidden" name="PBX_ANNULE" value="{{ pbx_annule }}">
                                <input type="hidden" name="PBX_REFUSE" value="{{ pbx_refuse }}">
                                <input type="hidden" name="PBX_HASH" value="SHA512">
                                <input type="hidden" name="PBX_TIME" value="{{ dateTime }}">
                                <input type="hidden" name="PBX_SHOPPINGCART" value="{{ pbx_shoppingcart }}">
                                <input type="hidden" name="PBX_BILLING" value="{{ pbx_billing }}">
                                <input type="hidden" name="PBX_HMAC" value="{{ hmac }}">
                                <button class="btn-base bgc-red">
                                    <span>Valider la commande</span>
                                </button>
                            </form>
                        </div>
                    {% elseif total != 0 and not readyPay %}
                        <div class="valid-box">
                            <a href="{{ path('app_login',{'purchase':'true'}) }}">
                                <button class="btn-base bgc-red">
                                    <span>Se connecter / s'inscrire pour valider la commande</span>
                                </button>
                            </a>
                        </div>
                    {% endif %}
                {% else %}
                    <p class="txt-century txt-regular txt-size15 txt-red">
                        Attention, votre panier contient des produits que vous possédez déjà
                        <br> Supprimez ces produits afin de poursuivre votre commande
                    </p>
                {% endif %}
    
    
            </div>
    
    
    
        </section>
    
    {% endblock %}