{% 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>PO Number</th>
            <th>Description</th>
            <th>Status Date</th>
            <th>PO Status</th>
            <th>PO Amount</th>
            <th>Actions</th>
        </tr>
        </thead>
        <tbody>
        {% for po in po_list %}
            <tr>
                <td>{% if po.po_number %}{{ po.po_number }}{% endif %}</td>
                <td>{{ po.po_title }}</td>
                <td>{{ po.get_status_action_date }}</td>
                <td>{{ po.get_po_status_display }}</td>
                <td>{% currency_symbol %}{{ po.po_amount | currency_format }}</td>
                <td class="has-text-centered">
                    <div class="dropdown is-right is-hoverable" id="bill-action-{{ po.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-{{ po.uuid }}" role="menu">
                            <div class="dropdown-content">
                                <a href="{% url 'django_ledger:po-detail' entity_slug=entity_slug po_pk=po.uuid %}"
                                   class="dropdown-item has-text-success">Details</a>
                                <a href="{% url 'django_ledger:po-delete' entity_slug=entity_slug po_pk=po.uuid %}"
                                   class="dropdown-item has-text-weight-bold has-text-danger">{% trans ' Delete' %}</a>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

</div>
