diff --git a/app/controllers/spree/users_controller.rb b/app/controllers/spree/users_controller.rb index 1fb03af1f9..5be52a0910 100644 --- a/app/controllers/spree/users_controller.rb +++ b/app/controllers/spree/users_controller.rb @@ -15,6 +15,11 @@ module Spree # Ignores invoice orders, only order where state: 'complete' def show @orders = @user.orders.where(state: 'complete').order('completed_at desc') + + customers = spree_current_user.customers + @shops = Enterprise + .where(id: @orders.pluck(:distributor_id).uniq | customers.pluck(:enterprise_id)) + @unconfirmed_email = spree_current_user.unconfirmed_email end diff --git a/app/views/spree/users/show.html.haml b/app/views/spree/users/show.html.haml index bddce94ce9..ec81685156 100644 --- a/app/views/spree/users/show.html.haml +++ b/app/views/spree/users/show.html.haml @@ -1,7 +1,8 @@ - content_for :injection_data do - = inject_orders - = inject_shops + = inject_json_array("orders", @orders.all, Api::OrderSerializer) + = inject_json_array("shops", @shops.all, Api::ShopForOrdersSerializer) = inject_saved_credit_cards + - if Stripe.publishable_key :javascript angular.module('Darkswarm').value("stripeObject", Stripe("#{Stripe.publishable_key}"))