<%# locals: ()  %>

<section class="multiform-page">
  <h3><%= t('scripts.authors_heading') %></h3>

  <% if @script.users.count > 1 %>
    <h4><%= t('scripts.invitations.form_title') %></h4>
  <% end %>

  <p><%= t('scripts.invitations.explanation', site_name: site_name) %></p>

  <%= form_tag(invite_script_path, method: :post) do |f| %>
    <div class="form-control">
      <label for="invited_user"><%= t('scripts.invitations.invited_user_url_label') %></label>
      <input id="invited_user" name="invited_user_url" type="url" placeholder="<%= t('scripts.invitations.invited_user_placeholder', site_name: site_name) %>" value="<%= params[:invited_user_url] %>" required>
    </div>

    <input type="submit" value="<%= t('scripts.invitations.submit') %>">
  <% end %>

  <% if @script.users.count > 1 %>
    <h4><%= t('scripts.remove_author.heading') %></h4>

    <ul id="user-remove-list">
      <% @script.users.each do |user| %>
        <li><%= link_to user.name, user %> <%= button_to(t('scripts.remove_author.remove_button'), remove_author_script_path(user_id: user.id), form_class: 'inline-form', data: { turbo: true, turbo_method: :POST }, form: { data: { turbo: true, turbo_confirm: t('scripts.remove_author.remove_confirm', user_name: user.name) }}) %></li>
      <% end %>
    </ul>
  <% end %>
</section>
