= form_for [:suppliers, @product] do |f|
  = render 'error_messages', target: @product
  .form-row class=(f.object.errors[:name].any? ? 'error' : nil)
    .form-label
      = f.label :name, data: {t: 'attributes.product.name'}
    .form-field
      = f.text_field :name
  .form-row class=(f.object.errors[:code].any? ? 'error' : nil)
    .form-label
      = f.label :code, data: {t: 'attributes.product.code'}
    .form-field
      = f.text_field :code
  .form-row class=(f.object.errors[:price].any? ? 'error' : nil)
    .form-label
      = f.label :price, data: {t: 'attributes.product.price'}
    .form-field
      = f.text_field :price
  .form-row class=(f.object.errors[:description].any? ? 'error' : nil)
    .form-label
      = f.label :description, data: {t: 'attributes.product.description'}
    .form-field
      = f.text_area :description
  /= f.input :name
  /= f.input :code
  /= f.input :price
  .form-row
    = hidden_field_tag 'product[product_category_ids][]', []
    .form-label
      = label_tag nil, ProductCategory.model_name.human_plural, class: 'control-label'
    .form-field
      - for product_category in current_supplier.product_categories
        = check_box_tag "product[product_category_ids][]", product_category.id, @product.product_categories.to_a.include?(product_category), id: "product-category-checker-#{product_category.id}"
        = label_tag "product-category-checker-#{product_category.id}", product_category.name
        br

  = f.supplier_form_actions
