- content_for :page_title do
  = "#{@enterprise.name}:"
  = t('.title')

- content_for :page_actions do
  %ul.tollbar.inline-menu
    %li
      = link_to_add_fields t(:add_producer_property), 'tbody#producer_properties', class: 'icon-plus button'

= render 'spree/shared/error_messages', target: @enterprise

= form_for @enterprise, url: main_app.admin_enterprise_path(@enterprise), method: :put do |f|
  = render 'form', f: f

  = render 'spree/admin/shared/edit_resource_links', collection_url: main_app.admin_enterprise_producer_properties_path(@enterprise)
  = hidden_field_tag 'clear_producer_properties', 'true'

:javascript
  var properties = #{raw(@properties.to_json)};

  $("#producer_properties").on("keydown", "input.autocomplete", function() {
    var already_auto_completed = $(this).is('ac_input');
    if (!already_auto_completed) {
      $(this).autocomplete({source: properties});
      $(this).focus();
    }
  });
