<%= Spree.t(:account) %>

<%= f.label :email, Spree.t(:email) %> <%= f.email_field :email, class: 'form-control' %>
<%= label_tag nil, Spree.t(:guest_checkout) %> <% if @order.completed? %>
<%= @order.user.nil? ? Spree.t(:say_yes) : Spree.t(:say_no) %>
<% else %> <% guest = @order.user.nil? %>
<%= label_tag :guest_checkout_true do %> <%= radio_button_tag :guest_checkout, true, guest %> <%= Spree.t(:say_yes) %> <% end %>
<%= label_tag :guest_checkout_false do %> <%= radio_button_tag :guest_checkout, false, !guest, disabled: @order.cart? %> <%= Spree.t(:say_no) %> <% end %>
<%= hidden_field_tag :user_id, @order.user_id %> <% end %>

<%= Spree.t(:billing_address) %>

<%= f.fields_for :bill_address do |ba_form| %> <%= render partial: 'spree/admin/shared/address_form', locals: { f: ba_form, type: "billing" } %> <% end %>

<%= Spree.t(:shipping_address) %>

<%= f.fields_for :ship_address do |sa_form| %>
<%= 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) %>
<%= render partial: 'spree/admin/shared/address_form', locals: { f: sa_form, type: 'shipping' } %> <% end %>
<%= button Spree.t('actions.update'), 'save' %>
<% content_for :head do %> <%= javascript_include_tag 'spree/backend/address_states.js' %> <% end %>