<% access_options = options_for_select([['Manager', 'manage'], ['Depositor', 'deposit'], ['Viewer', 'view']]) %>

<%= t('.note') %>

<%= t('.add_sharing') %>

<%= simple_form_for @form.permission_template, url: [hyrax, :dashboard, @form, :permission_template], html: { id: 'group-participants-form' } do |f| %>
<%= f.fields_for 'access_grants_attributes', f.object.access_grants.build(agent_type: 'group'), index: 0 do |builder| %>
<%= builder.hidden_field :agent_type %> <%= builder.text_field :agent_id, placeholder: "Search for a group...", class: 'form-control search-input' %> as <%= builder.select :access, access_options, { prompt: "Select a role..." }, class: 'form-control' %> <%= f.submit t('helpers.submit.hyrax_permission_template_access.create'), class: 'btn btn-info edit-collection-add-sharing-button' %>
<% end %>
<% end %>
<%= simple_form_for @form.permission_template, url: [hyrax, :dashboard, @form, :permission_template], html: { id: 'user-participants-form' } do |f| %>
<%= f.fields_for 'access_grants_attributes', f.object.access_grants.build(agent_type: 'user'), index: 0 do |builder| %>
<%= builder.hidden_field :agent_type %> <%= builder.text_field :agent_id, placeholder: "Search for a user..." %> as <%= builder.select :access, access_options, { prompt: "Select a role..." }, class: 'form-control' %> <%= f.submit t('helpers.submit.hyrax_permission_template_access.create'), class: 'btn btn-info edit-collection-add-sharing-button' %>
<% end %>
<% end %>

<%= t('hyrax.admin.admin_sets.form.note') %>

<%= t(".current_shared") %> <%= render 'form_share_table', access: 'managers', filter: :manage? %> <%= render 'form_share_table', access: 'depositors', filter: :deposit? %> <%= render 'form_share_table', access: 'viewers', filter: :view? %>