%= render :partial => 'spree/admin/shared/product_sub_menu' %>
<%= render :partial => 'spree/admin/shared/product_tabs', :locals => {:current => 'Variants'} %>
<%# Place for new variant form %>
<% content_for :table_filter_title do %>
<%= Spree.t(:search) %>
<% end %>
<% content_for :table_filter do %>
<%= search_form_for [:admin, @search], url: admin_product_variants_url(product: @product) do |f| %>
<%- locals = {:f => f} %>
<%= f.label :sku_cont, Spree.t(:sku) %>
<%= f.text_field :sku_cont, :size => 15 %>
<% @option_types.each do |option_type| %>
<% option_values = @option_values.select { |ov| ov.option_type_id == option_type.id } %>
<%= f.label :option_values_presentation_in, option_type.presentation %>
<%= f.collection_select :option_values_presentation_in, option_values.sort_by(&:presentation), :presentation, :presentation, { :include_blank => Spree.t('match_choices.none') }, { class: "select2 fullwidth" } %>
<% end %>
<%= button Spree.t(:search), 'search' %>
<% end %>
<% end %>
<% if @variants.any? %>
<%= paginate @variants %>
<%= Spree.t(:options) %> |
<%= Spree.t(:price) %> |
<%= Spree.t(:sku) %> |
|
<% @variants.each do |variant| %>
data-hook="variants_row" class="<%= cycle('odd', 'even')%>">
|
<%= variant.options_text %> |
<%= variant.display_price.to_html %> |
<%= variant.sku %> |
<%= link_to_edit(variant, :no_text => true) unless variant.deleted? %>
<%= link_to_delete(variant, :no_text => true) unless variant.deleted? %>
|
<% end %>
<% unless @product.has_variants? %>
<%= Spree.t(:none) %> |
<% end %>
<%= paginate @variants %>
<% else %>
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/variant')) %>,
<%= link_to Spree.t(:add_one), spree.new_admin_product_variant_path(@product) %>!
<% end %>
<% if @product.empty_option_values? %>
<%= Spree.t(:to_add_variants_you_must_first_define) %>
<%= link_to Spree.t(:option_types), admin_product_url(@product) %>
<%= Spree.t(:and) %>
<%= link_to Spree.t(:option_values), admin_option_types_url %>
<% else %>
<% content_for :page_actions do %>
<% end %>
<% end %>