<% s_or_b = type.chars.first %>
"> <%= f.label :firstname %> <%= f.text_field :firstname, :class => 'fullwidth' %>
"> <%= f.label :lastname %> <%= f.text_field :lastname, :class => 'fullwidth' %>
<% if Spree::Config[:company] %>
"> <%= f.label :company %> <%= f.text_field :company, :class => 'fullwidth' %>
<% end %>
"> <%= f.label :address1 %> <%= f.text_field :address1, :class => 'fullwidth' %>
"> <%= f.label :address2 %> <%= f.text_field :address2, :class => 'fullwidth' %>
"> <%= f.label :city %> <%= f.text_field :city, :class => 'fullwidth' %>
"> <%= f.label :zipcode %> <%= f.text_field :zipcode, :class => 'fullwidth' %>
"> <%= f.label :country_id, Spree::Country.model_name.human %> <%= f.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'select2 fullwidth'} %>
"> <%= f.label :state_id, Spree::State.model_name.human %> <%= f.text_field :state_name, :style => "display: #{f.object.country.states.empty? ? 'block' : 'none' };", :disabled => !f.object.country.states.empty?, :class => 'fullwidth state_name' %> <%= f.collection_select :state_id, f.object.country.states.sort, :id, :name, {:include_blank => true}, {:class => 'select2 fullwidth', :style => "display: #{f.object.country.states.empty? ? 'none' : 'block' };", :disabled => f.object.country.states.empty?} %>
"> <%= f.label :phone %> <%= f.phone_field :phone, :class => 'fullwidth' %>
<% content_for :head do %> <%= javascript_tag do -%> $(document).ready(function(){ $('span#<%= s_or_b %>country .select2').on('change', function() { update_state('<%= s_or_b %>'); }); }); <% end -%> <% end %>