Add navigation item for enterprise fee summary

This commit is contained in:
Kristina Lim
2018-11-09 09:30:11 +08:00
committed by luisramos0
parent d3e9a53120
commit edf0b0df76
4 changed files with 41 additions and 3 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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