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

<div class="table-responsive">
    {% if extraction.products_sorted|length > 0 %}
        <table class="table table-striped" id="table_extraction_details">
            <thead>
                <tr>
                    <th></th>
                    <th>Ore Type</th>
                    <th>Rarity</th>
                    <th>Est. Unit Price</th>
                    <th>Volume</th>
                    <th>Est. Total Price. *</th>
                </tr>
            </thead>
            <tbody>
                {% for product in extraction.products_sorted %}
                    <tr>
                        <td><img src="{{ product.ore_type.icon_url_32 }}"/></td>
                        <td>
                            <a href="{{ product.ore_type.profile_url }}" target="_blank">
                                {{ product.ore_type.name }}
                            </a>
                        </td>
                        <td>{{ product.ore_type.rarity_class.bootstrap_tag_html }}</td>
                        <td>{{ product.ore_type.price|floatformat:"0"|intcomma|default:"?" }}</td>
                        <td>{{ product.volume|floatformat:"0"|intcomma }}</td>
                        <td>{{ product.total_price|formatisk:"b"|default:""}}</td>
                    </tr>
                {% endfor %}
            </tbody>
            <tfoot>
                <tr>
                    <th></th>
                    <th>TOTAL</th>
                    <th></th>
                    <th></th>
                    <th>{{ extraction.volume|floatformat:"0"|intcomma }}</th>
                    <th>{{ extraction.value|formatisk:"b"|default:""}}</th>
                </tr>
            </tfoot>
        </table>
    {% else %}
        <p class="text-muted">No data.</p>
    {% endif %}
</div>
