<% content_for :page_title do %> <%= Spree.t(:listing_orders) %> <% end %> <% content_for :page_actions do %>
  • <%= button_link_to Spree.t(:new_order), new_admin_order_url, :icon => 'plus', :id => 'admin_new_order' %>
  • <% end if can? :edit, Spree::Order.new %> <% content_for :table_filter_title do %> <%= Spree.t(:search) %> <% end %> <% content_for :table_filter do %>
    <%= search_form_for [:admin, @search] do |f| %>
    <%= label_tag :q_created_at_gt, Spree.t(:date_range) %>
    <%= f.text_field :created_at_gt, :class => 'datepicker datepicker-from', :value => params[:q][:created_at_gt], :placeholder => Spree.t(:start) %> <%= f.text_field :created_at_lt, :class => 'datepicker datepicker-to', :value => params[:q][:created_at_lt], :placeholder => Spree.t(:stop) %>
    <%= label_tag :q_state_eq, Spree.t(:status) %> <%= f.select :state_eq, Spree::Order.state_machines[:state].states.collect {|s| [Spree.t("order_state.#{s.name}"), s.value]}, {:include_blank => true}, :class => 'select2' %>
    <%= label_tag :q_promotions_id_in, Spree.t(:promotion) %> <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), {:include_blank => true}, :class => 'select2' %>
    <%= label_tag :q_number_cont, Spree.t(:order_number, :number => '') %> <%= f.text_field :number_cont %>
    <%= label_tag :q_email_cont, Spree.t(:email) %> <%= f.text_field :email_cont %>
    <%= label_tag :q_line_items_variant_id_in, Spree.t(:sku) %> <%= f.select :line_items_variant_id_in, Spree::Variant.having_orders.order(:sku).pluck(:sku, :id), {:include_blank => true}, :class => 'select2' %>
    <%= label_tag :q_bill_address_firstname_start, Spree.t(:first_name_begins_with) %> <%= f.text_field :bill_address_firstname_start, :size => 25 %>
    <%= label_tag :q_bill_address_lastname_start, Spree.t(:last_name_begins_with) %> <%= f.text_field :bill_address_lastname_start, :size => 25%>
    <%= button Spree.t(:filter_results), 'search' %>
    <% end %>
    <% end %> <%= paginate @orders %> <% if @orders.any? %> <% if Spree::Order.checkout_step_names.include?(:delivery) %> <% end %> <% if @show_only_completed %> <% else %> <% end %> <% if Spree::Order.checkout_step_names.include?(:delivery) %> <% end %> <% @orders.each do |order| %> <% if Spree::Order.checkout_step_names.include?(:delivery) %> <% end %> <% end %>
    <%= sort_link @search, :completed_at, I18n.t(:completed_at, :scope => 'activerecord.attributes.spree/order') %><%= sort_link @search, :created_at, I18n.t(:created_at, :scope => 'activerecord.attributes.spree/order') %><%= sort_link @search, :number, I18n.t(:number, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :considered_risky, I18n.t(:considered_risky, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :state, I18n.t(:state, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :payment_state, I18n.t(:payment_state, :scope => 'activerecord.attributes.spree/order') %><%= sort_link @search, :shipment_state, I18n.t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %><%= sort_link @search, :email, I18n.t(:email, :scope => 'activerecord.attributes.spree/order') %> <%= sort_link @search, :total, I18n.t(:total, :scope => 'activerecord.attributes.spree/order') %>
    <%= l (@show_only_completed ? order.completed_at : order.created_at).to_date %> <%= link_to order.number, edit_admin_order_path(order) %> <%= Spree.t("order_state.#{order.state.downcase}") %> <%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %><%= Spree.t("shipment_states.#{order.shipment_state}") if order.shipment_state %> <% if order.user %> <%= link_to order.email, edit_admin_user_path(order.user) %> <% else %> <%= mail_to order.email %> <% end %> <%= order.display_total.to_html %> <%= link_to_edit_url edit_admin_order_path(order), :title => "admin_edit_#{dom_id(order)}", :no_text => true %>
    <% else %>
    <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/order')) %>, <%= link_to Spree.t(:add_one), spree.new_admin_order_path %>!
    <% end %> <%= paginate @orders %>