{% extends "layout.html" %}
{% load url from future %}
{% load currency_filters %}
{% load i18n %}

{% block title %}
    {% trans 'Check my balance' %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <ul class="breadcrumb">
        <li>
            <a href="{% url 'promotions:home' %}">{% trans 'Home' %}</a>
            <span class="divider">/</span>
        </li>
        <li class="active">{% trans 'Accounts' %}</li>
    </ul>
{% endblock %}

{% block headertext %}{% trans 'Check balance of giftcard' %}{% endblock %}

{% block content %}

    {% if is_blocked %}
        <p>{% trans "Your IP address is currently blocked.  Please try again later." %}</p>
    {% else %}
        <form action="." method="post" class="form-horizontal">
            {% csrf_token %}
            {% include 'partials/form_fields.html' %}
            <button type="submit" class="btn btn-large">{% trans "Fetch account details" %}</button>
        </form>
    {% endif %}

    {% if account %}
        <table id="" class="table">
            <tbody>
                <tr>
                    <th>{% trans "Code" %}</th>
                    <td>{{ account.code }}</td>
                </tr>
                <tr>
                    <th>{% trans "Balance" %}</th>
                    <td>{{ account.balance|currency }}</td>
                </tr>
                <tr>
                    <th>{% trans "Status" %}</th>
                    <td>{{ account.status }}</td>
                </tr>
                {% if account.start_date %}
                    <tr>
                        <th>{% trans "Start date" %}</th>
                        <td>{{ account.start_date }}</td>
                    </tr>
                {% endif %}
                {% if account.end_date %}
                    <tr>
                        <th>{% trans "End date" %}</th>
                        <td>{{ account.end_date }}</td>
                    </tr>
                {% endif %}
            </tbody>
        </table>
    {% endif %}

{% endblock %}
