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

{% block title %}
    {% trans "WebPay transactions" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <ul class="breadcrumb">
        <li>
            <a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
            <span class="divider">/</span>
        </li>
        <li>
            WebPay <span class="divider">/</span>
        </li>
        <li class="active">{% trans "WebPay transactions" %}</li>
    </ul>
{% endblock %}

{% block headertext %}
    {% trans "WebPay transactions" %}
{% endblock %}

{% block dashboard_content %}

    {% if transactions %}
        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>{% trans "Correlation ID" %}</th>
                    <th>{% trans "Method" %}</th>
                    <th>{% trans "Result" %}</th>
                    <th>{% trans "Token" %}</th>
                    <th>{% trans "Authorization code" %}</th>
                    <th>{% trans "Card number" %}</th>
                    <th>{% trans "Error code" %}</th>
                    <th>{% trans "Error message" %}</th>
                    <th>{% trans "Date" %}</th>
                </tr>
            </thead>
            <tbody>
                {% for txn in transactions %}
                    <tr>
                        <td><a href="{% url 'webpay-transaction-detail' txn.id %}">{{ txn.id|default:"-" }}</a></td>
                        <td>{{ txn.method }}</td>
                        <td>{{ txn.amount|currency:txn.currency }}</td>
                        <td>{{ txn.token|default:'-' }}</td>
                        <td>{{ txn.error_code|default:'-' }}</td>
                        <td>{{ txn.auth_code|default:'-' }}</td>
                        <td>{{ txn.card_number|default:'-' }}</td>
                        <td>{{ txn.error_code.display|default:'-' }}</td>
                        <td>{{ txn.date_created }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
        {% include "partials/pagination.html" %}
    {% else %}
        <p>{% trans "No transactions have been made yet." %}</p>
    {% endif %}

{% endblock dashboard_content %}
