{% extends 'cards/base.html' %}
{% load i18n %}

{% block header %}
    <a href="{% url "core:feeding-list" %}">
        {% trans "Last Feeding Method" %}
    </a>
{% endblock %}

{% block title %}
    {% if feedings|length > 0 %}
        <div id="feeding-methods-carousel" class="carousel slide" data-bs-interval="false">
            <div class="carousel-inner">
            {% for feeding in feedings %}
                <div class="carousel-item{% if forloop.counter == feedings|length %} active{% endif %}">
                    <div class="last-feeding-method text-center">{{ feeding.get_method_display }}</div>
                    <div class="text-center small text-body-secondary">
                        {% if forloop.last %}
                            {% trans "most recent" %}
                        {% else %}
                            {% blocktrans trimmed with n=forloop.revcounter0 count counter=n %}
                                {{ n }} feeding ago
                            {% plural %}
                                {{ n }} feedings ago
                            {% endblocktrans %}
                        {% endif %}
                    </div>
                </div>
            {% endfor %}
            </div>
            {% if feedings|length > 1 %}
                <a class="carousel-control-prev"
                   href="#feeding-methods-carousel"
                   role="button"
                   data-bs-slide="prev">
                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                    <span class="visually-hidden">{% trans "Previous" %}</span>
                </a>
                <a class="carousel-control-next"
                   href="#feeding-methods-carousel"
                   role="button"
                   data-bs-slide="next">
                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
                    <span class="visually-hidden">{% trans "Next" %}</span>
                </a>
            {% endif %}
        </div>
    {% else %}
        {% trans "None" %}
    {% endif %}

{% endblock %}