{% extends 'base.html' %}
{% block entete %}Gestion des produits{% endblock %}
{% block navbar%}
<ul>
	<li><a href="#first">Liste des produits</a></li>
</ul>
{% endblock %}
{% block content %}
<section id="first" class="main">
	<header class="major">
		<h2>Liste des produits</h2>
	</header>
	{% if perms.gestion.add_product %}
	<a class="button" href="{% url 'gestion:addProduct' %}"><i class="fa fa-boxes"></i> Créer un produit</a><br><br>
	{% endif %}
	<div class="table-wrapper">
		<table>
			<thead>
				<tr>
					<th>Nom</th>
					<th>Prix</th>
					<th>Stock</th>
					<th>Catégorie</th>
					<th>Actif</th>
					<th>Degré</th>
					<th>Volume</th>
					<th>Administrer</th>
				</tr>
			</thead>
			<tbody>
				{% for product in products %}
				<tr>
					<td><a href="{% url 'gestion:productProfile' product.pk %}">{{ product.name }}</a></td>
					<td>{{ product.amount}}</td>
					<td>{{ product.stock }}</td>
					<td>{{ product.category }}</td>
					<td><i class="fa fa-{{ product.is_active | yesno:'check,times'}}"></i></td>
					<td>{{ product.deg }}</td>
					<td>{{ product.volume }} cl</td>
					<td><a href="{% url 'gestion:productProfile' product.pk %}" class="button small"><i class="fa fa-eye"></i> Profil</a> {% if perms.gestion.change_product %}<a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}<i class="fa fa-times-circle"></i> Désa{% else %}<i class="fa fa-check-circle"></i> A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small"><i class="fa fa-pencil-alt"></i> Modifier</a>{% endif %}</td>
				</tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
</section>
{% endblock %}
