{% import "macros/datatable.html" as datatable %}

{% macro type_column(email_template) %}
{{ email_template.get_type_display_name() }}
{% endmacro %}

{% macro subject_column(email_template) %}
{{ email_template.subject }}
{% endmacro %}

{% macro actions_column(email_template) %}
<div class="flex justify-end">
  <a
    class="btn-xs bg-red-500 hover:bg-red-600 text-white"
    href="{{ url_for('dashboard.email_templates:update', id=email_template.id) }}"
  >
    Update
  </a>
</div>
{% endmacro %}

{{
  datatable.datatable(
    email_templates,
    count,
    datatable_query_parameters,
    "Email templates",
    columns | map("get_column_macro") | list,
  )
}}
