= admin_inject_shipping_method(@shipping_method)
.alpha.eleven.columns{ "ng-app" => "admin.shippingMethods",
  "ng-controller" => "shippingMethodCtrl" }
  .row
    = t '.deactivation_warning'
  .row
    .alpha.four.columns
      = f.label :name, t(:name)
    .omega.twelve.columns
      = f.text_field :name, class: 'fullwidth', placeholder: t(:spree_admin_eg_pickup_from_school)
      = error_message_on :shipping_method, :name
  .row
    .alpha.four.columns
      = f.label :description, t(:description)
    .omega.twelve.columns
      = f.text_area :description, class: 'fullwidth', rows: 2, placeholder: t(:spree_admin_eg_collect_your_order)
      = error_message_on :shipping_method, :description
  .row
    .alpha.four.columns
      = f.label :display_on, t(:display)
    .omega.twelve.columns
      = select(:shipping_method, :display_on, Spree::ShippingMethod::DISPLAY_ON_OPTIONS.map { |key, value| [t(".#{key}"), value] }, {}, {class: 'select2 fullwidth'})
      = error_message_on :shipping_method, :display_on

  .row
    .alpha.four.columns
      -# The 'Category' label here is just a logical descriptor for the data we are trying to collect for 'requires_ship_address'
      -# and does not relate to shipping categories in any way.
      = f.label :require_ship_address, t(:category)
    .three.columns
      = f.radio_button :require_ship_address, true
      &nbsp;
      = f.label :delivery, t(:delivery)
    .omega.six.columns
      = f.radio_button :require_ship_address, false
      &nbsp;
      = f.label :pick_up, t(:pick_up)

  .row
    .alpha.four.columns
      = f.label :tags, t(:tags)
    .omega.twelve.columns
      = f.hidden_field :tag_list, "ng-value" => "shippingMethod.tag_list"
      %tags-with-translation#something{ object: "shippingMethod", 'find-tags' => 'findTags(query)' }


  = render partial: 'spree/admin/shared/calculator_fields', locals: { f: f }

  %fieldset.tax_categories.no-border-bottom
    %legend{align: "center"}= t('.tax_category')
    = f.field_container :tax_categories do
      = f.select :tax_category_id, @tax_categories.map { |tc| [tc.name, tc.id] },
        { include_blank: t(:none) }, class: "select2 fullwidth"
      = error_message_on :shipping_method, :tax_category_id

  %fieldset.categories.no-border-bottom
    %legend{align: "center"}= t('.categories')
    = f.field_container :categories do
      - Spree::ShippingCategory.all.each do |category|
        = label_tag do
          = check_box_tag('shipping_method[shipping_categories][]', category.id, @shipping_method.shipping_categories.include?(category))
          = category.name
          %br/
      = error_message_on :shipping_method, :shipping_category_id


  %fieldset.no-border-bottom
    %legend{align: "center"}= t('.zones')
    = f.field_container :zones do
      - shipping_method_zones = @shipping_method.zones.to_a
      - Spree::Zone.all.each do |zone|
        = label_tag do
          = check_box_tag('shipping_method[zones][]', zone.id, shipping_method_zones.include?(zone))
          = zone.name
        %br/
      = error_message_on :shipping_method, :zone_id
