<%= form_for user, html: { class: 'space-y-4' }, data: { turbo_frame: :_top } do |f| %>
  <div class="space-y-2">
    <div class="flex space-x-4">
      <div class="w-full">
        <%= f.label :first_name, t('first_name'), class: 'label' %>
        <%= f.text_field :first_name, required: true, class: 'base-input w-full', dir: 'auto' %>
      </div>
      <div class="w-full">
        <%= f.label :last_name, t('last_name'), class: 'label' %>
        <%= f.text_field :last_name, required: true, class: 'base-input w-full', dir: 'auto' %>
      </div>
    </div>
    <div class="form-control">
      <%= f.label :email, t('email'), class: 'label' %>
      <%= f.email_field :email, required: true, class: 'base-input' %>
      <% if user.try(:pending_reconfirmation?) %>
        <label class="label">
          <span class="label-text-alt"><%= t('email_address_is_awaiting_confirmation_follow_the_link_in_the_email_to_confirm', email: f.object.unconfirmed_email) %></span>
        </label>
      <% end %>
      <% if user.persisted? && (Docuseal.multitenant? || Accounts.can_send_emails?(current_account)) %>
        <span class="label-text-alt mt-2 mx-1">
          <%= t('click_here_to_send_a_reset_password_email_html') %>
        </span>
      <% end %>
    </div>
    <% if user.new_record? && !Docuseal.multitenant? %>
      <div class="form-control">
        <%= f.label :password, t('password'), class: 'label' %>
        <%= f.password_field :password, class: 'base-input' %>
      </div>
    <% end %>
    <% if f.object != current_user %>
      <% if user.otp_required_for_login %>
        <div class="form-control">
          <%= f.label :otp_required_for_login, t('two_factor_authentication'), class: 'label' %>
          <%= f.select :otp_required_for_login, [[t('enabled'), true], [t('disabled'), false]], { include_blank: false }, class: 'base-select' %>
        </div>
      <% end %>
      <%= render 'role_select', f: %>
    <% end %>
    <% if local_assigns[:extra_fields_html].present? %>
      <%= local_assigns[:extra_fields_html] %>
    <% end %>
  </div>
  <div class="form-control pt-2">
    <%= f.button button_title, class: 'base-button' %>
  </div>
<% end %>
<% if user.persisted? %>
  <%= button_to nil, user_send_reset_password_path(user), id: 'resend_password_button', method: :put, class: 'hidden', data: { turbo_confirm: t('are_you_sure_'), turbo_frame: :_top } %>
<% end %>
