- content_for :head do
  = javascript_include_tag 'supplier/app/application'

/= form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f|
  = render 'suppliers/application/error_messages', target: current_supplier
  .control-group class=(@supplier.errors[:name].any? ? 'error' : nil)
    = f.label :name, class: 'control-label'
    .controls
      = f.text_field :name, class: 'text_field'
  .control-group class=(@supplier.errors[:email].any? ? 'error' : nil)
    = f.label :email, class: 'control-label'
    .controls
      = f.text_field :email, class: 'text_field'
  #settings-sections.accordion
    .accordion-group
      .accordion-heading
        a.accordion-toggle data-toggle="collapse" data-parent="#settings-sections" href="#settings-location" data-t="attributes.supplier.location"
      #settings-location.accordion-body.collapse.in
        .accordion-inner
          .control-group class=(@supplier.errors[:location].any? ? 'error' : nil)
            = f.label :location, class: 'control-label'
            .controls
            = f.text_field :location, class: 'location_picker'
            = image_tag 'supplier/settings/location-balloon.png'
          .control-group
            = f.label :time_zone, class: 'control-label'
            .controls
              /= f.input :time_zone, collection: ActiveSupport::TimeZone.all, label_method: :to_s, value_method: :name, include_blank: false
              /= f.collection_select :time_zone, ActiveSupport::TimeZone.all, :name, :to_s
              = f.time_zone_select :time_zone
    /.accordion-group
      .accordion-heading
        a.accordion-toggle data-toggle="collapse" data-parent="#settings-sections" href="#settings-wifi" data-t="attributes.supplier.offer_wifi"
      #settings-wifi.accordion-body.collapse
        .control-group class=(@supplier.errors[:offer_wifi].any? ? 'error' : nil)
          = f.label :offer_wifi, class: 'control-label'
          .controls
            = f.check_box :offer_wifi, class: 'checkbox'
        .control-group class=(@supplier.errors[:wifi_ssid].any? ? 'error' : nil)
          = f.label :wifi_ssid, class: 'control-label'
          .controls
            = f.text_field :wifi_ssid, class: 'text_field'
        .control-group class=(@supplier.errors[:wifi_type].any? ? 'error' : nil)
          = f.label :wifi_type, class: 'control-label'
          .controls
            = f.select :wifi_type, options_for_select([['web', 'web40'], ['WPA2 Personal', 'wpa2personal']], @supplier.wifi_type)
        .control-group class=(@supplier.errors[:wifi_password].any? ? 'error' : nil)
          = f.label :wifi_password, class: 'control-label'
          .controls
            = f.text_field :wifi_password, class: 'text_field'
    /.accordion-group
      .accordion-heading
        a.accordion-toggle data-toggle="collapse" data-parent="#settings-sections" href="#settings-reviews" data-t="settings.reviews.title"
      #settings-reviews.accordion-body.collapse class=(@supplier.errors[:iens_profile].any? ? 'in' : nil)
        .control-group class=(@supplier.errors[:iens_profile].any? ? 'error' : nil)
          = f.label :iens_profile, class: 'control-label', data: {t: 'attributes.supplier.iens_profile'}
          .controls
            = f.text_field :iens_profile, class: 'text_field'
            '
            = image_tag 'supplier/settings/iens-example.png', title: 'supplier.settings.reviews.explanation'

  .form-actions
    = f.submit nil, class: 'btn btn-primary submit-supplier-settings'
    '
    = link_to t("helpers.links.cancel"), supplier_root_path, class: 'btn'
