{% 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 'Estimate' %}</th>
            <th>{% trans 'Customer' %}</th>
            <th>{% trans 'Title' %}</th>
            <th>{% trans 'Status' %}</th>
            <th>{% trans 'Status Date' %}</th>
            <th>{% trans 'Sales Price' %}</th>
            <th>{% trans 'GM%' %}</th>
            <th>{% trans 'Actions' %}</th>
        </tr>
        </thead>
        <tbody>
        {% for ce_model in ce_list %}
            <tr id="{{ ce_model.get_html_id }}">
                <td>{{ ce_model.estimate_number }}</td>
                <td>{{ ce_model.customer.customer_name }}</td>
                <td>{{ ce_model.title }}</td>
                <td>{{ ce_model.get_status_display }}</td>
                <td>{{ ce_model.get_status_action_date }}</td>
                <td class="has-text-centered">
                    {% currency_symbol %}{{ ce_model.get_revenue_estimate | currency_format }}</td>
                <td class="has-text-centered">{{ ce_model.get_gross_margin_estimate | percentage }}</td>

                {# ACTIONS #}
                <td class="has-text-centered">
                    <div class="dropdown is-right is-hoverable" id="cj-action-{{ ce_model.uuid }}">
                        <div class="dropdown-trigger">
                            <button class="button is-small is-rounded is-outlined is-dark"
                                    aria-haspopup="true"
                                    aria-controls="dropdown-menu">
                                <span>{% trans 'Actions' %}</span>
                                <span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
                            </button>
                        </div>
                        <div class="dropdown-menu" id="dropdown-menu-{{ ce_model.uuid }}" role="menu">
                            <div class="dropdown-content">
                                <a href="{% url 'django_ledger:customer-estimate-detail' entity_slug=entity_slug ce_pk=ce_model.uuid %}"
                                   class="dropdown-item has-text-success">Details</a>
                                {#                                <a href="{% url 'django_ledger:cj-update' entity_slug=entity_slug cj_pk=cj.uuid %}"#}
                                {#                                   class="dropdown-item has-text-warning-dark">Update</a>#}
                                {#                                {% if not cj.paid %}#}
                                {#                                    {% modal_action cj 'get' entity_slug %}#}
                                {#                                    <a onclick="djLedger.showModal('{{ cj.get_html_id }}')"#}
                                {#                                       class="dropdown-item has-text-weight-bold has-text-info">{% trans 'Mark as Paid' %}</a>#}
                                {#                                {% endif %}#}
                                {#                                <a href="{% url 'django_ledger:cj-delete' entity_slug=entity_slug cj_pk=cj.uuid %}"#}
                                {#                                   class="dropdown-item has-text-weight-bold has-text-danger">{% trans ' Delete' %}</a>#}
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

</div>
