{# -*- coding: utf-8 -*-

  This file is part of Invenio.
  Copyright (C) 2022 CERN.
  Copyright (C) 2025 Graz University of Technology.

  Invenio is free software; you can redistribute it and/or modify it
  under the terms of the MIT License; see LICENSE file for more details.
#}

{% extends "invenio_communities/details/members/base.html" %}

{% if permissions.can_members_manage %}
  {% set search_endpoint = community_ui["links"]["members"] %}
  {% set bundle = webpack['invenio-communities-members-manager.js'] %}
  {% set app_id = "InvenioCommunities.ManagerSearch" %}
{% elif permissions.can_members_search %}
  {% set search_endpoint = community_ui["links"]["members"] %}
  {% set bundle = webpack['invenio-communities-members.js'] %}
  {% set app_id = "InvenioCommunities.MemberSearch" %}
{% elif permissions.can_members_search_public %}
  {% set search_endpoint = community_ui["links"]["public_members"] %}
  {% set bundle = webpack['invenio-communities-members-public.js'] %}
  {% set app_id = "InvenioCommunities.PublicSearch" %}
{% endif %}


{% block javascript %}
{{ super() }}
{{ bundle }}
{% endblock javascript %}

{% set active_members_menu_item = 'members' %}
{% set active_community_header_menu_item = 'members' %}

{% block settings_body %}
<div class="thirteen wide computer sixteen wide tablet sixteen wide mobile column">
    <div id="community-members-search-root"
      data-invenio-search-config='{{ search_app_communities_members_config(app_id=app_id, endpoint=search_endpoint) | tojson }}'
      data-community='{{ community_ui | tojson }}'
      data-communities-all-roles='{{ config.COMMUNITIES_ROLES | tojson }}'
      data-communities-roles-can-update='{{ roles_can_update | tojson }}'
      data-groups-enabled='{{ config.USERS_RESOURCES_GROUPS_ENABLED | tojson }}'
      data-communities-roles-can-invite='{{ roles_can_invite | tojson }}'
      data-permissions='{{ permissions | tojson }}'
    ></div>
</div>
{%- endblock settings_body %}
