<commit_before><% content_for :page_title do %>
  <%= plural_resource_name(Spree::Product) %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to Spree.t(:new_product), new_object_url, { class: "btn-success", icon: 'add.svg', id: 'admin_new_product' } %>
<% end if can?(:create, Spree::Product) %>

<% content_for :table_filter do %>
  <div data-hook="admin_products_sidebar">

    <%= search_form_for [:admin, @search] do |f| %>
      <%- locals = {f: f} %>
      <div data-hook="admin_products_index_search" class="row">
        <div class="col-12 col-lg-6">
          <div class="form-group">
            <%= f.label :search_by_name, Spree.t(:name) %>
            <%= f.text_field :search_by_name, size: 15, class: "form-control js-quick-search-target js-filterable" %>
          </div>
        </div>
        <div class="col-12 col-lg-6">
          <div class="form-group">
            <%= f.label :variants_including_master_sku_cont, Spree.t(:sku) %>
            <%= f.text_field :variants_including_master_sku_cont, size: 15, class: "form-control js-filterable" %>
          </div>
        </div>
        <div class="col-12">
          <div class="field checkbox mb-2">
            <label>
              <%= f.check_box :deleted_at_null, {checked: params[:q][:deleted_at_null] == '0'}, '0', '1' %>
              <%= Spree.t(:show_deleted) %>
            </label>
          </div>

          <div class="field checkbox mb-2">
            <label>
              <%= f.check_box :not_discontinued, {checked: params[:q][:not_discontinued] == '0'}, '0', '1' %>
              <%= Spree.t(:show_discontinued ) %>
            </label>
          </div>
        </div>
      </div>
      <div data-hook="admin_products_index_search_buttons" class="form-actions">
        <%= button Spree.t(:search), 'search.svg' %>
      </div>
    <% end %>

  </div>
<% end %>

<% if @collection.any? %>
<div class="table-responsive">
  <table class="table" id="listing_products">
    <thead>
      <tr data-hook="admin_products_index_headers">
        <th scope="col" colspan="2"><%= sort_link @search,:name, Spree.t(:name), { default_order: "desc" }, {title: 'admin_products_listing_name_title'} %></th>
        <th scope="col"><%= Spree.t(:sku) %></th>
        <th scope="col"><%= Spree.t(:status) %></th>
        <th scope="col" class="text-center">
          <%= sort_link @search, :master_default_price_amount, Spree.t(:master_price), {}, {title: 'admin_products_listing_price_title'} %>
        </th>
        <th scope="col" data-hook="admin_products_index_header_actions" class="actions"></th>
      </tr>
    </thead>
    <tbody>
      <% @collection.each do |product| %>
          <tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows" class="<%= cycle('odd', 'even') %>">
            <td scope="row" class="image">
              <%= link_to edit_admin_product_path(product) do %>
                <%= mini_image product %>
              <% end %>
            </td>
            <td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
            <td class="sku"><%= product.sku rescue '' %></td>
            <td class="status"><%= available_status(product) %> </td>
            <td class="text-center"><%= display_price(product) %></td>
            <td class="actions " data-hook="admin_products_index_row_actions">
              <span class="d-flex">
                <%= link_to_edit product, no_text: true, class: 'edit' if can?(:edit, product) && !product.deleted? %>
                <%= link_to_clone product, no_text: true, class: 'clone' if can?(:clone, product) %>
                <%= link_to_delete product, no_text: true if can?(:delete, product) && !product.deleted? %>
              </span>
            </td>
          </tr>
      <% end %>
    </tbody>
  </table>
</div>
<% else %>
  <div class="alert alert-info no-objects-found">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Product)) %>,
    <%= link_to Spree.t(:add_one), new_object_url if can?(:create, Spree::Product) %>!
  </div>
<% end %>

<%= render partial: 'spree/admin/shared/index_table_options', locals: { collection: @collection } %>
<commit_msg>Push buttons to the end of the row.<commit_after><% content_for :page_title do %>
  <%= plural_resource_name(Spree::Product) %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to Spree.t(:new_product), new_object_url, { class: "btn-success", icon: 'add.svg', id: 'admin_new_product' } %>
