<% provide(:head_title, t("users.settings.teams.head_title")) %>
<% provide(:container_class, "no-second-nav-container") %>

<% content_for :head do %>
  <meta id="cache-directive" name="turbolinks-cache-control" content="no-cache">
<% end %>

<div class="content-pane flexible team-settings-pane with-grey-background">
  <%= render partial: 'header' %>

  <!-- USERS TABLE -->
  <div class="users-datatable" data-e2e="e2e-CO-settings-workspace-usersTable">
    <% if can_invite_team_users?(@team) %>
      <div id="add-new-team-members-button" class="hidden">
        <a href="#" class="btn btn-primary" data-trigger="invite-users" data-turbolinks="false" data-modal-id="team-invite-users-modal">
          <span class="sn-icon sn-icon-new-task"></span>
          <%= I18n.t('users.settings.teams.edit.add_user') %>
        </a>
      </div>
      <%= render(partial: 'shared/invite_users_modal',
                  locals: { modal_id: 'team-invite-users-modal',
                            type: 'invite_to_team_with_role',
                            team: @team } ) %>
    <% end %>
    <table id="users-table" class="table" data-source="<%= team_users_datatable_path(@team, format: :json) %>">
      <thead>
        <tr>
          <th id="user-name"><%= t("users.settings.teams.edit.thead_user_name") %></th>
          <th id="email"><%= t("users.settings.teams.edit.thead_email") %></th>
          <th id="user-role"><%= t("users.settings.teams.edit.thead_role") %></th>
          <th id="joined-on"><%= t("users.settings.teams.edit.thead_joined_on") %></th>
          <th id="status"><%= t("users.settings.teams.edit.thead_status") %></th>
          <th id="options"><%= t("users.settings.teams.edit.thead_actions") %></th>
        </tr>
      </thead>
      <tbody></tbody>
    </table>
  </div>
  <!-- End of USERS TABLE -->
</div>

<%= render partial: 'users/settings/teams/description_modal' %>
<%= render partial: 'users/settings/teams/destroy_modal', locals: { team: @team } %>
<%= render partial: 'users/settings/user_teams/destroy_user_team_modal' %>
<%= stylesheet_link_tag 'datatables' %>
<%= javascript_include_tag 'users/settings/teams/show' %>
<span data-hook="team-bottom"></span>
