Working on report generation is a time consuming task yet very necessary for any software projects. End of the day every business owner needs to see where their business stands or see ongoing activity in the system. Reports need list of records and Graphs/Charts to show the big-picture at a glance.
If you are using RailsAdmin for managing you web-application from backend, you get reports for your data out of the box. In addition you can edit/update in no time with ease. You will not have charts and graph at that instant though.
How can I get Charts?
If you already have billing/shipping address and payment info of the store in the OAuth provider [eg. some app with Doorkeeper]; and you don’t want to let your users go through the hassle to fill the form all over again, then, you can reuse the data. For this, you need to return the info along with user info from the OAuth provider in the response.
# in /app/models/spree/user_decorator.rb
class << self
spree_user = get_or_set_user(auth_data)
# Extract address info from the payload and update
# can update only shipping or both address with same data
set_shipping_address(spree_user, auth_data) if spree_user.ship_address.nil?
set_billing_address (spree_user, auth_data) if spree_user.bill_address.nil?
# You might also import PaymentSource info from parent app
# Ex: User has already submitted payment info [CreditCard info] and
# and you have Stripe PaymentSource Id, then you can import the data
# along with other info. I recommend you to use HTTPS for this.
set_payment_source(spree_user, auth_data) if spree_user.payment_sources.blank?
# Set user's role; say in parent app the user is Admin, then you
# might want to set that user as an Admin in child app as well.
# See the function definition below
# Need to return the user object
# all the methods assisting '
from_omniauth' will go below here