{% load django_ledger %}
{% load i18n %}

<div class="box">
    <div class="table-container">
        <table class="table is-fullwidth is-striped is-hoverable is-narrow">
            <thead>
            <tr>
                <th>{% trans 'Item' %}</th>
                <th>{% trans 'Unit' %}</th>
                <th class="has-text-right">{% trans 'Quantity' %}</th>
                <th class="has-text-right">{% trans 'Unit Cost' %}</th>
                <th class="has-text-right">{% trans 'Unit Sale Price' %}</th>
                <th class="has-text-right">{% trans 'Total Cost' %}</th>
                <th class="has-text-right">{% trans 'Total Revenue' %}</th>
            </tr>
            </thead>
            <tbody>
            {% for ce_item in ce_item_list %}
                <tr>
                    <td><span class="has-text-weight-bold">{{ ce_item.item_model }}</span></td>
                    <td>{% if ce_item.entity_unit %}<span class="tag is-white">{{ ce_item.entity_unit }}</span>{% endif %}</td>
                    <td class="has-text-right">{{ ce_item.ce_quantity }}</td>
                    <td class="has-text-right">{% currency_symbol %}{{ ce_item.ce_unit_cost_estimate | currency_format }}</td>
                    <td class="has-text-right">{% currency_symbol %}{{ ce_item.ce_unit_revenue_estimate | currency_format }}</td>
                    <td class="has-text-right">{% currency_symbol %}{{ ce_item.ce_cost_estimate | currency_format }}</td>
                    <td class="has-text-right">{% currency_symbol %}{{ ce_item.ce_revenue_estimate | currency_format }}</td>
                </tr>
            {% endfor %}
            </tbody>
            <tfoot>
            <tr class="has-text-weight-bold has-background-light">
                <td colspan="5" class="has-text-right">{% trans 'Total' %}</td>
                <td class="has-text-right">{% currency_symbol %}{{ ce_model.get_cost_estimate | currency_format }}</td>
                <td class="has-text-right">{% currency_symbol %}{{ ce_model.get_revenue_estimate | currency_format }}</td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
