<div class="clearfix">
  <div class="left" data-hook="admin_product_form_left">
    <%= f.field_container :name do %>
      <%= f.label :name, t(:name) %> <span class="required">*</span><br />
      <%= f.text_field :name, :class => 'fullwidth title' %>
      <%= f.error_message_on :name %>
    <% end %>

    <%= f.field_container :permalink do %>
      <%= f.label :permalink, t(:permalink) %> <span class="required">*</span><br />
      <%= f.text_field :permalink, :class => 'fullwidth title' %>
      <%= f.error_message_on :permalink %>
    <% end %>

    <%= f.field_container :description do %>
      <%= f.label :description, t(:description) %><br />
      <%= f.text_area :description, {:cols => 60, :rows => 4, :class => 'fullwidth'} %>
      <%= f.error_message_on :description %>
    <% end %>
  </div>
  <div class="right" data-hook="admin_product_form_right">
      <%= f.field_container :price do %>
        <%= f.label :price, t(:master_price) %> <span class="required">*</span><br />
        <%= f.text_field :price, :value => number_with_precision(@product.price, :precision => 2) %>
        <%= f.error_message_on :price %>
      <% end %>

      <%= f.field_container :cost_price do %>
        <%= f.label :cost_price, t(:cost_price) %><br />
        <%= f.text_field :cost_price, :value => number_with_precision(@product.cost_price, :precision => 2) %>
      <%= f.error_message_on :cost_price %>
    <% end %>

    <p>
      <%= f.label :available_on, t(:available_on) %><br />
      <%= f.error_message_on :available_on %>
      <%= f.text_field :available_on, :class => 'datepicker' %>
    </p>

    <p>
      <%= f.label :sku, t(:sku) %><br />
      <%= f.text_field :sku, :size => 16 %>
    </p>
    <% unless @product.has_variants? %>
      <% if Spree::Config[:track_inventory_levels] %>
        <p>
          <%= f.label :on_hand, t(:on_hand) %><br />
          <%= f.number_field :on_hand, :min => 0 %>
        </p>
      <% end %>
      <ul id="shipping-specs">
        <li>
          <%= f.label :weight, t(:weight) %>
          <%= f.text_field :weight, :size => 4 %>
        </li>
        <li>
          <%= f.label :height, t(:height) %>
          <%= f.text_field :height, :size => 4 %>
        </li>
        <li>
          <%= f.label :width, t(:width) %>
          <%= f.text_field :width, :size => 4 %>
        </li>
        <li>
          <%= f.label :depth, t(:depth) %>
          <%= f.text_field :depth, :size => 4 %>
        </li>
      </ul>
    <% end %>
    <p>
      <%= f.label :shipping_category_id, t(:shipping_categories) %><br />
      <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {:include_blank => true}, {'style' => 'width:200px'}) %>
      <%= f.error_message_on :shipping_category %>
    </p>

    <p>
      <%= f.label :tax_category_id, t(:tax_category) %><br />
      <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, {:include_blank => true}, {'style' => 'width:200px'}) %>
      <%= f.error_message_on :tax_category %>
    </p>
  </div>
</div>

<h2><%= t(:metadata) %></h2>
<div data-hook="admin_product_form_meta">
  <p>
    <%= f.label :meta_keywords, t(:meta_keywords) %><br />
    <%= f.text_field :meta_keywords, :class => 'fullwidth' %>
  </p>
  <p>
    <%= f.label :meta_description, t(:meta_description) %><br />
    <%= f.text_field :meta_description, :class => 'fullwidth' %>
  </p>
</div>


<div data-hook="admin_product_form_additional_fields">
  <% Spree::Variant.additional_fields.select{|af| af[:only].nil? || af[:only].include?(:product) }.each do |field| %>
    <%= render :partial => 'spree/admin/shared/additional_field', :locals => { :field => field, :f => f } %>
  <% end %>
</div>
