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

{% macro name_column(permission) %}
{{ permission.name }}
{% endmacro %}

{% macro codename_column(permission) %}
{{ permission.codename }}
{% endmacro %}

{% macro actions_column(permission) %}
<div class="flex justify-end">
  <a
    class="btn-xs bg-red-500 hover:bg-red-600 text-white"
    href="{{ url_for('dashboard.permissions:delete', id=permission.id) }}"
    hx-boost="true"
    hx-target="#modal"
    _="install OpenModal"
  >
    Delete
  </a>
</div>
{% endmacro %}

{{
  datatable.datatable(
    permissions,
    count,
    datatable_query_parameters,
    "Permissions",
    columns | map("get_column_macro") | list,
  )
}}
