{% load i18n %}
{% load static %}
{% load humanize %}
{% load moonmining %}

<div class="table-responsive">
    {% if character_totals|length > 0 %}
        <table class="table table-striped table-width-fix" id="table-ledger-character-totals">
            <thead>
                <tr>
                    <th>Character</th>
                    <th>Main</th>
                    <th>Corporation</th>
                    <th class="text-right">Volume</th>
                    <th class="text-right">Price</th>
                    <th class="text-right">% Total Volume</th>
                    <th class="text-right">% Total Price</th>
                </tr>
            </thead>
            <tbody>
                {% for record in character_totals %}
                    <tr>
                        <td>{{ record.character_name }}</td>
                        <td>{{ record.main_name|default:"" }}</td>
                        <td>{{ record.corporation_name|default:"" }}</td>
                        <td class="text-right" data-order="{{ record.character_total_volume }}">
                            {{ record.character_total_volume|intcomma }}
                        </td>
                        <td class="text-right" data-order="{{ record.character_total_price }}">
                            {{ record.character_total_price|formatisk:"m" }}
                        </td>
                        <td class="text-right">{{ record.character_percent_volume }}</td>
                        <td class="text-right">{{ record.character_percent_value }}</td>
                    </tr>
                {% endfor %}
            </tbody>
            <tfoot>
                <tr class="info">
                    <th>TOTALS</th>
                    <th></th>
                    <th></th>
                    <th class="text-right">{{ total_volume|intcomma }}</th>
                    <th class="text-right">{{ total_value|formatisk:"m" }}</th>
                    <th></th>
                    <th></th>
                </tr>
            </tfoot>
        </table>
    {% else %}
        <p class="text-muted">No data.</p>
    {% endif %}
</div>
