<%= render component('ui/panel').new(title: t('.api_access')) do %>
<% if @user.spree_api_key.present? %>

<%= t('.key') %>

<% if @user == helpers.current_solidus_admin_user %> <%= @user.spree_api_key %> <% else %> (<%= t('spree.hidden') %>) <% end %>
<%= form_with url: spree.admin_user_api_key_path(@user), method: :delete, local: true, html: { class: 'clear_api_key inline-flex' } do %> <%= render component("ui/button").new( text: t('.clear_key'), scheme: :secondary, type: :submit, "data-action": "click->#{stimulus_id}#confirm", "data-#{stimulus_id}-message-param": t(".confirm_clear_key"), ) %> <% end %> <%= form_with url: spree.admin_user_api_key_path(@user), method: :post, local: true, html: { class: 'regen_api_key inline-flex' } do %> <%= render component("ui/button").new( text: t('.regenerate_key'), scheme: :secondary, type: :submit, "data-action": "click->#{stimulus_id}#confirm", "data-#{stimulus_id}-message-param": t(".confirm_regenerate_key"), ) %> <% end %>
<% else %>
<%= t('.no_key') %>
<%= form_with url: spree.admin_user_api_key_path(@user), method: :post, local: true, html: { class: 'generate_api_key inline-flex' } do %> <%= render component("ui/button").new( text: t('.generate_key'), type: :submit, ) %> <% end %>
<% end %>
<% end %>