%td.with-image
  %a.image-field{ href: admin_product_images_path(product), data: { controller: "modal", reflex: "click->products#edit_image", "current-id": product.id} }
    = image_tag product.image&.url(:mini) || Spree::Image.default_image_url(:mini), width: 40, height: 40
    .button.secondary.mini= t('admin.products_page.image.edit')
%td.field.align-left.header.naked_inputs
  = f.hidden_field :id
  = f.text_field :name, 'aria-label': t('admin.products_page.columns.name')
  = error_message_on product, :name
%td.field.naked_inputs
  = f.text_field :sku, 'aria-label': t('admin.products_page.columns.sku')
  = error_message_on product, :sku
%td.field.naked_inputs{ 'data-controller': 'toggle-control', 'data-toggle-control-match-value': 'items' }
  = f.hidden_field :variant_unit
  = f.hidden_field :variant_unit_scale
  = f.select :variant_unit_with_scale,
      options_for_select(WeightsAndMeasures.variant_unit_options, product.variant_unit_with_scale),
      {},
      class: "fullwidth no-input",
      'aria-label': t('admin.products_page.columns.unit_scale'),
      data: { "controller": "tom-select", "tom-select-options-value": '{ "plugins": [] }', action: "change->toggle-control#displayIfMatch"}
  .field
    = f.text_field :variant_unit_name, 'aria-label': t('items'), 'data-toggle-control-target': 'control', style: (product.variant_unit == "items" ? "" : "display: none")
    = error_message_on product, :variant_unit_name, 'data-toggle-control-target': 'control'
%td.align-right
  -# empty
%td.align-right
  -# empty
%td.align-right
  -# empty
%td.naked_inputs
  = render(SearchableDropdownComponent.new(form: f,
      name: :supplier_id,
      aria_label: t('.producer_field_name'),
      options: producer_options,
      selected_option: product.supplier_id,
      placeholder_value: t('admin.products_v3.filters.search_for_producers')))
%td.align-left
  -# empty
%td.align-left
%td.align-left
  .content= product.inherits_properties ? 'YES' : 'NO' #TODO: consider using https://github.com/RST-J/human_attribute_values, else use I18n.t (also below)
%td.align-right
  = render(VerticalEllipsisMenu::Component.new) do
    = link_to t('admin.products_page.actions.edit'), edit_admin_product_path(product), 'data-turbo': false
    = link_to t('admin.products_page.actions.clone'), clone_admin_product_path(product), 'data-turbo': false
    %a{ "data-controller": "modal-link", "data-action": "click->modal-link#setModalDataSetOnConfirm click->modal-link#open",
        "data-modal-link-target-value": "product-delete-modal", "class": "delete",
        "data-modal-link-modal-dataset-value": {'data-current-id': product.id}.to_json }
      = t('admin.products_page.actions.delete')
