kaui 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/README.rdoc +8 -1
  2. data/app/controllers/kaui/accounts_controller.rb +13 -9
  3. data/app/controllers/kaui/bundle_tags_controller.rb +15 -7
  4. data/app/controllers/kaui/bundles_controller.rb +11 -12
  5. data/app/controllers/kaui/credits_controller.rb +2 -1
  6. data/app/controllers/kaui/payments_controller.rb +2 -2
  7. data/app/controllers/kaui/subscriptions_controller.rb +40 -27
  8. data/app/helpers/kaui/killbill_helper.rb +38 -56
  9. data/app/models/kaui/account.rb +4 -0
  10. data/app/models/kaui/base.rb +8 -0
  11. data/app/models/kaui/chargeback.rb +4 -0
  12. data/app/models/kaui/invoice.rb +26 -0
  13. data/app/models/kaui/invoice_item.rb +4 -0
  14. data/app/models/kaui/payment.rb +9 -0
  15. data/app/models/kaui/refund.rb +4 -0
  16. data/app/views/kaui/account_timelines/show.html.erb +13 -21
  17. data/app/views/kaui/accounts/show.html.erb +15 -4
  18. data/app/views/kaui/chargebacks/new.html.erb +8 -1
  19. data/app/views/kaui/charges/new.html.erb +9 -2
  20. data/app/views/kaui/credits/new.html.erb +8 -1
  21. data/app/views/kaui/invoices/show.html.erb +4 -4
  22. data/app/views/kaui/payments/_payments_table.html.erb +2 -2
  23. data/app/views/kaui/payments/new.html.erb +16 -1
  24. data/app/views/kaui/refunds/new.html.erb +8 -1
  25. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +2 -2
  26. data/app/views/kaui/subscriptions/edit.html.erb +1 -1
  27. data/lib/kaui/version.rb +1 -1
  28. data/test/dummy/app/assets/javascripts/application.js +1 -0
  29. data/test/dummy/log/development.log +6795 -0
  30. data/test/dummy/log/test.log +6534 -0
  31. data/test/dummy/tmp/cache/assets/C95/690/sprockets%2Fc4b083702793f7599f4a3069c50f89a8 +0 -0
  32. data/test/dummy/tmp/cache/assets/CC2/520/sprockets%2F9637f46d37325381f96d96d94ae0bc50 +0 -0
  33. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  34. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  35. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  36. data/test/unit/kaui/base_test.rb +14 -0
  37. metadata +6 -4
  38. data/app/controllers/kaui/external_payments_controller.rb +0 -21
  39. data/app/views/kaui/external_payments/new.html.erb +0 -56
@@ -57,14 +57,14 @@
57
57
  <div class="control-group">
58
58
  <%= f.label :amount, "Charge amount", :class => "control-label" %>
59
59
  <div class="controls">
60
- <%= f.text_field :amount, :class => 'input-small' %>
60
+ <%= f.text_field :amount, :id => 'charge_amount', :class => 'input-small' %>
61
61
  <p class="help-inline"><%= @account.currency %></p>
62
62
  </div>
63
63
  </div>
64
64
  <div class="control-group">
65
65
  <%= label_tag :requested_date, 'Requested Date:', :class => "control-label" %>
66
66
  <div class="controls">
67
- <%= text_field_tag :requested_date, nil, :class => 'input-xlarge date-picker' %>
67
+ <%= text_field_tag :requested_date, Time.now.utc.iso8601, :class => 'input-xlarge date-picker' %>
68
68
  </div>
69
69
  </div>
70
70
  <div class="control-group">
@@ -85,3 +85,10 @@
85
85
  </div>
86
86
  </fieldset>
87
87
  <% end %>
88
+ <%= javascript_tag do %>
89
+ $(document).ready(function() {
90
+ $("#charge_amount").keydown(function(event) {
91
+ preventNonNumericValues(event);
92
+ });
93
+ });
94
+ <% end %>
@@ -51,7 +51,7 @@
51
51
  <div class="control-group">
