templates/produits/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Listes des produits!{% endblock %}
  3. {% block description %}Listes des produits{% endblock %}
  4. {% block body %}
  5.     <section>
  6.         <div class="container bg-center">
  7.             <nav aria-label="breadcrumb">
  8.                 <ol class="breadcrumb">
  9.                     <li class="breadcrumb-item"><a href="{{ path('accueil') }}">Accueil</a></li>
  10.                     <li class="breadcrumb-item active" aria-current="page">Listes des produits</li>
  11.                 </ol>
  12.             </nav>
  13.             <div class="row p-4">
  14.                 <h2>Nos Produits</h2>
  15.             </div>
  16.             {% for row in produits %}
  17.             <div class="row p-4">
  18.                 <h2>{{ row.catprod.name }} {{ row.name }}</h2>
  19.             </div>
  20.             <div class="row pt-2 pb-2">
  21.                 <div class="col-sm-3">
  22.                     <img class="img-fluid" height="200" src="/assets/src/{{ row.photo }}" alt="{{ row.name }}">
  23.                 </div>
  24.                 <div class="col-sm-9">
  25.                     <p>{{ row.description |raw  }}</p>
  26.                    <p> <strong>Prix:</strong> <span class="text-success">{{ row.price }} €</span></p>
  27.                     <div class="mb-2">
  28.                         <form action="{{ path("paniers_add") }}" method="post">
  29.                             <input type="hidden" name="produit" value="{{ row.id }}">
  30.                             <input type="hidden" name="name" value="{{ row.name }}">
  31.                             <input type="hidden" name="photo" value="{{ row.photo }}">
  32.                             {#                        {{ dump(app.session.get('panier')[details.id]["qte"]) }} #}
  33.                             {% if row.status == 1 %}
  34.                             <div class="form-row">
  35.                                 <div class="col-2">
  36.                                     <input type="number" class="form-control" name="qte" id="qte" min="0" max="{{ row.stock }}" value="{% if row.id in app.session.get('panier')|keys %}{{ app.session.get('panier')[row.id]['qte'] }}{% else %}1{% endif %}">
  37.                                 </div>
  38.                                 <div class="col">
  39.                                     <button type="submit" class="btn btn-success">Ajouter au panier</button>
  40.                                 </div>
  41.                             </div>
  42.                             {% else %}
  43.                                 <div class="alert alert-warning" role="alert">
  44.                                     Produit indisponible
  45.                                 </div>
  46.                             {% endif %}
  47.                         </form>
  48.                     </div>
  49.                     <p><a class="btn btn-dark" href="{{ path('produit_details', {id : row.id}) }}">Detail</a></p>
  50.                 </div>
  51.             </div>
  52.                 <hr>
  53.         {% endfor %}
  54.             <div class="row p-4">
  55.             {{ knp_pagination_render(produits) }}
  56.             </div>
  57.         </div>
  58.     </section>
  59. {% endblock %}