Class: Kaui::AccountTimelinesController
- Inherits:
-
EngineController
- Object
- ApplicationController
- EngineController
- Kaui::AccountTimelinesController
- Defined in:
- app/controllers/kaui/account_timelines_controller.rb
Constant Summary
Constants included from EngineControllerUtil
EngineControllerUtil::SIMPLE_PAGINATION_THRESHOLD
Instance Method Summary collapse
Methods inherited from EngineController
#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #populate_account_details, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user
Instance Method Details
#show ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/kaui/account_timelines_controller.rb', line 3 def show timeline = Kaui::AccountTimeline.find_by_account_id(params.require(:account_id), 'FULL', ) @account = timeline.account @bundles = timeline.bundles @invoices = timeline.invoices @payments = timeline.payments extract_invoices_by_id(@invoices) # Lookup all bundle names @bundle_names = {} @bundle_names_by_invoice_id = {} @bundle_keys_by_invoice_id = {} @bundles.each do |bundle| load_bundle_name_for_timeline(bundle.external_key) end @invoices.each do |invoice| @bundle_names_by_invoice_id[invoice.invoice_id] = Set.new @bundle_keys_by_invoice_id[invoice.invoice_id] = Set.new (invoice.bundle_keys || '').split(',').each do |bundle_key| load_bundle_name_for_timeline(bundle_key) @bundle_names_by_invoice_id[invoice.invoice_id] << @bundle_names[bundle_key] @bundle_keys_by_invoice_id[invoice.invoice_id] << bundle_key end end @selected_bundle = params.has_key?(:external_key) ? @bundle_names[params[:external_key]] : nil end |