templates/cart/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}panier{% endblock %}
  3. {% block body %}
  4.     <h1>Mon panier</h1>
  5.  {% if items | length > 0 %}
  6.   
  7. <div class="onlydesktop">
  8.     <table class="tableau">
  9.         <thead class="tableau">
  10.             <tr>
  11.                 <th>Titre</th> 
  12.                 <th>Date de début</th>
  13.                 <th>Date de fin</th>
  14.                 <th>Prix</th>
  15.                 <th>Unité</th>
  16.                 <th>Stock</th>
  17.                 <th>Total</th>
  18.                 <th> Ajouter </th>
  19.                 <th> Enlever </th>
  20.                 <th>Supprimer</th>
  21.             </tr>
  22.         </thead>
  23.         <tbody>
  24.         {% for item in items %}
  25.          
  26.             <tr>
  27.                 <td class="tableaucart">{{ item.activity.title }}</td>
  28.             
  29.                 <td class="tableaucart">{{ item.activity.start ? item.activity.start|date('Y-m-d H:i:s') : '' }}</td>
  30.            
  31.                 <td class="tableaucart">{{ item.activity.end ? item.activity.end|date('Y-m-d H:i:s') : '' }}</td>
  32.            
  33.                 <td class="tableaucart">{{ item.activity.modifiedPrice is not null ? item.activity.modifiedPrice|amount : item.activity.category.categorySetting.price|amount }}</td>
  34.                 <td class="tableaucart">{{ item.quantity }}</td>
  35.               <td class="tableaucart">{{ item.stock }}</td>
  36.            
  37.                 <td class="tableaucart">{{ item.total | amount }}</td>
  38.                    <td>
  39.                         <a href="{{path("cart_add", {'id': item.activity.id})}}" class="success">
  40.                             🛒+
  41.                         </a>
  42.                     </td>
  43.                           <td>
  44.                         <a href=" {{path("cart_decrement", {'id': item.activity.id})}}" class="warning">
  45.                           🛒-
  46.                         </a>
  47.                     </td>
  48.                        <td>
  49.                        
  50.                         <a href="{{path("cart_delete", {'id': item.activity.id})}}" class="danger">
  51.                             <i class="fas fa-trash-alt">Supprimer</i>
  52.                         </a>
  53.                     </td>
  54.             </tr>
  55.             
  56.           {% endfor %}
  57.       
  58.         </tbody>
  59.            <tfoot>
  60.             <tr>
  61.                 <td>Total </td>
  62.                 <td class="text-start">{{ total | amount }} </td>
  63.                 <td>
  64.                     <a href="{{path("cart_delete_all")}}" class="danger">
  65.                            Vider le panier
  66.                     </a>
  67.                    
  68.                 </td>
  69.             </tr>
  70.         </tfoot>
  71.     </table>
  72. </div>
  73. <div class="onlymobil">
  74.   {% for item in items %}
  75.        
  76.                 <h3>Titre</h3>
  77.                 <p>{{ item.activity.title }}</p>
  78.            
  79.                 <h3>Date de début</h3>
  80.                 <p>{{ item.activity.start ? item.activity.start|date('Y-m-d H:i:s') : '' }}</p>
  81.            
  82.                 <h3>Date de fin</h3>
  83.                 <p>{{ item.activity.end ? item.activity.end|date('Y-m-d H:i:s') : '' }}</p>
  84.         
  85.                 <h3>Prix</h3>
  86.                 <p class="tableau">{{  item.activity.price | amount }}</p>
  87.           
  88.                   <h3>Unité</h3>
  89.                 <p class="tableau">{{ item.quantity }}</p>
  90.          
  91.                 <h3>Total</h3>
  92.                 <p class="tableau">{{ item.total | amount }}</p>
  93.           
  94.                 <h3>Ajouter</h3>
  95.                    <p> <a href="{{path("cart_add", {'id': item.activity.id})}}" class="success">
  96.                             🛒 + 1
  97.                         </a>
  98.                         </p>
  99.         
  100.                 <h3>Soustraire</h3>
  101.                    <p>  <a href=" {{path("cart_decrement", {'id': item.activity.id})}}" class="warning">
  102.                           🛒 - 1
  103.                         </a>
  104.                         </p>
  105.          
  106.                 <h3>Supprimer</h3>
  107.                    <p>  <a href="{{path("cart_delete", {'id': item.activity.id})}}" class="danger">
  108.                             <i class="fas fa-trash-alt">Supprimer</i>
  109.                         </a>
  110.                         </p>
  111.           
  112.                 <p>
  113.                     <a class="milieu" href="{{path("cart_delete_all")}}" class="danger">
  114.                            Vider le panier
  115.                     </a>
  116.                 </p>
  117.         <p class="milieu">
  118.                 Total {{ total | amount }} 
  119.             </p>
  120.    {% endfor %}
  121. </div>
  122. <div class="milieu">
  123.     <a class="success" href="{{path("app_agenda")}}">
  124.            Compléter votre panier
  125.        </a>
  126.  </div>      
  127.       
  128.        <hr>
  129.       {% if app.user %}
  130.           {% if cartService.validateOrder() %}
  131.                 <form method="post" action="{{ path('app_purchase_confirm') }}">
  132.                     {% for item in items %}
  133.                         <input type="hidden" name="items[{{ item.activity.id }}][quantity]" value="{{ item.quantity }}">
  134.                         <input type="hidden" name="items[{{ item.activity.id }}][activity]" value="{{ item.activity.title }}">
  135.                     {% endfor %}
  136.                     <button type="submit" class="success">Valider la commande</button>
  137.                 </form>
  138.             {% else %} 
  139.                  <h2> "Stock insuffisant"</h2>
  140.             {% endif %} 
  141.         {% else %}
  142.             <div class="d-flex align-items-center">
  143.                 <h2>Pour valider votre panier, vous devez vous inscrire </h2>
  144.                 <a href="{{ path('app_registration') }}" class="secondary">Créer un compte</a>
  145.             </div>
  146.             <div class="d-flex align-items-center">
  147.                 <h2>Si vous avez déja un compte, vous devez vous connecter pour valider votre panier</h2>
  148.                 <a href="{{ path('app_login') }}" class="success">Connexion</a>
  149.             </div>
  150.         {% endif %}
  151.     {% else %}
  152.         <p>Aucune séance dans le panier </p> 
  153.         <p> Si un lien de paiement vous a été envoyé , il vous faut tout d'abord vous connecter via l'email de confirmation de création de votre compte </p>
  154.         
  155.         <a class="btn btn-primary" href="{{ path('app_agenda') }}">
  156.             Retour aux séances
  157.         </a>
  158.     {% endif %}
  159. {% endblock %}