{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}

{% block content %}
<div class="card bg-white mb-3">
    <h3 class="card-header text-center">
	{{ title }} {{ food.name }}
    </h3>
	<div class="card-body">
	    <ul>
		<li><p>{% trans 'Owner' %} : {{ food.owner }}</p></li>
		{% if can_see_ready %}
		<li><p>{% trans 'Ready' %} : {{ food.is_ready }}</p></li>
		{% endif %}
		<li><p>{% trans 'Creation date' %} : {{ food.creation_date }}</p></li>
		<li><p>{% trans 'Expiry date' %} : {{ food.expiry_date }}</p></li>
		<li>{% trans 'Allergens' %} :</li>
		<ul>
		    {% for allergen in food.allergens.iterator %}
		    <li>{{ allergen.name }}</li>
		    {% endfor %}
	        </ul>
		<p>
		<li>{% trans 'Ingredients' %} :</li>
		<ul>
		    {% for ingredient in food.ingredient.iterator %}
		    <li><a href="{% url "food:food_view" pk=ingredient.pk %}">{{ ingredient.name }}</a></li>
		    {% endfor %}
		</ul>
		<p>
		<li><p>{% trans 'Shelf life' %} : {{ food.shelf_life }}</p></li>
		<li><p>{% trans 'Ready' %} : {{ food.is_ready }}</p></li>
		<li><p>{% trans 'Active' %} : {{ food.is_active }}</p></li>
		<li><p>{% trans 'Eaten' %} : {{ food.was_eaten }}</p></li>
	    </ul>
	    {% if can_update %}
	        <a class="btn btn-sm btn-warning" href="{% url "food:transformed_update" pk=food.pk %}">
		    {% trans 'Update' %}
		</a>
	    {% endif %}
	    {% if can_add_ingredient %}
	        <a class="btn btn-sm btn-success" href="{% url "food:add_ingredient" pk=food.pk %}">
		    {% trans 'Add to a meal' %}
		</a>
	    {% endif %}
    </div>
</div>
{% endblock %}
