{% extends '@MapbenderManager/layouts/tabbed.html.twig' %}
{%- set title = 'mb.terms.security' | trans -%}
{%- import '@MapbenderManager/macros/tabs.html.twig' as tab_macros -%}

{% block js %}
  {{parent()}}
  <script type="application/javascript" src="{{ asset('bundles/mapbendermanager/js/user-control.js') }}"></script>
{% endblock %}

{% block tab_headers %}
  {%- if grants.users -%}
    {{- tab_macros.tab_header('Users', 'fom.user.userbundle.users', 'active') -}}
  {%- endif -%}
  {%- if grants.groups -%}
    {{- tab_macros.tab_header('Groups', 'fom.user.userbundle.groups', not grants.users ? 'active' : '') -}}
  {%- endif -%}
  {%- if grants.global_permissions -%}
    {{- tab_macros.tab_header('Permissions', 'fom.user.permissions.index.global_permissions', not (grants.users or grants.groups) ? 'active' : '') -}}{#- #tabContact -#}
  {%- endif -%}
{% endblock tab_headers %}

{% block tab_containers %}
  {%- if grants.users -%}
      <div{{ tab_macros.tab_content_attributes('Users', 'active', false) }}>
          {%- include '@FOMUser/User/list-tab.html.twig' with {show_groups: is_granted(constant('FOM\\UserBundle\\Security\\Permission\\ResourceDomainInstallation::ACTION_VIEW_GROUPS'))} -%}
      </div>
  {%- endif -%}
  {%- if grants.groups -%}
      <div{{ tab_macros.tab_content_attributes('Groups', not grants.users ? 'active' : '', false) }}>
          {%- include '@FOMUser/Group/list-tab.html.twig' -%}
      </div>
  {%- endif -%}
  {%- if grants.global_permissions -%}
      <div{{ tab_macros.tab_content_attributes('Permissions', not (grants.users or grants.groups) ? 'active' : '', true) }}>
          {%- include '@FOMUser/Permission/list.html.twig' with {classes: permission_categories} -%}
      </div>
  {%- endif -%}
{% endblock %}