<% end if can?(:create, Spree::Product) %>

<% content_for :table_filter do %>
  <div data-hook="admin_products_sidebar">

    <%= search_form_for [:admin, @search] do |f| %>
      <%- locals = {f: f} %>
      <div data-hook="admin_products_index_search" class="row">
        <div class="col-12 col-lg-6">
          <div class="form-group">
            <%= f.label :search_by_name, Spree.t(:name) %>
            <%= f.text_field :search_by_name, size: 15, class: "form-control js-quick-search-target js-filterable" %>
          </div>
        </div>
        <div class="col-12 col-lg-6">
          <div class="form-group">
            <%= f.label :variants_including_master_sku_cont, Spree.t(:sku) %>
            <%= f.text_field :variants_including_master_sku_cont, size: 15, class: "form-control js-filterable" %>
          </div>
        </div>
        <div class="col-12">
          <div class="field checkbox mb-2">
            <label>
              <%= f.check_box :deleted_at_null, {checked: params[:q][:deleted_at_null] == '0'}, '0', '1' %>
              <%= Spree.t(:show_deleted) %>
            </label>
          </div>

          <div class="field checkbox mb-2">
            <label>
              <%= f.check_box :not_discontinued, {checked: params[:q][:not_discontinued] == '0'}, '0', '1' %>
              <%= Spree.t(:show_discontinued ) %>
            </label>
          </div>
        </div>
      </div>
      <div data-hook="admin_products_index_search_buttons" class="form-actions">
        <%= button Spree.t(:search), 'search.svg' %>
      </div>
    <% end %>

  </div>
<% end %>

<% if @collection.any? %>
<div class="table-responsive">
  <table class="table" id="listing_products">
    <thead>
      <tr data-hook="admin_products_index_headers">
        <th scope="col" colspan="2"><%= sort_link @search,:name, Spree.t(:name), { default_order: "desc" }, {title: 'admin_products_listing_name_title'} %></th>
        <th scope="col"><%= Spree.t(:sku) %></th>
        <th scope="col"><%= Spree.t(:status) %></th>
        <th scope="col" class="text-center">
          <%= sort_link @search, :master_default_price_amount, Spree.t(:master_price), {}, {title: 'admin_products_listing_price_title'} %>
        </th>
        <th scope="col" data-hook="admin_products_index_header_actions" class="actions"></th>
      </tr>
    </thead>
    <tbody>
      <% @collection.each do |product| %>
          <tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows" class="<%= cycle('odd', 'even') %>">
            <td scope="row" class="image">
              <%= link_to edit_admin_product_path(product) do %>
                <%= mini_image product %>
              <% end %>
            </td>
            <td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
            <td class="sku"><%= product.sku rescue '' %></td>
            <td class="status"><%= available_status(product) %> </td>
            <td class="text-center"><%= display_price(product) %></td>
            <td class="actions " data-hook="admin_products_index_row_actions">
              <span class="d-flex justify-content-end">
                <%= link_to_edit product, no_text: true, class: 'edit' if can?(:edit, product) && !product.deleted? %>
                <%= link_to_clone product, no_text: true, class: 'clone' if can?(:clone, product) %>
                <%= link_to_delete product, no_text: true if can?(:delete, product) && !product.deleted? %>
              </span>
            </td>
          </tr>
      <% end %>
    </tbody>
  </table>
</div>
<% else %>
  <div class="alert alert-info no-objects-found">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Product)) %>,
    <%= link_to Spree.t(:add_one), new_object_url if can?(:create, Spree::Product) %>!
  </div>
<% end %>

<%= render partial: 'spree/admin/shared/index_table_options', locals: { collection: @collection } %>

{'fraction_non_alphanumeric': 0.19009135628952917, 'fraction_numerical': 0.004919184820801124, 'mean_word_length': 2.715839860748477, 'pattern_counts': {'":': 0, '<': 217, '<?xml version=': 0, '>': 217, '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': '2270374', 'n_tokens_mistral': 3009, 'n_tokens_neox': 2808, 'n_words': 542}