templates/elements/pagesElements/_cart_resume.html.twig line 1

Open in your IDE?
  1. {% set total = totalBrut %}
  2. {% set hasAction = action ?? true %}
  3. <div class="mt-5 mb-3 mb-lg-0">
  4.     <div class="row mt-3">
  5.         <div class="col-12 col-lg-8 mb-5 mb-lg-0">
  6.             <div class="row border-top border-bottom py-2">
  7.                 <div class="col-0 col-lg-3"></div>
  8.                 <div class="col-4 col-lg-3">
  9.                     <h6>{{ "Description" | trans }}</h6>
  10.                 </div>
  11.                 <div class="col-2 col-lg-2">
  12.                     <h6 class="text-center">{{ "QuantitĂ©" | trans }}</h6>
  13.                 </div>
  14.                 <div class="col-3 col-lg-2">
  15.                     <h6 class="text-center">{{ "Prix unitaire" | trans }}</h6>
  16.                 </div>
  17.                 <div class="col-3 col-lg-2">
  18.                     <h6 class="text-center">{{ "Total" | trans }}</h6>
  19.                 </div>
  20.             </div>
  21.             {% for itemCart in cart %}
  22.                 {% set translated = itemCart['product']|translate %}
  23.                 <div class="row mt-2 border-bottom align-items-center py-3" id="product-{{ itemCart['product'].id }}">
  24.                     <div class="col-0 col-lg-3">
  25.                         <img src="{{ vich_uploader_asset(translated) | imagine_filter('product_list') }}"
  26.                              alt="{{ translated.name }}" class="img-fluid d-none d-lg-block">
  27.                     </div>
  28.                     <div class="col-4 col-lg-3">
  29.                         {#                        {% dump(itemCart) %} #}
  30.                         <a href="{{ path('product_detail', {id: itemCart['product'].id, brand: itemCart['product'].brand.name | urlSanitizer, slug: translated.slug}) }}"
  31.                            class="text-black fw-bold">
  32.                             {{ translated.name }}
  33.                         </a>
  34.                         <div class="pt-2">
  35.                             {% if itemCart['attribut'] is not null %}
  36.                                 {% set attributTranslated = itemCart['attribut'].attributTerms|translate %}
  37.                                 <div>
  38.                                     {{ itemCart['attribut'].attributTerms.attributTitles.translate(app.request.locale).name }}
  39.                                     : <span class="fw-bold">{{ attributTranslated.name }}</span>
  40.                                 </div>
  41.                             {% endif %}
  42.                             <div>
  43.                                 {{ "PHARMACODE" | trans }}:
  44.                                 <span class="fw-bold">{{ itemCart['product'].pharmacode }}</span>
  45.                             </div>
  46.                             <div>
  47.                                 {{ "Marque" | trans }}:
  48.                                 <span class="fw-bold">{{ itemCart['product'].brand.name }}</span>
  49.                             </div>
  50.                         </div>
  51.                     </div>
  52.                     <div class="col-2 col-lg-2 d-flex align-items-center justify-content-start flex-column">
  53.                         <div class="d-flex align-items-center py-1">
  54.                             {% if hasAction %}
  55.                                 <div class="qt-item" data-cart-qt-down
  56.                                      data-product="{{ itemCart['product'].id }}"
  57.                                      data-attribut="{{ itemCart['attribut'] ? itemCart['attribut'].id : 0 }}"
  58.                                 >
  59.                                     <i class="fas fa-minus"></i>
  60.                                 </div>
  61.                             {% endif %}
  62.                             <div class="qt-count" data-cart-qt-count="{{ itemCart['product'].id }}"
  63.                                  style="user-select: none">{{ itemCart['quantity'] }}</div>
  64.                             {% if hasAction %}
  65.                                 <div class="qt-item" data-cart-qt-up
  66.                                      data-product="{{ itemCart['product'].id }}"
  67.                                      data-attribut="{{ itemCart['attribut'] ? itemCart['attribut'].id : 0 }}"
  68.                                 >
  69.                                     <i class="fas fa-plus"></i>
  70.                                 </div>
  71.                             {% endif %}
  72.                         </div>
  73.                         {% if hasAction %}
  74.                             <a href="#!" class="text-danger text-decoration-underline d-block mt-3" data-cart-delete
  75.                                data-product="{{ itemCart['product'].id }}"
  76.                                data-attribut="{{ itemCart['attribut'] ? itemCart['attribut'].id : 0 }}">
  77.                                 {{ "Supprimer" | trans }}
  78.                             </a>
  79.                         {% endif %}
  80.                     </div>
  81.                     <div class="col-3 col-lg-2">
  82.                         <p class="text-center">{{ itemCart['price']|format_currency("CHF") }}</p>
  83.                     </div>
  84.                     <div class="col-3 col-lg-2">
  85.                         <p class="text-center"
  86.                            data-item-total="{{ itemCart['product'].id }}">{{ itemCart['total']|format_currency("CHF") }}</p>
  87.                     </div>
  88.                     <div class="col-12">
  89.                         <div app-product-gift data-id="{{ itemCart['product'].id }}"></div>
  90.                     </div>
  91.                     {% if hasAction %}
  92.                         {% set productPrestatations = itemCart['product'].productsPrestations %}
  93.                         {% if productPrestatations|length > 0 %}
  94.                             {% set formatedPrestation = [] %}
  95.                             {% for service in productPrestatations %}
  96.                                 {% set formatedPrestation = formatedPrestation|merge([{
  97.                                     'id': service.prestation.id,
  98.                                     "icon": service.prestation.icon,
  99.                                     "name": service.prestation.name,
  100.                                     "description": service.prestation.description}
  101.                                 ]) %}
  102.                             {% endfor %}
  103.                             <div class="row d-flex justify-content-end mb-2">
  104.                                 <div
  105.                                         app-service-cart
  106.                                         class="col-sm-12 col-lg-6"
  107.                                         data-prestations="{{ formatedPrestation|json_encode }}"
  108.                                         data-form-id="{{ itemCart['product'].id }}"
  109.                                 ></div>
  110.                             </div>
  111.                         {% endif %}
  112.                     {% endif %}
  113.                 </div>
  114.             {% endfor %}
  115.             {% for prestation in prestations %}
  116.                 <div class="row py-3 border-bottom align-items-center"
  117.                      data-prestation="{{ prestation.pharmacyPrestation.id }}"
  118.                      id="prestation-{{ prestation.pharmacyPrestation.id }}">
  119.                     <div class="col-lg-3 d-flex justify-content-center">
  120.                         <img src="{{ prestation.productPrestation.prestation.icon }}" width="50"
  121.                              alt="{{ prestation.productPrestation.prestation.name }}" class="img-fluid">
  122.                     </div>
  123.                     <div class="col-lg-3">
  124.                         <p class="text-black m-0">
  125.                             {{ prestation.productPrestation.prestation.name }}
  126.                         </p>
  127.                     </div>
  128.                     <div class="col-lg-2 d-flex align-items-center justify-content-start flex-column">
  129.                         <div class="d-flex align-items-center py-1">
  130.                             {% if hasAction %}
  131.                                 <a href="{{ path('order_step_prestation') }}">{{ "GĂ©rer" }}</a>
  132.                             {% endif %}
  133.                         </div>
  134.                     </div>
  135.                     <div class="col-lg-2">
  136.                     </div>
  137.                     <div class="col-lg-2">
  138.                         <p class="text-center m-0">{{ prestation.price|format_currency("CHF") }}</p>
  139.                     </div>
  140.                 </div>
  141.             {% endfor %}
  142.             <div class="mt-2">
  143.                 <div app-product-gift data-id="{{ null }}"></div>
  144.             </div>
  145.             <div class="py-3 text-center {{ cart|length >= 1 ? "d-none" : "" }}" id="cart-no-product">
  146.                 <h4 class="text-muted">
  147.                     <span class="fas fa-shopping-cart"></span>
  148.                     {{ "Votre panier est vide" | trans }}
  149.                 </h4>
  150.                 <a
  151.                         href="{{ path('app_shop') }}"
  152.                         class="text-decoration-underline text-muted">
  153.                     {{ "Faire mes achats" | trans }}
  154.                 </a>
  155.             </div>
  156.         </div>
  157.         <div class="col-12 col-lg-4 px-2 ps-lg-5">
  158.             <div class="px-5 py-3" style="background-color: #EEEEEE">
  159.                 <h4 class="text-center">{{ "COMMANDE" | trans }}</h4>
  160.                 <hr>
  161.                 <div>
  162.                     <div class="row">
  163.                         <div class="col-7">{{ "Produit(s)" | trans }}: <span
  164.                                     class="cart-product-count">{{ cart|length }}</span></div>
  165.                         <div class="col-5 fw-bold text-end"
  166.                              id="cart-total-no-coupon">{{ total|format_currency("CHF") }}</div>
  167.                     </div>
  168.                     <hr>
  169.                     {% if hasAction %}
  170.                         <div class="row my-4">
  171.                             <div class="col-7">
  172.                                 <label for="" class="fw-bold">{{ "CODE PROMO" | trans }}</label>
  173.                                 <input type="text" class="form-control bg-white" placeholder="{{ "Code promo"|trans }}"
  174.                                        id="promo-code">
  175.                                 <input type="hidden" name="token" value="{{ csrf_token('promo-code-csrf') }}"
  176.                                        id="promo-code-csrf"/>
  177.                             </div>
  178.                             <div class="col-5 align-self-end">
  179.                                 <button class="btn btn-primary" id="promo-code-submit">{{ "Appliquer"|trans }}</button>
  180.                             </div>
  181.                             <div class="col-12 small d-none" id="promo-code-result"></div>
  182.                         </div>
  183.                     {% else %}
  184.                         <div class="row">
  185.                             <div class="col-12">
  186.                                 {#                                <span class="fw-bold">{{ "MODE DE TRANSPORT:" | trans }}</span> {{ (transport|translate).name }} #}
  187.                                 <span class="fw-bold">{{ "MODE DE TRANSPORT:" | trans }}</span> {{ "Click and collect" |  trans }}
  188.                             </div>
  189.                             <div class="col-12">
  190.                                 <span class="fw-bold">{{ "PAIEMENT LORS DU RETRAIT" | trans }}</span>
  191.                             </div>
  192.                         </div>
  193.                     {% endif %}
  194.                     <div class="row">
  195.                         <div class="col-12 fw-bold my-2">
  196.                             {{ "REDUCTION" | trans }}:
  197.                             <ul class="m-0" id="coupon_list">
  198.                                 {% for coupon in coupons %}
  199.                                     <li>
  200.                                         {{ include('elements/products/_product_promocode_type.html.twig', {
  201.                                             reference: coupon['ref'],
  202.                                             type: coupon['type'],
  203.                                             discount: coupon['discount']
  204.                                         }) }}
  205.                                     </li>
  206.                                     {% if coupon['type'] == "AMOUNT" %}
  207.                                         {% set total = total - coupon['discount'] %}
  208.                                     {% else %}
  209.                                         {% set total = total - (total * coupon['discount'] / 100) %}
  210.                                     {% endif %}
  211.                                 {% endfor %}
  212.                             </ul>
  213.                         </div>
  214.                     </div>
  215.                     <div class="row">
  216.                         <div class="col-6 fw-bold">{{ "TOTAL" | trans }}:</div>
  217.                         <div class="col-6 text-end"
  218.                              id="cart-total-coupon">{{ total|format_currency("CHF") }}</div>
  219.                     </div>
  220.                 </div>
  221.             </div>
  222.         </div>
  223.     </div>
  224. </div>