Module: Kaui::AccountHelper

Defined in:
app/helpers/kaui/account_helper.rb

Instance Method Summary collapse

Instance Method Details

#account_closed?Boolean

Returns:

  • (Boolean)

15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/kaui/account_helper.rb', line 15

def 
  return false if @account.nil?
  blocking_states = @account.blocking_states('ACCOUNT','account-service','NONE', Kaui.current_tenant_user_options(current_user, session))

   = false
  blocking_states.each do |blocking_state|
    if blocking_state.state_name.eql?('CLOSE_ACCOUNT')
       = true
      break
    end
  end
  
end

#billing_info_marginObject


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/kaui/account_helper.rb', line 29

def billing_info_margin
  style = ''
  unless can?(:trigger, Kaui::Payment) && can?(:credit, Kaui::Account) && can?(:charge, Kaui::Account)
    style = "#{style}margin-top:15px;"
  end

  unless can? :trigger, Kaui::Invoice
    style = "#{style}margin-bottom:15px;"
  end

  style = "style='#{style}'" unless style.empty?
  style
end

#email_notifications_plugin_available?Boolean

Returns:

  • (Boolean)

9
10
11
12
13
# File 'app/helpers/kaui/account_helper.rb', line 9

def email_notifications_plugin_available?
  Kenui::EmailNotificationService.email_notification_plugin_available?(Kaui.current_tenant_user_options(current_user, session)).first
rescue
  return false
end

#pretty_account_identifierObject


4
5
6
7
# File 'app/helpers/kaui/account_helper.rb', line 4

def 
  return nil if @account.nil?
  @account.name.presence || @account.email.presence || truncate_uuid(@account.external_key)
end