<% cart ||= @cart billing_address = cart.get_meta("billing_address", {}) shipping_address = cart.get_meta("shipping_address", {}) %>

<%= t('plugin.ecommerce.billing_address') %>

<%= text_field_tag 'order[billing_address][first_name]', billing_address[:first_name], class: 'form-control required' %>
<%= text_field_tag 'order[billing_address][last_name]',billing_address[:last_name], class: 'form-control required' %>
<%= text_field_tag 'order[billing_address][address1]',billing_address[:address1], class: 'form-control required' %>
<%= text_field_tag 'order[billing_address][address2]',billing_address[:address2], class: 'form-control' %>
<%= text_field_tag 'order[billing_address][city]',billing_address[:city], class: 'form-control required' %>
<%= country_select :billing_address, :country, {locale: I18n.locale.to_s, iso_codes: true, selected: billing_address[:country]}, { :name => 'order[billing_address][country]', class: 'form-control' } %>
<%= text_field_tag 'order[billing_address][state]',billing_address[:state], class: 'form-control' %>
<%= text_field_tag 'order[billing_address][zip]',billing_address[:zip], class: 'form-control' %>

<%= t('.shipping_address') %> (<%= t('.copy_address', default: 'copy from billing') %>)

<%= text_field_tag 'order[shipping_address][first_name]', shipping_address[:first_name], class: 'form-control required' %>
<%= text_field_tag 'order[shipping_address][last_name]', shipping_address[:last_name], class: 'form-control required' %>
<%= text_field_tag 'order[shipping_address][address1]', shipping_address[:address1], class: 'form-control required' %>
<%= text_field_tag 'order[shipping_address][address2]', shipping_address[:address2], class: 'form-control' %>
<%= text_field_tag 'order[shipping_address][city]', shipping_address[:city], class: 'form-control required' %>
<%= country_select :shipping_address, :country, {locale: I18n.locale.to_s, iso_codes: true, selected: billing_address[:country]}, { :name => 'order[shipping_address][country]', class: 'form-control' } %>
<%= text_field_tag 'order[shipping_address][state]', shipping_address[:state], class: 'form-control' %>
<%= text_field_tag 'order[shipping_address][zip]', shipping_address[:zip], class: 'form-control' %>
<% unless defined?(as_partial) %>
<% end %>