kaui 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/kaui/account_timelines_controller.rb +2 -6
- data/app/controllers/kaui/accounts_controller.rb +10 -5
- data/app/controllers/kaui/audit_logs_controller.rb +1 -1
- data/app/controllers/kaui/payments_controller.rb +10 -6
- data/app/helpers/kaui/subscription_helper.rb +1 -1
- data/app/models/kaui/account.rb +7 -0
- data/app/models/kaui/invoice.rb +1 -1
- data/app/models/kaui/payment.rb +7 -0
- data/app/views/kaui/account_timelines/_multi_functions_bar.html.erb +0 -29
- data/app/views/kaui/accounts/_multi_functions_bar.html.erb +11 -29
- data/app/views/kaui/accounts/index.html.erb +45 -44
- data/app/views/kaui/audit_logs/_multi_functions_bar.html.erb +0 -29
- data/app/views/kaui/audit_logs/index.html.erb +7 -0
- data/app/views/kaui/invoices/_multi_functions_bar.html.erb +10 -28
- data/app/views/kaui/invoices/index.html.erb +15 -12
- data/app/views/kaui/payments/_multi_functions_bar.html.erb +10 -31
- data/app/views/kaui/payments/index.html.erb +14 -10
- data/lib/kaui/version.rb +1 -1
- data/lib/kaui.rb +24 -13
- metadata +5 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1d09c53f971465792983fa62e85842cf0f7807e429793bcfaf298129fc30720
|
|
4
|
+
data.tar.gz: 4536845ab8261e1e16ef4d9a8caba638e62fd4b02090fe0142430fb4d988e8ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3f5018cfde24d5a5a53634a3b4098bb45cd439e0bcad1497163bb928737e6b628b6af430f4e3ff4ba792ed0e72c25c57f7a34f20a49480480383c35e4ddf741
|
|
7
|
+
data.tar.gz: e4079ed0b2ec629b9fb1ea6fbbc4d617515ec78e2cc75cc4b2742578164c14e8b2d344ebeebba5e3ca83a7a100cf844f0d65cef93d0d770d7743c94444bbb8a9
|
|
@@ -34,20 +34,16 @@ module Kaui
|
|
|
34
34
|
|
|
35
35
|
def download
|
|
36
36
|
timeline = Kaui::AccountTimeline.find_by_account_id(params.require(:account_id), 'FULL', options_for_klient)
|
|
37
|
-
start_date = params[:startDate]
|
|
38
|
-
end_date = params[:endDate]
|
|
39
37
|
start_date = begin
|
|
40
|
-
Date.parse(
|
|
38
|
+
Date.parse(params[:startDate])
|
|
41
39
|
rescue StandardError
|
|
42
40
|
nil
|
|
43
41
|
end
|
|
44
42
|
end_date = begin
|
|
45
|
-
Date.parse(
|
|
43
|
+
Date.parse(params[:endDate])
|
|
46
44
|
rescue StandardError
|
|
47
45
|
nil
|
|
48
46
|
end
|
|
49
|
-
start_date = params[:startDate].present? ? Date.parse(params[:startDate]) : nil
|
|
50
|
-
end_date = params[:endDate].present? ? Date.parse(params[:endDate]) : nil
|
|
51
47
|
|
|
52
48
|
event_type = params[:eventType]
|
|
53
49
|
@account = timeline.account
|
|
@@ -53,11 +53,16 @@ module Kaui
|
|
|
53
53
|
end_date = params[:endDate]
|
|
54
54
|
all_fields_checked = params[:allFieldsChecked] == 'true'
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
if all_fields_checked
|
|
57
|
+
columns = KillBillClient::Model::AccountAttributes.instance_variable_get('@json_attributes')
|
|
58
|
+
else
|
|
59
|
+
columns = params.require(:columnsString).split(',').map { |attr| attr.split.join('_').downcase }
|
|
60
|
+
Kaui::Account::REMAPPING_FIELDS.each do |k, v|
|
|
61
|
+
index = columns.index(v)
|
|
62
|
+
columns[index] = k if index
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
61
66
|
start_date = begin
|
|
62
67
|
Date.parse(start_date)
|
|
63
68
|
rescue StandardError
|
|
@@ -19,11 +19,15 @@ module Kaui
|
|
|
19
19
|
start_date = params[:startDate]
|
|
20
20
|
end_date = params[:endDate]
|
|
21
21
|
all_fields_checked = params[:allFieldsChecked] == 'true'
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if all_fields_checked
|
|
23
|
+
columns = KillBillClient::Model::PaymentAttributes.instance_variable_get('@json_attributes') - %w[transactions audit_logs]
|
|
24
|
+
else
|
|
25
|
+
columns = params.require(:columnsString).split(',').map { |attr| attr.split.join('_').downcase }
|
|
26
|
+
Kaui::Payment::REMAPPING_FIELDS.each do |k, v|
|
|
27
|
+
index = columns.index(v)
|
|
28
|
+
columns[index] = k if index
|
|
29
|
+
end
|
|
30
|
+
end
|
|
27
31
|
|
|
28
32
|
kb_params = {}
|
|
29
33
|
kb_params[:startDate] = Date.parse(start_date).strftime('%Y-%m-%d') if start_date
|
|
@@ -39,7 +43,7 @@ module Kaui
|
|
|
39
43
|
created_date = nil
|
|
40
44
|
payment.transactions.each do |transaction|
|
|
41
45
|
transaction_date = Date.parse(transaction.effective_date)
|
|
42
|
-
created_date
|
|
46
|
+
created_date = transaction_date if created_date.nil? || (transaction_date < created_date)
|
|
43
47
|
end
|
|
44
48
|
payment.payment_date = created_date
|
|
45
49
|
end
|
|
@@ -98,7 +98,7 @@ module Kaui
|
|
|
98
98
|
''
|
|
99
99
|
else
|
|
100
100
|
current_plan = sub.prices.select { |price| price['phaseType'] == sub.phase_type && price['planName'] == sub.plan_name }
|
|
101
|
-
price_override = current_plan.last['fixedPrice'] || current_plan.last['recurringPrice']
|
|
101
|
+
price_override = current_plan.last ? (current_plan.last['fixedPrice'] || current_plan.last['recurringPrice']) : nil
|
|
102
102
|
|
|
103
103
|
if price_override.blank?
|
|
104
104
|
''
|
data/app/models/kaui/account.rb
CHANGED
|
@@ -5,6 +5,13 @@ module Kaui
|
|
|
5
5
|
attr_accessor :phone, :bill_cycle_day_local
|
|
6
6
|
|
|
7
7
|
SENSIVITE_DATA_FIELDS = %w[name email].freeze
|
|
8
|
+
REMAPPING_FIELDS = {
|
|
9
|
+
'is_payment_delegated_to_parent' => 'pay_via_parent',
|
|
10
|
+
'bill_cycle_day_local' => 'bcd',
|
|
11
|
+
'account_balance' => 'balance',
|
|
12
|
+
'account_cba' => 'cba',
|
|
13
|
+
'is_migrated' => 'migrated'
|
|
14
|
+
}.freeze
|
|
8
15
|
|
|
9
16
|
def check_account_details_phone
|
|
10
17
|
return true if phone =~ /\A(?:\+?\d{1,3}\s*-?)?\(?(?:\d{3})?\)?[- ]?\d{3}[- ]?\d{4}\z/i
|
data/app/models/kaui/invoice.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Kaui
|
|
4
4
|
class Invoice < KillBillClient::Model::Invoice
|
|
5
|
-
TABLE_IGNORE_COLUMNS = %w[amount balance credit_adj refund_adj items is_parent_invoice parent_invoice_id parent_account_id].freeze
|
|
5
|
+
TABLE_IGNORE_COLUMNS = %w[amount balance credit_adj refund_adj items is_parent_invoice parent_invoice_id parent_account_id audit_logs bundle_keys].freeze
|
|
6
6
|
|
|
7
7
|
def self.build_from_raw_invoice(raw_invoice)
|
|
8
8
|
result = Kaui::Invoice.new
|
data/app/models/kaui/payment.rb
CHANGED
|
@@ -7,6 +7,13 @@ module Kaui
|
|
|
7
7
|
attr_accessor :payment_date, :target_invoice_id
|
|
8
8
|
|
|
9
9
|
TRANSACTION_STATUSES = %w[SUCCESS PENDING PAYMENT_FAILURE PLUGIN_FAILURE UNKNOWN].freeze
|
|
10
|
+
REMAPPING_FIELDS = {
|
|
11
|
+
'auth_amount' => 'auth',
|
|
12
|
+
'captured_amount' => 'capture',
|
|
13
|
+
'purchased_amount' => 'purchase',
|
|
14
|
+
'credited_amount' => 'credit',
|
|
15
|
+
'refunded_amount' => 'refund'
|
|
16
|
+
}.freeze
|
|
10
17
|
|
|
11
18
|
def self.build_from_raw_payment(raw_payment)
|
|
12
19
|
result = Kaui::Payment.new
|
|
@@ -107,38 +107,9 @@ $(document).ready(function() {
|
|
|
107
107
|
$('#allData').change(function() {
|
|
108
108
|
$('#startDate').val(null);
|
|
109
109
|
$('#endDate').val(null);
|
|
110
|
-
var isChecked = $(this).is(':checked');
|
|
111
110
|
$('#startDate, #endDate').prop('disabled', true);
|
|
112
111
|
});
|
|
113
112
|
|
|
114
|
-
function setDateRange(option) {
|
|
115
|
-
var currentDate = new Date();
|
|
116
|
-
var startDate, endDate;
|
|
117
|
-
|
|
118
|
-
if (option === "day") {
|
|
119
|
-
startDate = new Date();
|
|
120
|
-
endDate = new Date();
|
|
121
|
-
endDate.setDate(endDate.getDate() + 1);
|
|
122
|
-
} else if (option === "week") {
|
|
123
|
-
startDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1));
|
|
124
|
-
currentDate = new Date();
|
|
125
|
-
endDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 7));
|
|
126
|
-
} else if (option === "month") {
|
|
127
|
-
startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
|
128
|
-
endDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
129
|
-
} else if (option === "year") {
|
|
130
|
-
startDate = new Date(currentDate.getFullYear(), 0, 1);
|
|
131
|
-
endDate = new Date(currentDate.getFullYear(), 11, 31);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
var startDateFormatted = startDate.toISOString().split('T')[0];
|
|
135
|
-
var endDateFormatted = endDate.toISOString().split('T')[0];
|
|
136
|
-
|
|
137
|
-
$('#startDate').val(startDateFormatted);
|
|
138
|
-
$('#endDate').val(endDateFormatted);
|
|
139
|
-
$('#startDate, #endDate').prop('disabled', true);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
113
|
$('#thisWeek').change(function() {
|
|
143
114
|
if ($(this).is(':checked')) {
|
|
144
115
|
setDateRange("week");
|
|
@@ -101,6 +101,15 @@
|
|
|
101
101
|
width: 200px;
|
|
102
102
|
overflow-y: auto;
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
.dropdown-menu#column-visibility::before {
|
|
106
|
+
content: 'Drag to reorder columns';
|
|
107
|
+
display: block;
|
|
108
|
+
height: 30px;
|
|
109
|
+
text-align: center;
|
|
110
|
+
color: darkgrey;
|
|
111
|
+
padding-top: 5px;
|
|
112
|
+
}
|
|
104
113
|
|
|
105
114
|
.dropdown-menu {
|
|
106
115
|
padding: 5px;
|
|
@@ -170,38 +179,11 @@ $(document).ready(function() {
|
|
|
170
179
|
});
|
|
171
180
|
|
|
172
181
|
$('#allData').change(function() {
|
|
173
|
-
|
|
182
|
+
$('#startDate').val(null);
|
|
183
|
+
$('#endDate').val(null);
|
|
174
184
|
$('#startDate, #endDate').prop('disabled', true);
|
|
175
185
|
});
|
|
176
186
|
|
|
177
|
-
function setDateRange(option) {
|
|
178
|
-
var currentDate = new Date();
|
|
179
|
-
var startDate, endDate;
|
|
180
|
-
|
|
181
|
-
if (option === "day") {
|
|
182
|
-
startDate = new Date();
|
|
183
|
-
endDate = new Date();
|
|
184
|
-
endDate.setDate(endDate.getDate() + 1);
|
|
185
|
-
} else if (option === "week") {
|
|
186
|
-
startDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1));
|
|
187
|
-
currentDate = new Date();
|
|
188
|
-
endDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 7));
|
|
189
|
-
} else if (option === "month") {
|
|
190
|
-
startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
|
191
|
-
endDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
192
|
-
} else if (option === "year") {
|
|
193
|
-
startDate = new Date(currentDate.getFullYear(), 0, 1);
|
|
194
|
-
endDate = new Date(currentDate.getFullYear(), 11, 31);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var startDateFormatted = startDate.toISOString().split('T')[0];
|
|
198
|
-
var endDateFormatted = endDate.toISOString().split('T')[0];
|
|
199
|
-
|
|
200
|
-
$('#startDate').val(startDateFormatted);
|
|
201
|
-
$('#endDate').val(endDateFormatted);
|
|
202
|
-
$('#startDate, #endDate').prop('disabled', true);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
187
|
$('#thisWeek').change(function() {
|
|
206
188
|
if ($(this).is(':checked')) {
|
|
207
189
|
setDateRange("week");
|
|
@@ -26,53 +26,54 @@
|
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
|
+
<style>
|
|
30
|
+
#accounts-table td, #accounts-table tr {
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
}
|
|
33
|
+
.custom-checkbox {
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
|
|
29
38
|
<%= javascript_tag do %>
|
|
30
39
|
$(document).ready(function() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
dataSrc: function(json) {
|
|
62
|
-
var colOrder = $('#accounts-table').DataTable().colReorder.order();
|
|
63
|
-
var reorderedData = json.data.map(function(row) {
|
|
64
|
-
var newRow = [];
|
|
65
|
-
for (var i = 0; i < colOrder.length; i++) {
|
|
66
|
-
newRow.push(row[colOrder[i]]);
|
|
67
|
-
}
|
|
68
|
-
return newRow;
|
|
69
|
-
});
|
|
70
|
-
return reorderedData;
|
|
40
|
+
var table = $('#accounts-table').DataTable({
|
|
41
|
+
"colReorder": {
|
|
42
|
+
"enable": false
|
|
43
|
+
},
|
|
44
|
+
"stateSave": true,
|
|
45
|
+
"scrollX": true,
|
|
46
|
+
"dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
|
|
47
|
+
"pagingType": <% if @max_nb_records.nil? -%>"simple"<% else -%>"full_numbers"<% end -%>,
|
|
48
|
+
"language": {
|
|
49
|
+
<!-- See DefaultPaginationSqlDaoHelper.java -->
|
|
50
|
+
"info": <% if @max_nb_records.nil? -%>"Showing _START_ to _END_ of <%= number_with_delimiter(Kaui::EngineControllerUtil::SIMPLE_PAGINATION_THRESHOLD) -%>+ entries"<% else -%>"Showing _START_ to _END_ of _TOTAL_ entries"<% end -%>
|
|
51
|
+
},
|
|
52
|
+
"pageLength": <%= @limit %>,
|
|
53
|
+
"displayStart": <%= @offset %>,
|
|
54
|
+
<% if @search_query.blank? %>
|
|
55
|
+
"ordering": false,
|
|
56
|
+
<% elsif !@ordering.blank? %>
|
|
57
|
+
"order": [[ 1, "<%= @ordering %>" ]],
|
|
58
|
+
<% end %>
|
|
59
|
+
"processing": true,
|
|
60
|
+
"serverSide": true,
|
|
61
|
+
"search": {"search": "<%= @search_query %>"},
|
|
62
|
+
"ajax": {
|
|
63
|
+
url: "<%= accounts_pagination_path(:ordering => @ordering, :format => :json) %>",
|
|
64
|
+
dataSrc: function(json) {
|
|
65
|
+
var colOrder = table.colReorder.order();
|
|
66
|
+
var reorderedData = json.data.map(function(row) {
|
|
67
|
+
var newRow = [];
|
|
68
|
+
for (var i = 0; i < colOrder.length; i++) {
|
|
69
|
+
newRow.push(row[colOrder[i]]);
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
return newRow;
|
|
72
|
+
});
|
|
73
|
+
return reorderedData;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"columns": <%= raw @visible_columns.to_json %>
|
|
76
77
|
});
|
|
77
78
|
|
|
78
79
|
<!-- When we don't know the total number of pages, we need to hide the legend and next button manually -->
|
|
@@ -142,38 +142,9 @@ $(document).ready(function() {
|
|
|
142
142
|
$('#allData').change(function() {
|
|
143
143
|
$('#startDate').val(null);
|
|
144
144
|
$('#endDate').val(null);
|
|
145
|
-
var isChecked = $(this).is(':checked');
|
|
146
145
|
$('#startDate, #endDate').prop('disabled', true);
|
|
147
146
|
});
|
|
148
147
|
|
|
149
|
-
function setDateRange(option) {
|
|
150
|
-
var currentDate = new Date();
|
|
151
|
-
var startDate, endDate;
|
|
152
|
-
|
|
153
|
-
if (option === "day") {
|
|
154
|
-
startDate = new Date();
|
|
155
|
-
endDate = new Date();
|
|
156
|
-
endDate.setDate(endDate.getDate() + 1);
|
|
157
|
-
} else if (option === "week") {
|
|
158
|
-
startDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1));
|
|
159
|
-
currentDate = new Date();
|
|
160
|
-
endDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 7));
|
|
161
|
-
} else if (option === "month") {
|
|
162
|
-
startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
|
163
|
-
endDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
164
|
-
} else if (option === "year") {
|
|
165
|
-
startDate = new Date(currentDate.getFullYear(), 0, 1);
|
|
166
|
-
endDate = new Date(currentDate.getFullYear(), 11, 31);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
var startDateFormatted = startDate.toISOString().split('T')[0];
|
|
170
|
-
var endDateFormatted = endDate.toISOString().split('T')[0];
|
|
171
|
-
|
|
172
|
-
$('#startDate').val(startDateFormatted);
|
|
173
|
-
$('#endDate').val(endDateFormatted);
|
|
174
|
-
$('#startDate, #endDate').prop('disabled', true);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
148
|
$('#thisWeek').change(function() {
|
|
178
149
|
if ($(this).is(':checked')) {
|
|
179
150
|
setDateRange("week");
|
|
@@ -31,6 +31,12 @@
|
|
|
31
31
|
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
|
+
<style>
|
|
35
|
+
#audit-logs-table td, #audit-logs-table tr {
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
|
|
34
40
|
|
|
35
41
|
<%= javascript_tag do %>
|
|
36
42
|
$(document).ready(function() {
|
|
@@ -38,6 +44,7 @@
|
|
|
38
44
|
$('#audit-logs-table').DataTable({
|
|
39
45
|
dom: "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
|
|
40
46
|
data: auditLogs,
|
|
47
|
+
"scrollX": true,
|
|
41
48
|
order: [[ 0, 'desc' ]],
|
|
42
49
|
createdRow: function( row, data, dataIndex ) {
|
|
43
50
|
if ( data[3] == "INSERT" ) {
|
|
@@ -105,6 +105,16 @@
|
|
|
105
105
|
.dropdown-menu {
|
|
106
106
|
padding: 5px;
|
|
107
107
|
}
|
|
108
|
+
|
|
109
|
+
.dropdown-menu#column-visibility::before {
|
|
110
|
+
content: 'Drag to reorder columns';
|
|
111
|
+
display: block;
|
|
112
|
+
height: 30px;
|
|
113
|
+
text-align: center;
|
|
114
|
+
color: darkgrey;
|
|
115
|
+
padding-top: 5px;
|
|
116
|
+
}
|
|
117
|
+
|
|
108
118
|
.toggle-button-right {
|
|
109
119
|
float: right;
|
|
110
120
|
margin-bottom: 10px;
|
|
@@ -173,34 +183,6 @@ $(document).ready(function() {
|
|
|
173
183
|
$('#startDate, #endDate').prop('disabled', true);
|
|
174
184
|
});
|
|
175
185
|
|
|
176
|
-
function setDateRange(option) {
|
|
177
|
-
var currentDate = new Date();
|
|
178
|
-
var startDate, endDate;
|
|
179
|
-
|
|
180
|
-
if (option === "day") {
|
|
181
|
-
startDate = new Date();
|
|
182
|
-
endDate = new Date();
|
|
183
|
-
endDate.setDate(endDate.getDate() + 1);
|
|
184
|
-
} else if (option === "week") {
|
|
185
|
-
startDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1));
|
|
186
|
-
currentDate = new Date();
|
|
187
|
-
endDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 7));
|
|
188
|
-
} else if (option === "month") {
|
|
189
|
-
startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
|
190
|
-
endDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
191
|
-
} else if (option === "year") {
|
|
192
|
-
startDate = new Date(currentDate.getFullYear(), 0, 1);
|
|
193
|
-
endDate = new Date(currentDate.getFullYear(), 11, 31);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var startDateFormatted = startDate.toISOString().split('T')[0];
|
|
197
|
-
var endDateFormatted = endDate.toISOString().split('T')[0];
|
|
198
|
-
|
|
199
|
-
$('#startDate').val(startDateFormatted);
|
|
200
|
-
$('#endDate').val(endDateFormatted);
|
|
201
|
-
$('#startDate, #endDate').prop('disabled', true);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
186
|
$('#thisWeek').change(function() {
|
|
205
187
|
if ($(this).is(':checked')) {
|
|
206
188
|
setDateRange("week");
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
<div class="search">
|
|
2
|
-
|
|
3
2
|
<div class="column-block">
|
|
4
|
-
|
|
5
3
|
<h1>Invoices</h1>
|
|
6
|
-
|
|
7
4
|
<%= render :partial => 'multi_functions_bar' %>
|
|
8
|
-
|
|
9
5
|
<table id="invoices-table" class="table table-condensed mobile-data" style="width:100%">
|
|
10
6
|
<thead>
|
|
11
7
|
<tr>
|
|
@@ -20,13 +16,25 @@
|
|
|
20
16
|
</tr>
|
|
21
17
|
</tbody>
|
|
22
18
|
</table>
|
|
23
|
-
|
|
24
19
|
</div>
|
|
25
|
-
|
|
26
20
|
</div>
|
|
27
21
|
|
|
22
|
+
<style>
|
|
23
|
+
#invoices-table td, #invoices-table tr {
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
|
|
28
28
|
<%= javascript_tag do %>
|
|
29
29
|
$(document).ready(function() {
|
|
30
|
+
var stateKey = 'DataTables_invoices-table';
|
|
31
|
+
var state = JSON.parse(localStorage.getItem(stateKey));
|
|
32
|
+
if (state) {
|
|
33
|
+
state.start = <%= @offset %>;
|
|
34
|
+
state.search = { search: "<%= @search_query %>" };
|
|
35
|
+
localStorage.setItem(stateKey, JSON.stringify(state));
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
var table = $('#invoices-table').DataTable({
|
|
31
39
|
"colReorder": {
|
|
32
40
|
"enable": false
|
|
@@ -57,7 +65,7 @@ $(document).ready(function() {
|
|
|
57
65
|
"ajax": {
|
|
58
66
|
url: "<%= invoices_pagination_path(:ordering => @ordering, :format => :json) %>",
|
|
59
67
|
dataSrc: function(json) {
|
|
60
|
-
var colOrder =
|
|
68
|
+
var colOrder = table.colReorder.order();
|
|
61
69
|
var reorderedData = json.data.map(function(row) {
|
|
62
70
|
var newRow = [];
|
|
63
71
|
for (var i = 0; i < colOrder.length; i++) {
|
|
@@ -70,11 +78,6 @@ $(document).ready(function() {
|
|
|
70
78
|
}
|
|
71
79
|
});
|
|
72
80
|
|
|
73
|
-
var searchQuery = "<%= @search_query %>";
|
|
74
|
-
if (searchQuery) {
|
|
75
|
-
table.search(searchQuery).draw();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
81
|
<!-- When we don't know the total number of pages, we need to hide the legend and next button manually -->
|
|
79
82
|
<% if @max_nb_records.nil? %>
|
|
80
83
|
$('#invoices-table').on('draw.dt', function() {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<div class="dropdown-container">
|
|
2
|
-
<% unless @account.account_id.blank? %>
|
|
3
2
|
<button class="btn btn-default download-button-right" type="button" id="modalDownloadButton">
|
|
4
3
|
<i class="glyphicon glyphicon-download-alt"></i>
|
|
5
4
|
<strong>Download CSV</strong>
|
|
6
5
|
</button>
|
|
7
|
-
<% end %>
|
|
8
6
|
<div class="dropdown">
|
|
9
7
|
<button class="btn btn-default dropdown-toggle toggle-button-right" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
10
8
|
<i class="glyphicon glyphicon-cog"></i>
|
|
@@ -107,6 +105,16 @@
|
|
|
107
105
|
.dropdown-menu {
|
|
108
106
|
padding: 5px;
|
|
109
107
|
}
|
|
108
|
+
|
|
109
|
+
.dropdown-menu#column-visibility::before {
|
|
110
|
+
content: 'Drag to reorder columns';
|
|
111
|
+
display: block;
|
|
112
|
+
height: 30px;
|
|
113
|
+
text-align: center;
|
|
114
|
+
color: darkgrey;
|
|
115
|
+
padding-top: 5px;
|
|
116
|
+
}
|
|
117
|
+
|
|
110
118
|
.toggle-button-right {
|
|
111
119
|
float: right;
|
|
112
120
|
margin-bottom: 10px;
|
|
@@ -173,38 +181,9 @@ $(document).ready(function() {
|
|
|
173
181
|
$('#allData').change(function() {
|
|
174
182
|
$('#startDate').val(null);
|
|
175
183
|
$('#endDate').val(null);
|
|
176
|
-
var isChecked = $(this).is(':checked');
|
|
177
184
|
$('#startDate, #endDate').prop('disabled', true);
|
|
178
185
|
});
|
|
179
186
|
|
|
180
|
-
function setDateRange(option) {
|
|
181
|
-
var currentDate = new Date();
|
|
182
|
-
var startDate, endDate;
|
|
183
|
-
|
|
184
|
-
if (option === "day") {
|
|
185
|
-
startDate = new Date();
|
|
186
|
-
endDate = new Date();
|
|
187
|
-
endDate.setDate(endDate.getDate() + 1);
|
|
188
|
-
} else if (option === "week") {
|
|
189
|
-
startDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 1));
|
|
190
|
-
currentDate = new Date();
|
|
191
|
-
endDate = new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 7));
|
|
192
|
-
} else if (option === "month") {
|
|
193
|
-
startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
|
194
|
-
endDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
195
|
-
} else if (option === "year") {
|
|
196
|
-
startDate = new Date(currentDate.getFullYear(), 0, 1);
|
|
197
|
-
endDate = new Date(currentDate.getFullYear(), 11, 31);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
var startDateFormatted = startDate.toISOString().split('T')[0];
|
|
201
|
-
var endDateFormatted = endDate.toISOString().split('T')[0];
|
|
202
|
-
|
|
203
|
-
$('#startDate').val(startDateFormatted);
|
|
204
|
-
$('#endDate').val(endDateFormatted);
|
|
205
|
-
$('#startDate, #endDate').prop('disabled', true);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
187
|
$('#thisWeek').change(function() {
|
|
209
188
|
if ($(this).is(':checked')) {
|
|
210
189
|
setDateRange("week");
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<div class="search">
|
|
2
|
-
|
|
3
2
|
<div class="column-block">
|
|
4
|
-
|
|
5
3
|
<h1><%= I18n.translate('payments') %></h1>
|
|
6
4
|
<%= render :partial => 'multi_functions_bar' %>
|
|
7
|
-
|
|
8
5
|
<table id="payments-table" class="table table-condensed mobile-data" style="width:100%">
|
|
9
6
|
<thead>
|
|
10
7
|
<tr>
|
|
@@ -19,13 +16,25 @@
|
|
|
19
16
|
</tr>
|
|
20
17
|
</tbody>
|
|
21
18
|
</table>
|
|
22
|
-
|
|
23
19
|
</div>
|
|
24
|
-
|
|
25
20
|
</div>
|
|
26
21
|
|
|
22
|
+
<style>
|
|
23
|
+
#payments-table td, #payments-table tr {
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
|
|
27
28
|
<%= javascript_tag do %>
|
|
28
29
|
$(document).ready(function() {
|
|
30
|
+
var stateKey = 'DataTables_payments-table';
|
|
31
|
+
var state = JSON.parse(localStorage.getItem(stateKey));
|
|
32
|
+
if (state) {
|
|
33
|
+
state.start = <%= @offset %>;
|
|
34
|
+
state.search = { search: "<%= @search_query %>" };
|
|
35
|
+
localStorage.setItem(stateKey, JSON.stringify(state));
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
var table = $('#payments-table').DataTable({
|
|
30
39
|
"colReorder": {
|
|
31
40
|
"enable": false
|
|
@@ -90,11 +99,6 @@ $(document).ready(function() {
|
|
|
90
99
|
"search": {"search": "<%= @search_query %>"},
|
|
91
100
|
});
|
|
92
101
|
|
|
93
|
-
var searchQuery = "<%= @search_query %>";
|
|
94
|
-
if (searchQuery) {
|
|
95
|
-
table.search(searchQuery).draw();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
102
|
<!-- When we don't know the total number of pages, we need to hide the legend and next button manually -->
|
|
99
103
|
<% if @max_nb_records.nil? %>
|
|
100
104
|
$('#payments-table').on('draw.dt', function() {
|
data/lib/kaui/version.rb
CHANGED
data/lib/kaui.rb
CHANGED
|
@@ -65,20 +65,30 @@ module Kaui
|
|
|
65
65
|
original_fields = KillBillClient::Model::AccountAttributes.instance_variable_get('@json_attributes')
|
|
66
66
|
# Add additional fields if needed
|
|
67
67
|
fields = original_fields.dup
|
|
68
|
+
fields -= %w[audit_logs first_name_length]
|
|
69
|
+
headers = fields.dup
|
|
70
|
+
Kaui::Account::REMAPPING_FIELDS.each do |k, v|
|
|
71
|
+
headers[fields.index(k)] = v
|
|
72
|
+
end
|
|
73
|
+
headers.map! { |attr| attr.split('_').join(' ').capitalize }
|
|
68
74
|
|
|
69
|
-
headers = fields.map { |attr| attr.split('_').join(' ').capitalize }
|
|
70
75
|
values = fields.map do |attr|
|
|
76
|
+
next if account.nil? || view_context.nil?
|
|
77
|
+
|
|
71
78
|
case attr
|
|
79
|
+
when 'is_payment_delegated_to_parent', 'is_migrated'
|
|
80
|
+
"<div style='text-align: center;'><input type='checkbox' class='custom-checkbox' #{account&.send(attr.downcase) ? 'checked' : ''}></div>"
|
|
72
81
|
when 'account_id'
|
|
73
|
-
|
|
82
|
+
view_context.link_to(account.account_id, view_context.url_for(action: :show, account_id: account.account_id))
|
|
74
83
|
when 'parent_account_id'
|
|
75
|
-
account.
|
|
84
|
+
account.parent_account_id.nil? ? nil : view_context.link_to(account.account_id, view_context.url_for(action: :show, account_id: account.parent_account_id))
|
|
76
85
|
when 'account_balance'
|
|
77
|
-
|
|
86
|
+
view_context.humanized_money_with_symbol(account.balance_to_money)
|
|
78
87
|
else
|
|
79
88
|
account&.send(attr.downcase)
|
|
80
89
|
end
|
|
81
90
|
end
|
|
91
|
+
|
|
82
92
|
[headers, values, fields]
|
|
83
93
|
end
|
|
84
94
|
|
|
@@ -121,7 +131,7 @@ module Kaui
|
|
|
121
131
|
when 'balance'
|
|
122
132
|
view_context.humanized_money_with_symbol(invoice.balance_to_money)
|
|
123
133
|
when 'invoice_id'
|
|
124
|
-
view_context.link_to(invoice.
|
|
134
|
+
view_context.link_to(invoice.invoice_id, view_context.url_for(controller: :invoices, action: :show, account_id: invoice.account_id, id: invoice.invoice_id))
|
|
125
135
|
when 'status'
|
|
126
136
|
default_label = 'label-info'
|
|
127
137
|
default_label = 'label-default' if invoice&.status == 'DRAFT'
|
|
@@ -139,26 +149,27 @@ module Kaui
|
|
|
139
149
|
self.account_payments_columns = lambda do |account = nil, payment = nil, view_context = nil|
|
|
140
150
|
fields = KillBillClient::Model::PaymentAttributes.instance_variable_get('@json_attributes')
|
|
141
151
|
# Change the order if needed
|
|
142
|
-
fields = %w[payment_date
|
|
152
|
+
fields = %w[payment_date] + fields
|
|
143
153
|
fields -= %w[payment_number transactions audit_logs]
|
|
144
154
|
fields.unshift('status')
|
|
145
155
|
fields.unshift('payment_number')
|
|
146
156
|
|
|
147
|
-
headers = fields.
|
|
157
|
+
headers = fields.dup
|
|
158
|
+
Kaui::Payment::REMAPPING_FIELDS.each do |k, v|
|
|
159
|
+
headers[fields.index(k)] = v
|
|
160
|
+
end
|
|
161
|
+
headers.map! { |attr| attr.split('_').join(' ').capitalize }
|
|
162
|
+
|
|
148
163
|
return [headers, []] if payment.nil?
|
|
149
164
|
|
|
150
165
|
values = fields.map do |attr|
|
|
151
166
|
case attr
|
|
167
|
+
when 'auth_amount', 'captured_amount', 'purchased_amount', 'refunded_amount', 'credited_amount'
|
|
168
|
+
view_context.humanized_money_with_symbol(payment&.send(attr.downcase))
|
|
152
169
|
when 'payment_number'
|
|
153
170
|
view_context.link_to(payment.payment_number, view_context.url_for(controller: :payments, action: :show, account_id: payment.account_id, id: payment.payment_id))
|
|
154
171
|
when 'payment_date'
|
|
155
172
|
view_context.format_date(payment.payment_date, account&.time_zone)
|
|
156
|
-
when 'total_authed_amount_to_money'
|
|
157
|
-
view_context.humanized_money_with_symbol(payment.total_authed_amount_to_money)
|
|
158
|
-
when 'paid_amount_to_money'
|
|
159
|
-
view_context.humanized_money_with_symbol(payment.paid_amount_to_money)
|
|
160
|
-
when 'returned_amount_to_money'
|
|
161
|
-
view_context.humanized_money_with_symbol(payment.returned_amount_to_money)
|
|
162
173
|
when 'status'
|
|
163
174
|
payment.transactions.empty? ? nil : view_context.colored_transaction_status(payment.transactions[-1].status)
|
|
164
175
|
else
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kaui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kill Bill core team
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionpack
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: bootsnap
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: cancan
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -594,7 +580,7 @@ licenses:
|
|
|
594
580
|
- Apache License (2.0)
|
|
595
581
|
metadata:
|
|
596
582
|
rubygems_mfa_required: 'true'
|
|
597
|
-
post_install_message:
|
|
583
|
+
post_install_message:
|
|
598
584
|
rdoc_options: []
|
|
599
585
|
require_paths:
|
|
600
586
|
- lib
|
|
@@ -610,7 +596,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
610
596
|
version: '0'
|
|
611
597
|
requirements: []
|
|
612
598
|
rubygems_version: 3.4.10
|
|
613
|
-
signing_key:
|
|
599
|
+
signing_key:
|
|
614
600
|
specification_version: 4
|
|
615
601
|
summary: Killbill Admin UI mountable engine
|
|
616
602
|
test_files: []
|