%fieldset.omega.six.columns
  %legend= t('spree.api.access')
  = form_with(model: @user, url: spree.admin_user_path(@user)) do |form|
    = form.check_box :show_api_key_view, onchange: "this.form.submit()"
    = form.label :show_api_key_view, t('spree.api.toggle_api_key_view')

  - if @user.spree_api_key.present?
    .field
      = label_tag t('spree.api.key')
      = ":"
      = @user.spree_api_key

    .filter-actions.actions
      = form_with(model: @user, url: spree.api_key_path(id: @user), method: :delete) do |form|
        = form.button t('spree.api.clear_key'), class: 'icon-trash', icon: 'icon-trash'
      = form_with(model: @user, url: spree.api_keys_path(id: @user), method: :post) do |form|
        = form.button t('spree.api.regenerate_key'), class: 'icon-refresh', icon: 'icon-refresh'

  - else
    .no-objects-found= t('spree.api.no_key')
    .filter-actions.actions
      = form_with(model: @user, url: spree.api_keys_path(id: @user), method: :post) do |form|
        = form.button t('spree.api.generate_key'), class: 'icon-key', icon: 'icon-key'
