mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Add 'No Order Cycle' option and cycle dates to dropdown in Orders & Fulfillment Reports
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user