templates/frontoffice_bundle/article/tousProducts.html.twig line 1

  1. {% extends "frontoffice_bundle/base.html.twig" %}
  2. {% block body %}
  3.     <style>
  4.         .center{
  5.             width: 150px;
  6.             margin: 40px auto;
  7.         }
  8.         .pagination {
  9.             display:flex;
  10.             
  11.         }
  12.         .pagination .page-link {
  13.             color: var(--bs-dark);
  14.             padding: 10px 16px;
  15.             text-decoration: none;
  16.             transition: 0.5s;
  17.             border: 1px solid var(--bs-secondary);
  18.             margin: 0 4px;
  19.         }
  20.         
  21.         .pagination .page-link .active {
  22.             background-color: var(--bs-primary);
  23.             color: var(--bs-light);
  24.             border: 1px solid var(--bs-secondary);
  25.         }
  26.         
  27.         .pagination .page-link:hover:not(.active) {background-color: var(--bs-primary)}
  28.         .nav.nav-tabs .nav-link.active {
  29.             border-bottom: 2px solid var(--bs-secondary) !important;
  30.         }
  31.                 .fruite-item {
  32.             height: 100%;
  33.             transition: 0.5s;
  34.         }
  35.         .fruite-item:hover {
  36.             box-shadow: 0 0 55px rgba(0, 0, 0, 0.4);
  37.         }
  38.         .fruite-item .fruite-img {
  39.             overflow: hidden;
  40.             transition: 0.5s;
  41.             border-radius: 10px 10px 0 0;
  42.         }
  43.         .fruite-item .fruite-img img {
  44.             transition: 0.5s;
  45.         }
  46.         .fruite-item .fruite-img img:hover {
  47.             transform: scale(1.3);
  48.         }
  49.         .fruite-name .active{
  50.             color: #ffb524 !important;
  51.         }
  52.     </style>
  53.     <div class="container-fluid page-header py-5">
  54.         <h1 class="text-center text-white display-6">Produits</h1>
  55.         <ol class="breadcrumb justify-content-center mb-0">
  56.             <li class="breadcrumb-item"><a href="#">Acceuil</a></li>
  57.             <li class="breadcrumb-item active text-white">Tous les produits
  58.         </li>
  59.         </ol>
  60.     </div>
  61.     <section>
  62.         <div class="container">
  63.             <div class="row">
  64.             <div class="row">
  65.                 <div class="col-lg-3 mt-3">
  66.                     <div class="row g-4">
  67.                         <div class="col-lg-12">
  68.                             <form action="/search/" method="GET">
  69.                                 <div class="input-group w-100 mx-auto d-flex">
  70.                                     <input type="search" class="form-control p-3" placeholder="mots clés" aria-describedby="search-icon-1" name="name">
  71.                                     <button type="submit" id="search-icon-1" class="input-group-text p-3"><i class="fa fa-search"></i></button>
  72.                                 </div>
  73.                             </form>
  74.                         </div>
  75.                     </div>
  76.                     <div class="row g-4">
  77.                         <div class="col-lg-12">
  78.                             <div class="mb-3">
  79.                                 <h4 class="mt-2">Categories</h4>
  80.                                 <ul class="list-unstyled fruite-categorie">
  81.                                     <li>
  82.                                         <div class="d-flex justify-content-between fruite-name pt-2">
  83.                                             <a href="/products/Légumes/1/" ><i class="fas fa-apple-alt me-2"></i>Légumes</a>
  84.                                         </div>
  85.                                     </li>
  86.                                     <li>
  87.                                         <div class="d-flex justify-content-between fruite-name pt-2">
  88.                                             <a href="/products/Fruits/2/"><i class="fas fa-apple-alt me-2"></i>Fruits</a>
  89.                                         </div>
  90.                                     </li>
  91.                                     <li>
  92.                                         <div class="d-flex justify-content-between fruite-name pt-2">
  93.                                             <a href="/products/Poissons/3/"><i class="fas fa-apple-alt me-2"></i>Poissons</a>
  94.                                         </div>
  95.                                     </li>
  96.                                     <li>
  97.                                         <div class="d-flex justify-content-between fruite-name pt-2">
  98.                                             <a href="/products/Réstauration/4/"><i class="fas fa-apple-alt me-2"></i>Réstauration</a>
  99.                                         </div>
  100.                                     </li>
  101.                                     <li>
  102.                                         <div class="d-flex justify-content-between fruite-name pt-2">
  103.                                             <a href="/products/Hygiènes/5/"><i class="fas fa-apple-alt me-2"></i>Hygiènes</a>
  104.                                         </div>
  105.                                     </li>
  106.                                     <li>
  107.                                         <div class="d-flex justify-content-between fruite-name pt-2">
  108.                                             <a href="/products/Alimentations_générales/6/"><i class="fas fa-apple-alt me-2"></i>Alimentations générales</a>
  109.                                         </div>
  110.                                     </li>
  111.                                 </ul>
  112.                             </div>
  113.                         </div>
  114.                         <div class="col-lg-12">
  115.                             <div class="position-relative">
  116.                                 <img src='{{ asset("bundles/Frontoffice/img/banner-fruits.jpg")}}' class="img-fluid w-100 rounded" alt="">
  117.                                 <div class="position-absolute" style="top: 50%; right: 10px; transform: translateY(-50%);">
  118.                                     <h4 class="text-secondary fw-bold">Bannière <br> De <br> Fruits <br> Frais</h4>
  119.                                 </div>
  120.                             </div>
  121.                         </div>
  122.                     </div>
  123.                 </div>
  124.                 <div class="col-lg-9 mt-3">
  125.                     <div class="row g-4 justify-content-center">
  126.                     {% if articles %}
  127.                         {% for lm in articles %}
  128.                             <div class="col-md-6 col-lg-6 col-xl-4">
  129.                                 <div class="rounded position-relative fruite-item  border border-secondary  rounded-bottom">
  130.                                     <div class="fruite-img">
  131.                                         <a href="/product/{{ lm["categorie"] }}/{{ lm["categorie"] }}/{{ lm["article"].id }}/">
  132.                                             <img src="{{ asset(lm["article"].imgPrincipale) }}" class="img-fluid w-100 rounded-top " alt="" style="height: 250px !important;padding: 10px !important;">
  133.                                         </a>
  134.                                     </div>
  135.                                     <div class="text-white bg-secondary px-3 py-1 rounded position-absolute" style="top: 10px; left: 10px;">{{ lm["categorie"] }}</div>
  136.                                     <div class="p-4">
  137.                                         
  138.                                         <h4>{{ lm["article"].titre }}</h4>
  139.                                         <div class="d-flex justify-content-between flex-lg-wrap">
  140.                                             <div class="input-group" style="width: 60%;margin-top:10px;margin-bottom: 10px;margin-left: auto;margin-right: auto;">
  141.                                                 <div class="input-group-btn">
  142.                                                     <button type="button" class="btn btn-default btn-number" disabled="disabled" data-type="minus" data-field="quant-{{ lm["article"].id }}">
  143.                                                         <i class="fa fa-minus"></i>
  144.                                                     </button>
  145.                                                 </div>
  146.                                                 <input type="text" name="quant-{{ lm["article"].id }}" class="form-control input-number" id="quant-{{ lm["article"].id }}" value="{{ lm["article"].minQte }}" min="{{ lm["article"].minQte }}" max="150" unite="{{ lm["article"].unite }}">
  147.                                                 <div class="input-group-btn ">
  148.                                                     <button type="button" class="btn btn-default btn-number" data-type="plus" data-field="quant-{{ lm["article"].id }}">
  149.                                                         <i class="fa fa-plus"></i>
  150.                                                     </button>
  151.                                                 </div>
  152.                                             </div>
  153.                                         </div>
  154.                                         <div class="d-flex justify-content-between flex-lg-inherit">
  155.                                             <p class="text-dark fs-6 fw-bold mb-0 mt-1">
  156.                                                 {% if typeCompte == "PRO" %}
  157.                                                     {% if lm["article"].prixPromo > 0 and lm["article"].prixPromo < lm["article"].prixProTTC %}
  158.                                                         {{ lm["article"].prixPromo|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
  159.                                                         {% set prix = lm["article"].prixPromo %}
  160.                                                     {% else %}
  161.                                                         {{ lm["article"].prixProTTC|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
  162.                                                         {% set prix = lm["article"].prixProTTC %}
  163.                                                     {% endif %}
  164.                                                 {% else %}
  165.                                                     {% if lm["article"].prixPromo > 0 and lm["article"].prixPromo < lm["article"].prixTTC %}
  166.                                                         {{ lm["article"].prixPromo|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
  167.                                                         {% set prix = lm["article"].prixPromo %}
  168.                                                     {% else %}
  169.                                                         {{ lm["article"].prixTTC|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
  170.                                                         {% set prix = lm["article"].prixTTC %}
  171.                                                     {% endif %}
  172.                                                 {% endif %}
  173.                                             </p>
  174.                                             <button class="btn border border-secondary rounded-pill px-3 text-primary add-to-cart" onClick='addToPanierArticle({{ lm["article"].id }});'>Ajouter au <i class="fa fa-shopping-cart"></i></button>
  175.                                         </div>
  176.                                     </div>
  177.                                 </div>
  178.                             </div>    
  179.                         {% endfor %}
  180.                     {% else %}
  181.                         <div class="text-center" style="margin-top:30%;"><h3 class="text-secondary fw-bold">Aucun produit disponible pour le moment</h3></div>
  182.                     {% endif %}
  183.                     </div>
  184.                     <div class="col-12">
  185.                         <div class="pagination d-flex justify-content-center mt-5">
  186.                             {{ knp_pagination_render(articles) }}
  187.                         </div>
  188.                         
  189.                     </div>
  190.                 </div>
  191.             </div>
  192.         </div>
  193.     </section>
  194.     <div id="myModal" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" role="dialog">
  195.         <div class="modal-dialog modal-lg" style="min-width: 90%;">
  196.             <div class="modal-content">
  197.                 <div class="modal-header">
  198.                     <h4 class="modal-title"></h4>
  199.                     <button type="button" class="close" data-dismiss="modal">&times;</button>
  200.                 </div>
  201.                 <div class="modal-body">
  202.                     <div class="panel panel-default">
  203.                         <div class="panel-body">
  204.                             <div class="row">
  205.                                 <div class="col-lg-5">
  206.                                     <div class="image-large">
  207.                                         <img src="" alt="Product" id="imgProduct" style="max-width: 100%;">
  208.                                     </div>
  209.                                 </div>
  210.                                 <div class="col-lg-7">
  211.                                     <div class="product-details" style="width: 100%;">
  212.                                         <div class="text-right">
  213.                                         </div>
  214.                                         <h3 class="product-name" id="titleProduct"></h3>
  215.                                         <h4 class="product-name" id="titleProduct2"></h4>
  216.                                         <h4 class="product-price" style="text-decoration: line-through;color:#868686;"><strong id="priceProductOld"></strong></h4>
  217.                                         <h2 class="product-price"><strong id="priceProduct"></strong></h2>
  218.                                         <a href="#" class="view-more-detail" id="moreDetail">Voir plus de Details</a>
  219.                                     </div>
  220.                                     <div class="row">
  221.                                         <div class="col-lg-4">
  222.                                             <div class="option-dropdowns" style="width: 100%;">
  223.                                                 <div>
  224.                                                     <div>
  225.                                                         <input type="hidden" id="idArticle" value="0" />
  226.                                                         <div class="input-group" style="width: 100%;">
  227.                                                             <div class="input-group-btn">
  228.                                                                 <button type="button" class="btn btn-default btn-number" disabled="disabled" data-type="minus" data-field="quant[1]">
  229.                                                                     <i class="glyphicon glyphicon-minus"></i>
  230.                                                                 </button>
  231.                                                             </div>
  232.                                                             <input type="text" name="quant[1]" class="form-control input-number" id="qte" value="1" min="1" max="150" unite="">
  233.                                                             <div class="input-group-btn">
  234.                                                                 <button type="button" class="btn btn-default btn-number" data-type="plus" data-field="quant[1]">
  235.                                                                     <i class="glyphicon glyphicon-plus"></i>
  236.                                                                 </button>
  237.                                                             </div>
  238.                                                         </div>
  239.                                                     </div>
  240.                                                 </div>
  241.                                             </div>
  242.                                         </div>
  243.                                         <div class="col-lg-8">
  244.                                             <div class="buttons">
  245.                                                 <div>
  246.                                                     <a class="button vert add-to-bag" onclick="addArtPan()"><i class="fa fa-shopping-cart"></i>  Ajouter au panier </a>
  247.                                                 </div>
  248.                                             </div>
  249.                                         </div>
  250.                                     </div>
  251.                                     <div id="shareDiv">
  252.                                         <h3>PARTAGER : </h3>
  253.                                         <div class='social-share-btns-container'>
  254.                                             <div class='social-share-btns'>
  255.                                                 <a class='share-btn share-btn-twitter' href='https://twitter.com/intent/tweet?text=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank'>
  256.                                                     <i class="fa fa-twitter" aria-hidden="true"></i>
  257.                                                 </a>
  258.                                                 <a class='share-btn share-btn-facebook' href='https://www.facebook.com/sharer/sharer.php?u=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank'>
  259.                                                     <i class="fa fa-facebook" aria-hidden="true"></i>
  260.                                                 </a>
  261.                                                 <a class='share-btn share-btn-linkedin' href='https://www.linkedin.com/cws/share?url=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank'>
  262.                                                     <i class="fa fa-linkedin" aria-hidden="true"></i>
  263.                                                 </a>
  264.                                                 <a class='share-btn share-btn-mail' href='mailto:?subject=Look Fun Codepen Account&amp;amp;body=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank' title='via email'>
  265.                                                     <i class="fa fa-envelope-o" aria-hidden="true"></i>
  266.                                                 </a>
  267.                                                 <a class='share-btn share-btn-reddit' href='mailto:?subject=Look Fun Codepen Account&amp;amp;body=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank' title='via email'>
  268.                                                     <i class="fa fa-google-plus" aria-hidden="true"></i>
  269.                                                 </a>
  270.                                             </div>
  271.                                         </div>
  272.                                     </div>
  273.                                 </div>
  274.                             </div>
  275.                             <!-- /.panel-body -->
  276.                         </div>
  277.                         <!-- /.panel-body -->
  278.                     </div>
  279.                 </div>
  280.             </div>
  281.         </div>
  282.     </div>
  283. {% endblock %}
  284. {% block js %}
  285.     <script type="text/javascript">
  286.         var listOfProduct = {{ articlesJson|json_encode|raw }};
  287.         function addArtPan(){
  288.             var qte = document.getElementById("qte").value;
  289.             var id = document.getElementById("idArticle").value;
  290.             addToPanier(id,qte);
  291.             var lastPan = parseInt(document.getElementById("nbrArticle").innerText);
  292.             var nbrPan = lastPan+1;
  293.             document.getElementById("nbrArticle").innerText = nbrPan;
  294.         }
  295.         function addToPanierArticle(id){
  296.             var qte = document.getElementById("quant-"+id).value;
  297.             addToPanier(id,qte);
  298.             var lastPan = parseInt(document.getElementById("nbrArticle").innerText);
  299.             var nbrPan = lastPan+1;
  300.             document.getElementById("nbrArticle").innerText = nbrPan;
  301.         }
  302.     </script>
  303.     <script src='{{ asset("bundles/Frontoffice/js/products.js") }}'></script>
  304. {% endblock %}