<%= render :partial => 'spree/admin/shared/order_sub_menu' %>

<%= t(:listing_orders) %>

<% if @show_only_completed %> <% else %> <% end %> <% @orders.each do |order| %> <% end %>
<%= sort_link @search, :completed_at, t(:completed_at, :scope => 'activerecord.attributes.spree/order') %><%= sort_link @search, :created_at, t(:created_at, :scope => 'activerecord.attributes.spree/order') %><%= sort_link @search, :number, t(:number, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :state, t(:state, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :payment_state, t(:payment_state, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :shipment_state, t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :email, t(:email, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :total, t(:total, :scope => 'activerecord.attributes.spree/order') %>
<%= l (@show_only_completed ? order.completed_at : order.created_at).to_date %> <%= link_to order.number, admin_order_path(order) %> <%= t("order_state.#{order.state.downcase}") %> <%= link_to t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %> <%= link_to t("shipment_states.#{order.shipment_state}"), admin_order_shipments_path(order) if order.shipment_state %> <%= order.email %> <%= number_to_currency order.total %> <%= link_to_edit_url edit_admin_order_path(order), :title => "admin_edit_#{dom_id(order)}" %>
<%= paginate @orders %> <% content_for :sidebar do %>

<%= t(:search) %>

<%= search_form_for [:admin, @search] do |f| %> <%= label_tag nil, t(:date_range) %>
<%= f.text_field :created_at_gt, :class => 'datepicker', :value => params[:q][:created_at_gt] %>
<%= label_tag nil, t(:start), :class => 'sub' %>
<%= f.text_field :created_at_lt, :class => 'datepicker', :value => params[:q][:created_at_lt] %>
<%= label_tag nil, t(:stop), :class => 'sub' %>

<%= label_tag nil, t(:status) %>
<%= f.select :state_eq, Spree::Order.state_machines[:state].states.collect {|s| [t("order_state.#{s.name}"), s.value]}, {:include_blank => true} %>

<%= label_tag nil, t(:order_number) %>
<%= f.text_field :number_cont, :size => 25 %>

<%= label_tag nil, t(:email) %>
<%= f.text_field :email_cont, :size => 25 %>

<%= label_tag nil, t(:first_name_begins_with) %>
<%= f.text_field :bill_address_firstname_start, :size => 25 %>

<%= label_tag nil, t(:last_name_begins_with) %>
<%= f.text_field :bill_address_lastname_start, :size => 25 %>

<%= f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '' %> <%= label_tag nil, t(:show_only_complete_orders) %>

<%= button t(:search) %>

<% end %>
<% end %>