mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Show a list of Order Cycles report types in the description column
This commit is contained in:
@@ -7,11 +7,26 @@ require 'open_food_web/model_class_from_controller_name'
|
||||
Spree::Admin::ReportsController.class_eval do
|
||||
include OpenFoodWeb::ModelClassFromControllerName
|
||||
|
||||
# Render a partial for orders and fulfillment description
|
||||
respond_override :index => { :html => { :success => lambda {
|
||||
@reports[:order_cycles][:description] =
|
||||
render_to_string(partial: 'orders_and_fulfillment_description', layout: false, locals: {report_types: REPORT_TYPES[:order_cycles]}).html_safe
|
||||
} } }
|
||||
|
||||
Spree::Admin::ReportsController::AVAILABLE_REPORTS.merge!({:orders_and_distributors => {:name => "Orders And Distributors", :description => "Orders with distributor details"}})
|
||||
Spree::Admin::ReportsController::AVAILABLE_REPORTS.merge!({:group_buys => {:name => "Group Buys", :description => "Orders by supplier and variant"}})
|
||||
Spree::Admin::ReportsController::AVAILABLE_REPORTS.merge!({:bulk_coop => {:name => "Bulk Co-Op", :description => "Reports for Bulk Co-Op orders"}})
|
||||
Spree::Admin::ReportsController::AVAILABLE_REPORTS.merge!({:payments => {:name => "Payment Reports", :description => "Reports for Payments"}})
|
||||
Spree::Admin::ReportsController::AVAILABLE_REPORTS.merge!({:order_cycles => {:name => "Order Cycle Reports", :description => "Reports for Order Cycles"}})
|
||||
Spree::Admin::ReportsController::AVAILABLE_REPORTS.merge!({:order_cycles => {:name => "Order Cycle Reports", :description => ''}})
|
||||
|
||||
REPORT_TYPES = {
|
||||
order_cycles: [
|
||||
['Order Cycle Supplier Totals',:order_cycle_supplier_totals],
|
||||
['Order Cycle Supplier Totals by Distributor',:order_cycle_supplier_totals_by_distributor],
|
||||
['Order Cycle Distributor Totals by Supplier',:order_cycle_distributor_totals_by_supplier],
|
||||
['Order Cycle Customer Totals',:order_cycle_customer_totals]
|
||||
]
|
||||
}
|
||||
|
||||
def orders_and_distributors
|
||||
params[:q] = {} unless params[:q]
|
||||
@@ -355,6 +370,7 @@ Spree::Admin::ReportsController.class_eval do
|
||||
@distributors = Enterprise.is_distributor.managed_by(spree_current_user)
|
||||
#@suppliers = Enterprise.is_primary_producer
|
||||
@order_cycles = OrderCycle.active_or_complete.order('orders_close_at DESC')
|
||||
@report_types = REPORT_TYPES[:order_cycles]
|
||||
@report_type = params[:report_type]
|
||||
|
||||
case params[:report_type]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
%ul{style: "margin-left: 12pt"}
|
||||
- report_types.each do |report_type|
|
||||
%li
|
||||
= link_to report_type[0], "#{order_cycles_admin_reports_url}?report_type=#{report_type[1]}"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
= f.collection_select(:order_cycle_id_eq, @order_cycles, :id, :name, :include_blank => @include_blank)
|
||||
%br
|
||||
= label_tag nil, "Report Type: "
|
||||
= select_tag(:report_type, options_for_select([['Order Cycle Supplier Totals',:order_cycle_supplier_totals], ['Order Cycle Supplier Totals by Distributor',:order_cycle_supplier_totals_by_distributor], ['Order Cycle Distributor Totals by Supplier',:order_cycle_distributor_totals_by_supplier], ['Order Cycle Customer Totals',:order_cycle_customer_totals]], @report_type))
|
||||
= select_tag(:report_type, options_for_select(@report_types, @report_type))
|
||||
%br
|
||||
%br
|
||||
= check_box_tag :csv
|
||||
|
||||
Reference in New Issue
Block a user