<% if users.count > 0 %>
  <%= bootstrap_form_for UserOrganization.new, url: create_user_organization_path, data: { id: "create-user-organization-form" } do %>
    <input type="hidden" name="user_organization[organization_id]" id="user_organization_organization_id" value="<%= org.id %>">
    <input type="hidden" data-id="existing-user-id-input" name="user_organization[user_id]" id="user_organization_user_id" value="">
    <input type="hidden" data-id="existing-user-role-input" name="user_organization[role]" id="user_organization_role" value="">
    <div class="btn-group-vertical btn-group-existing-users" data-toggle="buttons">
      <label class="btn btn-default btn-title">
      <strong><%= t("users.settings.organizations.edit.modal_add_user.existing_results_title") %></strong>
      </label>
      <% users.each do |user| %>
        <label class="btn btn-default">
          <input type="radio" name="options" data-action="select-existing-user" data-user-id="<%= user.id %>" data-id="user-result-<%= user.id %>" autocomplete="off">
          <%= highlight user.full_name, query.strip.split(/\s+/) %>
        </label>
      <% end %>
    </div>
    <% if nr_of_members > 0 %>
      <div class="existing-users-smalltext"><em>
        <%= t("users.settings.organizations.edit.modal_add_user.existing_users_members_smalltext", count: nr_of_members) %>
      </em></div>
    <% end %>
    <% if nr_of_results > users.count %>
      <div class="existing-users-smalltext"><em>
        <%= t("users.settings.organizations.edit.modal_add_user.existing_users_smalltext", nr: users.count) %>
      </em></div>
    <% end %>
  <% end %>
<% else%>
  <em>
  <% if nr_of_members > 0 %>
    <%= t("users.settings.organizations.edit.modal_add_user.no_existing_users_members_smalltext", count: nr_of_members) %>
  <% else %>
    <%= t("users.settings.organizations.edit.modal_add_user.no_existing_users") %>
  <% end %>
  </em>
<% end %>