kaui 0.15.5 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -37
- data/app/assets/javascripts/application.js +1 -2
- data/app/assets/javascripts/kaui/kaui.js +87 -0
- data/app/assets/stylesheets/{bootstrap_and_overrides.less → bootstrap_and_overrides.css.less} +6 -6
- data/app/assets/stylesheets/kaui/account.less +20 -0
- data/app/assets/stylesheets/kaui/kaui.less +3 -0
- data/app/assets/stylesheets/kaui/overdue.less +9 -0
- data/app/assets/stylesheets/kaui/payment.less +10 -0
- data/app/controllers/kaui/account_children_controller.rb +50 -0
- data/app/controllers/kaui/account_tags_controller.rb +4 -3
- data/app/controllers/kaui/account_timelines_controller.rb +1 -3
- data/app/controllers/kaui/accounts_controller.rb +160 -17
- data/app/controllers/kaui/admin_allowed_users_controller.rb +11 -5
- data/app/controllers/kaui/admin_controller.rb +16 -3
- data/app/controllers/kaui/admin_tenants_controller.rb +56 -8
- data/app/controllers/kaui/bundle_tags_controller.rb +4 -3
- data/app/controllers/kaui/bundles_controller.rb +12 -6
- data/app/controllers/kaui/charges_controller.rb +4 -1
- data/app/controllers/kaui/credits_controller.rb +1 -0
- data/app/controllers/kaui/engine_controller.rb +8 -11
- data/app/controllers/kaui/engine_controller_util.rb +30 -18
- data/app/controllers/kaui/invoices_controller.rb +19 -8
- data/app/controllers/kaui/payment_methods_controller.rb +20 -1
- data/app/controllers/kaui/payments_controller.rb +15 -9
- data/app/controllers/kaui/queues_controller.rb +8 -1
- data/app/controllers/kaui/refunds_controller.rb +7 -4
- data/app/controllers/kaui/registrations_controller.rb +15 -1
- data/app/controllers/kaui/sessions_controller.rb +2 -1
- data/app/controllers/kaui/subscriptions_controller.rb +27 -5
- data/app/controllers/kaui/tenants_controller.rb +1 -1
- data/app/controllers/kaui/transactions_controller.rb +11 -1
- data/app/helpers/kaui/account_helper.rb +7 -0
- data/app/helpers/kaui/date_helper.rb +30 -2
- data/app/helpers/kaui/locale_helper.rb +20 -0
- data/app/helpers/kaui/locale_helper.yml +581 -0
- data/app/helpers/kaui/payment_helper.rb +12 -0
- data/app/helpers/kaui/subscription_helper.rb +3 -3
- data/app/helpers/kaui/us_states_helper.rb +11 -0
- data/app/helpers/kaui/us_states_helper.yml +103 -0
- data/app/models/kaui/ability.rb +1 -1
- data/app/models/kaui/account.rb +1 -1
- data/app/models/kaui/admin.rb +11 -9
- data/app/models/kaui/allowed_user.rb +3 -4
- data/app/models/kaui/allowed_user_tenant.rb +2 -2
- data/app/models/kaui/application_record.rb +5 -0
- data/app/models/kaui/base.rb +1 -1
- data/app/models/kaui/bundle.rb +2 -2
- data/app/models/kaui/catalog.rb +4 -24
- data/app/models/kaui/chargeback.rb +0 -23
- data/app/models/kaui/credit.rb +0 -4
- data/app/models/kaui/invoice_item.rb +0 -4
- data/app/models/kaui/invoice_payment.rb +16 -21
- data/app/models/kaui/killbill_authenticatable.rb +2 -2
- data/app/models/kaui/overdue.rb +4 -0
- data/app/models/kaui/payment.rb +0 -3
- data/app/models/kaui/refund.rb +0 -5
- data/app/models/kaui/tenant.rb +1 -2
- data/app/models/kaui/user.rb +1 -3
- data/app/views/kaui/account_children/index.html.erb +47 -0
- data/app/views/kaui/accounts/_account_info.html.erb +16 -1
- data/app/views/kaui/accounts/_billing_info.html.erb +18 -9
- data/app/views/kaui/accounts/_form.html.erb +26 -18
- data/app/views/kaui/accounts/_link_parent_modal.html.erb +34 -0
- data/app/views/kaui/accounts/_parent.html.erb +16 -0
- data/app/views/kaui/accounts/_payment_methods.html.erb +3 -1
- data/app/views/kaui/accounts/index.html.erb +17 -2
- data/app/views/kaui/accounts/show.html.erb +6 -0
- data/app/views/kaui/admin/index.html.erb +1 -1
- data/app/views/kaui/admin_allowed_users/_form.html.erb +22 -0
- data/app/views/kaui/admin_tenants/_show_catalog_simple.erb +12 -9
- data/app/views/kaui/admin_tenants/_show_catalog_xml.erb +1 -1
- data/app/views/kaui/admin_tenants/_show_overdue.erb +10 -0
- data/app/views/kaui/admin_tenants/new.html.erb +8 -4
- data/app/views/kaui/admin_tenants/new_catalog.html.erb +16 -4
- data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +25 -5
- data/app/views/kaui/bundles/index.html.erb +3 -0
- data/app/views/kaui/chargebacks/_form.html.erb +1 -1
- data/app/views/kaui/charges/_form.html.erb +11 -0
- data/app/views/kaui/credits/_form.html.erb +2 -2
- data/app/views/kaui/custom_fields/_list_bar.html.erb +12 -0
- data/app/views/kaui/invoice_items/_edit_form.html.erb +1 -1
- data/app/views/kaui/invoices/_invoice_table.html.erb +23 -18
- data/app/views/kaui/invoices/show.html.erb +9 -1
- data/app/views/kaui/layouts/kaui_navbar.html.erb +4 -1
- data/app/views/kaui/payment_methods/_form.html.erb +6 -0
- data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +3 -1
- data/app/views/kaui/payment_methods/_plugin_properties.html.erb +77 -0
- data/app/views/kaui/payments/_form.html.erb +1 -1
- data/app/views/kaui/payments/_payment_table.html.erb +24 -15
- data/app/views/kaui/payments/show.html.erb +4 -1
- data/app/views/kaui/queues/index.html.erb +4 -4
- data/app/views/kaui/refunds/_form.html.erb +3 -2
- data/app/views/kaui/subscriptions/_edit_form.html.erb +3 -3
- data/app/views/kaui/subscriptions/_form.html.erb +3 -0
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +1 -1
- data/app/views/kaui/transactions/_control_plugin_names.html.erb +66 -0
- data/app/views/kaui/transactions/_form.html.erb +7 -1
- data/config/initializers/asset.rb +1 -0
- data/config/initializers/devise.rb +13 -7
- data/config/initializers/killbill_authenticatable.rb +1 -1
- data/config/locales/devise.en.yml +1 -1
- data/config/routes.rb +19 -1
- data/config/symmetric-encryption.yml +1 -1
- data/db/ddl.sql +40 -40
- data/db/migrate/20130812155313_devise_create_kaui_users.rb +12 -0
- data/db/migrate/20150109214021_create_kaui_tenants.rb +12 -0
- data/db/migrate/20150112232813_create_kaui_allowed_users.rb +19 -0
- data/lib/core_ext.rb +191 -0
- data/lib/kaui.rb +68 -5
- data/lib/kaui/engine.rb +11 -4
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/app/controllers/application_controller.rb +1 -1
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +38 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +6 -53
- data/test/dummy/config/boot.rb +2 -9
- data/test/dummy/config/database.yml +15 -17
- data/test/dummy/config/environment.rb +4 -4
- data/test/dummy/config/environments/development.rb +42 -16
- data/test/dummy/config/environments/production.rb +62 -40
- data/test/dummy/config/environments/test.rb +26 -15
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +6 -5
- data/test/dummy/config/initializers/killbill_client.rb +1 -1
- data/test/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/new_framework_defaults_5_1.rb +14 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/test/dummy/config/locales/en.yml +30 -2
- data/test/dummy/config/secrets.yml +32 -0
- data/test/dummy/config/symmetric-encryption.yml +1 -1
- data/test/dummy/db/schema.rb +1 -1
- data/{app/assets/images/kaui/.gitkeep → test/dummy/log/test.log} +0 -0
- data/test/functional/kaui/account_children_controller_test.rb +32 -0
- data/test/functional/kaui/account_tags_controller_test.rb +3 -3
- data/test/functional/kaui/accounts_controller_test.rb +127 -12
- data/test/functional/kaui/admin_allowed_users_controller_test.rb +151 -1
- data/test/functional/kaui/admin_controller_test.rb +45 -0
- data/test/functional/kaui/admin_tenants_controller_test.rb +127 -0
- data/test/functional/kaui/bundle_tags_controller_test.rb +3 -3
- data/test/functional/kaui/bundles_controller_test.rb +27 -0
- data/test/functional/kaui/chargebacks_controller_test.rb +1 -1
- data/test/functional/kaui/custom_fields_controller_test.rb +10 -3
- data/test/functional/kaui/functional_test_helper.rb +1 -1
- data/test/functional/kaui/functional_test_helper_nosetup.rb +66 -1
- data/test/functional/kaui/home_controller_test.rb +9 -0
- data/test/functional/kaui/invoices_controller_test.rb +8 -0
- data/test/functional/kaui/login_proxy_controller_test.rb +12 -0
- data/test/functional/kaui/payment_methods_controller_test.rb +23 -0
- data/test/functional/kaui/payments_controller_test.rb +15 -1
- data/test/functional/kaui/queues_controller_test.rb +17 -0
- data/test/functional/kaui/registrations_controller_test.rb +49 -0
- data/test/functional/kaui/role_definitions_controller_test.rb +47 -0
- data/test/functional/kaui/subscriptions_controller_test.rb +39 -0
- data/test/functional/kaui/tenants_controller_test.rb +6 -0
- data/test/functional/kaui/transactions_controller_test.rb +36 -3
- data/test/integration/kaui/date_helper_integration_test.rb +16 -0
- data/test/integration/kaui/navigation_test.rb +11 -5
- data/test/killbill_test_helper.rb +24 -3
- data/test/test_helper.rb +3 -0
- data/test/unit/kaui/account_email_test.rb +3 -3
- data/test/unit/kaui/date_helper_test.rb +14 -2
- data/test/unit/kaui/money_helper_test.rb +1 -1
- metadata +327 -147
- data/.gitignore +0 -18
- data/.travis.yml +0 -37
- data/Gemfile +0 -6
- data/bin/kaui +0 -4
- data/kaui.gemspec +0 -65
- data/script/rails +0 -8
- data/script/sandbox +0 -30
- data/test/dummy/.gitignore +0 -1
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
data/app/models/kaui/overdue.rb
CHANGED
@@ -30,6 +30,8 @@ class Kaui::Overdue < KillBillClient::Model::Overdue
|
|
30
30
|
state.condition.time_since_earliest_unpaid_invoice_equals_or_exceeds.unit = "DAYS"
|
31
31
|
state.condition.time_since_earliest_unpaid_invoice_equals_or_exceeds.number = state_model["condition"]["time_since_earliest_unpaid_invoice_equals_or_exceeds"]
|
32
32
|
end
|
33
|
+
state.condition.number_of_unpaid_invoices_equals_or_exceeds = state_model["condition"]["number_of_unpaid_invoices_equals_or_exceeds"]
|
34
|
+
state.condition.total_unpaid_invoice_balance_equals_or_exceeds = state_model["condition"]["total_unpaid_invoice_balance_equals_or_exceeds"]
|
33
35
|
state.condition.control_tag_inclusion = format_tag_condition(state_model["condition"]["control_tag_inclusion"])
|
34
36
|
state.condition.control_tag_exclusion = format_tag_condition(state_model["condition"]["control_tag_exclusion"])
|
35
37
|
end
|
@@ -63,6 +65,8 @@ class Kaui::Overdue < KillBillClient::Model::Overdue
|
|
63
65
|
state.condition.time_since_earliest_unpaid_invoice_equals_or_exceeds = KillBillClient::Model::DurationAttributes.new
|
64
66
|
state.condition.time_since_earliest_unpaid_invoice_equals_or_exceeds.unit = "DAYS"
|
65
67
|
state.condition.time_since_earliest_unpaid_invoice_equals_or_exceeds.number = 0
|
68
|
+
state.condition.number_of_unpaid_invoices_equals_or_exceeds = 0
|
69
|
+
state.condition.total_unpaid_invoice_balance_equals_or_exceeds = 0
|
66
70
|
state.condition.control_tag_inclusion = :NONE
|
67
71
|
state.condition.control_tag_exclusion = :NONE
|
68
72
|
end
|
data/app/models/kaui/payment.rb
CHANGED
@@ -6,9 +6,6 @@ class Kaui::Payment < KillBillClient::Model::Payment
|
|
6
6
|
|
7
7
|
TRANSACTION_STATUSES = %w(SUCCESS PENDING PAYMENT_FAILURE PLUGIN_FAILURE UNKNOWN)
|
8
8
|
|
9
|
-
SAMPLE_REASON_CODES = ['600 - Alt payment method',
|
10
|
-
'699 - OTHER']
|
11
|
-
|
12
9
|
def self.build_from_raw_payment(raw_payment)
|
13
10
|
result = Kaui::Payment.new
|
14
11
|
KillBillClient::Model::PaymentAttributes.instance_variable_get('@json_attributes').each do |attr|
|
data/app/models/kaui/refund.rb
CHANGED
data/app/models/kaui/tenant.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'symmetric-encryption'
|
2
2
|
|
3
3
|
module Kaui
|
4
|
-
class Tenant <
|
4
|
+
class Tenant < ApplicationRecord
|
5
5
|
|
6
|
-
attr_accessible :name, :api_key, :api_secret, :kb_tenant_id
|
7
6
|
attr_encrypted :api_secret
|
8
7
|
|
9
8
|
has_many :kaui_allowed_user_tenants, :class_name => 'Kaui::AllowedUserTenant', :foreign_key => 'kaui_tenant_id'
|
data/app/models/kaui/user.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'killbill_client'
|
2
2
|
|
3
3
|
module Kaui
|
4
|
-
class User <
|
4
|
+
class User < ApplicationRecord
|
5
5
|
devise :killbill_authenticatable, :killbill_registerable
|
6
6
|
|
7
7
|
# Managed by Devise
|
8
8
|
attr_accessor :password
|
9
9
|
|
10
|
-
attr_accessible :kb_username, :kb_session_id, :password
|
11
|
-
|
12
10
|
# Called by Devise to perform authentication
|
13
11
|
# Throws KillBillClient::API::Unauthorized on failure
|
14
12
|
def self.find_permissions(kb_username, kb_password)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class="search">
|
2
|
+
|
3
|
+
<div class="column-block">
|
4
|
+
|
5
|
+
<h1>Showing children results</h1>
|
6
|
+
|
7
|
+
<table id="account-children-table" class="table table-condensed mobile-data">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>Name</th>
|
11
|
+
<th>ID</th>
|
12
|
+
<th>External key</th>
|
13
|
+
<th>Balance</th>
|
14
|
+
<th>City</th>
|
15
|
+
<th>Country</th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<tr>
|
20
|
+
<td colspan="1" class="dataTables_empty">Loading data from server</td>
|
21
|
+
</tr>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
</div>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<%= javascript_tag do %>
|
30
|
+
$(document).ready(function() {
|
31
|
+
$('#account-children-table').DataTable({
|
32
|
+
"dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
|
33
|
+
"paging": false,
|
34
|
+
"language": {
|
35
|
+
"info": "Showing _START_ to _END_ of TOTAL entries"
|
36
|
+
},
|
37
|
+
"processing": true,
|
38
|
+
"serverSide": true,
|
39
|
+
"search": {"search": "<%= @account.account_id %>"},
|
40
|
+
"ajax": "<%= account_children_pagination_path(:format => :json) %>",
|
41
|
+
"infoCallback": function( settings, start, end, max, total, pre ) {
|
42
|
+
|
43
|
+
return pre.replace('TOTAL',settings.json.data.length);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
});
|
47
|
+
<% end %>
|
@@ -8,13 +8,24 @@
|
|
8
8
|
kaui_engine.edit_account_path(@account.account_id),
|
9
9
|
:class => 'btn btn-xs' %>
|
10
10
|
<% end %>
|
11
|
+
<% if @children.size > 0 %>
|
12
|
+
<%= link_to "Children (#{@children.size})",
|
13
|
+
kaui_engine.account_children_path(@account.account_id),
|
14
|
+
:class => 'btn btn-xs' %>
|
15
|
+
<% end %>
|
16
|
+
<% unless @account.parent_account_id.nil? %>
|
17
|
+
<span class="label label-info account-child-label">Child</span>
|
18
|
+
<% end %>
|
19
|
+
<% if @children.size > 0 %>
|
20
|
+
<span class="label label-info account-child-label">Parent</span>
|
21
|
+
<% end %>
|
11
22
|
</h1>
|
12
23
|
|
13
24
|
<% unless @tags.find { |tag| tag.tag_definition_name == '__PARK__' }.nil? %>
|
14
25
|
<div class="alert alert-danger">
|
15
26
|
This account is parked, meaning the system detected inconsistent state which could lead to mis-billing. For safety, no more invoices will be generated.
|
16
27
|
<% if can? :trigger, Kaui::Invoice %>
|
17
|
-
Once the data is fixed, you can unpark it by manually <%= link_to 'triggering an invoice run', kaui_engine.trigger_invoice_path(params), :method => :post %>.
|
28
|
+
Once the data is fixed, you can unpark it by manually <%= link_to 'triggering an invoice run', kaui_engine.trigger_invoice_path(params.to_h), :method => :post %>.
|
18
29
|
<% end %>
|
19
30
|
</div>
|
20
31
|
<% end %>
|
@@ -35,6 +46,8 @@
|
|
35
46
|
</div>
|
36
47
|
</div>
|
37
48
|
|
49
|
+
<%= render :partial => 'kaui/custom_fields/list_bar',
|
50
|
+
:locals => {:custom_fields => @custom_fields} %>
|
38
51
|
</div>
|
39
52
|
|
40
53
|
<div class="row">
|
@@ -73,6 +86,8 @@
|
|
73
86
|
<td>N/A</td>
|
74
87
|
<% end %>
|
75
88
|
</tr>
|
89
|
+
<%= render :partial => 'parent',
|
90
|
+
:locals => {:account_parent => @account_parent} %>
|
76
91
|
</table>
|
77
92
|
</div>
|
78
93
|
</div>
|
@@ -86,19 +86,28 @@
|
|
86
86
|
<td><span class='label' id='next-invoice-date'>N/A</span></td>
|
87
87
|
</tr>
|
88
88
|
<% end %>
|
89
|
-
|
90
|
-
<
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
89
|
+
<% if email_notifications_plugin_available? %>
|
90
|
+
<tr>
|
91
|
+
<th>
|
92
|
+
Email Notifications
|
93
|
+
<%= link_to('<i class="fa fa-cog" aria-hidden="true"></i>'.html_safe,
|
94
|
+
'#configureEmailNotification',
|
95
|
+
data: { name: @account.name, account_id: @account.account_id,
|
96
|
+
events: @email_notification_configuration.map { |event| event[:eventType] }.join(', '),
|
97
|
+
toggle: 'modal', target: '#configureEmailNotification'}) %>
|
98
|
+
</th>
|
99
|
+
<td>
|
100
|
+
<% @email_notification_configuration.each do |configuration|%>
|
101
|
+
- <%= configuration[:eventType] %><br/>
|
102
|
+
<% end %>
|
103
|
+
</td>
|
104
|
+
</tr>
|
105
|
+
<% end %>
|
97
106
|
</table>
|
98
107
|
|
99
108
|
<% if can? :trigger, Kaui::Invoice %>
|
100
109
|
<div style="padding-bottom: 50px;">
|
101
|
-
<%= form_tag kaui_engine.trigger_invoice_path(params), :method => :post do %>
|
110
|
+
<%= form_tag kaui_engine.trigger_invoice_path(params.to_h), :method => :post do %>
|
102
111
|
<div class="form-group">
|
103
112
|
<%= label_tag :target_date, 'Trigger invoice generation', :class => 'col-sm-6 control-label', :style => 'padding-left: 0;' %>
|
104
113
|
<div class="col-sm-3">
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<% # Unclear why this url/method hack is needed %>
|
2
2
|
<%= form_for @account, :url => @account.persisted? ? account_path(@account.account_id) : accounts_path, :method => @account.persisted? ? :put : :post, :html => {:class => 'form-horizontal'} do |f| %>
|
3
|
+
<%= f.hidden_field :payment_method_id %>
|
4
|
+
|
3
5
|
<div class="form-group">
|
4
6
|
<%= f.label :name, 'Name', :class => 'col-sm-3 control-label' %>
|
5
7
|
<div class="col-sm-9">
|
@@ -7,9 +9,17 @@
|
|
7
9
|
</div>
|
8
10
|
</div>
|
9
11
|
<div class="form-group">
|
10
|
-
<%= f.label :first_name_length,
|
12
|
+
<%= f.label :first_name_length, :class => 'col-sm-3 control-label' do %>
|
13
|
+
First name length
|
14
|
+
<%= link_to('https://www.w3.org/International/questions/qa-personal-names',target: '_blank', rel: 'nofollow') do %>
|
15
|
+
<i class="fa fa-question-circle-o" aria-hidden="true"></i>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
11
18
|
<div class="col-sm-9">
|
12
|
-
<%= f.text_field :first_name_length,
|
19
|
+
<%= f.text_field :first_name_length,
|
20
|
+
:pattern => '^[0-9]*$',
|
21
|
+
:title => 'Format: Can only contain digits; Description: Identify where the first name ends and last name starts.',
|
22
|
+
:class => 'form-control' %>
|
13
23
|
</div>
|
14
24
|
</div>
|
15
25
|
<% unless @account.persisted? %>
|
@@ -17,6 +27,9 @@
|
|
17
27
|
<%= f.label :external_key, 'External key', :class => 'col-sm-3 control-label' %>
|
18
28
|
<div class="col-sm-9">
|
19
29
|
<%= f.text_field :external_key, :class => 'form-control' %>
|
30
|
+
<div class="account_external_key_invalid_msg text-danger">
|
31
|
+
Warning! External key already in use.
|
32
|
+
</div>
|
20
33
|
</div>
|
21
34
|
</div>
|
22
35
|
<% else %>
|
@@ -44,7 +57,7 @@
|
|
44
57
|
<div class="form-group">
|
45
58
|
<%= f.label :time_zone, 'Timezone', :class => 'col-sm-3 control-label' %>
|
46
59
|
<div class="col-sm-9">
|
47
|
-
<%= f.
|
60
|
+
<%= f.select :time_zone, ActiveSupport::TimeZone.all.collect { |tz| [tz.to_s, tz.tzinfo.name] }, {:selected => 'Etc/UTC'}, :class => 'form-control' %>
|
48
61
|
</div>
|
49
62
|
</div>
|
50
63
|
<% else %>
|
@@ -53,10 +66,10 @@
|
|
53
66
|
<%= f.hidden_field :time_zone %>
|
54
67
|
<% end %>
|
55
68
|
<div class="form-group">
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
69
|
+
<%= f.label :locale, 'Locale', :class => 'col-sm-3 control-label' %>
|
70
|
+
<div class="col-sm-9">
|
71
|
+
<%= f.select :locale, get_available_locales, {:selected => (@account.locale || 'en_US'), :disabled => '---------------'}, :class => 'form-control' %>
|
72
|
+
</div>
|
60
73
|
</div>
|
61
74
|
<div class="form-group">
|
62
75
|
<%= f.label :address1, 'Address line 1', :class => 'col-sm-3 control-label' %>
|
@@ -91,13 +104,14 @@
|
|
91
104
|
<div class="form-group">
|
92
105
|
<%= f.label :state, 'State', :class => 'col-sm-3 control-label' %>
|
93
106
|
<div class="col-sm-9">
|
94
|
-
<%= f.
|
107
|
+
<%= f.select :state, get_U_S_states, {:include_blank => '', :selected => @account.state}, :class => 'form-control select-state' %>
|
108
|
+
<%= f.text_field :state, :class => 'form-control text-state', :style => 'display: none;' %>
|
95
109
|
</div>
|
96
110
|
</div>
|
97
111
|
<div class="form-group">
|
98
112
|
<%= f.label :country, 'Country', :class => 'col-sm-3 control-label' %>
|
99
113
|
<div class="col-sm-9">
|
100
|
-
<%= f.country_select :country, {:
|
114
|
+
<%= f.country_select :country, {:priority_countries => %w(US CA), :selected => @account.country}, :class => 'form-control' %>
|
101
115
|
</div>
|
102
116
|
</div>
|
103
117
|
<div class="form-group">
|
@@ -125,15 +139,9 @@
|
|
125
139
|
<% else %>
|
126
140
|
<%= f.hidden_field :is_migrated %>
|
127
141
|
<% end %>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
<%= f.label :is_notified_for_invoices do %>
|
132
|
-
<%= f.check_box :is_notified_for_invoices, {:checked => @account.is_notified_for_invoices} %>Notified for invoices?
|
133
|
-
<% end %>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
</div>
|
142
|
+
<%= f.hidden_field :is_notified_for_invoices %>
|
143
|
+
<%= f.hidden_field :is_payment_delegated_to_parent %>
|
144
|
+
<%= f.hidden_field :parent_account_id %>
|
137
145
|
<div class="form-group">
|
138
146
|
<div class="col-sm-offset-3 col-sm-9">
|
139
147
|
<%= submit_tag 'Save', :class => 'btn btn-default' %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div class="modal fade" id="link_account" tabindex="-1" role="dialog">
|
2
|
+
<div class="modal-dialog" role="document">
|
3
|
+
<div class="modal-content column-block">
|
4
|
+
<div>
|
5
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
6
|
+
<h1 class="modal-title">Link to parent</h1>
|
7
|
+
</div>
|
8
|
+
<div class="modal-body">
|
9
|
+
<%= form_for @account, :url => link_to_parent_path(@account.account_id), :method => :put, :html => {:class => 'form-horizontal'} do |f| %>
|
10
|
+
<div class='form-group'>
|
11
|
+
<%= f.label :parent_account_id, 'Parent account id', :class => 'col-sm-4 control-label' %>
|
12
|
+
<div class="col-sm-8">
|
13
|
+
<%= f.text_field :parent_account_id, :class => 'form-control', :required => true %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="form-group">
|
17
|
+
<div class="col-sm-offset-4 col-sm-8">
|
18
|
+
<div class="checkbox">
|
19
|
+
<%= f.label :is_payment_delegated_to_parent do %>
|
20
|
+
<%= f.check_box :is_payment_delegated_to_parent, {:checked => @account.is_payment_delegated_to_parent} %>Is payment delegated to parent?
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<div class="form-group">
|
26
|
+
<div class="col-sm-offset-4 col-sm-10">
|
27
|
+
<%= submit_tag 'Save', :class => 'btn btn-default' %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div><!-- /.modal-content -->
|
33
|
+
</div><!-- /.modal-dialog -->
|
34
|
+
</div><!-- /.modal -->
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<tr>
|
2
|
+
<th>Parent</th>
|
3
|
+
<td>
|
4
|
+
<% if account_parent.present? %>
|
5
|
+
<%= link_to account_parent.name, kaui_engine.account_path(@account.parent_account_id) %>
|
6
|
+
<% if can? :update, Kaui::Account %>
|
7
|
+
<%= link_to ' <i class="fa fa-times"></i>'.html_safe, kaui_engine.unlink_to_parent_path(@account.account_id), :method => :delete %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% unless account_parent.present? %>
|
11
|
+
<% if can? :update, Kaui::Account %>
|
12
|
+
<button type="button" class="naked" data-toggle="modal" data-target="#link_account"> <i class="fa fa-plus"></i></button>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
</td>
|
16
|
+
</tr>
|
@@ -13,7 +13,9 @@
|
|
13
13
|
<% unless @payment_methods.empty? %>
|
14
14
|
<div class="info-wrapper">
|
15
15
|
|
16
|
-
<%= render :partial => 'kaui/payment_methods/payment_methods_table', :locals => {:account => @account,
|
16
|
+
<%= render :partial => 'kaui/payment_methods/payment_methods_table', :locals => {:account => @account,
|
17
|
+
:payment_methods => @payment_methods,
|
18
|
+
:last_transaction_by_payment_method_id => @last_transaction_by_payment_method_id} %>
|
17
19
|
|
18
20
|
</div>
|
19
21
|
<% end %>
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<table id="accounts-table" class="table table-condensed mobile-data">
|
12
12
|
<thead>
|
13
13
|
<tr>
|
14
|
+
<th></th>
|
14
15
|
<th>Name</th>
|
15
16
|
<th>ID</th>
|
16
17
|
<th>External key</th>
|
@@ -42,12 +43,26 @@ $(document).ready(function() {
|
|
42
43
|
"pageLength": <%= @limit %>,
|
43
44
|
"displayStart": <%= @offset %>,
|
44
45
|
<% unless @ordering.blank? %>
|
45
|
-
"order": [[
|
46
|
+
"order": [[ 1, "<%= @ordering %>" ]],
|
46
47
|
<% end %>
|
47
48
|
"processing": true,
|
48
49
|
"serverSide": true,
|
49
50
|
"search": {"search": "<%= @search_query %>"},
|
50
|
-
"ajax": "<%= accounts_pagination_path(:ordering => @ordering, :format => :json) %>"
|
51
|
+
"ajax": "<%= accounts_pagination_path(:ordering => @ordering, :format => :json) %>",
|
52
|
+
"rowCallback": function( row, data, index ) {
|
53
|
+
if ( data[0] == 1 ) {
|
54
|
+
$('td:eq(0)', row).html( '<span class="label label-info account-child-label">Child</span>' );
|
55
|
+
}else{
|
56
|
+
$('td:eq(0)', row).html('')
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"columnDefs": [
|
60
|
+
{ "orderable": false, "targets": 0, "createdCell": function (td, cellData, rowData, row, col) {
|
61
|
+
$(td).css('padding-left', '20px');
|
62
|
+
$(td).css('width', '60px');
|
63
|
+
|
64
|
+
} }
|
65
|
+
]
|
51
66
|
});
|
52
67
|
|
53
68
|
<!-- When we don't know the total number of pages, we need to hide the legend and next button manually -->
|
@@ -4,6 +4,12 @@
|
|
4
4
|
|
5
5
|
<%= render :partial => 'payment_methods' %>
|
6
6
|
|
7
|
+
<%= render :partial => 'link_parent_modal' %>
|
8
|
+
|
9
|
+
<% if email_notifications_plugin_available? %>
|
10
|
+
<%= render :partial => 'kenui/email_notifications/configure_events_modal' %>
|
11
|
+
<% end %>
|
12
|
+
|
7
13
|
<%= javascript_tag do %>
|
8
14
|
function disableLinks() {
|
9
15
|
$('a.btn.disabled').click(function (e) {
|
@@ -7,7 +7,7 @@
|
|
7
7
|
</ul>
|
8
8
|
|
9
9
|
<div>
|
10
|
-
<%= form_tag kaui_engine.admin_set_clock_path(params), :method => :put, :class => 'form-horizontal' do %>
|
10
|
+
<%= form_tag kaui_engine.admin_set_clock_path(params.to_h), :method => :put, :class => 'form-horizontal' do %>
|
11
11
|
<div class="form-group">
|
12
12
|
<%= label_tag :new_date, 'Set new date', :class => 'col-sm-2 control-label' %>
|
13
13
|
<div class="col-sm-2">
|
@@ -1,5 +1,14 @@
|
|
1
1
|
<% # Unclear why this url/method hack is needed %>
|
2
2
|
<%= form_for @allowed_user, :url => @allowed_user.persisted? ? admin_allowed_user_path(@allowed_user.id) : admin_allowed_users_path, :method => @allowed_user.persisted? ? :put : :post, :html => {:class => 'form-horizontal'} do |f| %>
|
3
|
+
<div class='form-group'>
|
4
|
+
<div class="col-sm-offset-2 col-sm-9">
|
5
|
+
<div class="checkbox">
|
6
|
+
<%= label_tag :external do %>
|
7
|
+
<%= check_box_tag :external %>Managed externally (LDAP, Okta, etc.)?
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
</div>
|
3
12
|
<div class="form-group">
|
4
13
|
<%= f.label :kb_username, 'Name', :class => 'col-sm-2 control-label' %>
|
5
14
|
<div class="col-sm-10">
|
@@ -32,3 +41,16 @@
|
|
32
41
|
</div>
|
33
42
|
</div>
|
34
43
|
<% end %>
|
44
|
+
|
45
|
+
<%= javascript_tag do %>
|
46
|
+
$('#external').change(function() {
|
47
|
+
if ($('#external').is(":checked")) {
|
48
|
+
$('#password').attr('disabled', true);
|
49
|
+
$('#roles').attr('disabled', true);
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
$('#password').attr('disabled', false);
|
53
|
+
$('#roles').attr('disabled', false);
|
54
|
+
}
|
55
|
+
});
|
56
|
+
<% end %>
|