<%= f.field_container :name do %> <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %> <%= f.text_field :name, class: 'form-control title' %> <%= f.error_message_on :name %> <% end %>
<%= f.field_container :slug do %> <%= f.label :slug, raw(Spree.t(:slug) + required_span_tag) %> <%= f.text_field :slug, class: 'form-control title' %> <%= f.error_message_on :slug %> <% end %>
<%= f.field_container :description do %> <%= f.label :description, Spree.t(:description) %> <%= f.text_area :description, { rows: "#{unless @product.has_variants? then '29' else '30' end}", class: "form-control #{"spree-rte" if product_wysiwyg_editor_enabled? }" } %> <%= f.error_message_on :description %> <% end %>
<%= f.field_container :price do %> <%= f.label :price, raw(Spree.t(:master_price) + required_span_tag) %>
<%= currency_symbol(current_currency) %>
<%= f.text_field :price, value: number_to_currency(@product.amount_in(current_currency), unit: ''), class: 'form-control', disabled: (cannot? :update, @product.master.default_price) %>
<%= f.error_message_on :price %> <% end %>
<%= f.field_container :compare_at_price do %> <%= f.label :compare_at_price, Spree.t(:compare_at_price) %>
<%= currency_symbol(current_currency) %>
<%= f.text_field :compare_at_price, value: number_to_currency(@product.compare_at_amount_in(current_currency), unit: ''), class: 'form-control' %>
<%= f.error_message_on :compare_at_price %> <% end %>
<%= f.field_container :cost_price do %> <%= f.label :cost_price, Spree.t(:cost_price) %> <%= f.text_field :cost_price, value: number_to_currency(@product.cost_price, unit: ''), class: 'form-control' %> <%= f.error_message_on :cost_price %> <% end %>
<%= f.field_container :cost_currency do %> <%= f.label :cost_currency, Spree.t(:cost_currency) %> <%= f.select :cost_currency, currency_options(@product.cost_currency), {}, { class: 'select2' } %> <%= f.error_message_on :cost_currency %> <% end %>
<%= f.field_container :available_on do %> <%= f.label :available_on, Spree.t(:available_on) %> <%= f.error_message_on :available_on %>
<%= f.text_field :available_on, value: datepicker_field_value(@product.available_on), placeholder: Spree.t(:select_a_date), class: 'form-control shadow-none ', 'data-input':'' %> <%= render partial: 'spree/admin/shared/cal_close' %>
<% end %>
<%= f.field_container :discontinue_on do %> <%= f.label :discontinue_on, Spree.t(:discontinue_on) %> <%= f.error_message_on :discontinue_on %>
<%= f.text_field :discontinue_on, value: datepicker_field_value(@product.discontinue_on), placeholder: Spree.t(:select_a_date), class: 'form-control shadow-none ', 'data-input':'' %> <%= render partial: 'spree/admin/shared/cal_close' %>
<% end %>
<%= f.field_container :promotionable do %> <%= f.check_box :promotionable %> <%= f.label :promotionable, Spree.t(:promotionable) %> <%= f.error_message_on :promotionable %> <% end %>
<%= f.field_container :master_sku do %> <%= f.label :master_sku, Spree.t(:master_sku) %> <%= f.text_field :sku, size: 16, class: 'form-control' %> <% end %>
<% if @product.has_variants? %>
<%= f.label :skus, Spree.t(:sku).pluralize %>
<%= Spree.t(:info_product_has_multiple_skus, count: @product.variants.size) %>
    <% @product.variants.first(5).each do |variant| %>
  • <%= variant.sku %>
  • <% end %>
<% if @product.variants.size > 5 %> <%= Spree.t(:info_number_of_skus_not_shown, count: @product.variants.size - 5) %> <% end %>
<% if can?(:admin, Spree::Variant) %> <%= link_to_with_icon 'adjust.svg', Spree.t(:manage_variants), spree.admin_product_variants_url(@product), class: "btn btn-outline-secondary" %> <% end %>
<% else %>
<%= f.label :weight, Spree.t(:weight) %> <%= f.text_field :weight, value: number_with_precision(@product.weight, precision: 2), size: 4, class: 'form-control' %>
<%= f.label :height, Spree.t(:height) %> <%= f.text_field :height, value: number_with_precision(@product.height, precision: 2), size: 4, class: 'form-control' %>
<%= f.label :width, Spree.t(:width) %> <%= f.text_field :width, value: number_with_precision(@product.width, precision: 2), size: 4, class: 'form-control' %>
<%= f.label :depth, Spree.t(:depth) %> <%= f.text_field :depth, value: number_with_precision(@product.depth, precision: 2), size: 4, class: 'form-control' %>
<% end %>
<%= f.field_container :shipping_category do %> <%= f.label :shipping_category_id, Spree.t(:shipping_category) %> <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %> <%= f.error_message_on :shipping_category %> <% end %>
<%= f.field_container :tax_category do %> <%= f.label :tax_category_id, Spree.t(:tax_category) %> <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %> <%= f.error_message_on :tax_category %> <% end %>
<%= f.field_container :taxons do %> <%= f.label :taxon_ids, Spree.t(:taxons) %> <% if can? :modify, Spree::Classification %> <%= f.select :taxon_ids, options_from_collection_for_select(@product.taxons, :id, :pretty_name, @product.taxon_ids), { include_hidden: true }, multiple: true, data: { autocomplete_url_value: 'taxons_api_v2', autocomplete_return_attr_value: 'pretty_name', autocomplete_multiple_value: true } %> <% elsif @product.taxons.any? %> <% else %>
<%= Spree.t(:no_resource_found, resource: :taxons) %>
<% end %> <% end %>
<%= f.field_container :option_types do %> <%= f.label :option_type_ids, Spree.t(:option_types) %> <% if can? :modify, Spree::ProductOptionType %> <%= f.select :option_type_ids, options_from_collection_for_select(@product.option_types, :id, :name, @product.option_type_ids), { include_hidden: true }, multiple: true, data: { autocomplete_url_value: 'option_types_api_v2', autocomplete_return_attr_value: 'name', autocomplete_multiple_value: true } %> <% elsif @product.option_types.any? %> <% else %>
<%= Spree.t(:no_resource_found, resource: :option_types) %>
<% end %> <% end %>
<% if @stores.count > 1 %>
<%= f.field_container :stores do %> <%= f.label :product_stores, Spree.t(:stores) %> <%= collection_select(:product, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %> <% end %>
<% end %>
<%= f.field_container :meta_title do %> <%= f.label :meta_title, Spree.t(:meta_title) %> <%= f.text_field :meta_title, class: 'form-control' %> <% end %>
<%= f.field_container :meta_keywords do %> <%= f.label :meta_keywords, Spree.t(:meta_keywords) %> <%= f.text_field :meta_keywords, class: 'form-control' %> <% end %>
<%= f.field_container :meta_description do %> <%= f.label :meta_description, Spree.t(:meta_description) %> <%= f.text_area :meta_description, class: 'form-control' %> <% end %>