52
52
  <%= f.label :credit_amount, "Credit amount", :class => "control-label" %>
53
53
  <div class="controls">
54
- <%= f.text_field :credit_amount, :class => 'input-small' %>
54
+ <%= f.text_field :credit_amount, :id => 'credit_amount', :class => 'input-small' %>
55
55
  <p class="help-inline"><%= @account.currency %></p>
56
56
  </div>
57
57
  </div>
@@ -79,3 +79,10 @@
79
79
  </div>
80
80
  </fieldset>
81
81
  <% end %>
82
+ <%= javascript_tag do %>
83
+ $(document).ready(function() {
84
+ $("#credit_amount").keydown(function(event) {
85
+ preventNonNumericValues(event);
86
+ });
87
+ });
88
+ <% end %>
@@ -9,9 +9,9 @@
9
9
  <dt>Target date:</dt>
10
10
  <dd><%= format_date(@invoice.target_date).html_safe %>&nbsp;</dd>
11
11
  <dt>Amount:</dt>
12
- <dd><%= @invoice.amount %>&nbsp;</dd>
12
+ <dd><%= humanized_money_with_symbol @invoice.amount_to_money(@account.currency) %>&nbsp;</dd>
13
13
  <dt>Balance:</dt>
14
- <dd><%= @invoice.balance %>&nbsp;</dd>
14
+ <dd><%= humanized_money_with_symbol @invoice.balance_to_money(@account.currency) %>&nbsp;</dd>
15
15
  </dl>
16
16
  <div class="page-header">
17
17
  <h3>Invoice items</h3>
@@ -58,10 +58,10 @@
58
58
  <td onClick="hightlightLinkedItems('<%= item.invoice_item_id %>', '<%= item.linked_invoice_item_id %>'); return false;"><%= format_date(item.end_date).html_safe if item.end_date %></td>
59
59
  <td onClick="hightlightLinkedItems('<%= item.invoice_item_id %>', '<%= item.linked_invoice_item_id %>'); return false;"><%= format_date(sub.charged_through_date).html_safe if sub.present? %></td>
60
60
  <td onClick="hightlightLinkedItems('<%= item.invoice_item_id %>', '<%= item.linked_invoice_item_id %>'); return false;"><%= sub.price_list.downcase.capitalize if sub.present? and sub.price_list.present? %></td>
61
- <td onClick="hightlightLinkedItems('<%= item.invoice_item_id %>', '<%= item.linked_invoice_item_id %>'); return false;"><%= item.amount %>&nbsp;<%= item.currency %></td>
61
+ <td onClick="hightlightLinkedItems('<%= item.invoice_item_id %>', '<%= item.linked_invoice_item_id %>'); return false;"><%= humanized_money_with_symbol item.amount_to_money %></td>
62
62
  <td><%= link_to "Adjust",
63
63
  kaui_engine.edit_invoice_item_path(item.invoice_item_id, :invoice_id => @invoice.invoice_id),
64
- :class => "btn btn-mini" %></td>
64
+ :class => "btn btn-mini" if item.amount > 0 and item.subscription_id.present? %></td>
65
65
  </tr>
66
66
  <% end %>
67
67
  </tbody>
@@ -20,8 +20,8 @@
20
20
  <tr>
21
21
  <td><%= format_date(payment.requested_date).html_safe if payment.requested_date.present? %></td>
22
22
  <td><%= format_date(payment.effective_date).html_safe if payment.effective_date.present? %></td>
23
- <td><%= payment.amount %> <%= payment.currency if payment.amount.present? %></td>
24
- <td><%= payment.paid_amount %> <%= payment.currency if payment.paid_amount.present? %></td>
23
+ <td><%= humanized_money_with_symbol payment.amount_to_money %></td>
24
+ <td><%= humanized_money_with_symbol payment.paid_amount_to_money %></td>
25
25
  <td></td>
