diff --git a/app/controllers/kaui/home_controller.rb b/app/controllers/kaui/home_controller.rb
index 7960454c..66090764 100644
--- a/app/controllers/kaui/home_controller.rb
+++ b/app/controllers/kaui/home_controller.rb
@@ -14,7 +14,7 @@ def index
@max_records = {}
%w[account payment invoice].each do |type|
model = "Kaui::#{type.capitalize}".constantize
- @max_records[type.to_sym] = model.list_or_search(nil, 0, 0, options_for_klient).pagination_max_nb_records || 0
+ @max_records[type.to_sym] = model.list_or_search(nil, 0, 0, options_for_klient).pagination_max_nb_records
end
end
diff --git a/app/controllers/kaui/invoices_controller.rb b/app/controllers/kaui/invoices_controller.rb
index 64068f71..4172ceb4 100644
--- a/app/controllers/kaui/invoices_controller.rb
+++ b/app/controllers/kaui/invoices_controller.rb
@@ -36,6 +36,15 @@ def download
Kaui::Invoice.list_or_search(query_string, 0, MAXIMUM_NUMBER_OF_RECORDS_DOWNLOAD, options_for_klient.merge(params: kb_params))
end
+ if start_date && end_date
+ invoices = invoices.select do |invoice|
+ start_date_parsed = Date.parse(start_date)
+ end_date_parsed = Date.parse(end_date)
+ invoice_date = Date.parse(invoice.invoice_date)
+ invoice_date.between?(start_date_parsed, end_date_parsed)
+ end
+ end
+
csv_string = CSV.generate(headers: true) do |csv|
csv << columns
diff --git a/app/helpers/kaui/plugin_helper.rb b/app/helpers/kaui/plugin_helper.rb
index 9ba28384..b742699d 100644
--- a/app/helpers/kaui/plugin_helper.rb
+++ b/app/helpers/kaui/plugin_helper.rb
@@ -24,6 +24,8 @@ def installed_plugin_names
'/kenui'
when /payment-test/
'/payment_test'
+ when /aviate/
+ '/aviate'
else
"/#{plugin_key}"
end
diff --git a/app/views/kaui/account_timelines/_multi_functions_bar.html.erb b/app/views/kaui/account_timelines/_multi_functions_bar.html.erb
index 84a84851..8a8aa327 100644
--- a/app/views/kaui/account_timelines/_multi_functions_bar.html.erb
+++ b/app/views/kaui/account_timelines/_multi_functions_bar.html.erb
@@ -43,7 +43,7 @@
-
+
–
diff --git a/app/views/kaui/accounts/_billing_details.html.erb b/app/views/kaui/accounts/_billing_details.html.erb
index b3dd3a9f..e9c8d684 100644
--- a/app/views/kaui/accounts/_billing_details.html.erb
+++ b/app/views/kaui/accounts/_billing_details.html.erb
@@ -117,12 +117,10 @@
<% end %>
- <% if can? :trigger, Kaui::Invoice %>
-
-
Next invoice date
-
N/A
-
- <% end %>
+
+
Next invoice date
+
N/A
+
diff --git a/app/views/kaui/admin_allowed_users/index.html.erb b/app/views/kaui/admin_allowed_users/index.html.erb
index ca227208..85de7f78 100644
--- a/app/views/kaui/admin_allowed_users/index.html.erb
+++ b/app/views/kaui/admin_allowed_users/index.html.erb
@@ -60,23 +60,12 @@
<%= link_to u.kb_username, admin_allowed_user_path(u.id) %> |
<%= u.description %> |
-
-
- <%= render "kaui/components/button/button", {
- label: 'Delete',
- variant: "outline-secondary d-inline-flex align-items-center gap-1",
- type: "button",
- html_class: "kaui-button delete-button custom-hover",
- html_options: {
- data: {
- confirm: "Are you sure?",
- method: "delete",
- turbo: false,
- "url": kaui_engine.admin_allowed_user_path(u.id)
- }
- }
- } %>
- <%= link_to kaui_engine.edit_admin_allowed_user_path(u.id), :class => '' do %>
+ <%= form_tag kaui_engine.admin_allowed_user_path(u.id), method: :delete, class: 'd-inline', onsubmit: "return confirm('Are you sure?');" do %>
+ <%= button_tag type: 'submit', class: 'btn btn-outline-secondary d-inline-flex align-items-center gap-1 kaui-button delete-button custom-hover' do %>
+ Delete
+ <% end %>
+ <% end %>
+ <%= link_to kaui_engine.edit_admin_allowed_user_path(u.id), class: 'text-decoration-none' do %>
<%= render "kaui/components/button/button", {
label: "Edit",
variant: "outline-secondary d-inline-flex align-items-center gap-1",
@@ -154,6 +143,8 @@
$header.find('.sort-' + direction).addClass('active');
}
+ } catch (e) {
+ console.error('Error initializing DataTable:', e);
}
}, 100);
});
diff --git a/app/views/kaui/admin_tenants/new_catalog.html.erb b/app/views/kaui/admin_tenants/new_catalog.html.erb
index 2a0a4081..3e4487ff 100644
--- a/app/views/kaui/admin_tenants/new_catalog.html.erb
+++ b/app/views/kaui/admin_tenants/new_catalog.html.erb
@@ -246,6 +246,8 @@ function switch_basic_config() {
$(document).ready(function() {
switch_basic_config();
+ // jQuery UI autocomplete interferes with HTML5 validation
+ // So we keep the custom JS validation
$('#simple_plan_product_name').autocomplete({
source: function(query, process) {
process(known_products());
@@ -261,8 +263,72 @@ $(document).ready(function() {
$('#simple_plan_product_name').on('mouseleave', function() {
recompute_available_base_products_for_ao();
});
+
+ // Custom validation since HTML5 validation is not working
+ // (possibly due to jQuery autocomplete or other JavaScript interference)
+ $('#catalog_simple form').on('submit', function(e) {
+ var isValid = true;
+ var pattern = /^[a-zA-Z_][\w\.-]*$/;
+
+ // Validate Product Name
+ var productName = $('#simple_plan_product_name').val().trim();
+ var productNameField = $('#simple_plan_product_name');
+
+ if (productName === '') {
+ showError(productNameField, 'Product Name is required');
+ isValid = false;
+ } else if (!pattern.test(productName)) {
+ showError(productNameField, 'Product Name must start with a letter or underscore, and can only contain letters, digits, underscores, hyphens, and periods');
+ isValid = false;
+ } else {
+ clearError(productNameField);
+ }
+
+ // Validate Plan Name
+ var planName = $('#simple_plan_plan_id').val().trim();
+ var planNameField = $('#simple_plan_plan_id');
+
+ if (planName === '') {
+ showError(planNameField, 'Plan Name is required');
+ isValid = false;
+ } else if (!pattern.test(planName)) {
+ showError(planNameField, 'Plan Name must start with a letter or underscore, and can only contain letters, digits, underscores, hyphens, and periods');
+ isValid = false;
+ } else {
+ clearError(planNameField);
+ }
+
+ if (!isValid) {
+ e.preventDefault();
+ e.stopPropagation();
+ // Scroll to first error
+ $('.error-message:first').get(0)?.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ return false;
+ }
+
+ return true;
+ });
+
+ // Clear errors on input
+ $('#simple_plan_product_name, #simple_plan_plan_id').on('input', function() {
+ clearError($(this));
+ });
});
+function showError(field, message) {
+ clearError(field);
+ field.addClass('error-field');
+ field.css('border-color', '#dc3545');
+ var errorDiv = $('').text(message);
+ field.parent().append(errorDiv);
+}
+
+function clearError(field) {
+ field.removeClass('error-field');
+ field.css('border-color', '');
+ field.parent().find('.error-message').remove();
+}
+
document.querySelectorAll('.toggle-option').forEach(el => {
el.addEventListener('click', () => {
document.querySelectorAll('.toggle-option').forEach(opt => opt.classList.remove('active-btn'));
diff --git a/app/views/kaui/audit_logs/_multi_functions_bar.html.erb b/app/views/kaui/audit_logs/_multi_functions_bar.html.erb
index b3ec6c2d..787fdee2 100644
--- a/app/views/kaui/audit_logs/_multi_functions_bar.html.erb
+++ b/app/views/kaui/audit_logs/_multi_functions_bar.html.erb
@@ -43,7 +43,7 @@
-
+
–
diff --git a/app/views/kaui/components/dashboard/_card.html.erb b/app/views/kaui/components/dashboard/_card.html.erb
index 18c0ff1b..a4bc816d 100644
--- a/app/views/kaui/components/dashboard/_card.html.erb
+++ b/app/views/kaui/components/dashboard/_card.html.erb
@@ -1,3 +1,4 @@
+<% count_text = count.nil? ? "20k+" : count.to_i %>
|