= form_for [:suppliers, @product_category] do |f|
  = render 'error_messages', target: @product_category
  .form-row
    .form-label
      = f.label :name
    .form-field
      = f.text_field :name
  .form-row
    = hidden_field_tag 'product_category[product_ids][]', ''
    .form-label
      = label_tag nil, Product.model_name.human_plural, class: 'control-label'
    .form-field
      - for product in current_supplier.products
        = check_box_tag "product_category[product_ids][]", product.id, @product_category.product_ids.to_a.include?(product.id), id: "product-checker-#{product.id}"
        = label_tag "product-checker-#{product.id}", product.display
        br
  .form-row
    .form-label
      = label_tag nil, ProductCategory.human_attribute_name(:week_days), class: 'control-label'
    .form-field.full
      ul#week_days-group.button-group
        - day_titles = (t('date.day_names') || []).dup
        - day_names = week_days.dup
        - if current_supplier.week_starts_on_monday?
          - day_names << day_names.shift
          - day_titles << day_titles.shift
        - day_names.each.with_index do |day_name, i|
          li: button.week-day-toggle.tiny type="button" data-day=day_name data-t="product_category.week_days.abbreviation.#{day_name}" title=day_titles[i]


      span#full_day-controller: span
      #sub-day-container.hide
        = f.select :start_from, (1..24).map{|h| ["#{h}:00", h*60]}
        = f.select :end_on, (1..24).map{|h| ["#{h}:00", h*60]}
  .hidden
    - @product_category.week_days.each.with_index do |day, i|
      = select_tag 'product_category[week_days][]', options_for_select([0,1], day), class: 'week-day-select', id: "week-day-select-#{week_days[i]}", data: {day: week_days[i] }
    /= f.input :full_day, as: :select, collection: [true, false], label: false, include_blank: false
    /= f.input_field :full_day, as: :boolean, label: false, wrapper: false
    = f.check_box :full_day
  = f.supplier_form_actions
