kaui 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +51 -37
  4. data/README.md +5 -0
  5. data/Rakefile +1 -1
  6. data/app/controllers/kaui/account_emails_controller.rb +26 -44
  7. data/app/controllers/kaui/account_tags_controller.rb +26 -38
  8. data/app/controllers/kaui/account_timelines_controller.rb +47 -50
  9. data/app/controllers/kaui/accounts_controller.rb +68 -148
  10. data/app/controllers/kaui/bundle_tags_controller.rb +32 -21
  11. data/app/controllers/kaui/bundles_controller.rb +44 -69
  12. data/app/controllers/kaui/chargebacks_controller.rb +31 -61
  13. data/app/controllers/kaui/charges_controller.rb +19 -21
  14. data/app/controllers/kaui/credits_controller.rb +22 -36
  15. data/app/controllers/kaui/custom_fields_controller.rb +15 -13
  16. data/app/controllers/kaui/engine_controller.rb +8 -10
  17. data/app/controllers/kaui/invoice_items_controller.rb +24 -41
  18. data/app/controllers/kaui/invoices_controller.rb +36 -46
  19. data/app/controllers/kaui/payment_methods_controller.rb +84 -28
  20. data/app/controllers/kaui/payments_controller.rb +64 -26
  21. data/app/controllers/kaui/refunds_controller.rb +27 -107
  22. data/app/controllers/kaui/subscriptions_controller.rb +88 -132
  23. data/app/controllers/kaui/tag_definitions_controller.rb +32 -79
  24. data/app/controllers/kaui/tags_controller.rb +16 -14
  25. data/app/controllers/kaui/transactions_controller.rb +25 -0
  26. data/app/helpers/kaui/money_helper.rb +8 -0
  27. data/app/helpers/kaui/subscription_helper.rb +115 -0
  28. data/app/helpers/kaui/uuid_helper.rb +9 -0
  29. data/app/models/kaui/ability.rb +2 -2
  30. data/app/models/kaui/account.rb +25 -42
  31. data/app/models/kaui/account_email.rb +11 -48
  32. data/app/models/kaui/account_timeline.rb +1 -5
  33. data/app/models/kaui/audit_log.rb +1 -15
  34. data/app/models/kaui/base.rb +1 -126
  35. data/app/models/kaui/bundle.rb +47 -14
  36. data/app/models/kaui/catalog.rb +2 -0
  37. data/app/models/kaui/chargeback.rb +24 -36
  38. data/app/models/kaui/credit.rb +5 -20
  39. data/app/models/kaui/custom_field.rb +9 -5
  40. data/app/models/kaui/invoice.rb +9 -53
  41. data/app/models/kaui/invoice_item.rb +8 -18
  42. data/app/models/kaui/invoice_payment.rb +24 -0
  43. data/app/models/kaui/payment.rb +14 -32
  44. data/app/models/kaui/payment_method.rb +36 -0
  45. data/app/models/kaui/rails_methods.rb +7 -9
  46. data/app/models/kaui/refund.rb +5 -20
  47. data/app/models/kaui/subscription.rb +7 -27
  48. data/app/models/kaui/tag.rb +10 -6
  49. data/app/models/kaui/tag_definition.rb +26 -34
  50. data/app/models/kaui/transaction.rb +30 -0
  51. data/app/models/kaui/user.rb +2 -0
  52. data/app/views/kaui/account_emails/_form.html.erb +8 -28
  53. data/app/views/kaui/account_emails/show.html.erb +10 -10
  54. data/app/views/kaui/account_tags/_account_tags_table.html.erb +20 -18
  55. data/app/views/kaui/account_tags/_form.html.erb +42 -0
  56. data/app/views/kaui/account_tags/edit.html.erb +1 -41
  57. data/app/views/kaui/account_tags/show.html.erb +6 -3
  58. data/app/views/kaui/account_timelines/show.html.erb +273 -302
  59. data/app/views/kaui/accounts/_form.html.erb +116 -0
  60. data/app/views/kaui/accounts/index.html.erb +13 -11
  61. data/app/views/kaui/accounts/new.html.erb +5 -0
  62. data/app/views/kaui/accounts/show.html.erb +101 -99
  63. data/app/views/kaui/bundle_tags/_bundle_tags_table.html.erb +29 -9
  64. data/app/views/kaui/bundle_tags/_form.html.erb +41 -0
  65. data/app/views/kaui/bundle_tags/edit.html.erb +2 -34
  66. data/app/views/kaui/bundle_tags/show.html.erb +6 -0
  67. data/app/views/kaui/bundles/index.html.erb +9 -9
  68. data/app/views/kaui/bundles/show.html.erb +17 -15
  69. data/app/views/kaui/bundles/transfer.html.erb +25 -24
  70. data/app/views/kaui/chargebacks/_form.html.erb +44 -0
  71. data/app/views/kaui/chargebacks/new.html.erb +3 -115
  72. data/app/views/kaui/charges/_form.html.erb +73 -0
  73. data/app/views/kaui/charges/new.html.erb +2 -91
  74. data/app/views/kaui/credits/_form.html.erb +73 -0
  75. data/app/views/kaui/credits/new.html.erb +2 -85
  76. data/app/views/kaui/invoice_items/edit.html.erb +77 -78
  77. data/app/views/kaui/invoices/show.html.erb +3 -10
  78. data/app/views/kaui/layouts/kaui_application.html.erb +0 -2
  79. data/app/views/kaui/payment_methods/_form.html.erb +30 -0
  80. data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +19 -18
  81. data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +8 -5
  82. data/app/views/kaui/payment_methods/index.html.erb +10 -10
  83. data/app/views/kaui/payment_methods/new.html.erb +2 -20
  84. data/app/views/kaui/payment_methods/show.html.erb +2 -1
  85. data/app/views/kaui/payments/_payments_table.html.erb +30 -22
  86. data/app/views/kaui/payments/index.html.erb +1 -1
  87. data/app/views/kaui/payments/new.html.erb +5 -5
  88. data/app/views/kaui/payments/show.html.erb +3 -0
  89. data/app/views/kaui/refunds/new.html.erb +96 -104
  90. data/app/views/kaui/subscriptions/_form.html.erb +36 -0
  91. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +39 -44
  92. data/app/views/kaui/subscriptions/edit.html.erb +24 -35
  93. data/app/views/kaui/subscriptions/index.html.erb +13 -12
  94. data/app/views/kaui/subscriptions/new.html.erb +6 -43
  95. data/app/views/kaui/subscriptions/show.html.erb +32 -25
  96. data/app/views/kaui/tag_definitions/_form.html.erb +10 -37
  97. data/app/views/kaui/tag_definitions/index.html.erb +3 -5
  98. data/app/views/kaui/tag_definitions/show.html.erb +1 -2
  99. data/app/views/kaui/transactions/_form.html.erb +77 -0
  100. data/app/views/kaui/transactions/new.html.erb +3 -0
  101. data/config/initializers/kilbill-client-init.rb +1 -1
  102. data/config/routes.rb +4 -15
  103. data/kaui.gemspec +8 -6
  104. data/lib/kaui/engine.rb +4 -1
  105. data/lib/kaui/version.rb +1 -1
  106. data/lib/kaui.rb +2 -2
  107. data/test/functional/kaui/account_emails_controller_test.rb +28 -0
  108. data/test/functional/kaui/account_tags_controller_test.rb +29 -0
  109. data/test/functional/kaui/account_timelines_controller_test.rb +21 -0
  110. data/test/functional/kaui/accounts_controller_test.rb +56 -50
  111. data/test/functional/kaui/bundle_tags_controller_test.rb +29 -0
  112. data/test/functional/kaui/bundles_controller_test.rb +58 -13
  113. data/test/functional/kaui/chargebacks_controller_test.rb +16 -5
  114. data/test/functional/kaui/charges_controller_test.rb +39 -0
  115. data/test/functional/kaui/credits_controller_test.rb +35 -0
  116. data/test/functional/kaui/custom_fields_controller_test.rb +21 -0
  117. data/test/functional/kaui/functional_test_helper.rb +61 -0
  118. data/test/functional/kaui/invoice_items_controller_test.rb +24 -10
  119. data/test/functional/kaui/invoices_controller_test.rb +41 -13
  120. data/test/functional/kaui/payment_methods_controller_test.rb +49 -0
  121. data/test/functional/kaui/payments_controller_test.rb +32 -5
  122. data/test/functional/kaui/refunds_controller_test.rb +40 -5
  123. data/test/functional/kaui/subscriptions_controller_test.rb +82 -0
  124. data/test/functional/kaui/tag_definitions_controller_test.rb +27 -53
  125. data/test/functional/kaui/tags_controller_test.rb +21 -0
  126. data/test/functional/kaui/transactions_controller_test.rb +32 -0
  127. data/test/integration/kaui/integration_test_helper.rb +31 -0
  128. data/test/integration/kaui/navigation_test.rb +43 -0
  129. data/test/killbill_test_helper.rb +143 -0
  130. data/test/test_helper.rb +10 -227
  131. data/test/unit/kaui/account_email_test.rb +19 -0
  132. data/test/unit/kaui/account_test.rb +7 -35
  133. data/test/unit/kaui/base_test.rb +5 -46
  134. data/test/unit/kaui/date_helper_test.rb +6 -5
  135. data/test/unit/kaui/invoice_item_test.rb +5 -17
  136. data/test/unit/kaui/invoice_payment_test.rb +42 -0
  137. data/test/unit/kaui/invoice_test.rb +15 -15
  138. data/test/unit/kaui/money_helper_test.rb +10 -0
  139. data/test/unit/kaui/payment_test.rb +42 -0
  140. data/test/unit/kaui/tag_definition_test.rb +5 -28
  141. data/test/unit/kaui/uuid_helper_test.rb +10 -0
  142. metadata +134 -159
  143. data/app/controllers/kaui/analytics_controller.rb +0 -28
  144. data/app/helpers/kaui/killbill_helper.rb +0 -611
  145. data/app/models/kaui/analytics.rb +0 -19
  146. data/app/models/kaui/analytics_sanity.rb +0 -7
  147. data/app/models/kaui/business_account.rb +0 -12
  148. data/app/models/kaui/business_field.rb +0 -6
  149. data/app/models/kaui/business_invoice.rb +0 -31
  150. data/app/models/kaui/business_invoice_item.rb +0 -17
  151. data/app/models/kaui/business_invoice_payment.rb +0 -25
  152. data/app/models/kaui/business_overdue_status.rb +0 -8
  153. data/app/models/kaui/business_snapshot.rb +0 -9
  154. data/app/models/kaui/business_subscription_transition.rb +0 -53
  155. data/app/models/kaui/business_tag.rb +0 -5
  156. data/app/models/kaui/charge.rb +0 -14
  157. data/app/models/kaui/entitlement.rb +0 -2
  158. data/app/models/kaui/event.rb +0 -13
  159. data/app/models/kaui/external_payment.rb +0 -15
  160. data/app/models/kaui/overdue_state.rb +0 -10
  161. data/app/models/kaui/payment_attempt.rb +0 -27
  162. data/app/models/kaui/product.rb +0 -24
  163. data/app/models/kaui/time_series_data.rb +0 -8
  164. data/app/views/kaui/analytics/account_snapshot.html.erb +0 -211
  165. data/app/views/kaui/analytics/index.html.erb +0 -17
  166. data/app/views/kaui/chargebacks/index.html.erb +0 -14
  167. data/app/views/kaui/chargebacks/show.html.erb +0 -19
  168. data/app/views/kaui/credits/index.html.erb +0 -14
  169. data/app/views/kaui/credits/show.html.erb +0 -19
  170. data/app/views/kaui/invoice_items/index.html.erb +0 -20
  171. data/app/views/kaui/invoice_items/show.html.erb +0 -31
  172. data/app/views/kaui/refunds/_refunds_table.html.erb +0 -31
  173. data/app/views/kaui/refunds/index.html.erb +0 -43
  174. data/app/views/kaui/refunds/show.html.erb +0 -33
  175. data/app/views/kaui/tag_definitions/edit.html.erb +0 -3
  176. data/test/dummy/test/fixtures/accounts.yml +0 -32
  177. data/test/dummy/test/fixtures/bill_cycle_days.yml +0 -3
  178. data/test/dummy/test/fixtures/bundles.yml +0 -4
  179. data/test/dummy/test/fixtures/invoice_items.yml +0 -13
  180. data/test/dummy/test/fixtures/invoices.yml +0 -11
  181. data/test/dummy/test/fixtures/overdue_states.yml +0 -8
  182. data/test/dummy/test/fixtures/payment_methods.yml +0 -5
  183. data/test/dummy/test/fixtures/plugin_info_properties.yml +0 -59
  184. data/test/dummy/test/fixtures/plugin_infos.yml +0 -2
  185. data/test/dummy/test/fixtures/refunds.yml +0 -9
  186. data/test/dummy/test/fixtures/tag_definitions.yml +0 -20
  187. data/test/functional/kaui/account_timeline_controller_test.rb +0 -9
  188. data/test/functional/kaui/extpayments_controller_test.rb +0 -9
  189. data/test/functional/kaui/home_controller_test.rb +0 -11
  190. data/test/integration/navigation_test.rb +0 -10
  191. data/test/kaui_test.rb +0 -7
  192. data/test/unit/helpers/kaui/account_timeline_helper_test.rb +0 -6
  193. data/test/unit/helpers/kaui/bundles_helper_test.rb +0 -6
  194. data/test/unit/helpers/kaui/chargebacks_helper_test.rb +0 -6
  195. data/test/unit/helpers/kaui/extpayments_helper_test.rb +0 -6
  196. data/test/unit/helpers/kaui/home_helper_test.rb +0 -6
  197. data/test/unit/helpers/kaui/invoices_helper_test.rb +0 -6
  198. data/test/unit/helpers/kaui/payments_helper_test.rb +0 -6
  199. data/test/unit/helpers/kaui/refunds_helper_test.rb +0 -6
  200. data/test/unit/kaui/overdue_state_test.rb +0 -18
  201. data/test/unit/kaui/refund_test.rb +0 -20
  202. data/test/unit/model_test.rb +0 -151
