{% 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>
      <li><p>{% trans 'Arrival date' %} : {{ food.arrival_date }}</p></li>
      <li><p>{% trans 'Expiry date' %} : {{ food.expiry_date }} ({{ food.date_type }})</p></li>
      <li>{% trans 'Allergens' %} :</li>
      <ul>
      {% for allergen in food.allergens.iterator %}
        <li>{{ allergen.name }}</li>
      {% endfor %}
      </ul>
	<p>
	<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:basic_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 %}
