{% extends "oscar/customer/baseaccountpage.html" %}
{% load i18n %}

{% block tabcontent %}
    {% if wishlists %}
        <table class="table table-striped table-bordered">
            <tbody>
                <tr>
                    <th>{% trans 'Name' %}</th>
                    <th>{% trans 'Number of products' %}</th>
                    <th>{% trans 'Action' %}</th>
                </tr>
                {% for wishlist in wishlists %}
                    <tr>
                        <td><a href="{% url 'customer:wishlists-detail' key=wishlist.key %}">{{ wishlist.name }}</a></td>
                        <td>{{ wishlist.lines.count }}</td>
                        <td>
                            <div class="btn-group">
                                <a class="btn btn-secondary" href="{% url 'customer:wishlists-detail' key=wishlist.key %}">{% trans 'View' %}</a>
                                <button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown"></button>
                                <div class="dropdown-menu">
                                    <a href="{% url 'customer:wishlists-update' key=wishlist.key %}" class="dropdown-item">
                                        {% trans 'Wish list settings' %}
                                    </a>
                                    {% if wishlist.is_shareable %}
                                    <a href="{{ wishlist.get_shared_url }}" class="dropdown-item clipboard-item">
                                        {% trans 'Copy sharing link' %}
                                    </a>
                                    {% endif %}
                                    <a href="{% url 'customer:wishlists-delete' key=wishlist.key %}" class="dropdown-item">
                                        {% trans 'Delete' %}
                                    </a>
                                </div>
                            </div>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
        {% include "oscar/partials/pagination.html" %}
    {% else %}
        <p>
            {% trans "You don't have any wish lists yet." %}
        </p>
    {% endif %}

    <p>
        <a href="{% url 'customer:wishlists-create' %}" class="btn btn-primary">{% trans 'Create a new wish list' %}</a>
    </p>

{% endblock tabcontent %}

{% block onbodyload %}
    {{ block.super }}
    oscar.customer.wishlists.init();
{% endblock %}
