{% extends 'base.html' %}
{% block entete %}Gestion des produits{% endblock %}
{% block navbar%}
<ul>
	<li><a href="#first">Liste des menus</a></li>
</ul>
{% endblock %}
{% block content %}
<section id="first" class="main">
	<header class="major">
		<h2>Liste des menus</h2>
	</header>
	<a class="button" href="{% url 'gestion:addMenu' %}"><i class="fa fa-plus-square"></i> Créer un menu</a><br><br>
	<div class="table-wrapper">
		<table>
			<thead>
				<tr>
					<th>Nom</th>
					<th>Prix</th>
					<th>Produits</th>
					<th>Actif</th>
					<th>Administrer</th>
				</tr>
			</thead>
			<tbody>
				{% for menu in menus %}
				<tr>
					<td>{{ menu.name }}</td>
					<td>{{ menu.amount}} €</td>
					<td>{% for art in menu.articles.all %}<a href="{% url 'gestion:productProfile' art.pk %}">{{art}}</a>,{% endfor %}</td>
					<td><i class="fa fa-{{ menu.is_active | yesno:'check,times'}}"></i></td>
					<td>{% if perms.gestion.change_menu %}<a href="{% url 'gestion:switchActivateMenu' menu.pk %}" class="button small">{% if menu.is_active %}<i class="fa fa-times-cirlce"></i> Désa{% else %}<i class="fa fa-check-circle"></i> A{% endif %}ctiver</a> <a href="{% url 'gestion:editMenu' menu.pk %}" class="button small"><i class="fa fa-pencil-alt"></i> Modifier</a>{% endif %}</td>
				</tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
</section>
{% endblock %}
