kaui 3.0.6 → 3.0.8

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.
@@ -0,0 +1,190 @@
1
+ <div class="modal fade" id="advanceSearchModal" tabindex="-1" role="dialog" aria-labelledby="advanceSearchModalLabel" aria-hidden="true">
2
+ <div class="modal-dialog" role="document">
3
+ <div class="modal-content">
4
+ <div class="modal-header">
5
+ <h5 class="modal-title" id="advanceSearchModalLabel">Advance Search</h5>
6
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
7
+ <span aria-hidden="true">&times;</span>
8
+ </button>
9
+ </div>
10
+ <div class="modal-body">
11
+ <form id="advanceSearchForm">
12
+ <div class="form-group d-flex align-items-center">
13
+ <label for="searchFieldSelect" class="mr-2" style="width: 30%;">Search Fields:</label>
14
+ <select id="searchFieldSelect" class="form-control mr-2">
15
+ <% if @account.account_id.present? %>
16
+ <% @search_fields.reject { |value, _| value == 'account_id' }.each do |value, title| %>
17
+ <option value="<%= value %>"><%= title %></option>
18
+ <% end %>
19
+ <% else %>
20
+ <% @search_fields.each do |value, title| %>
21
+ <option value="<%= value %>"><%= title %></option>
22
+ <% end %>
23
+ <% end %>
24
+ </select>
25
+ <button type="button" class="btn btn-secondary" id="addSearchField">Add</button>
26
+ </div>
27
+ <div id="search-fields-container">
28
+ </div>
29
+ </form>
30
+ </div>
31
+ <div class="modal-footer">
32
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
33
+ <button type="button" class="btn btn-primary" id="applyAdvanceSearch">Apply Search</button>
34
+ <button type="button" class="btn btn-danger" id="clearAdvanceSearch">Clear Search</button>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+
40
+ <template id="search-field-template">
41
+ <div class="form-group row align-items-center search-field">
42
+ <label class="col-sm-4 col-form-label search-field-label"></label>
43
+ <div class="col-sm-3">
44
+ <select class="form-control search-field-filter">
45
+ <option value="eq">Equals</option>
46
+ <option value="neq">Not Equals</option>
47
+ <option value="gt">Greater Than</option>
48
+ <option value="gte">Greater Than Or Equal</option>
49
+ <option value="lt">Less Than</option>
50
+ <option value="lte">Less Than Or Equal</option>
51
+ <option value="like">Like</option>
52
+ </select>
53
+ </div>
54
+ <div class="col-sm-4">
55
+ <input type="text" class="form-control search-field-value">
56
+ </div>
57
+ <div class="col-sm-1">
58
+ <i class="glyphicon glyphicon-remove" id=remove-search-field></i>
59
+ </div>
60
+ </div>
61
+ </template>
62
+
63
+ <style>
64
+ .form-group.row.align-items-center {
65
+ display: flex;
66
+ align-items: center;
67
+ }
68
+
69
+ .form-group.row.align-items-center label {
70
+ margin-bottom: 0; /* Remove default margin */
71
+ }
72
+
73
+ .form-group.row.align-items-center .form-control {
74
+ margin-right: 10px; /* Add some space between elements */
75
+ }
76
+
77
+ .form-group.d-flex {
78
+ display: flex;
79
+ align-items: center;
80
+ }
81
+
82
+ .form-group.d-flex label {
83
+ margin-bottom: 0; /* Remove default margin */
84
+ }
85
+
86
+ .form-group.d-flex .form-control {
87
+ margin-right: 10px; /* Add some space between the select box and the button */
88
+ }
89
+
90
+ #search-labels-container .label {
91
+ margin-left: 5px; /* Add space between labels */
92
+ margin-bottom: 5px; /* Add space below labels if they wrap to the next line */
93
+ color: white;
94
+ }
95
+
96
+ .filter-bar-container {
97
+ display: flex;
98
+ justify-content: flex-start; /* Align items to the left */
99
+ align-items: center; /* Center items vertically */
100
+ }
101
+
102
+ .filter-bar {
103
+ display: flex;
104
+ align-items: center; /* Center items vertically */
105
+ }
106
+
107
+ .filter-bar label {
108
+ margin: 10px; /* Add some space between the label and the select box */
109
+ }
110
+ </style>
111
+
112
+ <%= javascript_tag do %>
113
+ $(document).ready(function() {
114
+ populateSearchLabelsFromUrl();
115
+
116
+ // Handle the "Add" button click to add new search fields
117
+ $('#addSearchField').on('click', function() {
118
+ var selectedField = $('#searchFieldSelect option:selected').text();
119
+ var template = document.getElementById('search-field-template').content.cloneNode(true);
120
+
121
+ // Set the label and input names based on the selected field
122
+ template.querySelector('.search-field-label').textContent = selectedField.replace(/([A-Z])/g, ' $1').trim();
123
+ template.querySelector('.search-field-filter').name = selectedField + 'Filter';
124
+
125
+ // Check if the field should use a date input
126
+ var dateFields = ['Invoice date', 'Target date'];
127
+ if (dateFields.includes(selectedField)) {
128
+ template.querySelector('.search-field-value').type = 'date';
129
+ } else {
130
+ template.querySelector('.search-field-value').type = 'text';
131
+ }
132
+ template.querySelector('.search-field-value').name = selectedField;
133
+
134
+ // Append the new search field to the container
135
+ document.getElementById('search-fields-container').appendChild(template);
136
+ });
137
+
138
+ // Handle the "Apply Search" button click inside the modal
139
+ $('#applyAdvanceSearch').on('click', function() {
140
+ var searchFields = $('.search-field');
141
+ var searchLabelsContainer = $('#search-labels-container');
142
+ searchLabelsContainer.empty();
143
+
144
+ var table = $('#payments-table').DataTable();
145
+ table.on('preXhr.dt', function(e, settings, data) {
146
+ data.search.value = searchQuery("<%= @search_query.to_s %>");
147
+ });
148
+
149
+ table.ajax.url("<%= payments_pagination_path(:ordering => @ordering, :format => :json) %>").load();
150
+
151
+ // Update the URL with the search parameters
152
+ var searchParams = searchQuery("<%= @search_query.to_s %>");
153
+ if (searchParams) {
154
+ searchParams = searchParams.replace(/account_id/g, 'ac_id');
155
+ var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + searchParams;
156
+ window.history.pushState({ path: newUrl }, '', newUrl);
157
+ }
158
+
159
+ searchFields.each(function() {
160
+ var filter = $(this).find('.search-field-filter option:selected').text();
161
+ var value = $(this).find('.search-field-value').val();
162
+ var columnName = $(this).find('.search-field-filter').attr('name').replace('Filter', '');
163
+
164
+ // Create and append the search label
165
+ if (value !== '') {
166
+ var label = $('<span>', {
167
+ class: 'label label-info',
168
+ text: columnName + ' [' + filter + '] ' + value
169
+ });
170
+ }
171
+ searchLabelsContainer.append(label);
172
+ });
173
+ $('#advanceSearchModal').modal('hide');
174
+ });
175
+
176
+ // Populate the modal with the current filters when it is shown
177
+ $('#advanceSearchModal').on('show.bs.modal', function() {
178
+ showAdvanceSearchModal();
179
+ });
180
+
181
+ $('#clearAdvanceSearch').on('click', function() {
182
+ clearAdvanceSearch();
183
+ });
184
+
185
+ // Handle the remove icon click event to remove search fields
186
+ $('#search-fields-container').on('click', '#remove-search-field', function() {
187
+ $(this).closest('.search-field').remove();
188
+ });
189
+ });
190
+ <% end %>
@@ -57,7 +57,7 @@ $(document).ready(function() {
57
57
  "pageLength": <%= @limit %>,
58
58
  "displayStart": <%= @offset %>,
59
59
  "ajax": {
60
- url: "<%= payments_pagination_path(:ordering => @ordering, :format => :json) %>",
60
+ url: "<%= payments_pagination_path(:ordering => @ordering, :format => :json, :advance_search_query => @advance_search_query) %>",
61
61
  dataSrc: function(json) {
62
62
  var colOrder = $('#payments-table').DataTable().colReorder.order();
63
63
  var reorderedData = json.data.map(function(row) {
@@ -75,7 +75,7 @@ $(document).ready(function() {
75
75
  "dom": "t",
76
76
  "paging": false,
77
77
  "ajax": {
78
- url: "<%= payments_pagination_path(:format => :json) %>",
78
+ url: "<%= payments_pagination_path(:format => :json, :advance_search_query => @advance_search_query) %>",
79
79
  data: function(d) {
80
80
  d.colum_order = $('#payments-table').DataTable().colReorder.order();
81
81
  },
@@ -103,14 +103,15 @@ $(document).ready(function() {
103
103
  });
104
104
 
105
105
  <!-- When we don't know the total number of pages, we need to hide the legend and next button manually -->
106
- <% if @max_nb_records.nil? %>
107
- $('#payments-table').on('draw.dt', function() {
106
+ $('#payments-table').on('draw.dt', function() {
107
+ <% if @max_nb_records.nil? %>
108
108
  var noMoreData = table.column(0)
109
109
  .data()
110
110
  .length == 0;
111
111
  $(".next.paginate_button").toggleClass("disabled", noMoreData);
112
112
  $(".dataTables_info").toggle(!noMoreData);
113
- });
114
- <% end %>
113
+ <% end %>
114
+ populateSearchLabelsFromUrl();
115
+ });
115
116
  });
116
117
  <% end %>
data/lib/kaui/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kaui
4
- VERSION = '3.0.6'
4
+ VERSION = '3.0.8'
5
5
  end
data/lib/kaui.rb CHANGED
@@ -77,7 +77,8 @@ module Kaui
77
77
 
78
78
  case attr
79
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>"
80
+ checked_attr = account&.send(attr.downcase) ? 'checked' : nil
81
+ "<div style='text-align: center;'><input type='checkbox' class='custom-checkbox' #{checked_attr}></div>"
81
82
  when 'account_id'
82
83
  view_context.link_to(account.account_id, view_context.url_for(action: :show, account_id: account.account_id))
83
84
  when 'parent_account_id'
@@ -296,6 +297,7 @@ module Kaui
296
297
  password: user.password,
297
298
  session_id: user.kb_session_id
298
299
  }
300
+ result[:jwt_token] = session[:jwt_token] if session[:jwt_token]
299
301
  if user_tenant
300
302
  result[:api_key] = user_tenant.api_key
301
303
  result[:api_secret] = user_tenant.api_secret
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.6
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-10 00:00:00.000000000 Z
11
+ date: 2025-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -307,6 +307,7 @@ files:
307
307
  - app/assets/javascripts/application.js
308
308
  - app/assets/javascripts/kaui/kaui.js
309
309
  - app/assets/javascripts/kaui/kaui_override.js
310
+ - app/assets/javascripts/kaui/multi_functions_bar_utils.js
310
311
  - app/assets/stylesheets/application.css
311
312
  - app/assets/stylesheets/kaui/account.css
312
313
  - app/assets/stylesheets/kaui/audit.css
@@ -422,6 +423,7 @@ files:
422
423
  - app/views/kaui/account_tags/index.html.erb
423
424
  - app/views/kaui/account_timelines/_multi_functions_bar.html.erb
424
425
  - app/views/kaui/account_timelines/show.html.erb
426
+ - app/views/kaui/accounts/_account_filterbar.html.erb
425
427
  - app/views/kaui/accounts/_account_info.html.erb
426
428
  - app/views/kaui/accounts/_billing_info.html.erb
427
429
  - app/views/kaui/accounts/_close_account_modal.html.erb
@@ -489,6 +491,7 @@ files:
489
491
  - app/views/kaui/invoice_tags/_form.html.erb
490
492
  - app/views/kaui/invoice_tags/_form_bar.html.erb
491
493
  - app/views/kaui/invoice_tags/edit.html.erb
494
+ - app/views/kaui/invoices/_invoice_filterbar.html.erb
492
495
  - app/views/kaui/invoices/_invoice_table.html.erb
493
496
  - app/views/kaui/invoices/_multi_functions_bar.html.erb
494
497
  - app/views/kaui/invoices/index.html.erb
@@ -507,6 +510,7 @@ files:
507
510
  - app/views/kaui/payment_methods/new.html.erb
508
511
  - app/views/kaui/payments/_form.html.erb
509
512
  - app/views/kaui/payments/_multi_functions_bar.html.erb
513
+ - app/views/kaui/payments/_payment_filterbar.html.erb
510
514
  - app/views/kaui/payments/_payment_table.html.erb
511
515
  - app/views/kaui/payments/index.html.erb
512
516
  - app/views/kaui/payments/new.html.erb