{% extends 'base.html.twig' %}
{% block title %}{{ details.name }}!{% endblock %}
{% block description %}{{ details.description|striptags }}{% endblock %}
{% block picture %}/assets/src/{{ details.photo }}{% endblock %}
{% block body %}
<section>
<div class="container bg-center">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ path('accueil') }}">Accueil</a></li>
<li class="breadcrumb-item"><a
href="{{ path('categories', {id:details.catprod.souscat.id}) }}">{{ details.catprod.souscat.name }}</a>
</li>
<li class="breadcrumb-item"><a
href="{{ path('produits_listes', {id:details.catprod.id}) }}">{{ details.catprod.name }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ details.name }}</li>
</ol>
</nav>
<div class="row p-4">
<h2>{{ details.name }}</h2>
</div>
<div class="row pt-2 pb-2">
<div class="col-sm-3">
<img alt="{{ details.name }}" src="/assets/src/{{ details.photo }}" class="img-fluid">
</div>
<div class="col-sm-9">
<p>{{ details.description |raw }}</p>
<p><strong>Prix : </strong><span class="text-success">{{ details.price }} €</span></p>
<form action="{{ path("paniers_add") }}" method="post">
<input type="hidden" name="produit" value="{{ details.id }}">
<input type="hidden" name="name" value="{{ details.name }}">
<input type="hidden" name="photo" value="{{ details.photo }}">
{# {{ dump(app.session.get('panier')[details.id]["qte"]) }} #}
{% if details.status == 1 %}
<div class="form-row">
<div class="col-2">
<input type="number" class="form-control" name="qte" id="qte" min="0" max="{{ details.stock }}" value="{% if details.id in app.session.get('panier')|keys %}{{ app.session.get('panier')[details.id]['qte'] }}{% else %}1{% endif %}">
</div>
<div class="col">
<button type="submit" class="btn btn-success">Ajouter au panier</button>
</div>
</div>
{% else %}
<div class="alert alert-warning" role="alert">
Produit indisponible
</div>
{% endif %}
</form>
</div>
</div>
</div>
</section>
{% endblock %}