diff --git a/app/controllers/spree/admin/reports_controller_decorator.rb b/app/controllers/spree/admin/reports_controller_decorator.rb index 657c6b6bb8..ba51b4692e 100644 --- a/app/controllers/spree/admin/reports_controller_decorator.rb +++ b/app/controllers/spree/admin/reports_controller_decorator.rb @@ -40,6 +40,9 @@ Spree::Admin::ReportsController.class_eval do [I18n.t('admin.reports.mailing_list'), :mailing_list], [I18n.t('admin.reports.addresses'), :addresses] ], + enterprise_fee_summary: [ + [I18n.t("admin.reports.enterprise_fee_summary"), :enterprise_fee_summary] + ], order_cycle_management: [ [I18n.t('admin.reports.payment_methods'), :payment_methods], [I18n.t('admin.reports.delivery'), :delivery] @@ -275,6 +278,7 @@ Spree::Admin::ReportsController.class_eval do :products_and_inventory, :sales_total, :users_and_enterprises, + :enterprise_fee_summary, :order_cycle_management, :sales_tax, :xero_invoices, diff --git a/app/models/spree/ability_decorator.rb b/app/models/spree/ability_decorator.rb index 7aa9e697f8..e7ba9df1ef 100644 --- a/app/models/spree/ability_decorator.rb +++ b/app/models/spree/ability_decorator.rb @@ -184,7 +184,7 @@ class AbilityDecorator can [:admin, :index, :guide, :import, :save, :save_data, :validate_data, :reset_absent_products], ProductImport::ProductImporter # Reports page - can [:admin, :index, :customers, :orders_and_distributors, :group_buys, :bulk_coop, :payments, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management, :packing], :report + can [:admin, :index, :customers, :orders_and_distributors, :group_buys, :bulk_coop, :payments, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management, :packing, :enterprise_fee_summary], :report can [:admin, :index], :enterprise_fee_summary_report end @@ -258,7 +258,7 @@ class AbilityDecorator end # Reports page - can [:admin, :index, :customers, :group_buys, :bulk_coop, :sales_tax, :payments, :orders_and_distributors, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management, :xero_invoices], :report + can [:admin, :index, :customers, :group_buys, :bulk_coop, :sales_tax, :payments, :orders_and_distributors, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management, :xero_invoices, :enterprise_fee_summary], :report can [:admin, :index], :enterprise_fee_summary_report can [:create], Customer diff --git a/config/locales/en.yml b/config/locales/en.yml index b309175379..ea17a0515b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1072,7 +1072,9 @@ en: description: Invoices for import into Xero packing: name: Packing Reports - + enterprise_fee_summary: + name: "Enterprise Fee Summary" + description: "Summary of Enterprise Fees collected" subscriptions: subscriptions: Subscriptions new: New Subscription diff --git a/spec/features/admin/reports/enterprise_fee_summary_report_spec.rb b/spec/features/admin/reports/enterprise_fee_summary_report_spec.rb new file mode 100644 index 0000000000..391dcdf4a5 --- /dev/null +++ b/spec/features/admin/reports/enterprise_fee_summary_report_spec.rb @@ -0,0 +1,32 @@ +require "spec_helper" + +feature "enterprise fee summary report" do + include AuthenticationWorkflow + include WebHelper + + let!(:distributor) { create(:distributor_enterprise) } + let!(:other_distributor) { create(:distributor_enterprise) } + + before do + login_as current_user + end + + describe "navigation" do + let(:current_user) { distributor.owner } + + before do + visit spree.admin_reports_path + click_on "Enterprise Fee Summary" + end + + context "when accessing the report as an enterprise user" do + it "allows access to the report" do + expect(page).to have_button(I18n.t("generate_report", scope: i18n_scope)) + end + end + end + + def i18n_scope + "spree.admin.reports.enterprise_fee_summary_report.filters" + end +end