@@ -0,0 +1,116 @@
1
+ <%= form_for @account, :html => {:class => 'form-horizontal'} do |f| %>
2
+ <fieldset>
3
+ <div class="control-group">
4
+ <%= f.label :name, 'Name *', :class => 'control-label' %>
5
+ <div class="controls">
6
+ <%= f.text_field :name, :class => 'input-small', :required => true %>
7
+ </div>
8
+ </div>
9
+ <div class="control-group">
10
+ <%= f.label :first_name_length, 'First name length', :class => 'control-label' %>
11
+ <div class="controls">
12
+ <%= f.text_field :first_name_length, :class => 'input-small' %>
13
+ </div>
14
+ </div>
15
+ <div class="control-group">
16
+ <%= f.label :external_key, 'External key *', :class => 'control-label' %>
17
+ <div class="controls">
18
+ <%= f.text_field :external_key, :class => 'input-small', :required => true %>
19
+ </div>
20
+ </div>
21
+ <div class="control-group">
22
+ <%= f.label :email, 'Email *', :class => 'control-label' %>
23
+ <div class="controls">
24
+ <%= f.text_field :email, :class => 'input-small', :required => true %>
25
+ </div>
26
+ </div>
27
+ <div class="control-group">
28
+ <%= f.label :bill_cycle_day_local, 'Bill cycle day', :class => 'control-label' %>
29
+ <div class="controls">
30
+ <%= f.text_field :bill_cycle_day_local, :class => 'input-small' %>
31
+ </div>
32
+ </div>
33
+ <div class="control-group">
34
+ <%= f.label :currency, 'Currency', :class => 'control-label' %>
35
+ <div class="controls">
36
+ <%= f.select :currency, currencies, {}, :class => 'input-small' %>
37
+ </div>
38
+ </div>
39
+ <div class="control-group">
40
+ <%= f.label :time_zone, 'Timezone', :class => 'control-label' %>
41
+ <div class="controls">
42
+ <%= f.collection_select :time_zone, ActiveSupport::TimeZone.all, :formatted_offset, :to_s, :class => 'input-large' %>
43
+ </div>
44
+ </div>
45
+ <div class="control-group">
46
+ <%= f.label :address1, 'Address line 1', :class => 'control-label' %>
47
+ <div class="controls">
48
+ <%= f.text_field :address1, :class => 'input-small' %>
49
+ </div>
50
+ </div>
51
+ <div class="control-group">
52
+ <%= f.label :address2, 'Address line 2', :class => 'control-label' %>
53
+ <div class="controls">
54
+ <%= f.text_field :address2, :class => 'input-small' %>
55
+ </div>
56
+ </div>
57
+ <div class="control-group">
58
+ <%= f.label :postal_code, 'Zip code', :class => 'control-label' %>
59
+ <div class="controls">
60
+ <%= f.text_field :postal_code, :class => 'input-small' %>
61
+ </div>
62
+ </div>
63
+ <div class="control-group">
64
+ <%= f.label :company, 'Company', :class => 'control-label' %>
65
+ <div class="controls">
66
+ <%= f.text_field :company, :class => 'input-small' %>
67
+ </div>
68
+ </div>
69
+ <div class="control-group">
70
+ <%= f.label :city, 'City', :class => 'control-label' %>
71
+ <div class="controls">
72
+ <%= f.text_field :city, :class => 'input-small' %>
73
+ </div>
74
+ </div>
75
+ <div class="control-group">
76
+ <%= f.label :state, 'State', :class => 'control-label' %>
77
+ <div class="controls">
78
+ <%= f.text_field :state, :class => 'input-small' %>
79
+ </div>
80
+ </div>
81
+ <div class="control-group">
82
+ <%= f.label :country, 'Country', :class => 'control-label' %>
83
+ <div class="controls">
84
+ <%= f.country_select :country, {priority: %w(US CA), prompt: 'Please select a country'}, :class => 'input-large' %>
85
+ </div>
86
+ </div>
87
+ <div class="control-group">
88
+ <%= f.label :locale, 'Locale', :class => 'control-label' %>
89
+ <div class="controls">
90
+ <%= f.text_field :locale, :class => 'input-small' %>
91
+ </div>
92
+ </div>
93
+ <div class="control-group">
94
+ <%= f.label :phone, 'Phone', :class => 'control-label' %>
95
+ <div class="controls">
96
+ <%= f.text_field :phone, :class => 'input-small' %>
97
+ </div>
98
+ </div>
99
+ <div class="control-group">
100
+ <%= f.label :is_migrated, 'Migrated?', :class => 'control-label' %>
101
+ <div class="controls">
102
+ <%= f.check_box :is_migrated, :class => 'input-small' %>
103
+ </div>
104
+ </div>
105
+ <div class="control-group">
106
+ <%= f.label :is_notified_for_invoices, 'Notified for invoices?', :class => 'control-label' %>
107
+ <div class="controls">
108
+ <%= f.check_box :is_notified_for_invoices, :class => 'input-small' %>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="form-actions">
113
+ <%= button_tag 'Create account', :class => 'btn btn-primary' %>
114
+ </div>
115
+ </fieldset>
116
+ <% end %>
@@ -1,21 +1,23 @@
1
1
  <table id="accounts-table" class="table table-condensed">
