<% if use_billing %>
<%= check_box_tag 'order[use_billing]', '1', (!(@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %> <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address) %>
<% end %> <% is_shipping_address = name == Spree.t(:shipping_address) %> <% shipping_or_billing = is_shipping_address ? 'shipping' : 'billing' %> <% s_or_b = is_shipping_address ? 's' : 'b' %>
"> <%= f.label :firstname, Spree.t(:first_name) + ':' %> <%= f.text_field :firstname, :class => 'fullwidth' %>
"> <%= f.label :lastname, Spree.t(:last_name) + ':' %> <%= f.text_field :lastname, :class => 'fullwidth' %>
<% if Spree::Config[:company] %>
"> <%= f.label :company, Spree.t(:company) + ':' %> <%= f.text_field :company, :class => 'fullwidth' %>
<% end %>
"> <%= f.label :address1, Spree.t(:street_address) + ':' %> <%= f.text_field :address1, :class => 'fullwidth' %>
"> <%= f.label :address2, Spree.t(:street_address_2) + ':' %> <%= f.text_field :address2, :class => 'fullwidth' %>
"> <%= f.label :city, Spree.t(:city) + ':' %> <%= f.text_field :city, :class => 'fullwidth' %>
"> <%= f.label :zipcode, Spree.t(:zip) + ':' %> <%= f.text_field :zipcode, :class => 'fullwidth' %>
"> <%= f.label :country_id, Spree.t(:country) + ':' %> <%= f.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'select2 fullwidth'} %>
"> <%= f.label :state_id, Spree.t(:state) + ':' %> <%= 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, Spree.t(: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 %>