<%= errors_summary_for user %>
<%= bootstrap_form_with model: [:admin, user], local: true, html: { autocorrect: :off, autocapitalize: :none, autocomplete: :off, spellcheck: false } do |form| %>
  <%= form.email_field :email %>
  
  <%# autocomplete: 'new-password' prevent the existing password value from showing up %>
  <%= form.password_field :password, autocomplete: "new-password" %>
  
  <% if user.new_record? %>
    <%= form.collection_select :account_id, accounts, :id, :name, { prompt: "Select an Account", required: true }, class: "form-control custom-select" %>
    <%= form.select :role, options_for_role_select, {}, class: "form-control custom-select" %>
  <% end %>

  <div class="mb-4">
    <%= form.check_box :admin, label: "Admin User" %>
    <div class="help-block text-muted"><%= fa_icon :warning, text: "This option grants access to the Admin dashboard. This should only be for trusted BiG employees." %></div>
  </div>

  <div class="row align-items-center text-center mt-4">
    <%= link_to t("shared.cancel"), [:admin, :users], class: "col-3 text-reset" %>
    <div class="col-9">
      <%= form.button class: class_string("btn btn-block", ["btn-success", "btn-primary"] => user.new_record?), data: { disable_with: t("shared.disable_with") } %>
    </div>
  </div>
<% end %>
