{% extends "base.html" %}
{% comment %}
Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n pretty_money %}

{% 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> {% trans "Associated food" %} : 
        <a href="{% url "food:transformedfood_view" pk=food.pk %}">
          {{ food.name }}
        </a>
      </li>
      <li> {% trans "Sell price" %} : {{ dish.price|pretty_money }}</li>
      <li> {% trans "Available" %} : {{ dish.available|yesno }}</li>
      <li> {% trans "Possible supplements" %} : 
        {% for supp in supplements %}
          <a href="{% url "food:food_view" pk=supp.food.pk %}">{{ supp.food.name }} ({{ supp.price|pretty_money }})</a>{% if not forloop.last %},{% endif %}
        {% endfor %}
      </li>
    </ul>
    {% if update %}
        <a class="btn btn-sm btn-secondary" href="{% url "food:dish_update" activity_pk=dish.activity.pk pk=dish.pk %}">
          {% trans "Update" %}
        </a>
    {% endif %}
    <a class="btn btn-sm btn-primary" href="{% url "food:dish_list" activity_pk=dish.activity.pk %}">
          {% trans "Return to dish list" %}
        </a>
    {% if delete %}
    <a class="btn btn-sm btn-danger" href="{% url "food:dish_delete" activity_pk=dish.activity.pk pk=dish.pk %}">
          {% trans "Delete" %}
        </a>
    {% endif %}
  </div>
</div>
{% endblock %}
