.label-block.left.six.columns.alpha{'ng-app' => 'admin.products', 'ng-controller' => 'variantUnitsCtrl'} .field = f.label :display_name, t('.display_name') = f.text_field :display_name, class: "fullwidth", placeholder: t('.display_name_placeholder') .field = f.label :display_as, t('.display_as') = f.text_field :display_as, class: "fullwidth", placeholder: t('.display_as_placeholder') - if product_has_variant_unit_option_type?(@product) - if @product.variant_unit != 'items' .field = label_tag :unit_value_human, "#{t('admin.'+@product.variant_unit)} ({{unitName(#{@product.variant_unit_scale}, '#{@product.variant_unit}')}})" = hidden_field_tag 'product_variant_unit_scale', @product.variant_unit_scale = text_field_tag :unit_value_human, nil, {class: "fullwidth", 'ng-model' => 'unit_value_human', 'ng-change' => 'updateValue()'} = f.text_field :unit_value, {hidden: true, 'ng-value' => 'unit_value'} .field = f.label :unit_description, t(:spree_admin_unit_description) = f.text_field :unit_description, class: "fullwidth", placeholder: t('admin.products.unit_name_placeholder') %div - @product.option_types.each do |option_type| - unless variant_unit_option_type?(option_type) .field = label :new_variant, option_type.presentation - if @variant.new_record? = select(:new_variant, option_type.presentation, option_type.option_values.collect {|ov| [ ov.presentation, ov.id ] }, {}, {class: 'select2 fullwidth'}) - else - if opt = @variant.option_values.detect {|o| o.option_type == option_type }.try(:presentation) = text_field(:new_variant, option_type.presentation, value: opt, disabled: 'disabled', class: 'fullwidth') .field = f.label :sku, t('.sku') = f.text_field :sku, class: 'fullwidth' .field = f.label :price, t('.price') = f.text_field :price, class: 'fullwidth', "ng-model" => "variant.price", "ng-init" => "variant.price = '#{number_to_currency(@variant.price, unit: '')}'" .field = hidden_field_tag 'product_variant_unit', @product.variant_unit = hidden_field_tag 'product_variant_unit_name', @product.variant_unit_name = f.field_container :unit_price do %div{style: "display: flex"} = f.label :unit_price, t(".unit_price"), {style: "display: inline-block"} %question-mark-with-tooltip{"question-mark-with-tooltip" => "_", "question-mark-with-tooltip-append-to-body" => "true", "question-mark-with-tooltip-placement" => "top", "question-mark-with-tooltip-animation" => true, key: "'js.admin.unit_price_tooltip'"} %input{ "type" => "text", "id" => "variant_unit_price", "name" => "variant[unit_price]", "class" => 'fullwidth', "disabled" => true, "ng-model" => "unit_price"} %div{style: "color: black"} = t("spree.admin.products.new.unit_price_legend") %div{ 'set-on-demand' => '' } .field.checkbox %label = f.check_box :on_demand = t(:on_demand) %div{'ofn-with-tip' => t('admin.products.variants.to_order_tip')} %a= t('admin.whats_this') .field = f.label :on_hand, t(:on_hand) .fullwidth = f.text_field :on_hand .right.six.columns.omega.label-block - if @product.variant_unit != 'weight' .field = f.label 'weight', t(:weight)+' (kg)' - value = number_with_precision(@variant.weight, precision: 2) = f.text_field 'weight', value: value, class: 'fullwidth' - [:height, :width, :depth].each do |field| .field = f.label field, t(field) - value = number_with_precision(@variant.send(field), precision: 2) = f.text_field field, value: value, class: 'fullwidth' .clear