diff --git a/app/controllers/spree/admin/reports_controller_decorator.rb b/app/controllers/spree/admin/reports_controller_decorator.rb index 72f1614cc3..9436377846 100644 --- a/app/controllers/spree/admin/reports_controller_decorator.rb +++ b/app/controllers/spree/admin/reports_controller_decorator.rb @@ -361,6 +361,10 @@ Spree::Admin::ReportsController.class_eval do end params[:q][:meta_sort] ||= "completed_at.desc" + if params[:q] && !params[:q][:order_cycle_id_eq] == -1 + params[:q][:order_cycle_id_null] = true + end + @search = Spree::Order.complete.not_state(:canceled).managed_by(spree_current_user).search(params[:q]) orders = @search.result diff --git a/app/views/spree/admin/reports/orders_and_fulfillment.html.haml b/app/views/spree/admin/reports/orders_and_fulfillment.html.haml index 3ce0285a7a..2534826d34 100644 --- a/app/views/spree/admin/reports/orders_and_fulfillment.html.haml +++ b/app/views/spree/admin/reports/orders_and_fulfillment.html.haml @@ -2,14 +2,12 @@ = label_tag nil, t(:date_range) %br .date-range-filter - %div{"class" => "left sub-field"} - = f.text_field :completed_at_gt, :class => 'datetimepicker' - %br - = label_tag nil, t(:start), :class => 'sub' - %div{"class" => "right sub-field"} - = f.text_field :completed_at_lt, :class => 'datetimepicker' - %br - = label_tag nil, t(:stop) + = label_tag nil, t(:start), :class => 'inline' + = f.text_field :completed_at_gt, :class => 'datetimepicker datepicker-from' + %span.range-divider + %i.icon-arrow-right + = f.text_field :completed_at_lt, :class => 'datetimepicker datepicker-to' + = label_tag nil, t(:end), :class => 'inline' %br = label_tag nil, "Distributor: " = f.collection_select(:distributor_id_eq, @distributors, :id, :name, :include_blank => @include_blank) @@ -18,7 +16,9 @@ =# f.collection_select(:supplier_id_eq, @suppliers, :id, :name, :include_blank => @include_blank) %br = label_tag nil, "Order Cycle: " - = f.collection_select(:order_cycle_id_eq, @order_cycles, :id, :name, :include_blank => @include_blank) + - order_cycles_select = [['No Order Cycle', -1]] + - order_cycles_select += @order_cycles.collect {|oc| [ "#{oc.name} (#{oc.orders_open_at.to_s(:short)} - #{oc.orders_close_at.to_s(:short)})", oc.id ] } + = f.select(:order_cycle_id_eq, order_cycles_select, :include_blank => @include_blank) %br = label_tag nil, "Report Type: " = select_tag(:report_type, options_for_select(@report_types, @report_type))