kaui 0.6.6 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile.lock +51 -37
- data/README.md +5 -0
- data/Rakefile +1 -1
- data/app/controllers/kaui/account_emails_controller.rb +26 -44
- data/app/controllers/kaui/account_tags_controller.rb +26 -38
- data/app/controllers/kaui/account_timelines_controller.rb +47 -50
- data/app/controllers/kaui/accounts_controller.rb +68 -148
- data/app/controllers/kaui/bundle_tags_controller.rb +32 -21
- data/app/controllers/kaui/bundles_controller.rb +44 -69
- data/app/controllers/kaui/chargebacks_controller.rb +31 -61
- data/app/controllers/kaui/charges_controller.rb +19 -21
- data/app/controllers/kaui/credits_controller.rb +22 -36
- data/app/controllers/kaui/custom_fields_controller.rb +15 -13
- data/app/controllers/kaui/engine_controller.rb +8 -10
- data/app/controllers/kaui/invoice_items_controller.rb +24 -41
- data/app/controllers/kaui/invoices_controller.rb +36 -46
- data/app/controllers/kaui/payment_methods_controller.rb +84 -28
- data/app/controllers/kaui/payments_controller.rb +64 -26
- data/app/controllers/kaui/refunds_controller.rb +27 -107
- data/app/controllers/kaui/subscriptions_controller.rb +88 -132
- data/app/controllers/kaui/tag_definitions_controller.rb +32 -79
- data/app/controllers/kaui/tags_controller.rb +16 -14
- data/app/controllers/kaui/transactions_controller.rb +25 -0
- data/app/helpers/kaui/money_helper.rb +8 -0
- data/app/helpers/kaui/subscription_helper.rb +115 -0
- data/app/helpers/kaui/uuid_helper.rb +9 -0
- data/app/models/kaui/ability.rb +2 -2
- data/app/models/kaui/account.rb +25 -42
- data/app/models/kaui/account_email.rb +11 -48
- data/app/models/kaui/account_timeline.rb +1 -5
- data/app/models/kaui/audit_log.rb +1 -15
- data/app/models/kaui/base.rb +1 -126
- data/app/models/kaui/bundle.rb +47 -14
- data/app/models/kaui/catalog.rb +2 -0
- data/app/models/kaui/chargeback.rb +24 -36
- data/app/models/kaui/credit.rb +5 -20
- data/app/models/kaui/custom_field.rb +9 -5
- data/app/models/kaui/invoice.rb +9 -53
- data/app/models/kaui/invoice_item.rb +8 -18
- data/app/models/kaui/invoice_payment.rb +24 -0
- data/app/models/kaui/payment.rb +14 -32
- data/app/models/kaui/payment_method.rb +36 -0
- data/app/models/kaui/rails_methods.rb +7 -9
- data/app/models/kaui/refund.rb +5 -20
- data/app/models/kaui/subscription.rb +7 -27
- data/app/models/kaui/tag.rb +10 -6
- data/app/models/kaui/tag_definition.rb +26 -34
- data/app/models/kaui/transaction.rb +30 -0
- data/app/models/kaui/user.rb +2 -0
- data/app/views/kaui/account_emails/_form.html.erb +8 -28
- data/app/views/kaui/account_emails/show.html.erb +10 -10
- data/app/views/kaui/account_tags/_account_tags_table.html.erb +20 -18
- data/app/views/kaui/account_tags/_form.html.erb +42 -0
- data/app/views/kaui/account_tags/edit.html.erb +1 -41
- data/app/views/kaui/account_tags/show.html.erb +6 -3
- data/app/views/kaui/account_timelines/show.html.erb +273 -302
- data/app/views/kaui/accounts/_form.html.erb +116 -0
- data/app/views/kaui/accounts/index.html.erb +13 -11
- data/app/views/kaui/accounts/new.html.erb +5 -0
- data/app/views/kaui/accounts/show.html.erb +101 -99
- data/app/views/kaui/bundle_tags/_bundle_tags_table.html.erb +29 -9
- data/app/views/kaui/bundle_tags/_form.html.erb +41 -0
- data/app/views/kaui/bundle_tags/edit.html.erb +2 -34
- data/app/views/kaui/bundle_tags/show.html.erb +6 -0
- data/app/views/kaui/bundles/index.html.erb +9 -9
- data/app/views/kaui/bundles/show.html.erb +17 -15
- data/app/views/kaui/bundles/transfer.html.erb +25 -24
- data/app/views/kaui/chargebacks/_form.html.erb +44 -0
- data/app/views/kaui/chargebacks/new.html.erb +3 -115
- data/app/views/kaui/charges/_form.html.erb +73 -0
- data/app/views/kaui/charges/new.html.erb +2 -91
- data/app/views/kaui/credits/_form.html.erb +73 -0
- data/app/views/kaui/credits/new.html.erb +2 -85
- data/app/views/kaui/invoice_items/edit.html.erb +77 -78
- data/app/views/kaui/invoices/show.html.erb +3 -10
- data/app/views/kaui/layouts/kaui_application.html.erb +0 -2
- data/app/views/kaui/payment_methods/_form.html.erb +30 -0
- data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +19 -18
- data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +8 -5
- data/app/views/kaui/payment_methods/index.html.erb +10 -10
- data/app/views/kaui/payment_methods/new.html.erb +2 -20
- data/app/views/kaui/payment_methods/show.html.erb +2 -1
- data/app/views/kaui/payments/_payments_table.html.erb +30 -22
- data/app/views/kaui/payments/index.html.erb +1 -1
- data/app/views/kaui/payments/new.html.erb +5 -5
- data/app/views/kaui/payments/show.html.erb +3 -0
- data/app/views/kaui/refunds/new.html.erb +96 -104
- data/app/views/kaui/subscriptions/_form.html.erb +36 -0
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +39 -44
- data/app/views/kaui/subscriptions/edit.html.erb +24 -35
- data/app/views/kaui/subscriptions/index.html.erb +13 -12
- data/app/views/kaui/subscriptions/new.html.erb +6 -43
- data/app/views/kaui/subscriptions/show.html.erb +32 -25
- data/app/views/kaui/tag_definitions/_form.html.erb +10 -37
- data/app/views/kaui/tag_definitions/index.html.erb +3 -5
- data/app/views/kaui/tag_definitions/show.html.erb +1 -2
- data/app/views/kaui/transactions/_form.html.erb +77 -0
- data/app/views/kaui/transactions/new.html.erb +3 -0
- data/config/initializers/kilbill-client-init.rb +1 -1
- data/config/routes.rb +4 -15
- data/kaui.gemspec +8 -6
- data/lib/kaui/engine.rb +4 -1
- data/lib/kaui/version.rb +1 -1
- data/lib/kaui.rb +2 -2
- data/test/functional/kaui/account_emails_controller_test.rb +28 -0
- data/test/functional/kaui/account_tags_controller_test.rb +29 -0
- data/test/functional/kaui/account_timelines_controller_test.rb +21 -0
- data/test/functional/kaui/accounts_controller_test.rb +56 -50
- data/test/functional/kaui/bundle_tags_controller_test.rb +29 -0
- data/test/functional/kaui/bundles_controller_test.rb +58 -13
- data/test/functional/kaui/chargebacks_controller_test.rb +16 -5
- data/test/functional/kaui/charges_controller_test.rb +39 -0
- data/test/functional/kaui/credits_controller_test.rb +35 -0
- data/test/functional/kaui/custom_fields_controller_test.rb +21 -0
- data/test/functional/kaui/functional_test_helper.rb +61 -0
- data/test/functional/kaui/invoice_items_controller_test.rb +24 -10
- data/test/functional/kaui/invoices_controller_test.rb +41 -13
- data/test/functional/kaui/payment_methods_controller_test.rb +49 -0
- data/test/functional/kaui/payments_controller_test.rb +32 -5
- data/test/functional/kaui/refunds_controller_test.rb +40 -5
- data/test/functional/kaui/subscriptions_controller_test.rb +82 -0
- data/test/functional/kaui/tag_definitions_controller_test.rb +27 -53
- data/test/functional/kaui/tags_controller_test.rb +21 -0
- data/test/functional/kaui/transactions_controller_test.rb +32 -0
- data/test/integration/kaui/integration_test_helper.rb +31 -0
- data/test/integration/kaui/navigation_test.rb +43 -0
- data/test/killbill_test_helper.rb +143 -0
- data/test/test_helper.rb +10 -227
- data/test/unit/kaui/account_email_test.rb +19 -0
- data/test/unit/kaui/account_test.rb +7 -35
- data/test/unit/kaui/base_test.rb +5 -46
- data/test/unit/kaui/date_helper_test.rb +6 -5
- data/test/unit/kaui/invoice_item_test.rb +5 -17
- data/test/unit/kaui/invoice_payment_test.rb +42 -0
- data/test/unit/kaui/invoice_test.rb +15 -15
- data/test/unit/kaui/money_helper_test.rb +10 -0
- data/test/unit/kaui/payment_test.rb +42 -0
- data/test/unit/kaui/tag_definition_test.rb +5 -28
- data/test/unit/kaui/uuid_helper_test.rb +10 -0
- metadata +134 -159
- data/app/controllers/kaui/analytics_controller.rb +0 -28
- data/app/helpers/kaui/killbill_helper.rb +0 -611
- data/app/models/kaui/analytics.rb +0 -19
- data/app/models/kaui/analytics_sanity.rb +0 -7
- data/app/models/kaui/business_account.rb +0 -12
- data/app/models/kaui/business_field.rb +0 -6
- data/app/models/kaui/business_invoice.rb +0 -31
- data/app/models/kaui/business_invoice_item.rb +0 -17
- data/app/models/kaui/business_invoice_payment.rb +0 -25
- data/app/models/kaui/business_overdue_status.rb +0 -8
- data/app/models/kaui/business_snapshot.rb +0 -9
- data/app/models/kaui/business_subscription_transition.rb +0 -53
- data/app/models/kaui/business_tag.rb +0 -5
- data/app/models/kaui/charge.rb +0 -14
- data/app/models/kaui/entitlement.rb +0 -2
- data/app/models/kaui/event.rb +0 -13
- data/app/models/kaui/external_payment.rb +0 -15
- data/app/models/kaui/overdue_state.rb +0 -10
- data/app/models/kaui/payment_attempt.rb +0 -27
- data/app/models/kaui/product.rb +0 -24
- data/app/models/kaui/time_series_data.rb +0 -8
- data/app/views/kaui/analytics/account_snapshot.html.erb +0 -211
- data/app/views/kaui/analytics/index.html.erb +0 -17
- data/app/views/kaui/chargebacks/index.html.erb +0 -14
- data/app/views/kaui/chargebacks/show.html.erb +0 -19
- data/app/views/kaui/credits/index.html.erb +0 -14
- data/app/views/kaui/credits/show.html.erb +0 -19
- data/app/views/kaui/invoice_items/index.html.erb +0 -20
- data/app/views/kaui/invoice_items/show.html.erb +0 -31
- data/app/views/kaui/refunds/_refunds_table.html.erb +0 -31
- data/app/views/kaui/refunds/index.html.erb +0 -43
- data/app/views/kaui/refunds/show.html.erb +0 -33
- data/app/views/kaui/tag_definitions/edit.html.erb +0 -3
- data/test/dummy/test/fixtures/accounts.yml +0 -32
- data/test/dummy/test/fixtures/bill_cycle_days.yml +0 -3
- data/test/dummy/test/fixtures/bundles.yml +0 -4
- data/test/dummy/test/fixtures/invoice_items.yml +0 -13
- data/test/dummy/test/fixtures/invoices.yml +0 -11
- data/test/dummy/test/fixtures/overdue_states.yml +0 -8
- data/test/dummy/test/fixtures/payment_methods.yml +0 -5
- data/test/dummy/test/fixtures/plugin_info_properties.yml +0 -59
- data/test/dummy/test/fixtures/plugin_infos.yml +0 -2
- data/test/dummy/test/fixtures/refunds.yml +0 -9
- data/test/dummy/test/fixtures/tag_definitions.yml +0 -20
- data/test/functional/kaui/account_timeline_controller_test.rb +0 -9
- data/test/functional/kaui/extpayments_controller_test.rb +0 -9
- data/test/functional/kaui/home_controller_test.rb +0 -11
- data/test/integration/navigation_test.rb +0 -10
- data/test/kaui_test.rb +0 -7
- data/test/unit/helpers/kaui/account_timeline_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/bundles_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/chargebacks_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/extpayments_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/home_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/invoices_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/payments_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/refunds_helper_test.rb +0 -6
- data/test/unit/kaui/overdue_state_test.rb +0 -18
- data/test/unit/kaui/refund_test.rb +0 -20
- data/test/unit/model_test.rb +0 -151
@@ -1,123 +1,115 @@
|
|
1
1
|
<div class="page-header">
|
2
2
|
<h1>Refund Payment</h1>
|
3
3
|
</div>
|
4
|
-
<%= form_for(@refund, :url => {
|
5
|
-
|
6
|
-
<%= hidden_field_tag :
|
7
|
-
<%= hidden_field_tag :
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
</
|
4
|
+
<%= form_for(@refund, :url => {:action => :create}, :html => {:class => "form-horizontal"}) do |f| %>
|
5
|
+
<%= hidden_field_tag :account_id, @account.account_id %>
|
6
|
+
<%= hidden_field_tag :payment_id, @payment.payment_id %>
|
7
|
+
<%= hidden_field_tag :invoice_id, @invoice.invoice_id %>
|
8
|
+
<fieldset>
|
9
|
+
<div class="control-group">
|
10
|
+
<label class="control-label">Date</label>
|
11
|
+
<div class="controls">
|
12
|
+
<label class="checkbox">
|
13
|
+
<%= DateTime.now.to_s(:pretty) %>
|
14
|
+
</label>
|
15
|
+
</div>
|
16
16
|
</div>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<label class="checkbox">
|
17
|
+
<div class="control-group">
|
18
|
+
<label class="control-label">Invoice number</label>
|
19
|
+
<div class="controls">
|
20
|
+
<label class="checkbox">
|
22
21
|
<%= @invoice.invoice_number %><br/>
|
23
|
-
|
24
|
-
|
25
|
-
</div>
|
26
|
-
<div class="control-group">
|
27
|
-
<label class="control-label">Account name</label>
|
28
|
-
<div class="controls">
|
29
|
-
<label class="checkbox">
|
30
|
-
<%= @account.name %><br/>
|
31
|
-
<%= @account.email %>
|
32
|
-
</label>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
<div class="control-group">
|
36
|
-
<label class="control-label">Status</label>
|
37
|
-
<div class="controls">
|
38
|
-
<label class="checkbox">
|
39
|
-
<%= @payment.status %>
|
40
|
-
</label>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
<div class="control-group">
|
44
|
-
<%= f.label :adjustment_type, "Adjustment Type", :class => "control-label" %>
|
45
|
-
<div class="controls">
|
46
|
-
<label class="radio">
|
47
|
-
<%= f.radio_button :adjustment_type, 'noInvoiceAdjustment', :checked => true %>
|
48
|
-
No Invoice Adjustment
|
49
|
-
</label>
|
22
|
+
</label>
|
23
|
+
</div>
|
50
24
|
</div>
|
51
|
-
|
25
|
+
<div class="control-group">
|
26
|
+
<label class="control-label">Account name</label>
|
52
27
|
<div class="controls">
|
53
|
-
<label class="
|
54
|
-
<%=
|
55
|
-
|
28
|
+
<label class="checkbox">
|
29
|
+
<%= @account.name %><br/>
|
30
|
+
<%= @account.email %>
|
56
31
|
</label>
|
57
32
|
</div>
|
58
|
-
|
59
|
-
|
33
|
+
</div>
|
34
|
+
<div class="control-group">
|
35
|
+
<%= label_tag :adjustment_type, 'Adjustment Type', :class => 'control-label' %>
|
60
36
|
<div class="controls">
|
61
37
|
<label class="radio">
|
62
|
-
<%=
|
38
|
+
<%= radio_button_tag :adjustment_type, 'noInvoiceAdjustment', :checked => true %>
|
39
|
+
No Invoice Adjustment
|
40
|
+
</label>
|
41
|
+
</div>
|
42
|
+
<% if can? :adjust, Kaui::Invoice %>
|
43
|
+
<div class="controls">
|
44
|
+
<label class="radio">
|
45
|
+
<%= radio_button_tag :adjustment_type, 'invoiceAdjustment' %>
|
46
|
+
Invoice Adjustment
|
47
|
+
</label>
|
48
|
+
</div>
|
49
|
+
<% end %>
|
50
|
+
<% if can? :item_adjust, Kaui::Invoice %>
|
51
|
+
<div class="controls">
|
52
|
+
<label class="radio">
|
53
|
+
<%= radio_button_tag :adjustment_type, 'invoiceItemAdjustment' %>
|
63
54
|
Invoice Item Adjustment
|
55
|
+
</label>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
</div>
|
59
|
+
<div id="invoiceItems" style="display:none">
|
60
|
+
<% @invoice.items.each_with_index do |ii, index| %>
|
61
|
+
<% if ii.amount > 0 %>
|
62
|
+
<div id=<%= "div_#{ii.invoice_item_id}" %> class="control-group">
|
63
|
+
<label class="control-label"></label>
|
64
|
+
|
65
|
+
<div class="controls">
|
66
|
+
<input type="checkbox" id=<%= "cb_adj_#{ii.invoice_item_id}" %>>
|
67
|
+
<%= "Item #{index + 1} : #{ii.description} " %>
|
68
|
+
<%= text_field_tag "adjustments[#{ii.invoice_item_id}]", index, :id => "tf_adj_#{ii.invoice_item_id}", :value => ii.amount, :class => 'input-small' %>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
<% end %>
|
72
|
+
<% end %>
|
73
|
+
</div>
|
74
|
+
<div class="control-group">
|
75
|
+
<label class="control-label">Paid Amount</label>
|
76
|
+
<div class="controls">
|
77
|
+
<label class="checkbox">
|
78
|
+
<%= @payment.purchased_amount %> <%= @account.currency if @payment.purchased_amount.present? %>
|
64
79
|
</label>
|
65
80
|
</div>
|
66
|
-
<% end %>
|
67
|
-
</div>
|
68
|
-
<div id="invoiceItems" style="display:none">
|
69
|
-
<% @invoice.items.each_with_index do |ii, index | %>
|
70
|
-
<% if ii.amount > 0 and ii.subscription_id.present? %>
|
71
|
-
<div id=<%= "div_#{ii.invoice_item_id}" %> class="control-group">
|
72
|
-
<label class="control-label"></label>
|
73
|
-
<div class="controls">
|
74
|
-
<input type="checkbox" id=<%= "cb_adj_#{ii.invoice_item_id}" %>>
|
75
|
-
<%= "Item #{index + 1} : #{ii.description} " %>
|
76
|
-
<%= text_field_tag "adjustments[#{ii.invoice_item_id}]", index, :id => "tf_adj_#{ii.invoice_item_id}" , :value => ii.amount, :class => 'input-small' %>
|
77
|
-
</div>
|
78
|
-
</div>
|
79
|
-
<% end %>
|
80
|
-
<% end %>
|
81
|
-
</div>
|
82
|
-
<div class="control-group">
|
83
|
-
<label class="control-label">Paid Amount</label>
|
84
|
-
<div class="controls">
|
85
|
-
<label class="checkbox">
|
86
|
-
<%= @payment.paid_amount %> <%= @account.currency if @payment.paid_amount.present? %>
|
87
|
-
</label>
|
88
81
|
</div>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
82
|
+
<div id="div_refund_amount" class="control-group">
|
83
|
+
<%= label_tag :amount, 'Refund amount', :class => 'control-label' %>
|
84
|
+
<div class="controls">
|
85
|
+
<%= text_field_tag :amount, @payment.purchased_amount, :id => 'refund_amount', :class => 'input-small' %>
|
86
|
+
<p class="help-inline"><%= @account.currency %></p>
|
87
|
+
</div>
|
95
88
|
</div>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
89
|
+
<div class="control-group">
|
90
|
+
<%= label_tag :reason, "Reason", :class => "control-label" %>
|
91
|
+
<div class="controls">
|
92
|
+
<%= select_tag :reason, options_for_select(Kaui::Refund::SAMPLE_REASON_CODES) %>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="control-group">
|
96
|
+
<%= label_tag :comment, "Comment", :class => "control-label" %>
|
97
|
+
<div class="controls">
|
98
|
+
<%= text_area_tag :comment, "", :rows => 3, :class => 'input-xlarge' %>
|
99
|
+
</div>
|
101
100
|
</div>
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
<div class="controls">
|
106
|
-
<%= text_area_tag :comment, "", :rows => 3, :class => 'input-xlarge' %>
|
101
|
+
<div class="form-actions">
|
102
|
+
<%= button_tag "Create refund", :id => "submit", :class => "btn btn-primary" %>
|
103
|
+
<%= link_to 'Back', :back, :class => 'btn' %>
|
107
104
|
</div>
|
108
|
-
</
|
109
|
-
<div class="form-actions">
|
110
|
-
<%= button_tag "Create refund", :id => "submit", :class =>"btn btn-primary" %>
|
111
|
-
<%= link_to 'Back', :back, :class => 'btn' %>
|
112
|
-
</div>
|
113
|
-
</fieldset>
|
105
|
+
</fieldset>
|
114
106
|
<% end %>
|
115
107
|
<%= javascript_tag do %>
|
116
108
|
|
117
109
|
var textToDivId = function(textId) {
|
118
110
|
return "div_" + textId.split("tf_adj_")[1];
|
119
111
|
};
|
120
|
-
|
112
|
+
|
121
113
|
var textToCheckboxId = function(textId) {
|
122
114
|
return "cb_adj_" + textId.split("tf_adj_")[1];
|
123
115
|
};
|
@@ -125,7 +117,7 @@
|
|
125
117
|
var checkboxToTextId = function(cbId) {
|
126
118
|
return "tf_adj_" + cbId.split("cb_adj_")[1];
|
127
119
|
};
|
128
|
-
|
120
|
+
|
129
121
|
var setClassForElement = function(id, newClass) {
|
130
122
|
var currentClasses = $(id).attr('class').split(' ');
|
131
123
|
for (var i=0; i<currentClasses.length; i++) {
|
@@ -144,7 +136,7 @@
|
|
144
136
|
};
|
145
137
|
|
146
138
|
var validateRefundAmount = function() {
|
147
|
-
if (Number($("#refund_amount").attr('value')) > <%= @payment.
|
139
|
+
if (Number($("#refund_amount").attr('value')) > <%= @payment.purchased_amount %> ||
|
148
140
|
Number($("#refund_amount").attr('value')) <= 0) {
|
149
141
|
setClassForElement("#div_refund_amount", "control-group error");
|
150
142
|
$("#submit").prop('disabled', true);
|
@@ -174,8 +166,8 @@
|
|
174
166
|
* _ For Invoice adjustment or no adjustment, default to payment amount
|
175
167
|
*/
|
176
168
|
var recomputeRefundAmountAndValidateAmount = function() {
|
177
|
-
var computedRefundAmount = <%= @payment.
|
178
|
-
if ($("#
|
169
|
+
var computedRefundAmount = <%= @payment.purchased_amount %>;
|
170
|
+
if ($("#adjustment_type_invoiceItemAdjustment").is(':checked')) {
|
179
171
|
var x = 0; $('input').filter(function() { return this.id.match(/tf_adj_/) }).each(function() {
|
180
172
|
var id = textToCheckboxId(this.id);
|
181
173
|
if ($("#" + id).is(':checked')) {
|
@@ -191,7 +183,7 @@
|
|
191
183
|
}
|
192
184
|
validateRefundAmount();
|
193
185
|
};
|
194
|
-
|
186
|
+
|
195
187
|
/*
|
196
188
|
* When clicking checkbox for each item, disable amount and recompute total refund amount
|
197
189
|
*/
|
@@ -250,11 +242,11 @@
|
|
250
242
|
/*
|
251
243
|
* Adjustment type handlers
|
252
244
|
*/
|
253
|
-
$("#
|
245
|
+
$("#adjustment_type_noInvoiceAdjustment")
|
254
246
|
.click(onClickWithInvoiceOrNoAdjustment);
|
255
|
-
$("#
|
247
|
+
$("#adjustment_type_invoiceAdjustment")
|
256
248
|
.click(onClickWithInvoiceOrNoAdjustment);
|
257
|
-
$("#
|
249
|
+
$("#adjustment_type_invoiceItemAdjustment")
|
258
250
|
.click(onClickWithInvoiceItemAdjustment);
|
259
251
|
|
260
252
|
/*
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= form_for(@subscription, :html => {:class => 'form-horizontal'}) do |f| %>
|
2
|
+
<fieldset>
|
3
|
+
<%= f.hidden_field :bundle_id %>
|
4
|
+
<%= f.hidden_field :account_id %>
|
5
|
+
<%= f.hidden_field :product_category %>
|
6
|
+
<% if @subscription.product_category == 'ADD_ON' %>
|
7
|
+
<%= hidden_field_tag :base_product_name, @base_product_name %>
|
8
|
+
<div class="control-group">
|
9
|
+
<%= label_tag :plan_name, 'Available Plans:', :class => 'control-label' %>
|
10
|
+
<div class="controls">
|
11
|
+
<%= select_tag :plan_name, options_for_select(@plans) %>
|
12
|
+
<p class="help-block">
|
13
|
+
Proration on customer's invoice will be done automatically.
|
14
|
+
</p>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<% else %>
|
18
|
+
<div class="control-group">
|
19
|
+
<%= f.label :external_key, 'Bundle External Key:', :class => 'control-label' %>
|
20
|
+
<div class="controls">
|
21
|
+
<%= f.text_field :external_key, :class => 'input-xlarge', :id => 'external_key' %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<div class="control-group">
|
25
|
+
<%= label_tag :plan_name, 'Available Plans:', :class => 'control-label' %>
|
26
|
+
<div class="controls">
|
27
|
+
<%= select_tag :plan_name, options_for_select(@plans) %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
<div class="form-actions">
|
32
|
+
<%= f.submit 'Create Subscription', :class => 'btn btn-primary' %>
|
33
|
+
<%= link_to 'Back', :back, :class => 'btn' %>
|
34
|
+
</div>
|
35
|
+
</fieldset>
|
36
|
+
<% end %>
|
@@ -3,54 +3,49 @@
|
|
3
3
|
</div>
|
4
4
|
<table class="table table-condensed table-striped data-table">
|
5
5
|
<thead>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
<tr>
|
7
|
+
<th>Product category</th>
|
8
|
+
<th>Product name</th>
|
9
|
+
<th>Start date</th>
|
10
|
+
<th>Charged through date</th>
|
11
|
+
<th>Notes</th>
|
12
|
+
<th>Actions</th>
|
13
|
+
</tr>
|
14
14
|
</thead>
|
15
15
|
<tbody>
|
16
|
-
|
16
|
+
<% if subscriptions.present? && !subscriptions.nil? %>
|
17
17
|
<% subscriptions.each do |sub| %>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
</div>
|
46
|
-
<% if sub.product_category == 'BASE' %>
|
47
|
-
<%= link_to "Add Addons", kaui_engine.new_subscription_path(:params => { :bundle_id => sub.bundle_id, :base_subscription => sub.product_name, :product_category => "ADD_ON" }), :class => "btn btn-mini" %>
|
48
|
-
<% end %>
|
18
|
+
<tr>
|
19
|
+
<td><%= humanized_product_category(sub) %></td>
|
20
|
+
<td><%= humanized_full_product_name(sub) %></td>
|
21
|
+
<td><%= humanized_start_date(sub, account) %></td>
|
22
|
+
<td><%= humanized_charged_through_date(sub, account) %></td>
|
23
|
+
<td><%= humanized_cancelled_date(sub, account) %></td>
|
24
|
+
<td>
|
25
|
+
<%= link_to 'Details', kaui_engine.subscription_path(:id => sub.subscription_id), :class => 'btn btn-mini' %>
|
26
|
+
<% if is_future_cancelled?(sub) %>
|
27
|
+
<%= link_to 'Reinstate', kaui_engine.reinstate_subscription_path(:id => sub.subscription_id), :method => :put, :class => 'btn btn-mini' %>
|
28
|
+
<% elsif is_cancelled?(sub) %>
|
29
|
+
<%= link_to 'Change', kaui_engine.edit_subscription_path(sub.subscription_id), :class => 'btn btn-mini' %>
|
30
|
+
<div class="btn-group">
|
31
|
+
<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
|
32
|
+
Cancel
|
33
|
+
<span class="caret"></span>
|
34
|
+
</a>
|
35
|
+
<ul class="dropdown-menu">
|
36
|
+
<li><%= link_to 'Cancel (default policy)', kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'END_OF_TERM'), :method => :delete %></li>
|
37
|
+
<li><%= link_to 'Cancel at previous CTD (no proration)', kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'IMMEDIATE', :ctd => sub.charged_through_date, :billing_period => sub.billing_period), :method => :delete %></li>
|
38
|
+
<li><%= link_to 'Cancel immediately (generate proration)', kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'IMMEDIATE'), :method => :delete %></li>
|
39
|
+
<li><%= link_to 'Cancel end of term', kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'END_OF_TERM'), :method => :delete %></li>
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
<% if sub.product_category == 'BASE' %>
|
43
|
+
<%= link_to 'Add add-ons', kaui_engine.new_subscription_path(:params => {:bundle_id => sub.bundle_id, :base_product_name => sub.product_name, :product_category => 'ADD_ON'}), :class => 'btn btn-mini' %>
|
44
|
+
<% end %>
|
49
45
|
<% end %>
|
50
|
-
</
|
51
|
-
</
|
52
|
-
</tr>
|
46
|
+
</td>
|
47
|
+
</tr>
|
53
48
|
<% end %>
|
54
|
-
|
49
|
+
<% end %>
|
55
50
|
</tbody>
|
56
51
|
</table>
|
@@ -1,41 +1,30 @@
|
|
1
|
-
<% @page_title =
|
2
|
-
<%= form_for(@subscription, :
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<label class="checkbox">
|
9
|
-
<%= @account.timezone %>
|
10
|
-
</label>
|
1
|
+
<% @page_title = 'Edit Subscription' %>
|
2
|
+
<%= form_for(@subscription, :url => subscription_path(@subscription.subscription_id), :html => {:method => :put, :class => 'form-horizontal'}) do |f| %>
|
3
|
+
<div class="control-group">
|
4
|
+
<%= label_tag :current_plan, 'Current plan:', :class => 'control-label' %>
|
5
|
+
<div class="controls">
|
6
|
+
<%= text_field_tag :current_plan, @current_plan, :class => 'input-xlarge disabled', :disabled => 'disabled' %>
|
7
|
+
</div>
|
11
8
|
</div>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
<div class="control-group">
|
10
|
+
<%= label_tag :plan_name, 'New plan:', :class => 'control-label' %>
|
11
|
+
<div class="controls">
|
12
|
+
<%= select_tag :plan_name, options_for_select(@plans) %>
|
13
|
+
</div>
|
17
14
|
</div>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
<div class="control-group">
|
16
|
+
<%= label_tag :requested_date, 'Change Date:', :class => 'control-label' %>
|
17
|
+
<div class="controls">
|
18
|
+
<%= text_field_tag :requested_date, Date.parse(Time.now.to_s).to_s, :class => 'input-xlarge date-picker' %>
|
19
|
+
</div>
|
23
20
|
</div>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
<div class="control-group">
|
22
|
+
<%= label_tag :policy, 'Policy Override (leave blank for default; select an option to force plan change):', :class => 'control-label' %>
|
23
|
+
<div class="controls">
|
24
|
+
<%= select_tag :policy, options_for_select(['', 'IMMEDIATE', 'END_OF_TERM']) %>
|
25
|
+
</div>
|
29
26
|
</div>
|
30
|
-
|
31
|
-
|
32
|
-
<%= label_tag :policy, "Policy Override (leave blank for default; select an option to force plan change):", :class => "control-label" %>
|
33
|
-
<div class="controls">
|
34
|
-
<%= select_tag :policy, options_for_select(['', 'IMMEDIATE', 'END_OF_TERM']) %>
|
27
|
+
<div class="form-actions">
|
28
|
+
<%= f.submit 'Change', :class => 'btn btn-primary' %>
|
35
29
|
</div>
|
36
|
-
</div>
|
37
|
-
<div class="form-actions">
|
38
|
-
<%= f.submit "Change", :class => 'btn btn-primary' %>
|
39
|
-
<%= link_to 'Back', :back, :class => 'btn' %>
|
40
|
-
</div>
|
41
30
|
<% end %>
|
@@ -1,14 +1,15 @@
|
|
1
|
-
<%= form_tag subscriptions_path, :class =>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<%= form_tag subscriptions_path, :class => 'form-horizontal', :method => :get do %>
|
2
|
+
<fieldset>
|
3
|
+
<legend>Please enter subscription id</legend>
|
4
|
+
<div class="control-group">
|
5
|
+
<label class="control-label" for="subscription_id">Subscription</label>
|
6
|
+
|
7
|
+
<div class="controls">
|
8
|
+
<%= text_field_tag 'subscription_id', nil, :class => 'input-xlarge', :id => 'subscription_id' %>
|
9
|
+
</div>
|
8
10
|
</div>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
</
|
13
|
-
</fieldset>
|
11
|
+
<div class="form-actions">
|
12
|
+
<%= button_tag 'Search', :class => 'btn btn-primary' %>
|
13
|
+
</div>
|
14
|
+
</fieldset>
|
14
15
|
<% end %>
|
@@ -1,49 +1,12 @@
|
|
1
1
|
<div class="page-header">
|
2
|
-
<% if @product_category ==
|
3
|
-
<h1>Add
|
2
|
+
<% if @subscription.product_category == 'ADD_ON' %>
|
3
|
+
<h1>Add add-on subscription
|
4
4
|
<% if @bundle.external_key %> to <%= Kaui.bundle_key_display_string.call(@bundle.external_key) %>
|
5
|
-
<% end
|
5
|
+
<% end %>
|
6
|
+
</h1>
|
6
7
|
<% else %>
|
7
|
-
<h1>Create new base subscription
|
8
|
-
<% if @account_id %> to account <%= @account_id %>
|
9
|
-
<% end %></h1>
|
8
|
+
<h1>Create new base subscription to account <%= @subscription.account_id %></h1>
|
10
9
|
<% end %>
|
11
10
|
</div>
|
12
|
-
<%= form_for(@subscription, :url => {:action => :create}, :html => {:class => "form-horizontal"}) do |f| %>
|
13
|
-
<fieldset>
|
14
|
-
<% if @product_category == "ADD_ON" %>
|
15
|
-
<%= f.hidden_field :bundle_id %>
|
16
|
-
<%= f.hidden_field :product_category %>
|
17
|
-
<%= hidden_field_tag :base_subscription, @base_subscription %>
|
18
|
-
<div class="control-group">
|
19
|
-
<%= label_tag :plan_name, "Available Plans:", :class => "control-label" %>
|
20
|
-
<div class="controls">
|
21
|
-
<%= select_tag :plan_name, options_for_select(@catalog.keys, @plan_name) %>
|
22
|
-
<p class="help-block">
|
23
|
-
Proration on customer's invoice will be done automatically.
|
24
|
-
</p>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
<% else %>
|
28
|
-
<%= f.hidden_field :account_id %>
|
29
|
-
<%= f.hidden_field :product_category %>
|
30
|
-
<div class="control-group">
|
31
|
-
<%= label_tag :external_key, "Bundle External Key:", :class => "control-label" %>
|
32
|
-
<div class="controls">
|
33
|
-
<%= text_field_tag :external_key, params[:external_key], :class => 'input-xlarge', :id => "external_key" %>
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
<div class="control-group">
|
37
|
-
<%= label_tag :plan_name, "Available Plans:", :class => "control-label" %>
|
38
|
-
<div class="controls">
|
39
|
-
<%= select_tag :plan_name, options_for_select(@catalog.keys, @plan_name) %>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
<% end %>
|
43
|
-
<div class="form-actions">
|
44
|
-
<%= f.submit 'Create Subscription', :class => 'btn btn-primary' %>
|
45
|
-
<%= link_to 'Back', :back, :class => 'btn' %>
|
46
|
-
</div>
|
47
11
|
|
48
|
-
|
49
|
-
<% end %>
|
12
|
+
<%= render 'form' %>
|
@@ -1,26 +1,33 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
<div class="page-header">
|
2
|
+
<h2>Subscription <%= @subscription.subscription_id %></h2>
|
3
|
+
</div>
|
4
|
+
<dl class="dl-horizontal">
|
5
|
+
<dt>Category</dt>
|
6
|
+
<dd><%= humanized_product_category(@subscription) || ' '.html_safe %></dd>
|
7
|
+
<dt>Product</dt>
|
8
|
+
<dd><%= humanized_product_name(@subscription) || ' '.html_safe %></dd>
|
9
|
+
<dt>Period</dt>
|
10
|
+
<dd><%= humanized_billing_period(@subscription) || ' '.html_safe %></dd>
|
11
|
+
<dt>Charged through</dt>
|
12
|
+
<dd><%= humanized_charged_through_date(@subscription, @account) || ' '.html_safe %>
|
13
|
+
<dt>Price list</dt>
|
14
|
+
<dd><%= humanized_price_list(@subscription) || ' '.html_safe %></dd>
|
15
|
+
<dt>Start date</dt>
|
16
|
+
<dd><%= humanized_start_date(@subscription, @account) || ' '.html_safe %></dd>
|
17
|
+
<dt>Cancelled date</dt>
|
18
|
+
<dd><%= humanized_cancelled_date(@subscription, @account) || ' '.html_safe %></dd>
|
19
|
+
<dt>Billing start date</dt>
|
20
|
+
<dd><%= humanized_billing_start_date(@subscription, @account) || ' '.html_safe %></dd>
|
21
|
+
<dt>Billing end date</dt>
|
22
|
+
<dd><%= humanized_billing_end_date(@subscription, @account) || ' '.html_safe %></dd>
|
23
|
+
</dl>
|
24
|
+
<hr/>
|
25
|
+
<% if is_future_cancelled?(@subscription) %>
|
26
|
+
<%= link_to 'Reinstate', kaui_engine.reinstate_subscription_path(:id => sub.subscription_id), :method => :put, :class => 'btn btn-mini' %>
|
27
|
+
<% elsif is_cancelled?(@subscription) %>
|
28
|
+
<%= link_to 'Change', kaui_engine.edit_subscription_path(@subscription.subscription_id), :class => 'btn btn-mini' %>
|
29
|
+
<%= link_to 'Cancel', kaui_engine.subscription_path(@subscription.subscription_id), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini' %>
|
30
|
+
<%= link_to 'Add Addons', kaui_engine.new_subscription_path(:params => {:bundle_id => @subscription.bundle_id, :base_product_name => @subscription.product_name, :product_category => 'ADD_ON'}), :class => 'btn btn-mini' %>
|
25
31
|
<% end %>
|
26
|
-
|
32
|
+
|
33
|
+
<%= link_to 'Go to bundle', kaui_engine.bundle_path(@subscription.bundle_id), :class => 'btn btn-mini' %>
|