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

{% block content %}
<div class="card bg-white mb-3">
  <h3 class="card-header text-center">
    {{ title }}
  </h3>
  <div class="card-body" id="form">
    <a class="btn btn-sm btn-success" href="{% url "food:qrcode_basic_create" slug=slug %}">
      {% trans 'New basic food' %}
    </a>
    <form method="post">
      {%  csrf_token %}
      {{ form|crispy }}
      <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
    </form>
    <div class="card-body" id="profile_infos">
      <h4>{% trans "Copy constructor" %}</h4>
      <table class="table">
        <thead>
          <tr>
            <th class="orderable">
              {% trans "Name" %}
            </th>
            <th class="orderable">
              {% trans "Owner" %}
            </th>
            <th class="orderable">
              {% trans "Arrival date" %}
            </th>
            <th class="orderable">
              {% trans "Expiry date" %}
            </th>
          </tr>
        </thead>
        <tbody>
          {% for basic in last_basic %}
            <tr>
              <td><a href="{% url "food:qrcode_basic_create" slug=slug %}?copy={{ basic.pk }}">{{ basic.name }}</a></td>
              <td>{{ basic.owner }}</td>
              <td>{{ basic.arrival_date }}</td>
              <td>{{ basic.expiry_date }}</td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
</div>
{% endblock %}
