{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 humanize i18n %}

{% block content %}
<div class="dashboard-container">
    <div class="dashboard-container-head">
        <h3 class="dashboard-title-thin"><img src="{% static 'hosting/img/shopping-cart.svg' %}" class="un-icon" style="margin-top: -4px; width: 30px;"> {% trans "My Bills" %}</h3>
        {% if messages %}
            <div class="alert alert-warning">
                {% for message in messages %}
                <span>{{ message }}</span>
                {% endfor %}
            </div>
        {% endif %}
        <div class="dashboard-subtitle"></div>
    </div>

    <table class="table table-switch">
        <thead>
            <tr>
                <th>{% trans "Order Nr." %}</th>
                <th>{% trans "Date" %}</th>
                <th>{% trans "Amount" %}</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            {% for order in orders %}
                <tr>
                    <td class="xs-td-inline" data-header="{% trans 'Order Nr.' %}">{{ order.id }}</td>
                    <td class="xs-td-bighalf" data-header="{% trans 'Date' %}">{{ order.created_at | date:"M d, Y H:i" }}</td>
                    <td class="xs-td-smallhalf" data-header="{% trans 'Amount' %}">{{ order.price|floatformat:2|intcomma }}</td>
                    <td class="text-right last-td">
                        <a class="btn btn-order-detail" href="{% url 'hosting:orders' order.pk %}">{% trans 'See Invoice' %}</a>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

    {% if is_paginated %}
        <div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="{{request.path}}?page={{ page_obj.previous_page_number }}">{% trans "previous" %}</a>
                {% endif %}
                <span class="page-current">
                    {% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ page_obj.paginator.num_pages }}.
                </span>
                {% if page_obj.has_next %}
                    <a href="{{request.path}}?page={{ page_obj.next_page_number }}">{% trans "next" %}</a>
                {% endif %}
            </span>
        </div>
    {% endif %}
</div>
{% endblock %}
