<% 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: 'form-control js-filterable shadow-none', value: params[:q][:created_at_gt], placeholder: Spree.t(:starting_from), 'data-input':'' %> <%= render partial: 'spree/admin/shared/cal_close' %>
<%= f.text_field :created_at_lt, class: 'form-control js-filterable shadow-none', value: params[:q][:created_at_lt], placeholder: Spree.t(:ending_at), 'data-input':'' %> <%= render partial: 'spree/admin/shared/cal_close' %>
<%= label_tag :q_number_cont, Spree.t(:search_order_number) %> <%= f.text_field :number_cont, class: 'form-control js-quick-search-target js-filterable' %>
<%= label_tag :q_state_eq, Spree.t(:status) %> <%= f.select :state_eq, Spree::Order.state_machines[:state].states.map {|s| [Spree.t("order_state.#{s.name}"), s.value]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
<%= label_tag :q_payment_state_eq, Spree.t(:payment_state) %> <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
<%= label_tag :q_shipment_state_eq, Spree.t(:shipment_state) %> <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
<%= label_tag :q_bill_address_firstname_start, Spree.t(:first_name_begins_with) %> <%= f.text_field :bill_address_firstname_start, class: 'form-control js-filterable' %>
<%= label_tag :q_bill_address_lastname_start, Spree.t(:last_name_begins_with) %> <%= f.text_field :bill_address_lastname_start, class: 'form-control js-filterable' %>
<%= label_tag :q_email_cont, Spree.t(:email) %> <%= f.text_field :email_cont, class: 'form-control js-filterable' %>
<%= label_tag :q_line_items_variant_sku_eq, Spree.t(:sku) %> <%= f.text_field :line_items_variant_sku_eq, class: 'form-control js-filterable' %>
<%= 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-clear js-filterable' %>
<%= label_tag :q_channel_eq, Spree.t(:channel) %> <%= f.select :channel_eq, Spree::Order.distinct.pluck(:channel), { include_blank: true }, class: 'select2-clear js-filterable' %>
<%= f.field_container :completed_at_not_null do %>
<%= f.check_box :completed_at_not_null, {checked: @show_only_completed, class: 'custom-control-input'}, '1', '0' %> <%= f.label :completed_at_not_null, Spree.t(:show_only_complete_orders), class: 'custom-control-label' %>
<% end %> <%= f.field_container :considered_risky_eq do %>
<%= f.check_box :considered_risky_eq, {checked: params[:q][:considered_risky_eq] == '1', class: 'custom-control-input'}, '1', '' %> <%= f.label :considered_risky_eq, Spree.t(:show_only_considered_risky), class: 'custom-control-label' %>
<% end %>
<%= button Spree.t(:filter_results), 'search.svg' %>
<% end %>
<% end %>