{% extends 'dashboard/layout.html' %}
{% load url from future %}
{% load i18n %}

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

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

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

{% block dashboard_content %}
    {% if transactions %}
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th>{% trans "Datacash reference" %}</th>
                    <th>{% trans "Order number" %}</th>
                    <th>{% trans "Method" %}</th>
                    <th>{% trans "Amount" %}</th>
                    <th>{% trans "Currency" %}</th>
                    <th>{% trans "Merchant reference" %}</th>
                    <th>{% trans "Auth code" %}</th>
                    <th>{% trans "Status" %}</th>
                    <th>{% trans "Reason" %}</th>
                    <th>{% trans "Date" %}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
            {% for txn in transactions %}
            <tr {% if txn.accepted %}class="success"{% elif txn.declined %}class="info"{% else %}class="error"{% endif %}>
                <td><a href="{% url 'datacash-transaction-detail' txn.pk %}">{{ txn.datacash_reference }}</a></td>
                <td>{{ txn.order_number }}</td>
                <td>{{ txn.method }}</td>
                <td>{{ txn.amount }}</td>
                <td>{{ txn.currency }}</td>
                <td>{{ txn.merchant_reference|default:"-" }}</td>
                <td>{{ txn.auth_code|default:"-" }}</td>
                <td>{{ txn.status }}</td>
                <td>{{ txn.reason }}</td>
                <td>{{ txn.date_created }}</td>
                <td>
                    <a href="{% url 'datacash-transaction-detail' txn.pk %}" class="btn btn-info">{% trans "View" %}</a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
        {% include "partials/pagination.html" %}
    {% else %}
        <p>{% trans "No transactions have been made yet." %}</p>
    {% endif %}
{% endblock dashboard_content %}
