{% load i18n %}
{% load url from future %}
{% load currency_filters %}

<table id="" class="table">
    <tbody>
        <tr>
            <th>{% trans "Name" %}</th>
            <td>{{ account.name }}</td>
        </tr>
        <tr>
            <th>{% trans "Description" %}</th>
            <td>{{ account.description|default:"-" }}</td>
        </tr>
        <tr>
            <th>{% trans "Status" %}</th>
            <td>{{ account.status }}</td>
        </tr>
        <tr>
            <th>{% trans "Code" %}</th>
            <td>{{ account.code|default:"-" }}</td>
        </tr>
        <tr>
            <th>{% trans "Account type" %}</th>
            <td>{{ account.account_type.full_name }}</td>
        </tr>
        <tr>
            <th>{% trans "Balance" %}</th>
            <td>{{ account.balance|currency }}</td>
        </tr>
        <tr>
            <th>{% trans "Credit limit" %}</th>
            <td>
                {% if not account.has_credit_limit %}
                    {% trans "No limit" %}
                {% else %}
                    {{ account.credit_limit|currency }}
                {% endif %}
            </td>
        </tr>
        {% if account.start_date %}
            <tr>
                <th>{% trans "Start date" %}</th>
                <td>{{ account.start_date|default:"-" }}</td>
            </tr>
        {% endif %}
        {% if account.end_date %}
            <tr>
                <th>{% trans "End date" %}</th>
                <td>{{ account.end_date|default:"-" }}</td>
            </tr>
        {% endif %}
        {% if account.primary_user %}
            <tr>
                <th>{% trans "Primary user" %}</th>
                <td>{{ account.primary_user }}</td>
            </tr>
        {% endif %}
        {% with num_users=account.secondary_users.all.count %}
            {% if num_users %}
                <tr>
                    <th>{% trans "Num secondary users" %}</th>
                    <td>{{ num_users}}</td>
                </tr>
            {% endif %}
        {% endwith %}
        {% if account.product_range %}
            <tr>
                <th>{% trans "Can be spent on products from range" %}</th>
                <td><a href="{% url 'dashboard:range-update' account.product_range.id %}">{{ account.product_range }}</a></td>
            </tr>
        {% endif %}
    </tbody>
</table>
