templates/etapes/panier.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block body %}
  3. <div class="container-fluid">
  4.     <h1 class="mb-3 d-flex justify-content-between">
  5.         <span>Panier
  6.             {% if cart.date is defined %}<small><small class="badge text-white bg-primary ml-2">( {{ cart.date|replace({'-': "/"}) }} )</small></small>{% endif %}
  7.         </span>  
  8.         {% if cart_details is not empty %}
  9.         <form action="/panier" method="POST" class="d-print-none">
  10.             <input type="hidden" name="reset_cart" value="true">
  11.             <button type="submit" class="btn btn-sm bg-danger text-white" style="display: inline-block;">
  12.                 <i class="fas fa-trash"></i><span class="d-none d-md-inline">&nbsp;&nbsp;Vider le panier</span>
  13.             </button>
  14.         </form>
  15.         {% endif %}
  16.     </h1>
  17.     {% if cart_details is not empty %}
  18.         {# {{ dump(cart_details) }} #}
  19.         {% set totalPanier = 0 %}
  20.         {% set totalAPayer = 0 %}
  21.         {% for formule in cart_details  %}
  22.             {% if formule.forfaits is defined %}
  23.                 <div class="card mb-4">
  24.                     <h4 class="card-header d-flex justify-content-between">
  25.                         Formule : {{ formule.obj_formule.getDesignation() }}
  26.                         <form action="/panier" class="d-print-none" method="POST">
  27.                             <input type="hidden" name="remove_formule" value="{{ formule.obj_formule.getCode() }}">
  28.                             <button type="submit" title="Supprimer la fomule" class="btn btn-sm bg-secondary text-white" style="display: inline-flex;">
  29.                                 <i class="fas fa-trash"></i><span class="msg-remove_formule">&nbsp;&nbsp;Supprimer la formule</span>
  30.                             </button>
  31.                         </form>
  32.                     </h4>
  33.                     <div class="card-body">
  34.                         {% set totalFormule = 0 %}
  35.                         {% set acompteFormuleAnniversaire = 0 %}
  36.                         {% for forfait in formule.forfaits  %}
  37.                             <h5>{{ forfait.obj_forfait.getDesignation() }}</h5>
  38.                             {% if forfait.activity is defined %}
  39.                                 {% if formule.obj_formule.getCode() != "anniversaire" %}
  40.                                 <p class="mb-1">
  41.                                     <u>Créneau réservé :</u>
  42.                                 </p>
  43.                                 <ul class="pl-4">
  44.                                 {% for activity in forfait.activity  %}
  45.                                     <li><b>{{ activity.obj_activity.getDesignation() }} 
  46.                                       {% if activity.creneau is defined %}
  47.                                         à {{ activity.creneau }}
  48.                                       {% endif %}
  49.                                     </b> ({{ activity.participants }} personnes {% if activity.creneau is defined %} x {{ activity.parties }} parties{% endif %})</li>
  50.                                 {% endfor %}
  51.                                 </ul>
  52.                                 {% else %}
  53.                                     <p class="mb-1">
  54.                                         <u>Créneau d'anniversaire réservé :</u>
  55.                                     </p>
  56.                                     <p>Le <b>{{ cart.date|replace({'-': "/"}) }}</b> à <b>{{ forfait.infos_anniv.creneau_anniv }}</b> pour <b>{{ forfait.infos_anniv.nbreParticipants }} personnes</b></p>
  57.                                     <p class="mb-1">
  58.                                         <u>Activités à créneaux réservées :</u>
  59.                                     </p>
  60.                                     <ul class="pl-4">
  61.                                     {% for activity in forfait.activity  %}
  62.                                          <li><b>{{ activity.obj_activity.getDesignation() }}</b> : {{ activity.parties }} partie(s)</li>
  63.                                     {% endfor %}
  64.                                     </ul>
  65.                                     <p><b>Vous serez recontacté.e rapidement par la Team 10.55 pour les horaires de vos activités à créneaux.</b></p>
  66.                                 {% endif %}
  67.                             {% endif %}
  68.                             <p class="mb-1"><u>Tarifs :</u></p>
  69.                             <ul class="pl-4">
  70.                             {% for tarif in forfait.tarifs  %}
  71.                                 {% if forfait.tarifs|length == 1 and formule.obj_formule.getCode() == "anniversaire" and acompteFormuleAnniversaire == 0 %}
  72.                                     {% set totalAPayer = totalAPayer + ( tarif.obj_tarif.getPriceTtc() * 4) %}
  73.                                     {% set acompteFormuleAnniversaire =  tarif.obj_tarif.getPriceTtc() * 4 %}
  74.                                 {% endif %}
  75.                                 {% set totalFormule = totalFormule + (tarif.qty) * tarif.obj_tarif.getPriceTtc() %}
  76.                                 <li>{{ tarif.obj_tarif.getDesignation() }} : <span class="text-white badge bg-primary px-2 py-1">{{ tarif.qty }} x {{ tarif.obj_tarif.getPriceTtc() }}€</span></li>
  77.                             {% endfor %}
  78.                             </ul>
  79.                             {% if forfait.options is not empty %}
  80.                                 <p class="mb-1"><u>Options :</u></p>
  81.                                 <ul class="pl-4">
  82.                                 {% for option in forfait.options  %}
  83.                                     {% set totalFormule = totalFormule + (option.qty) * option.obj_option.getPriceTtc() %}
  84.                                     <li>{{ option.obj_option.getDesignation() }} : <span class="text-white badge bg-primary px-2 py-1">{{ option.qty }} x {{ option.obj_option.getPriceTtc() }}€</span></li>
  85.                                 {% endfor %}
  86.                                 </ul>
  87.                             {% endif %}
  88.                             <hr>
  89.                         {% endfor %}
  90.                         {% set totalPanier = totalPanier + totalFormule %}
  91.                         {% if formule.obj_formule.getCode() != "anniversaire" %}
  92.                             {% set totalAPayer = totalAPayer + totalFormule %}
  93.                         {% endif %}
  94.                         <div class="d-flex justify-content-end">
  95.                             <span><b>Total formule :</b> <span class="bg-light border px-2 py-1"><b>{{ totalFormule }}€</b></span> <span class="badge">(TTC)</span></span>
  96.                         </div>
  97.                         {% if formule.obj_formule.getCode() == "anniversaire" and acompteFormuleAnniversaire != 0 %}
  98.                         <div class="d-flex justify-content-end mt-2">
  99.                             <span class="badge"><b>Acompte :</b> <span class="bg-light border px-2 py-1"><b>{{ acompteFormuleAnniversaire }}€</b></span> <span>(TTC)</span></span>
  100.                         </div>
  101.                         {% endif %}
  102.                     </div>
  103.                 </div>
  104.                 {% if formule.obj_formule.getCode() == "anniversaire" %}
  105.                     <div class="card mb-4">
  106.                         <form id="customer_comment" method="POST" action="/panier" class="p-0" style="">
  107.                             <div class="card-header h6 alert alert-warning mb-2">Souhaitez-vous ajouter un commentaire à votre réservation d'anniversaire ?</div>
  108.                             <div class="card-body pt-2 pb-3">
  109.                             {# {{ dump() }} #}
  110.                                 {% if cart['birthday_customer_comment'] is defined %}
  111.                                     {% set birthday_customer_comment = cart['birthday_customer_comment'] %}
  112.                                     {% set txt_btn_bcc = "Modifier le commentaire" %}
  113.                                 {% else %}
  114.                                     {% set birthday_customer_comment = "" %}
  115.                                     {% set txt_btn_bcc = "Ajouter le commentaire" %}
  116.                                 {% endif %}
  117.                                 <textarea  id="birthday_customer_comment" name="birthday_customer_comment" class="form-control">{{ birthday_customer_comment }}</textarea>
  118.                                 <button type="submit" class="mt-2 btn btn-secondary">{{ txt_btn_bcc }}</button>
  119.                             </div>
  120.                         </form>
  121.                     </div>
  122.                 {% endif %}
  123.             {% endif %}
  124.         {% endfor %}
  125.         <div class="mb-4">
  126.             <div class="d-flex justify-content-end">
  127.                 <div class="card pt-2 px-2">
  128.                     <form id="formcodepromo" method="POST" action="/panier" class="p-0" style="">
  129.                         <div class="d-inline-flex mr-md-2 mb-2">
  130.                             {# <div class="alert alert-danger">
  131.                                 Bon numérique en maintenance !<br><small>si vous souhaitez payer avec votre e-ticket, <br>revenez un peu plus tard, <br>ce moyen de paiement est en maintenance</small>
  132.                             </div> #}
  133.                             <div class="input-group">
  134.                                 <input id="bon_numerique" name="bon_numerique" class="form-control" placeholder="E-ticket" type="text">
  135.                                 <div class="input-group-append">
  136.                                     <button type="submit" class="btn btn-secondary">Utiliser mon E-ticket</button>
  137.                                 </div>
  138.                             </div>
  139.                         </div>
  140.                         {% if cart.code_promo is not defined %}
  141.                         <div class="d-inline-flex mb-2">
  142.                             <div class="input-group">
  143.                                 <input id="codepromo" name="codepromo" class="form-control" placeholder="Code Promo" type="text">
  144.                                 <input id="totalPanier" name="totalPanier" class="form-control" type="hidden" value="{{ totalPanier }}">
  145.                                 <div class="input-group-append">
  146.                                     <button type="submit" class="btn btn-secondary">Utiliser mon code</button>
  147.                                 </div>
  148.                             </div>
  149.                         </div>
  150.                         {% endif %}
  151.                     </form>
  152.                     
  153.                     {% if alert_voucher is defined and alert_voucher != '' %} 
  154.                     <p id="error_reduction" class="h6 mb-2 text-danger">
  155.                         {{ alert_voucher }} 
  156.                     </p>
  157.                     {% else %}
  158.                     <p id="error_reduction" class="h6 mb-2 alert alert-danger d-none">
  159.                     </p>
  160.                     {% endif %}
  161.                     
  162.                     {% if code_promo_response is defined and code_promo_response.error is defined and code_promo_response.error != null %} 
  163.                     <p id="error_reduction" class="h6 mb-2 text-danger">
  164.                         {{ code_promo_response.error }} 
  165.                     </p>
  166.                     {% else %}
  167.                     <p id="error_reduction" class="h6 mb-2 alert alert-danger d-none">
  168.                     </p>
  169.                     {% endif %}
  170.                 </div>
  171.             </div>
  172.         </div>
  173.         <div class="card mb-4">
  174.             {% if cart.bon_numerique is defined %}
  175.                 {% for bon in cart.bon_numerique  %}
  176.                 <div class="card-body d-flex justify-content-end">
  177.                     {% set valeur_promo = "-" ~ (bon.total) ~  "€" %}
  178.                     {% set totalPanier = (totalPanier - bon.total) %}
  179.                     {% set totalAPayer = (totalAPayer - bon.total) %}
  180.                     {% if totalPanier < 0 %}
  181.                         {% set totalPanier = 0 %}
  182.                     {% endif %}
  183.                     {% if totalAPayer < 0 %}
  184.                         {% set totalAPayer = 0 %}
  185.                     {% endif %}
  186.                     <form action="/panier" class="d-print-none" method="POST">
  187.                         <input type="hidden" name="remove_bon_numerique" value="{{ bon.bon }}">
  188.                         <button type="submit" title="Retirer ce E-ticket" class="btn btn-sm bg-white text-danger" style="display: inline-flex;">
  189.                             <i class="fas fa-trash mt-1"></i><span class="msg-remove_bon_numerique py-1 ml-2 bg-danger text-white" style="line-height:1;">&nbsp;&nbsp;Retirer ce Bon</span>
  190.                         </button>
  191.                     </form>
  192.                     <div class="text-danger">
  193.                         E-ticket [{{ bon.bon }}]&nbsp; : &nbsp;
  194.                         <span class="h5"><span class="badge bg-danger text-white border-danger px-2 py-1">{{ valeur_promo }}</span></span>
  195.                     </div>
  196.                 </div>
  197.             {% endfor %}
  198.             {% endif %}
  199.             {% if cart.code_promo is defined %}
  200.                 <div class="card-body d-flex justify-content-end">
  201.                     {% if cart.code_promo.getTypeReduction() == 'percentage' %} 
  202.                         {% set percent_promo = "-" ~ (cart.code_promo.getPercent() * 100) ~  "%" %}
  203.                         {% set valeur_promo = "-" ~ (totalPanier * cart.code_promo.getPercent()) ~  "€" %}
  204.                         {% set totalPanier = (totalPanier - (totalPanier * cart.code_promo.getPercent())) %}
  205.                         <div class="text-danger">
  206.                             Code promo [{{ cart.code_promo.getCode() }}] ({{ percent_promo }})&nbsp; : &nbsp;
  207.                             <span class="h5"><span class="badge bg-danger text-white border-danger px-2 py-1">{{ valeur_promo }}</span></span>
  208.                         </div>
  209.                     {% else %}
  210.                         {% set valeur_promo = "-" ~ (cart.code_promo.getReduction()) ~  "€" %}
  211.                     {% endif %}
  212.                 </div>
  213.             {% endif %}
  214.             {% if totalPanier != totalAPayer %}
  215.                 <h5 class="card-header d-flex justify-content-end">
  216.                     Total panier :&nbsp;<span class="badge bg-light border px-2 py-1"><b>{{ totalPanier }}€</b></span> <span class="badge"><small>(TTC)</small></span></span>
  217.                 </h5>
  218.                 <h4 class="card-header d-flex justify-content-end">
  219.                     Total à payer :&nbsp;<span class="badge bg-success text-white border px-2 py-1"><b>{{ totalAPayer }}€</b></span> <span class="badge"><small>(TTC)</small></span></span>
  220.                 </h4>
  221.             {% else %}
  222.                 <h4 class="card-header d-flex justify-content-end">
  223.                     Total panier :&nbsp;<span class="badge bg-success text-white border px-2 py-1"><b>{{ totalPanier }}€</b></span> <span class="badge"><small>(TTC)</small></span></span>
  224.                 </h4>
  225.             {% endif %}
  226.         </div>
  227.         <div class="container-fluid d-print-none">
  228.             <div class="row justify-content-between">
  229.                 <a href="/" class="btn btn-secondary btn-lg ladda-button d-flex align-items-center" id="etape0" data-style="zoom-out" >
  230.                     <span class="h3 mb-0">&lt;&nbsp;</span>
  231.                     <span class="ladda-label">Ajouter une formule</span>
  232.                 </a>
  233.                 <a href="/paiement" class="btn btn-primary btn-lg ladda-button d-flex align-items-center" id="etape3" data-style="zoom-out" >
  234.                     <span class="ladda-label">Finaliser ma réservation</span>
  235.                     <span class="h3 mb-0">&nbsp;&gt;</span>
  236.                 </a>
  237.             </div>
  238.         </div>
  239.     {% else %}
  240.         <div class="py-5">
  241.             <h3 class="text-center alert alert-warning">Votre panier est vide</h3>
  242.         </div>
  243.     {% endif %}
  244.         
  245. </div>
  246. {% endblock %}