{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% import "invoice/actions.html.twig" as actions %}

{% block page_title %}{{ 'admin_invoice_template.title'|trans }}{% endblock %}
{% block page_actions %}{{ actions.invoice_templates('index') }}{% endblock %}

{% block main %}
    {% if entries.count == 0 %}
        {{ widgets.callout('warning', 'error.no_entries_found') }}
    {% endif %}

    {% set columns = {
        'name': 'alwaysVisible',
        'title': 'hidden-xs',
        'due_days': 'hidden-xs hidden-sm',
        'vat': 'hidden-xs hidden-sm',
        'actions': 'actions alwaysVisible',
    } %}

    {% set tableName = 'invoice_template' %}

    {{ tables.data_table_header(tableName, columns) }}

    {% for entry in entries %}
        <tr class="modal-ajax-form open-edit" data-href="{{ path('admin_invoice_template_edit', {'id' : entry.id}) }}">
            <td>{{ entry.name }}</td>
            <td class="{{ tables.data_table_column_class(tableName, columns, 'title') }}">{{ entry.title }}</td>
            <td class="{{ tables.data_table_column_class(tableName, columns, 'due_days') }}">{{ entry.dueDays }}</td>
            <td class="{{ tables.data_table_column_class(tableName, columns, 'vat') }}">{{ entry.vat }}</td>
            <td class="actions">
                {{- actions.invoice_template(entry, 'index') -}}
            </td>
        </tr>
    {% endfor %}

    {{ tables.data_table_footer(entries, 'admin_invoice_template') }}
{% endblock %}
