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

<div class="table-container">
    <table class="table is-fullwidth is-narrow is-striped is-bordered django-ledger-table-bottom-margin-75">
        <thead>
        <tr>
            <th>{% trans 'Inventory Number' %}</th>
            <th>{% trans 'Item' %}</th>
            <th>{% trans 'UOM' %}</th>
            <th>{% trans 'Inventory Account' %}</th>
            <th>{% trans 'COGS Account' %}</th>
            <th>{% trans 'Action' %}</th>
        </tr>
        </thead>
        <tbody>
        {% for inv_item in inventory_item_list %}
            <tr>
                <td>{{ inv_item.item_number }}</td>
                <td>{{ inv_item.name }}</td>
                <td>{{ inv_item.uom }}</td>
                <td>{{ inv_item.inventory_account }}</td>
                <td>{{ inv_item.cogs_account }}</td>
                <td>
                    <div class="dropdown is-right is-hoverable" id="inv-item-action-{{ inv_item.uuid }}">
                        <div class="dropdown-trigger">
                            <button class="button is-small is-rounded is-outlined is-dark"
                                    aria-haspopup="true"
                                    aria-controls="dropdown-menu">
                                <span>Actions</span>
                                <span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
                            </button>
                        </div>

                        <div class="dropdown-menu" id="dropdown-menu-{{ inv_item.uuid }}" role="menu">
                            <div class="dropdown-content">
                                <a href="{% url 'django_ledger:inventory-item-update' entity_slug=entity_slug item_pk=inv_item.uuid %}"
                                   class="dropdown-item has-text-success">{% trans 'Update' %}</a>
                            </div>
                        </div>
                    </div>

                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
