Working version of Customers reports without filters

This commit is contained in:
Will Marshall
2013-11-22 16:53:57 +11:00
parent fbe0e2cc29
commit 27f99d1383
5 changed files with 35 additions and 10 deletions

View File

@@ -18,6 +18,8 @@ Spree::Admin::ReportsController.class_eval do
render_to_string(partial: 'orders_and_fulfillment_description', layout: false, locals: {report_types: REPORT_TYPES[:orders_and_fulfillment]}).html_safe
@reports[:products_and_inventory][:description] =
render_to_string(partial: 'products_and_inventory_description', layout: false, locals: {report_types: REPORT_TYPES[:products_and_inventory]}).html_safe
@reports[:customers][:description] =
render_to_string(partial: 'customers_description', layout: false, locals: {report_types: REPORT_TYPES[:customers]}).html_safe
} } }
# OVERRIDING THIS so we use a method not a constant for available reports

View File

@@ -0,0 +1,4 @@
%ul{style: "margin-left: 12pt"}
- report_types.each do |report_type|
%li
= link_to report_type[0], "#{customers_admin_reports_url}?report_type=#{report_type[1]}"

View File

@@ -6,3 +6,16 @@
%br
%br
%table#listing_customers.index
%thead
%tr{'data-hook' => "orders_header"}
- @report.header.each do |heading|
%th=heading
%tbody
- @report.table.each do |row|
%tr
- row.each do |column|
%td= column
- if @report.table.empty?
%tr
%td{:colspan => "2"}= t(:none)

View File

@@ -23,15 +23,15 @@ module OpenFoodNetwork
order.billing_address.city]
else
ba = order.billing_address
da = order.distributor.address
da = order.distributor.andand.address
[ba.firstname,
ba.lastname,
[ba.address1, ba.address2, ba.city].join(" "),
order.email,
ba.phone,
order.distributor.name,
[da.address1, da.address2, da.city].join(" "),
order.shipping_method.name
order.distributor.andand.name,
[da.andand.address1, da.andand.address2, da.andand.city].join(" "),
order.shipping_method.andand.name
]
end
end

View File

@@ -29,12 +29,18 @@ feature %q{
end
end
scenario "customers report" do
login_to_admin_section
click_link "Reports"
click_link "Customers"
page.should have_content "Customers"
page.should have_content "Mailing List"
describe "Customers report" do
before do
login_to_admin_section
click_link "Reports"
end
scenario "customers report" do
click_link "Mailing List"
end
scenario "customers report" do
click_link "Addresses"
end
end
scenario "orders and distributors report" do