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

{% macro name_column(client) %}
<a
  class="font-medium text-slate-800 hover:text-slate-900"
  href="{{ url_for('dashboard.clients:get', id=client.id) }}"
  hx-boost="true"
  hx-target="#aside"
  _="install OpenAside"
>
  {{ client.name }}
</a>
{% if client.first_party %}
  <div class="inline-flex font-medium rounded-full text-center ml-2 px-2.5 py-0.5 bg-green-100 text-green-600">
    First-party
  </div>
{% endif %}
{% endmacro %}

{% macro type_column(client) %}
{{ client.client_type.get_display_name() }}
{% endmacro %}

{% macro tenant_column(client) %}
{{ client.tenant.name }}
{% endmacro %}

{% macro client_id_column(client) %}
{{ client.client_id }}
{% endmacro %}

{{
  datatable.datatable(
    clients,
    count,
    datatable_query_parameters,
    "Clients",
    columns | map("get_column_macro") | list,
  )
}}
