<commit_before><%= render partial: 'spree/admin/shared/product_tabs', locals: {current: :variants} %>

<%# Place for new variant form %>
<div id="new_variant" data-hook></div>

<% if @variants.any? %>
  <table class="table sortable" data-sortable-link="<%= update_positions_admin_product_variants_path(@product) %>">
    <thead data-hook="variants_header">
      <tr>
        <th colspan="2"><%= Spree.t(:options) %></th>
        <th><%= Spree.t(:price) %></th>
        <th><%= Spree.t(:sku) %></th>
        <th class="actions"></th>
      </tr>
    </thead>
    <tbody>
    <% @variants.each do |variant| %>
      <tr id="<%= spree_dom_id variant %>" <%= 'style="color:red;"' if variant.deleted? %> data-hook="variants_row">
        <td class="move-handle">
          <% if can? :edit, variant %>
            <span class="icon icon-move handle"></span>
          <% end %>
        </td>
        <td><%= variant.options_text %></td>
        <td><%= variant.display_price.to_html %></td>
        <td><%= variant.sku %></td>
        <td class="actions actions-2 text-right">
          <%= link_to_edit(variant, no_text: true) if can?(:edit, variant) && !variant.deleted? %>
          <%= link_to_delete(variant, no_text: true) if can?(:destroy, variant) && !variant.deleted? %>
        </td>
      </tr>
      <% end %>
      <% unless @product.has_variants? %>
        <tr>
          <td colspan="5"><%= Spree.t(:none) %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <div class="no-objects-found alert alert-info">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Variant)) %>
    <% if can?(:create, Spree::Variant) && !@product.empty_option_values? %>
       - <%= link_to(Spree.t(:add_one), spree.new_admin_product_variant_path(@product)) %>
    <% end %>!
  </div>
<% end %>

<% if @product.empty_option_values? %>
  <% if can?(:modify, Spree::ProductOptionType) %>
    <p class='first_add_option_types no-objects-found' data-hook="first_add_option_types">
      <%= Spree.t(:to_add_variants_you_must_first_define) %>
      <%= link_to(Spree.t(:option_types), spree.admin_product_url(@product)) %>
      <% if can?(:display, Spree::OptionType) && can?([:create, :display], Spree::OptionValue) %>
        <%= Spree.t(:and) %><commit_msg>Remove extra space before punctuation<commit_after><%= render partial: 'spree/admin/shared/product_tabs', locals: {current: :variants} %>

<%# Place for new variant form %>
<div id="new_variant" data-hook></div>

<% if @variants.any? %>
  <table class="table sortable" data-sortable-link="<%= update_positions_admin_product_variants_path(@product) %>">
    <thead data-hook="variants_header">
      <tr>
        <th colspan="2"><%= Spree.t(:options) %></th>
        <th><%= Spree.t(:price) %></th>
        <th><%= Spree.t(:sku) %></th>
        <th class="actions"></th>
      </tr>
    </thead>
    <tbody>
    <% @variants.each do |variant| %>
      <tr id="<%= spree_dom_id variant %>" <%= 'style="color:red;"' if variant.deleted? %> data-hook="variants_row">
        <td class="move-handle">
          <% if can? :edit, variant %>
            <span class="icon icon-move handle"></span>
          <% end %>
        </td>
        <td><%= variant.options_text %></td>
        <td><%= variant.display_price.to_html %></td>
        <td><%= variant.sku %></td>
        <td class="actions actions-2 text-right">
          <%= link_to_edit(variant, no_text: true) if can?(:edit, variant) && !variant.deleted? %>
          <%= link_to_delete(variant, no_text: true) if can?(:destroy, variant) && !variant.deleted? %>
        </td>
      </tr>
      <% end %>
      <% unless @product.has_variants? %>
        <tr>
          <td colspan="5"><%= Spree.t(:none) %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <div class="no-objects-found alert alert-info">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Variant)) %>
    <% if can?(:create, Spree::Variant) && !@product.empty_option_values? %>
       - <%= link_to(Spree.t(:add_one), spree.new_admin_product_variant_path(@product)) %>!
    <% end %>
  </div>
<% end %>

<% if @product.empty_option_values? %>
  <% if can?(:modify, Spree::ProductOptionType) %>
    <p class='first_add_option_types no-objects-found' data-hook="first_add_option_types">
      <%= Spree.t(:to_add_variants_you_must_first_define) %>
      <%= link_to(Spree.t(:option_types), spree.admin_product_url(@product)) %>
      <% if can?(:display, Spree::OptionType) && can?([:create, :display], Spree::OptionValue) %>
        <%= Spree.t(:and) %>
{'fraction_non_alphanumeric': 0.20885801128962223, 'fraction_numerical': 0.0013026487190620929, 'mean_word_length': 3.215004574565416, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 147, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7482673', 'n_tokens_mistral': 1711, 'n_tokens_neox': 1587, 'n_words': 284}