= form_for @product, :html => {:multipart => true} do |f|
= f.error_messages
= field_set_tag "Product Information" do
%dl
%dt= f.label :product_category_id
%dd= f.collection_select :product_category_id, Shoppe::ProductCategory.ordered, :id, :name, {:include_blank => true}, {:class => 'chosen'}
.splitContainer
%dl.third
%dt= f.label :title
%dd= f.text_field :title, :class => 'text'
%dl.third
%dt= f.label :permalink
%dd= f.text_field :permalink, :class => 'text'
%dl.third
%dt= f.label :sku, 'SKU'
%dd= f.text_field :sku, :class => 'text'
%dl
%dt= f.label :description
%dd= f.text_area :description, :class => 'text'
%dl
%dt= f.label :short_description
%dd= f.text_area :short_description, :class => 'text'
%dl
%dt= f.label :in_the_box, "What's in the box?"
%dd= f.text_area :in_the_box, :class => 'text'
= field_set_tag "Attributes" do
.margin
%table.productAttributes
%thead
%tr
%td Name
%td Value
%td.searchable Searchable?
%td.searchable Public?
%td.remove Remove
%td
%tbody
%tr.template{:style => 'display:none;'}
%td= text_field_tag 'product[product_attributes_array][][key]', '', :placeholder => 'Name'
%td= text_field_tag 'product[product_attributes_array][][value]', '', :placeholder => 'Value'
%td.searchable= check_box_tag 'product[product_attributes_array][][searchable]', '1'
%td.searchable= check_box_tag 'product[product_attributes_array][][public]', '1'
%td.remove= link_to "Remove", '#', :class => 'button button-mini purple'
%td.handle
- for attribute in @product.product_attributes
%tr
%td= text_field_tag 'product[product_attributes_array][][key]', attribute.key, :placeholder => 'Name'
%td= text_field_tag 'product[product_attributes_array][][value]', attribute.value, :placeholder => 'Value'
%td.searchable= check_box_tag 'product[product_attributes_array][][searchable]', '1', attribute.searchable?
%td.searchable= check_box_tag 'product[product_attributes_array][][public]', '1', attribute.public?
%td.remove= link_to "Remove", '#', :class => 'button button-mini purple'
%td.handle
%p.addAttribute= link_to "Add attribute", '#', :data => {:behavior => 'addAttributeToAttributesTable'}, :class => 'button button-mini green'
= field_set_tag "Attachments" do
.splitContainer
%dl.half
%dt= f.label :default_image_file, "Default Image"
%dd
= attachment_preview @product.default_image
%p= f.file_field :default_image_file
%dl.half
%dt= f.label :data_sheet_file, "Datasheet"
%dd
= attachment_preview @product.data_sheet
%p= f.file_field :data_sheet_file
= field_set_tag "Pricing" do
.splitContainer
%dl.third
%dt= f.label :price
%dd= f.text_field :price, :class => 'text'
%dl.third
%dt= f.label :cost_price
%dd= f.text_field :cost_price, :class => 'text'
%dl.third
%dt= f.label :tax_rate_id
%dd= f.collection_select :tax_rate_id, Shoppe::TaxRate.ordered, :id, :description, {:include_blank => true}, {:class => 'chosen-with-deselect', :data => {:placeholder => "No tax"}}
= field_set_tag "Website Properties" do
.splitContainer
%dl.half
%dt= f.label :active, "On sale?"
%dd.checkbox
= f.check_box :active
= f.label :active, "If checked, this product will be displayed within the public store"
%dl.half
%dt= f.label :featured, "Featured?"
%dd.checkbox
= f.check_box :featured
= f.label :featured, "If checked, this product will appear on your homepage"
= field_set_tag "Stock Control" do
.splitContainer
%dl.half
%dt= f.label :weight
%dd= f.text_field :weight, :class => 'text'
%dl.half
%dt= f.label :stock_control
%dd.checkbox
= f.check_box :stock_control
= f.label :stock_control, "Enable stock control for this product?"
%p.submit
- unless @product.new_record?
%span.right= link_to "Delete", @product, :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this product?"}
= f.submit :class => 'button green'
= link_to "Cancel", :products, :class => 'button'