2
2
  <thead>
3
- <tr>
4
- <th>Account ID</th>
5
- <th>Name</th>
6
- <th>External key</th>
7
- <th>Currency</th>
8
- <th>City</th>
9
- <th>Country</th>
10
- </tr>
3
+ <tr>
4
+ <th>Account ID</th>
5
+ <th>Name</th>
6
+ <th>External key</th>
7
+ <th>Currency</th>
8
+ <th>City</th>
9
+ <th>Country</th>
10
+ </tr>
11
11
  </thead>
12
12
  <tbody>
13
- <tr>
14
- <td colspan="1" class="dataTables_empty">Loading data from server</td>
15
- </tr>
13
+ <tr>
14
+ <td colspan="1" class="dataTables_empty">Loading data from server</td>
15
+ </tr>
16
16
  </tbody>
17
17
  </table>
18
18
 
19
+ <h3><%= link_to 'Create new account', new_account_path %></h3>
20
+
19
21
  <%= javascript_tag do %>
20
22
  $(document).ready(function() {
21
23
  $('#accounts-table').dataTable({
@@ -0,0 +1,5 @@
1
+ <div class="page-header">
2
+ <h1>New account</h1>
3
+ </div>
4
+
5
+ <%= render 'form' %>
@@ -1,106 +1,108 @@
1
- <% if @account.present? %>
2
- <dl class="dl-horizontal">
3
- <dt>Id:</dt>
4
- <dd><%= @account.account_id %>&nbsp;</dd>
5
- <dt>Name:</dt>
6
- <dd><%= @account.name %>&nbsp;</dd>
7
- <dt>Email:</dt>
8
- <dd><%= @account.email %>&nbsp;</dd>
9
- <dt>Bill cycle day:</dt>
10
- <% if @account.bill_cycle_day %>
11
- <dd><%= @account.bill_cycle_day %> (user timezone)</dd>
12
- <% else %>
13
- <dd><%=t :unknown_bcd %></dd>
14
- <% end %>
15
- <dt>Currency:</dt>
16
- <dd><%= @account.currency %>&nbsp;</dd>
17
- <dt>Timezone:</dt>
18
- <dd><%= @account.timezone %>&nbsp;</dd>
19
- <dt>Address 1:</dt>
20
- <dd><%= @account.address1 %>&nbsp;</dd>
21
- <dt>Address 2:</dt>
22
- <dd><%= @account.address2 %>&nbsp;</dd>
23
- <dt>Company:</dt>
24
- <dd><%= @account.company %>&nbsp;</dd>
25
- <dt>State:</dt>
26
- <dd><%= @account.state %>&nbsp;</dd>
27
- <dt>Country:</dt>
28
- <dd><%= @account.country %>&nbsp;</dd>
29
- <dt>Phone:</dt>
30
- <dd><%= @account.phone %>&nbsp;</dd>
31
- <dt>External key:</dt>
32
- <dd><%= @account.external_key %>&nbsp;</dd>
33
- <dt>Overdue status:</dt>
34
- <% if @overdue_state.nil? %>
35
- <dd>unknown</dd>
36
- <% elsif @overdue_state.clear_state %>
37
- <dd><span class='label label-success'>Good</span><dd>
38
- <% else %>
39
- <dd><span class='label label-important'><%= @overdue_state.name %></span><dd>
40
- <% end %>
41
- <dt>Account balance:</dt>
42
- <% if @account.balance.nil? %>
43
- <dd>unknown</dd>
44
- <% elsif @account.balance <= 0 %>
45
- <dd><span class="label label-success" ><%= humanized_money_with_symbol @account.balance_to_money %> (<%= @account.currency %>)</span>
46
- <% else %>
47
- <dd><span class="label label-important" ><%= humanized_money_with_symbol @account.balance_to_money %> (<%= @account.currency %>)</span>
48
- <% end %>
49
- &nbsp;
50
- <nobr>
51
- <!-- Payment, Credit then Charge. Same ordering as in the billing timeline -->
52
- <%= link_to 'Payment',
53
- kaui_engine.pay_all_invoices_account_path(@account.account_id),
54
- :method => :post,
55
- :class => "btn btn-mini #{"disabled" if !@account.balance.nil? and @account.balance <= 0}" %>
56
- </nobr>
57
- <% if can? :credit, Kaui::Account %>
58
- <nobr>
59
- <%= link_to 'Credit',
60
- kaui_engine.new_credit_path(:params => { :account_id => @account.account_id }),
61
- :class => "btn btn-mini" %>
62
- </nobr>
63
- <% end %>
64
- <% if can? :charge, Kaui::Account %>
65
- <nobr>
66
- <%= link_to 'Charge',
67
- kaui_engine.new_charge_path(:params => { :account_id => @account.account_id }),
68
- :class => "btn btn-mini" %>
69
- </nobr>
70
- <% end %>
71
- </dd>
72
- <dt>Account credit:</dt>
73
- <% if @account.cba.nil? %>
74
- <dd>unknown
75
- <% elsif @account.cba >= 0 %>
76
- <dd><span class="label label-success" ><%= humanized_money_with_symbol @account.cba_to_money %> (<%= @account.currency %>)</span>
77
- <% else %>
78
- <dd><span class="label label-important" ><%= humanized_money_with_symbol @account.cba_to_money %> (<%= @account.currency %>)</span>
79
- <% end %>
80
- </dd>
81
- <dt>Notified for inv?</dt>
82
- <dd><%= @account.is_notified_for_invoices %>&nbsp;<%= link_to "Toggle", kaui_engine.toggle_email_notifications_account_path(@account.account_id, :is_notified => !@account.is_notified_for_invoices), :method => :post, :class => 'btn btn-mini' %></dd>
83
- <%= render :partial => "kaui/tags/tags_table",
84
- :locals => { :tags => @tags, :tags_url_or_path => kaui_engine.edit_account_tags_path(:params => { :account_id => @account.account_id }), :tags_show_path => kaui_engine.account_tags_path(:account_id => @account.account_id) } %>
85
- <%= render :partial => "kaui/account_emails/account_emails_table",
86
- :locals => { :account_emails => @account_emails, :account_id => @account.account_id } %>
87
- <dt>New base subscription:</dt>
88
- <dd><%= link_to "Create", kaui_engine.new_subscription_path(:params => { :account_id => @account.account_id, :product_category => "BASE" }), :class => "btn btn-mini" %></dd>
89
- </dl>
90
- <h2><%= link_to "Billing timeline", kaui_engine.account_timeline_path(@account.account_id) %></h2>
91
- <% if @payment_methods.present? %>
92
- <%= render :partial => "kaui/payment_methods/payment_methods_table", :locals => { :account_id => @account.account_id, :payment_methods => @payment_methods } %>
1
+ <dl class="dl-horizontal">
2
+ <dt>Id:</dt>
3
+ <dd><%= @account.account_id %>&nbsp;</dd>
4
+ <dt>Name:</dt>
5
+ <dd><%= @account.name %>&nbsp;</dd>
6
+ <dt>Email:</dt>
7
+ <dd><%= @account.email %>&nbsp;</dd>
8
+ <dt>Bill cycle day:</dt>
9
+ <% if @account.bill_cycle_day_local %>
10
+ <dd><%= @account.bill_cycle_day_local %> (user timezone)</dd>
11
+ <% else %>
12
+ <dd><%= t :unknown_bcd %></dd>
13
+ <% end %>
14
+ <dt>Currency:</dt>
15
+ <dd><%= @account.currency %>&nbsp;</dd>
16
+ <dt>Timezone:</dt>
17
+ <dd><%= @account.time_zone %>&nbsp;</dd>
18
+ <dt>Address 1:</dt>
19
+ <dd><%= @account.address1 %>&nbsp;</dd>
20
+ <dt>Address 2:</dt>
21
+ <dd><%= @account.address2 %>&nbsp;</dd>
22
+ <dt>Company:</dt>
23
+ <dd><%= @account.company %>&nbsp;</dd>
24
+ <dt>State:</dt>
25
+ <dd><%= @account.state %>&nbsp;</dd>
26
+ <dt>Country:</dt>
27
+ <dd><%= @account.country %>&nbsp;</dd>
28
+ <dt>Phone:</dt>
29
+ <dd><%= @account.phone %>&nbsp;</dd>
30
+ <dt>External key:</dt>
31
+ <dd><%= @account.external_key %>&nbsp;</dd>
32
+ <dt>Overdue status:</dt>
33
+ <% if @overdue_state.nil? %>
34
+ <dd>unknown</dd>
35
+ <% elsif @overdue_state.clear_state %>
36
+ <dd><span class='label label-success'>Good</span>
37
+ <dd>
38
+ <% else %>
39
+ <dd><span class='label label-important'><%= @overdue_state.name %></span>
40
+ <dd>
41
+ <% end %>
42
+ <dt>Account balance:</dt>
43
+ <% if @account.account_balance.nil? %>
44
+ <dd>unknown</dd>
45
+ <% elsif @account.account_balance <= 0 %>
46
+ <dd><span class="label label-success"><%= humanized_money_with_symbol @account.balance_to_money %>
47
+ (<%= @account.currency %>)</span>
48
+ <% else %>
49
+ <dd><span class="label label-important"><%= humanized_money_with_symbol @account.balance_to_money %>
50
+ (<%= @account.currency %>)</span>
93
51
  <% end %>
94
- <%= link_to "Add payment method", kaui_engine.add_payment_method_account_path(@account.account_id), :class => "btn btn-mini" %>
95
- <% @bundles.each do |bundle| %>
52
+ &nbsp;
53
+ <nobr>
54
+ <!-- Payment, Credit then Charge. Same ordering as in the billing timeline -->
55
+ <%= link_to 'Payment',
56
+ kaui_engine.pay_all_invoices_account_path(@account.account_id),
57
+ :method => :post,
58
+ :class => "btn btn-mini #{"disabled" if !@account.account_balance.nil? and @account.account_balance <= 0}" %>
59
+ </nobr>
60
+ <% if can? :credit, Kaui::Account %>
61
+ <nobr>
62
+ <%= link_to 'Credit',
63
+ kaui_engine.new_credit_path(:params => {:account_id => @account.account_id}),
64
+ :class => "btn btn-mini" %>
65
+ </nobr>
66
+ <% end %>
67
+ <% if can? :charge, Kaui::Account %>
68
+ <nobr>
69
+ <%= link_to 'Charge',
70
+ kaui_engine.new_charge_path(:params => {:account_id => @account.account_id}),
71
+ :class => "btn btn-mini" %>
72
+ </nobr>
73
+ <% end %>
74
+ </dd>
75
+ <dt>Account credit:</dt>
76
+ <% if @account.account_cba.nil? %>
77
+ <dd>unknown
78
+ <% elsif @account.account_cba >= 0 %>
79
+ <dd><span class="label label-success"><%= humanized_money_with_symbol @account.cba_to_money %>
80
+ (<%= @account.currency %>)</span>
81
+ <% else %>
82
+ <dd><span class="label label-important"><%= humanized_money_with_symbol @account.cba_to_money %>
83
+ (<%= @account.currency %>)</span>
84
+ <% end %>
85
+ </dd>
86
+ <dt>Notified for inv?</dt>
87
+ <dd><%= @account.is_notified_for_invoices %>&nbsp;<%= link_to "Toggle", kaui_engine.toggle_email_notifications_account_path(@account.account_id, :is_notified => !@account.is_notified_for_invoices), :method => :post, :class => 'btn btn-mini' %></dd>
88
+ <%= render :partial => "kaui/tags/tags_table",
89
+ :locals => {:tags => @tags, :tags_url_or_path => kaui_engine.edit_account_tags_path(:params => {:account_id => @account.account_id}), :tags_show_path => kaui_engine.account_tags_path(:account_id => @account.account_id)} %>
90
+ <%= render :partial => "kaui/account_emails/account_emails_table",
91
+ :locals => {:account_emails => @account_emails, :account_id => @account.account_id} %>
92
+ <dt>New base subscription:</dt>
93
+ <dd><%= link_to "Create", kaui_engine.new_subscription_path(:params => {:account_id => @account.account_id, :product_category => "BASE"}), :class => "btn btn-mini" %></dd>
94
+ </dl>
95
+ <h2><%= link_to "Billing timeline", kaui_engine.account_timeline_path(@account.account_id) %></h2>
96
+ <% if @payment_methods.present? %>
97
+ <%= render :partial => "kaui/payment_methods/payment_methods_table", :locals => {:account_id => @account.account_id, :payment_methods => @payment_methods} %>
98
+ <% end %>
99
+ <%= link_to "Add payment method", kaui_engine.new_payment_method_path(:account_id => @account.account_id), :class => "btn btn-mini" %>
100
+ <% @bundles.each do |bundle| %>
96
101
  <% subs = @subscriptions_by_bundle_id[bundle.bundle_id] %>
97
102
  <% if subs.present? %>
98
- <h2>Bundle <%= link_to Kaui.bundle_key_display_string.call(bundle.external_key), Kaui.bundle_home_path.call(bundle.bundle_id) if bundle.external_key.present? %></h2>
99
- <%= render :partial => "kaui/subscriptions/subscriptions_table", :locals => { :subscriptions => subs, :account => @account } %>
103
+ <h2>Bundle <%= link_to Kaui.bundle_key_display_string.call(bundle.external_key), Kaui.bundle_home_path.call(bundle.bundle_id) if bundle.external_key.present? %></h2>
104
+ <%= render :partial => "kaui/subscriptions/subscriptions_table", :locals => {:subscriptions => subs, :account => @account} %>
100
105
  <% end %>
101
- <% end %>
102
- <% else %>
103
- <p>Account not found</p>
104
106
  <% end %>
105
107
 
106
108
  <%= javascript_tag do %>
@@ -1,11 +1,31 @@
1
- <dt>Tags:</dt>
2
- <dd>
1
+ <div class="page-header">
2
+ <h3>Tags for <%= (link_to @bundle.external_key, bundle_path(@bundle.bundle_id)) if @bundle.present? %></h3>
3
+ </div>
4
+ <table class="table table-condensed table-striped data-table">
5
+ <thead>
6
+ <tr>
7
+ <th>Tag Name</th>
8
+ <th>Executed date</th>
9
+ <th>Execution type</th>
10
+ <th>Executed by</th>
11
+ <th>Comments</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
3
15
  <% if @tags.present? %>
4
- <% @tags.sort.each_with_index do |tag, idx| %>
5
- <span><%= tag %><% if idx < @tags.length - 1 %>, <% end %></span>
6
- <% end %>
7
- <br/>
16
+ <% @tags.each do |tag| %>
17
+ <% tag.audit_logs.each do |log| %>
18
+ <tr>
19
+ <td><%= link_to tag.tag_definition_name, tag_definition_path(:id => tag.tag_definition_id) %></td>
20
+ <td><%= format_date(log.change_date, @account.time_zone).html_safe if log.change_date.present? %></td>
21
+ <td><span
22
+ <% if log.change_type != 'INSERT' %>class='alert-error'
23
+ <% else %>class='alert-success' <% end %>><%= log.change_type %></span></td>
24
+ <td><%= log.changed_by %></td>
25
+ <td><%= log.reason_code %> <%= log.comments %></td>
26
+ </tr>
27
+ <% end %>
28
+ <% end %>
8
29
  <% end %>
9
- <%= link_to 'Add/Remove', kaui_engine.edit_bundle_tags_path(:params => { :bundle_id => @bundle.bundle_id }),
10
- :class => "btn btn-mini" %>
11
- </dd>
30
+ </tbody>
31
+ </table>
@@ -0,0 +1,41 @@
1
+ <%= form_tag update_bundle_tags_path, :class => 'form-horizontal' do %>
2
+ <%= hidden_field_tag :bundle_id, @bundle.bundle_id %>
3
+ <fieldset>
4
+ <div class="control-group">
5
+ <label class="control-label">Bundle name</label>
6
+
7
+ <div class="controls">
8
+ <label class="checkbox">
9
+ <%= link_to @bundle.external_key, Kaui.bundle_home_path.call(@bundle.bundle_id) %><br/>
10
+ </label>
11
+ </div>
12
+ </div>
13
+ <div class="control-group">
14
+ <%= label_tag :name, 'Tag', :class => 'control-label' %>
15
+ <div class="controls">
16
+ <% @available_tags.each do |tag| %>
17
+ <label class="checkbox">
18
+ <%= check_box_tag "tag_#{tag.id}", tag.name, @tag_names.include?(tag.name) %>
19
+ <span href="#" class="tag-description" rel="tooltip" title="<%= tag.description %>"><%= tag.name %></span>
20
+ </label>
21
+ <% end %>
22
+ </div>
23
+ </div>
24
+
25
+ <div class='control-group'>
26
+ <%= label_tag :comment, 'Comment', :class => "control-label" %>
27
+ <div class="controls">
28
+ <%= text_area_tag :comment, '', :rows => 3, :class => 'input-xlarge' %>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="form-actions">
33
+ <%= button_tag 'Update', :class => 'btn btn-primary' %>
34
+ </div>
35
+ </fieldset>
36
+ <% end %>
37
+ <%= javascript_tag do %>
38
+ $(function() {
39
+ $(".tag-description").tooltip();
40
+ });
41
+ <% end %>
@@ -1,37 +1,5 @@
1
- <div class="page-header">
1
+ <div class='page-header'>
2
2
  <h1>Add/Remove Tags</h1>
3
3
  </div>
4
- <%= form_tag update_bundle_tags_path, :class => "form-horizontal" do %>
5
- <%= hidden_field_tag :bundle_id, @bundle.bundle_id %>
6
- <fieldset>
7
- <div class="control-group">
8
- <label class="control-label">Bundle name</label>
9
- <div class="controls">
10
- <label class="checkbox">
11
- <%= link_to @bundle.external_key, Kaui.bundle_home_path.call(@bundle.bundle_id) %><br/>
12
- </label>
13
- </div>
14
- </div>
15
- <div class="control-group">
16
- <%= label_tag :name, "Tag", :class => "control-label" %>
17
- <div class="controls">
18
- <% @available_tags.each do |tag| %>
19
- <label class="checkbox">
20
- <%= check_box_tag "tags[]", tag.name, @tags.include?(tag.name) %>
21
- <span href="#" class="tag-description" rel="tooltip" title="<%= tag.description %>"><%= tag.name %></span>
22
- </label>
23
- <% end %>
24
- </div>
25
- </div>
26
4
 
27
- <div class="form-actions">
28
- <%= button_tag "Update", :class =>"btn btn-primary" %>
29
- <%= link_to 'Back', :back, :class => 'btn' %>
30
- </div>
31
- </fieldset>
32
- <% end %>
33
- <%= javascript_tag do %>
34
- $(function() {
35
- $(".tag-description").tooltip();
36
- });
37
- <% end %>
5
+ <%= render 'form' %>
@@ -0,0 +1,6 @@
1
+ <%= render 'bundle_tags_table' %>
2
+
3
+ <% if can? :add, Kaui::Tag or can? :remove, Kaui::Tag %>
4
+ <%= link_to 'Add/Remove Tags', kaui_engine.edit_bundle_tags_path(:bundle_id => @bundle.bundle_id), :class => 'btn' %>
5
+ <% end %>
6
+ <%= link_to 'Go to bundle', kaui_engine.bundle_path(:id => @bundle.bundle_id), :class => 'btn' %>
@@ -1,16 +1,16 @@
1
1
  <table id="bundles-table" class="table table-condensed">
2
2
  <thead>
3
- <tr>
4
- <th>Bundle ID</th>
5
- <th>Account ID</th>
6
- <th>External key</th>
7
- <th>Subscriptions</th>
8
- </tr>
3
+ <tr>
4
+ <th>Bundle ID</th>
5
+ <th>Account ID</th>
6
+ <th>External key</th>
7
+ <th>Subscriptions</th>
8
+ </tr>
9
9
  </thead>
10
10
  <tbody>
11
- <tr>
12
- <td colspan="1" class="dataTables_empty">Loading data from server</td>
13
- </tr>
11
+ <tr>
12
+ <td colspan="1" class="dataTables_empty">Loading data from server</td>
13
+ </tr>
14
14
  </tbody>
15
15
  </table>
16
16
 
@@ -1,16 +1,18 @@
1
- <% if @bundle.present? %>
2
- <dl class="dl-horizontal">
3
- <dt>Id:</dt>
4
- <dd><%= @bundle.bundle_id %>&nbsp;</dd>
5
- <dt>Account:</dt>
6
- <dd><%= @account.name %>&nbsp;</dd>
7
- <dd><%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %>&nbsp;</dd>
8
- <dt>Bundle key:</dt>
9
- <dd><%= @bundle.external_key %>&nbsp;</dd>
10
- <%= link_to "Transfer Ownership", kaui_engine.transfer_bundle_path(@bundle.bundle_id), :class => "btn btn-mini" %></dd>
11
- <% if @subscriptions.present? %>
12
- <%= render :partial => "kaui/subscriptions/subscriptions_table", :locals => { :subscriptions => @subscriptions, :account => @account } %>
1
+ <dl class="dl-horizontal">
2
+ <dt>Id:</dt>
3
+ <dd><%= @bundle.bundle_id %>&nbsp;</dd>
4
+ <dt>Account:</dt>
5
+ <dd><%= @account.name %>&nbsp;</dd>
6
+ <dd><%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %>&nbsp;</dd>
7
+ <dt>Bundle key:</dt>
8
+ <dd>
9
+ <%= @bundle.external_key %>&nbsp;
10
+ <%= link_to 'Transfer Ownership', kaui_engine.transfer_bundle_path(@bundle.bundle_id), :class => 'btn btn-mini' %>
11
+ </dd>
12
+ <%= render :partial => 'kaui/tags/tags_table',
13
+ :locals => {:tags => @tags, :tags_url_or_path => kaui_engine.edit_bundle_tags_path(:params => {:bundle_id => @bundle.bundle_id}), :tags_show_path => kaui_engine.bundle_tags_path(:bundle_id => @bundle.bundle_id)} %>
14
+ <% if @bundle.subscriptions.present? %>
15
+ <%= render :partial => 'kaui/subscriptions/subscriptions_table', :locals => {:subscriptions => @bundle.subscriptions, :account => @account} %>
13
16
  <% end %>
14
- <% else %>
15
- <p>Bundle not found</p>
16
- <% end %>
17
+ </dl>
18
+ <%= link_to 'Go to account', kaui_engine.account_path(:id => @account.account_id), :class => 'btn' %>
@@ -1,29 +1,30 @@
1
1
  <h3>Transfer <%= link_to Kaui.bundle_key_display_string.call(@bundle.external_key), Kaui.bundle_home_path.call(@bundle.bundle_id) if @bundle.external_key.present? %>&nbsp;</h3>
2
- <%= form_tag do_transfer_bundle_path(@bundle.bundle_id), :class => "form-horizontal", :method => :put do %>
3
- <div class="control-group">
4
- <%= label_tag :current_owner, 'Current account', :class => "control-label" %>
5
- <div class="controls">
6
- <label class="checkbox">
7
- <%= link_to @account.name, Kaui.account_home_path.call(@account.external_key) %><br/>
8
- <%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %><br/>
9
- <%= link_to @account.external_key, Kaui.account_home_path.call(@account.external_key) %>
10
- </label>
2
+ <%= form_tag do_transfer_bundle_path(@bundle.bundle_id), :class => 'form-horizontal', :method => :put do %>
3
+ <div class="control-group">
4
+ <%= label_tag :current_owner, 'Current account', :class => 'control-label' %>
5
+ <div class="controls">
6
+ <label class="checkbox">
7
+ <%= link_to @account.name, Kaui.account_home_path.call(@account.external_key) %><br/>
8
+ <%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %><br/>
9
+ <%= link_to @account.external_key, Kaui.account_home_path.call(@account.external_key) %>
10
+ </label>
11
+ </div>
11
12
  </div>
12
- </div>
13
- <div class="control-group">
14
- <label class="control-label" for="new_account_key">New Account</label>
15
- <div class="controls">
16
- <%= text_field_tag :new_account_key, nil, :class => "input-xlarge" %>
13
+ <div class="control-group">
14
+ <label class="control-label" for="new_account_key">New Account</label>
15
+
16
+ <div class="controls">
17
+ <%= text_field_tag :new_account_key, nil, :class => 'input-xlarge' %>
18
+ </div>
17
19
  </div>
18
- </div>
19
- <div class="control-group">
20
- <%= label_tag :comment, "Comment", :class => "control-label" %>
21
- <div class="controls">
22
- <%= text_area_tag :comment, "", :rows => 3, :class => 'input-xlarge' %>
20
+ <div class="control-group">
21
+ <%= label_tag :comment, 'Comment', :class => 'control-label' %>
22
+ <div class="controls">
23
+ <%= text_area_tag :comment, '', :rows => 3, :class => 'input-xlarge' %>
24
+ </div>
25
+ </div>
26
+ <div class="form-actions">
27
+ <%= submit_tag 'Change', :class => 'btn btn-primary' %>
28
+ <%= link_to 'Back', :back, :class => 'btn' %>
23
29
  </div>
24
- </div>
25
- <div class="form-actions">
26
- <%= submit_tag "Change", :class => 'btn btn-primary' %>
27
- <%= link_to 'Back', :back, :class => 'btn' %>
28
- </div>
29
30
  <% end %>