%div{"data-hook" => "admin_product_form_fields"}
  .left.eight.columns.alpha
    = f.field_container :name do
      = f.label :name, raw(t(:name) + content_tag(:span, ' *', :class => 'required'))
      = f.text_field :name, :class => 'fullwidth title'
      = f.error_message_on :name

    = f.field_container :permalink do
      = f.label :permalink, raw(t(:permalink) + content_tag(:span, ' *',  :class => "required"))
      = f.text_field :permalink, :class => 'fullwidth title'
      = f.error_message_on :permalink

    = f.field_container :description do
      = f.label :description, t(:description)
      %text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', "textangular-links-target-blank" => true, 'ta-toolbar' => "[['bold','italics','underline','clear'],['insertLink']]"}
        = sanitize(@product.description)
      = f.error_message_on :description

    = f.field_container :taxons do
      = f.label :taxon_ids, t(:taxons)
      %br
      = f.hidden_field :taxon_ids, :value => @product.taxon_ids.join(',')

  .right.four.columns.omega
    .variant_units_form{ 'ng-app' => 'admin.products', 'ng-controller' => 'editUnitsCtrl' }

      = f.field_container :units do
        = f.label :variant_unit_with_scale, t(:spree_admin_variant_unit_scale)
        %select.select2.fullwidth{ id: 'product_variant_unit_with_scale', 'ng-model' => 'variant_unit_with_scale', 'ng-change' => 'setFields()', 'ng-options' => 'unit[1] as unit[0] for unit in variant_unit_options' }
          %option{'value' => ''}

      = f.text_field :variant_unit, {'id' => 'variant_unit', 'ng-value' => 'product.variant_unit', 'hidden' => true}
      = f.text_field :variant_unit_scale, {'id' => 'variant_unit_scale', 'ng-value' => 'product.variant_unit_scale', 'hidden' => true}

      .variant_unit_name{'ng-show' => 'product.variant_unit == "items"'}
        = f.field_container :variant_unit_name do
          = f.label :variant_unit_name, t(:spree_admin_variant_unit_name)
          = f.text_field :variant_unit_name, {placeholder: t('admin.products.unit_name_placeholder')}
          = f.error_message_on :variant_unit_name

    = render 'spree/admin/products/primary_taxon_form', f: f

    = f.field_container :supplier do
      = f.label :supplier, t(:spree_admin_supplier)
      %br
      = f.collection_select(:supplier_id, @producers, :id, :name, {:include_blank => true}, {:class => "select2"})
      = f.error_message_on :supplier

    .clear

    - unless @product.has_variants?
      = f.field_container :sku do
        = f.label :sku, t(:sku)
        = f.text_field :sku, :size => 16

      .alpha.two.columns
        = f.field_container :on_hand do
          = f.label :on_hand, t(:on_hand)
          = f.number_field :on_hand, :min => 0
      .omega.two.columns
        = f.field_container :on_demand, :class => ['checkbox'] do
          %label
            = f.check_box :on_demand
            = t(:on_demand)

      .clear

      %ul#shipping_specs
        %li#shipping_specs_weight_field.field.alpha.two.columns
          = f.label :weight, t(:weight)
          = f.text_field :weight, :size => 4
        %li#shipping_specs_height_field.field.omega.two.columns
          = f.label :height, t(:height)
          = f.text_field :height, :size => 4
        %li#shipping_specs_width_field.field.alpha.two.columns
          = f.label :width, t(:width)
          = f.text_field :width, :size => 4
        %li#shipping_specs_depth_field.field.omega.two.columns
          = f.label :depth, t(:depth)
          = f.text_field :depth, :size => 4

    = f.field_container :shipping_categories do
      = f.label :shipping_category_id, t(:shipping_categories)
      = f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { :include_blank => 'None' }, { :class => 'select2' })
      = f.error_message_on :shipping_category

    = f.field_container :tax_category do
      = f.label :tax_category_id, t(:tax_category)
      = f.collection_select(:tax_category_id, @tax_categories, :id, :name, { :include_blank => 'None' }, { :class => 'select2' })
      = f.error_message_on :tax_category

  .clear

  %div

  .clear

- unless Rails.env.test?
  :javascript
    $('.select2-container').css({width: '20em'})
