<%= t('account') %>
    
    <%= form_for '', url: settings_account_path, method: :patch, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
      <%= fields_for current_account do |ff| %>
        
          <%= ff.label :name, t('company_name'), class: 'label' %>
          <%= ff.text_field :name, required: true, class: 'base-input', dir: 'auto' %>
        
        
          
            <%= ff.label :timezone, t('time_zone'), class: 'label' %>
            <%= ff.select :timezone, nil, {}, class: 'base-select' do %>
              <%= time_zone_options_for_select(current_account.timezone) %>
            <% end %>
          
          
            <%= ff.label :locale, t('language'), class: 'label' %>
            <%= ff.select :locale, options_for_select(AccountsController::LOCALE_OPTIONS.invert, current_account.locale), {}, class: 'base-select' %>
          
         
      <% end %>
      <% encrypted_config = @encrypted_config || EncryptedConfig.find_or_initialize_by(account: current_account, key: EncryptedConfig::APP_URL_KEY) %>
      <% if !Docuseal.multitenant? && can?(:manage, encrypted_config) && !current_account.testing? && ENV['APP_URL'].blank? %>
        <%= fields_for encrypted_config do |ff| %>
          
            <%= ff.label :value, t('app_url'), class: 'label' %>
            <%= ff.text_field :value, autocomplete: 'off', class: 'base-input' %>
          
        <% end %>
      <% end %>
      <% if can?(:update, current_account) %>
        
          <%= f.button button_title(title: t('update'), disabled_with: t('updating')), class: 'base-button' %>
        
      <% end %>
    <% end %>
    <% if can?(:manage, AccountConfig) %>
      
        
          <%= t('preferences') %>
        
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::FORCE_MFA) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('force_2fa_with_authenticator_app') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::WITH_SIGNATURE_ID) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('add_signature_id_to_the_documents') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::REQUIRE_SIGNING_REASON_KEY) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('require_signing_reason') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::ALLOW_TYPED_SIGNATURE) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('allow_typed_text_signatures') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::ALLOW_TO_RESUBMIT) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('allow_to_resubmit_completed_forms') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::FORM_PREFILL_SIGNATURE_KEY) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('remember_and_pre_fill_signatures') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::DOWNLOAD_LINKS_AUTH_KEY) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('require_authentication_for_file_download_links') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
        <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::COMBINE_PDF_RESULT_KEY) %>
        <% if can?(:manage, account_config) %>
          <%= form_for account_config, url: account_configs_path, method: :post do |f| %>
            <%= f.hidden_field :key %>
            
              
                <%= t('combine_completed_documents_and_audit_log') %>
              
              <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
            
          <% end %>
        <% end %>
      
 
    <% end %>
    <%= render 'integrations' %>
    <% if can?(:manage, current_account) && Docuseal.multitenant? && true_user == current_user %>
      
        
          <%= t('danger_zone') %>
        
        <%= button_to button_title(title: t('delete_my_account')), settings_account_path, class: 'btn btn-outline btn-error block', data: { turbo_confirm: t('schedule_account_for_deletion_') }, method: :delete, id: :account_delete_button %>
      
    <% end %>