<%= render 'spree/admin/shared/product_tabs', current: 'Product Properties' %> <%= render 'spree/shared/error_messages', target: @product %> <% admin_breadcrumb(plural_resource_name(Spree::ProductProperty)) %> <% content_for :page_actions do %> <% if can?(:create, Spree::ProductProperty) %> <% end %> <% end %> <%= form_for @product, url: admin_product_url(@product), method: :put do |f| %>
<%= plural_resource_name(Spree::ProductProperty) %>
<%= f.fields_for :product_properties do |pp_form| %> <%= render 'product_property_fields', f: pp_form %> <% end %>
<%= Spree::Property.model_name.human %> <%= Spree::ProductProperty.human_attribute_name(:value) %>
<% if can?(:create, Spree::ProductProperty) && can?(:update, Spree::ProductProperty) %> <%= render 'spree/admin/shared/edit_resource_links' %> <% end %> <%= hidden_field_tag 'clear_product_properties', 'true' %>
<% end %> <%= form_tag admin_product_product_properties_path, method: :get, id: 'variant_option_value_selections' do %>
<%= t('spree.variant_properties') %>
<% @option_types.each do |option_type, option_values| %>
<%= label :option_type_presentation, option_type.presentation %> <%= select_tag "ovi[]", options_from_collection_for_select(option_values, :id, :presentation, params[:ovi]), class: 'custom-select fullwidth', include_blank: true, id: "#{option_type.name}_option_type_select" %>
<% end %>
<%= button_tag t('spree.filter_results'), class: 'btn btn-primary' %> <% if @option_value_ids.present? %> <%= button_tag t('spree.add_variant_properties'), type: 'button', data: { target: 'tbody#variant_property_values' }, class: 'button spree_add_fields' %> <% end %>
<% end %> <%= form_for @product, url: admin_product_url(@product), method: :put do |f| %> <%= f.fields_for :variant_property_rules, @variant_property_rule do |rule_form| %> <%= rule_form.hidden_field 'id', value: @variant_property_rule.id %> <%= rule_form.hidden_field 'option_value_ids', value: @option_value_ids.join(',') %>
<% if @option_value_ids.present? %>
<%= rule_form.fields_for :values do |values_form| %> <%= render 'product_property_fields', f: values_form %> <% end %>
<%= Spree::Property.model_name.human %> <%= Spree::ProductProperty.human_attribute_name(:value) %>
<% if can?(:create, Spree::VariantPropertyRule) && can?(:update, Spree::VariantPropertyRule) %> <%= render 'spree/admin/shared/edit_resource_links' %> <% end %>
<% end %> <% end %> <% end %> <%= safe_join @properties.map { |name| tag(:option, value: name) } %>