.row
  .three.columns.alpha
    = f.label :name, t('primary_details.name', scope: scope)
    %span.required *
  .nine.columns.omega
    = f.text_field :name, { placeholder: t('primary_details.name_placeholder', scope: scope), class: "fullwidth" }

- if spree_current_user.admin?
  .row
    .three.columns.alpha
      =f.label :owner_id, t('.owner')
      %span.required *
      %div{'ofn-with-tip' => t('.owner_tip')}
        %a= t('admin.whats_this')
    .nine.columns.omega
      - owner_email = @enterprise&.owner&.email || ""
      = f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner'
.row
  .three.columns.alpha
    %label= t('primary_details.primary_producer', scope: scope)
    %div{'ofn-with-tip' => t('primary_details.primary_producer_tip', scope: scope)}
      %a= t('admin.whats_this')
  .five.columns.omega
    = f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
    &nbsp;
    = f.label :is_primary_producer, t('.i_am_producer')
- if spree_current_user.admin?
  .row
    .alpha.eleven.columns
      .three.columns.alpha
        = f.label :sells, t('primary_details.sells', scope: scope)
        %div{'ofn-with-tip' => t('primary_details.sells_tip', scope: scope)}
          %a What's this?
      .two.columns
        = f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
        &nbsp;
        = f.label :sells, t('primary_details.none', scope: scope), value: "none"
      .two.columns
        = f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
        &nbsp;
        = f.label :sells, t('primary_details.own', scope: scope), value: "own"
      .four.columns.omega
        = f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
        &nbsp;
        = f.label :sells, t('primary_details.any', scope: scope), value: "any"

.row
  .alpha.three.columns
    = f.label :contact_name, t('.contact_name')
  .omega.nine.columns
    = f.text_field :contact_name, { placeholder: t('contact.name_placeholder', scope: scope)}
.row
  .alpha.three.columns
    = f.label :email_address, t('contact.email_address', scope: scope)
  .omega.nine.columns
    = f.text_field :email_address, { placeholder: t('contact.email_address_placeholder', scope: scope), "ng-model" => "Enterprise.email_address" }
.row
  .alpha.three.columns
    = f.label :phone, t('contact.phone', scope: scope)
  .omega.nine.columns
    = f.text_field :phone, { placeholder: t('contact.phone_placeholder', scope: scope)}
.row
  .alpha.three.columns
    = f.label :website, t('contact.website', scope: scope)
  .omega.nine.columns
    = f.text_field :website, { placeholder: t('contact.website_placeholder', scope: scope)}

= f.fields_for :address do |af|
  .row
    .three.columns.alpha
      = af.label :address1, t(:address)
      %span.required *
    .nine.columns.omega
      = af.text_field :address1, { placeholder: t(:address_placeholder)}
  .row
    .alpha.three.columns
      = af.label :address2, t(:address2)
    .nine.columns.omega
      = af.text_field :address2
  .row
    .three.columns.alpha
      = af.label :city, t(:city)
      \/
      = af.label :zipcode, t(:postcode)
      %span.required *
    .four.columns
      = af.text_field :city, { placeholder: t(:city_placeholder)}
    .five.columns.omega
      = af.text_field :zipcode, { placeholder: t(:postcode_placeholder)}
  %div{"data-controller": "dependent-select", "data-dependent-select-options-value": countries_with_states }
    .row
      .three.columns.alpha
        = af.label :state_id, t(:state)
        \/
        = af.label :country_id, t(:country)
      .four.columns
        = af.select :country_id, available_countries.map { |c| [c.name, c.id] }, {}, { "data-controller": "tom-select", "data-dependent-select-target": "source", "data-action": "dependent-select#handleSelectChange", class: "primary" }
      .five.columns.omega
        = af.select :state_id, @enterprise.address.country.states.map { |s| [s.name, s.id] }, {}, { "data-controller": "tom-select", "data-dependent-select-target": "select", class: "primary" }
  .row
    .three.columns.alpha
      = af.label :latitude, t(:latitude)
      \/
      = af.label :longitude, t(:longitude)
      %div{'ofn-with-tip' => t('latitude_longitude_tip')}
        %a= t('admin.whats_this')
    .four.columns
      = af.text_field :latitude, { placeholder: t(:latitude_placeholder) }
    .four.columns.omega
      = af.text_field :longitude, { placeholder: t(:longitude_placeholder) }
  .row
    .three.columns.alpha
      = "&nbsp;".html_safe
    .five.columns.omega
      = check_box_tag "use_geocoder"
      = label_tag "use_geocoder", t('use_geocoder')
.row
  .twelve.columns.alpha
    &nbsp;
.row
  .twelve.columns.alpha
    = render partial: "spree/admin/shared/new_resource_links"