26
26
  <td><%= payment.ext_first_payment_id_ref %> <%= " / " if payment.ext_second_payment_id_ref.present? %> <%= payment.ext_second_payment_id_ref %></td>
27
27
  <td><%= payment.retry_count %></td>
@@ -49,10 +49,18 @@
49
49
  </div>
50
50
  </div>
51
51
  <% end %>
52
+ <div class="control-group">
53
+ <%= f.label :external, "External Payment?", :class => "control-label" %>
54
+ <div class="controls">
55
+ <label class="checkbox">
56
+ <%= f.check_box :external %>
57
+ </label>
58
+ </div>
59
+ </div>
52
60
  <div class="control-group">
53
61
  <%= f.label :amount, "Amount", :class => "control-label" %>
54
62
  <div class="controls">
55
- <%= f.text_field :amount, :class => 'input-small' %>
63
+ <%= f.text_field :amount, :id => 'payment_amount', :class => 'input-small' %>
56
64
  <p class="help-inline"><%= @account.currency %></p>
57
65
  </div>
58
66
  </div>
@@ -74,3 +82,10 @@
74
82
  </div>
75
83
  </fieldset>
76
84
  <% end %>
85
+ <%= javascript_tag do %>
86
+ $(document).ready(function() {
87
+ $("#payment_amount").keydown(function(event) {
88
+ preventNonNumericValues(event);
89
+ });
90
+ });
91
+ <% end %>
@@ -65,7 +65,7 @@
65
65
  <div class="control-group">
66
66
  <%= f.label :amount, "Refund amount", :class => "control-label" %>
67
67
  <div class="controls">
68
- <%= f.text_field :amount, :value => @payment.amount, :class => 'input-small' %>
68
+ <%= f.text_field :amount, :id => 'refund_amount', :value => @payment.amount, :class => 'input-small' %>
69
69
  <p class="help-inline"><%= @account.currency %></p>
70
70
  </div>
71
71
  </div>
@@ -87,3 +87,10 @@
87
87
  </div>
88
88
  </fieldset>
89
89
  <% end %>
90
+ <%= javascript_tag do %>
91
+ $(document).ready(function() {
92
+ $("#refund_amount").keydown(function(event) {
93
+ preventNonNumericValues(event);
94
+ });
95
+ });
96
+ <% end %>
@@ -30,9 +30,9 @@
30
30
  <td>
31
31
  <nobr>
32
32
  <% if sub.product_category == 'BASE' %>
33
- <% if sub.canceled_date.present? %>
33
+ <% if sub.canceled_date.present? && Time.parse(sub.canceled_date) > Time.now %>
34
34
  <%= link_to "Reinstate", kaui_engine.reinstate_subscription_path(:id => sub.subscription_id), :method => :put, :class => "btn btn-mini" %>
35
- <% else %>
35
+ <% elsif !sub.canceled_date.present? %>
36
36
  <%= link_to "Change", kaui_engine.edit_subscription_path(sub.subscription_id), :class => "btn btn-mini" %>
37
37
  <%= link_to "Cancel", kaui_engine.subscription_path(:id => sub.subscription_id), :method => :delete, :class => "btn btn-mini" %>
38
38
  <%= link_to "Add Addons", kaui_engine.new_subscription_path(:params => { :bundle_id => sub.bundle_id, :base_subscription => sub.product_name }), :class => "btn btn-mini" %>
@@ -25,7 +25,7 @@
25
25
  <div class="control-group">
26
26
  <%= label_tag :requested_date, 'Change Date:', :class => "control-label" %>
27
27
  <div class="controls">
28
- <%= text_field_tag :requested_date, nil, :class => 'input-xlarge date-picker' %>
28
+ <%= text_field_tag :requested_date, Time.now.utc.iso8601, :class => 'input-xlarge date-picker' %>
29
29
  </div>
30
30
  </div>
31
31
  <div class="form-actions">
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -12,4 +12,5 @@
12
12
  //
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
+ //= require validation
15
16
  //= require_tree .