templates/frontoffice_bundle/article/product.html.twig line 1
{% extends "frontoffice_bundle/base.html.twig" %}
{% block menu %}
<li><a href="/">Accueil</a></li>
<li><a href="/products/Légumes/1/" {% if nom == "Légumes" %}class="active"{% endif %}>Légumes</a></li>
<li><a href="/products/Fruits/2/" {% if nom == "Fruits" %}class="active"{% endif %}>Fruits</a></li>
<li><a href="/products/Poissons/3/" {% if nom == "Poissons" %}class="active"{% endif %}>Poissons</a></li>
<li><a href="/products/Hygiènes/5/" {% if nom == "Hygiènes" %}class="active"{% endif %}>Hygiènes</a></li>
<li><a href="/products/Réstauration/4/" {% if nom == "Réstauration" %}class="active"{% endif %}>Réstauration</a></li>
<li><a href="/products/Alimentations_générales/6/" {% if nom == "Alimentations_générales" %}class="active"{% endif %}>Alimentations générales</a></li>
{% endblock %}
{% block body %}
<style>
.center{
width: 150px;
margin: 40px auto;
}
.fruite-item {
height: 100%;
transition: 0.5s;
}
.fruite-item:hover {
box-shadow: 0 0 55px rgba(0, 0, 0, 0.4);
}
.fruite-item .fruite-img {
overflow: hidden;
transition: 0.5s;
border-radius: 10px 10px 0 0;
}
.fruite-item .fruite-img img {
transition: 0.5s;
}
.fruite-item .fruite-img img:hover {
transform: scale(1.3);
}
.fruite-name .active{
color: #ffb524 !important;
}
</style>
<div class="container-fluid page-header py-5">
<h1 class="text-center text-white display-6">Produits</h1>
<ol class="breadcrumb justify-content-center mb-0">
<li class="breadcrumb-item"><a href="/">Acceuil</a></li>
<li class="breadcrumb-item"><a href="/products">Produits</a></li>
<li class="breadcrumb-item active text-white">
{% if nom == "Légumes" %}
Légumes
{% elseif nom == "Fruits" %}
Fruits
{% elseif nom == "Poissons" %}
Poissons
{% elseif nom == "Réstauration" %}
Réstauration
{% elseif nom == "Hygiènes" %}
Hygiènes
{% elseif nom == "Alimentations_générales" %}
Alimentations générales
{% endif %}
</li>
</ol>
</div>
<section>
<div class="container">
<div class="row">
<div class="col-lg-3 mt-3">
<div class="row g-4">
<div class="col-lg-12">
<form action="/search/" method="GET">
<div class="input-group w-100 mx-auto d-flex">
<input type="search" class="form-control p-3" placeholder="mots clés" aria-describedby="search-icon-1" name="name">
<button type="submit" id="search-icon-1" class="input-group-text p-3"><i class="fa fa-search"></i></button>
</div>
</form>
</div>
</div>
<div class="row g-4">
<div class="col-lg-12">
<div class="mb-3">
<h4 class="mt-2">Categories</h4>
<ul class="list-unstyled fruite-categorie">
<li>
<div class="d-flex justify-content-between fruite-name pt-2">
<a href="/products/Legumes/1/" class="nav-item nav-link {% if app.request.pathinfo == '/products/Legumes/1/' %}active{% endif %}"><i class="fas fa-apple-alt me-2"></i>Légumes</a>
</div>
</li>
<li>
<div class="d-flex justify-content-between fruite-name pt-2">
<a href="/products/Fruits/2/" class="nav-item nav-link {% if app.request.pathinfo == '/products/Fruits/2/' %}active{% endif %}"><i class="fas fa-apple-alt me-2"></i>Fruits</a>
</div>
</li>
<li>
<div class="d-flex justify-content-between fruite-name pt-2">
<a href="/products/Poissons/3/" class="nav-item nav-link {% if app.request.pathinfo == '/products/Poissons/3/' %}active{% endif %}"><i class="fas fa-apple-alt me-2"></i>Poissons</a>
</div>
</li>
<li>
<div class="d-flex justify-content-between fruite-name pt-2">
<a href="/products/Restauration/4/" class="nav-item nav-link {% if app.request.pathinfo == '/products/Restauration/4/' %}active{% endif %}"><i class="fas fa-apple-alt me-2"></i>Réstauration</a>
</div>
</li>
<li>
<div class="d-flex justify-content-between fruite-name pt-2">
<a href="/products/Hygienes/5/" class="nav-item nav-link {% if app.request.pathinfo == '/products/Hygienes/5/' %}active{% endif %}"><i class="fas fa-apple-alt me-2"></i>Hygiènes</a>
</div>
</li>
<li>
<div class="d-flex justify-content-between fruite-name pt-2">
<a href="/products/Alimentations_generales/6/" class="nav-item nav-link {% if app.request.pathinfo == '/products/Alimentations_generales/6/' %}active{% endif %}"><i class="fas fa-apple-alt me-2"></i>Alimentations générales</a>
</div>
</li>
</ul>
</div>
</div>
<div class="col-lg-12">
<div class="position-relative">
<img src='{{ asset("bundles/Frontoffice/img/banner-fruits.jpg")}}' class="img-fluid w-100 rounded" alt="">
<div class="position-absolute" style="top: 50%; right: 10px; transform: translateY(-50%);">
<h4 class="text-secondary fw-bold">Bannière <br> De <br> Fruits <br> Frais</h4>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-9 mt-3">
<div class="row g-4 justify-content-center">
{% if listarticles %}
{% for lm in listarticles %}
<div class="col-md-6 col-lg-6 col-xl-4 ">
<div class="rounded position-relative fruite-item border border-secondary rounded-bottom" >
<div class="fruite-img">
<a href="/product/{{ lm["categorie"] }}/{{ lm["categorie"] }}/{{ lm["article"].id }}/">
<img src="{{ asset(lm["article"].imgPrincipale) }}" class="img-fluid w-100 rounded-top " alt="" style="height: 250px !important;padding: 10px !important;">
</a>
</div>
<div class="text-white bg-secondary px-3 py-1 rounded position-absolute" style="top: 10px; left: 10px;">{{ lm["categorie"] }}</div>
<div class="p-4">
<h4>{{ lm["article"].titre }}</h4>
<div class="d-flex justify-content-between flex-lg-wrap">
<div class="input-group" style="width: 60%;margin-top:10px;margin-bottom: 10px;margin-left: auto;margin-right: auto;">
<div class="input-group-btn">
<button type="button" class="btn btn-default btn-number" disabled="disabled" data-type="minus" data-field="quant-{{ lm["article"].id }}">
<i class="fa fa-minus"></i>
</button>
</div>
<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 }}">
<div class="input-group-btn">
<button type="button" class="btn btn-default btn-number" data-type="plus" data-field="quant-{{ lm["article"].id }}">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
</div>
<div class="d-flex justify-content-between flex-lg-inherit">
<p class="text-dark fs-5 fw-bold mb-0 mt-1">
{% if typeCompte == "PRO" %}
{% if lm["article"].prixPromo > 0 and lm["article"].prixPromo < lm["article"].prixProTTC %}
{{ lm["article"].prixPromo|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
{% set prix = lm["article"].prixPromo %}
{% else %}
{{ lm["article"].prixProTTC|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
{% set prix = lm["article"].prixProTTC %}
{% endif %}
{% else %}
{% if lm["article"].prixPromo > 0 and lm["article"].prixPromo < lm["article"].prixTTC %}
{{ lm["article"].prixPromo|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
{% set prix = lm["article"].prixPromo %}
{% else %}
{{ lm["article"].prixTTC|number_format(2, '.', '') }} DH / {{ lm["article"].unite }}
{% set prix = lm["article"].prixTTC %}
{% endif %}
{% endif %}
</p>
<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>
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="text-center" style="margin-top:30%;"><h3 class="text-secondary fw-bold">Aucun produit disponible pour le moment</h3></div>
{% endif %}
</div>
<div class="col-12">
<div class="pagination d-flex justify-content-center mt-5">
{{ knp_pagination_render(articles) }}
</div>
</div>
</div>
</div>
</div>
</section>
<div id="myModal" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" role="dialog">
<div class="modal-dialog modal-lg" style="min-width: 90%;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-lg-5">
<div class="image-large">
<img src="" alt="Product" id="imgProduct" style="max-width: 100%;">
</div>
</div>
<div class="col-lg-7">
<div class="product-details" style="width: 100%;">
<div class="text-right">
</div>
<h3 class="product-name" id="titleProduct"></h3>
<h4 class="product-name" id="titleProduct2"></h4>
<h4 class="product-price" style="text-decoration: line-through;color:#868686;"><strong id="priceProductOld"></strong></h4>
<h2 class="product-price"><strong id="priceProduct"></strong></h2>
<a href="#" class="view-more-detail" id="moreDetail">Voir plus de Details</a>
</div>
<div class="row">
<div class="col-lg-4">
<div class="option-dropdowns" style="width: 100%;">
<div>
<div>
<input type="hidden" id="idArticle" value="0" />
<div class="input-group" style="width: 100%;">
<div class="input-group-btn">
<button type="button" class="btn btn-default btn-number" disabled="disabled" data-type="minus" data-field="quant[1]">
<i class="glyphicon glyphicon-minus"></i>
</button>
</div>
<input type="text" name="quant[1]" class="form-control input-number" id="qte" value="1" min="1" max="150" unite="">
<div class="input-group-btn">
<button type="button" class="btn btn-default btn-number" data-type="plus" data-field="quant[1]">
<i class="glyphicon glyphicon-plus"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="buttons">
<div>
<a class="button vert add-to-bag" onclick="addArtPan()"><i class="fa fa-shopping-cart"></i> Ajouter au panier </a>
</div>
</div>
</div>
</div>
<div id="shareDiv">
<h3>PARTAGER : </h3>
<div class='social-share-btns-container'>
<div class='social-share-btns'>
<a class='share-btn share-btn-twitter' href='https://twitter.com/intent/tweet?text=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank'>
<i class="fa fa-twitter" aria-hidden="true"></i>
</a>
<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'>
<i class="fa fa-facebook" aria-hidden="true"></i>
</a>
<a class='share-btn share-btn-linkedin' href='https://www.linkedin.com/cws/share?url=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank'>
<i class="fa fa-linkedin" aria-hidden="true"></i>
</a>
<a class='share-btn share-btn-mail' href='mailto:?subject=Look Fun Codepen Account&amp;body=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank' title='via email'>
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</a>
<a class='share-btn share-btn-reddit' href='mailto:?subject=Look Fun Codepen Account&amp;body=https://codepen.io/marko-zub/#' rel='nofollow' target='_blank' title='via email'>
<i class="fa fa-google-plus" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel-body -->
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script type="text/javascript">
var listOfProduct = {{ articlesJson|json_encode|raw }};
function addArtPan(){
var qte = document.getElementById("qte").value;
var id = document.getElementById("idArticle").value;
addToPanier(id,qte);
var lastPan = parseInt(document.getElementById("nbrArticle").innerText);
var nbrPan = lastPan+1;
document.getElementById("nbrArticle").innerText = nbrPan;
}
function addToPanierArticle(id){
var qte = document.getElementById("quant-"+id).value;
addToPanier(id,qte);
var lastPan = parseInt(document.getElementById("nbrArticle").innerText);
var nbrPan = lastPan+1;
document.getElementById("nbrArticle").innerText = nbrPan;
}
</script>
<script src='{{ asset("bundles/Frontoffice/js/products.js") }}'></script>
{% endblock %}