<% theme_options_for_select = Spree::Backend::Config.themes.keys.map { |theme| [theme.to_s.humanize, theme] }.sort %>

<% if theme_options_for_select.length > 1 %>
  <%= form_tag(spree.admin_set_theme_path(format: :html), method: :put, style: "width: 100%;", class: "light-only") do %>
    <%= hidden_field_tag :system_theme, :light %>
    <label class="admin-navbar-selection">
      <i class="fa fa-sun-o fa-fw" title="<%= I18n.t('spree.choose_dashboard_theme') %>"></i>
      <select name="switch_to_theme" class="custom-select fullwidth" onchange="this.form.requestSubmit()">
        <%= options_for_select(theme_options_for_select, session[:admin_light_theme] || Spree::Backend::Config.theme) %>
      </select>
    </label>
  <% end %>

  <%= form_tag(spree.admin_set_theme_path(format: :html), method: :put, style: "width: 100%;", class: "dark-only") do %>
    <%= hidden_field_tag :system_theme, :dark %>
    <label class="admin-navbar-selection">
      <i class="fa fa-moon-o fa-fw" title="<%= I18n.t('spree.choose_dashboard_theme') %>"></i>
      <select name="switch_to_theme" class="custom-select fullwidth" onchange="this.form.requestSubmit()">
        <%= options_for_select(theme_options_for_select, session[:admin_dark_theme] || Spree::Backend::Config.dark_theme) %>
      </select>
    </label>
  <% end %>
<% end %>
