{% extends 'oscar/dashboard/layout.html' %}
{% load i18n %}
{% load currency_filters %}

{% block title %}
    {% trans "Shipping methods" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% trans "Shipping methods" %}</li>
        </ol>
    </nav>
{% endblock %}

{% block header %}
    <div class="page-header">
        <a id="create_new_shipping_method" href="{% url 'dashboard:shipping-method-create' %}" class="btn btn-primary float-right"><i class="fas fa-plus-circle"></i> {% trans "Create new shipping charge" %}</a>
        <h1>{% trans "Shipping methods" %}</h1>
    </div>
{% endblock header %}

{% block dashboard_content %}
    <table class="table table-striped table-bordered">
        <caption><i class="fas fa-truck"></i> {% trans "Shipping methods" %}</caption>
        {% if methods %}
            <thead>
                <tr>
                    <th>{% trans "Name" %}</th>
                    <th>{% trans "Number of weight bands" %}</th>
                    <th>{% trans "Default weight (kg)" %}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                {% for method in methods %}
                    <tr>
                        <td>
                            <a href="{% url 'dashboard:shipping-method-detail' pk=method.pk %}">{{ method.name }}</a>
                        </td>
                        <td>{{ method.num_bands }}</td>
                        <td>{{ method.default_weight }}</td>
                        <td>
                            <a href="{% url 'dashboard:shipping-method-detail' pk=method.pk %}" class="btn btn-secondary">{% trans "View" %}</a>
                            <a href="{% url 'dashboard:shipping-method-edit' pk=method.pk %}" class="btn btn-primary">{% trans "Edit" %}</a>
                            <a href="{% url 'dashboard:shipping-method-delete' pk=method.pk %}" class="btn btn-danger">{% trans "Delete" %}</a>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        {% else %}
            <tr><td>{% trans "No shipping methods found." %}</td></tr>
        {% endif %}
    </table>
{% endblock %}
