{% extends 'babybuddy/page.html' %}
{% load datetime i18n widget_tweaks %}

{% block title %}{% trans "Pumping" %}{% endblock %}

{% block breadcrumbs %}
    <li class="breadcrumb-item active" aria-current="page">{% trans "Pumping" %}</li>
{% endblock %}

{% block content %}
    <h1>
        {% trans "Pumping" %}
        {% if perms.core.add_pumping %}
            <a href="{% url 'core:pumping-add' %}" class="btn btn-sm btn-success">
                <i class="icon-pumping" aria-hidden="true"></i> {% trans "Add Pumping Entry" %}
            </a>
        {% endif %}
    </h1>
    {% include 'babybuddy/filter.html' %}
    <div class="table-responsive">
        <table class="table table-instances">
            <thead class="thead-inverse">
                <tr>
                    <th>{% trans "Actions" %}</th>
                    <th>{% trans "Time" %}</th>
                    {% if not unique_child %}
                        <th>{% trans "Child" %}</th>
                    {% endif %}
                    <th>{% trans "Amount" %}</th>
                </tr>
            </thead>
            <tbody>
                {% for pumping in object_list %}
                    {% cycle "odd" "even" as row_class silent %}
                    <tr class="{{ row_class }}">
                        <td>
                            <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">

                                {% if perms.core.change_pumping %}
                                    <a href="{% url 'core:pumping-update' pumping.id %}" class="btn btn-primary">
                                        <i class="icon-update" aria-hidden="true"></i>
                                    </a>
                                {% endif %}

                                {% if perms.core.delete_pumping %}
                                    <a href="{% url 'core:pumping-delete' pumping.id %}" class="btn btn-danger">
                                        <i class="icon-delete" aria-hidden="true"></i>
                                    </a>
                                {% endif %}

                            </div>
                        </td>
                        <th scope="row">{{ pumping.time|datetime_short }}</th>
                        {% if not unique_child %}
                            <td><a href="{% url 'core:child' pumping.child.slug %}">{{ pumping.child }}</a></td>
                        {% endif %}
                        <td>{{ pumping.amount }}</td>
                    </tr>
                    {% if pumping.notes %}
                        <tr class="{{ row_class }} row-details">
                            <td colspan="4"><i class="icon-note mr-2" aria-hidden="true"></i>{{ pumping.notes }}</td>
                        </tr>
                    {% endif %}
                {% empty %}
                    <tr>
                        <th colspan="4">{% trans "No pumping entries found." %}</th>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% include 'babybuddy/paginator.html' %}
{% endblock %}