{% 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 }} {% trans 'number' %} {{ qrcode.qr_code_number }}
    </h3>
	<div class="card-body">
	    <ul>
		<li><p>{% trans 'Name' %} : {{ qrcode.food_container.name }}</p></li>
		<li><p>{% trans 'Owner' %} : {{ qrcode.food_container.owner }}</p></li>
		<li><p>{% trans 'Expiry date' %} : {{ qrcode.food_container.expiry_date  }}</p></li>
	    </ul>
	{% if qrcode.food_container.polymorphic_ctype.model == 'basicfood' and can_update_basic %}
	    <a class="btn btn-sm btn-warning" href="{% url "food:basic_update" pk=qrcode.food_container.pk %}" data-turbolinks="false">
		{% trans 'Update' %}
	    </a>
	{% elif can_update_transformed %}
	    <a class="btn btn-sm btn-warning" href="{% url "food:transformed_update" pk=qrcode.food_container.pk %}">
		{% trans 'Update' %}
	    </a>
	{% endif %}
	{% if can_view_detail %}
	    <a class="btn btn-sm btn-primary" href="{% url "food:food_view" pk=qrcode.food_container.pk %}">
		{% trans 'View details' %}
	    </a>
	{% endif %}
	{% if can_add_ingredient %}
	    <a class="btn btn-sm btn-success" href="{% url "food:add_ingredient" pk=qrcode.food_container.pk %}">
		{% trans 'Add to a meal' %}
	    </a>
	{% endif %}
	</div>
</div>
{% endblock %}
