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

<div class="table-container">
    <table style="margin-bottom: 100px;"
           class="table is-fullwidth is-narrow is-striped">
        <thead>
        <tr>
            <th>Description</th>
            <th>Bank Account</th>
            <th>Created</th>
            <th>Completed</th>
            <th>Actions</th>
        </tr>
        </thead>
        <tbody>

        {% for job in import_jobs %}
            <tr>
                <td>{{ job.description }}</td>
                <td>{{ job.bank_account_model }}</td>
                <td>{{ job.created }}</td>
                <td class="has-text-centered">
                    {% if job.is_complete %}
                        <span class="icon has-text-success">{% icon 'ant-design:check-circle-filled' 24 %}</span>
                    {% else %}
                        <span class="icon is-small has-text-danger">{% icon 'maki:roadblock-11' 24 %}</span>
                    {% endif %}
                </td>
                <td>
                    <div class="dropdown is-right" id="customer-action-{{ job.uuid }}">

                        <div class="dropdown-trigger">
                            <button class="button is-small is-rounded is-outlined is-dark"
                                    aria-haspopup="true"
                                    onclick="djLedger.toggleDropdown('customer-action-{{ job.uuid }}')"
                                    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-{{ customer.uuid }}"
                             role="menu">
                            <div class="dropdown-content">
                                <a href="{% url 'django_ledger:data-import-jobs-update' entity_slug=view.kwargs.entity_slug job_pk=job.uuid %}"
                                   class="dropdown-item has-text-weight-bold has-text-warning">{% trans 'Update' %}</a>
                                <a href="{% url 'django_ledger:data-import-jobs-delete' entity_slug=view.kwargs.entity_slug job_pk=job.uuid %}"
                                   class="dropdown-item has-text-weight-bold has-text-danger">{% trans 'Delete' %}</a>
                                <a href="{% url 'django_ledger:data-import-job-txs' entity_slug=view.kwargs.entity_slug job_pk=job.uuid %}"
                                   class="dropdown-item has-text-weight-bold has-text-info">{% trans 'Manage' %}</a>
                            </div>
                        </div>
                    </div>

                </td>
            </tr>
        {% endfor %}

        </tbody>
    </table>
</div>
