kaui 3.0.9 → 4.0.0
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/assets/images/kaui/account/authorize.svg +4 -0
- data/app/assets/images/kaui/account/credit.svg +4 -0
- data/app/assets/images/kaui/account/down-arrow.svg +3 -0
- data/app/assets/images/kaui/account/edit.svg +4 -0
- data/app/assets/images/kaui/account/pay-all.svg +5 -0
- data/app/assets/images/kaui/account/plus.svg +3 -0
- data/app/assets/images/kaui/account/purchase.svg +5 -0
- data/app/assets/images/kaui/account/refresh.svg +5 -0
- data/app/assets/images/kaui/arrow.svg +3 -0
- data/app/assets/images/kaui/card.svg +5 -0
- data/app/assets/images/kaui/copy.svg +12 -0
- data/app/assets/images/kaui/dashboard/aviate.svg +6 -0
- data/app/assets/images/kaui/dashboard/custom-field.svg +5 -0
- data/app/assets/images/kaui/dashboard/kaui-doc-img.png +0 -0
- data/app/assets/images/kaui/dashboard/plugins.svg +7 -0
- data/app/assets/images/kaui/dashboard/tags.svg +4 -0
- data/app/assets/images/kaui/dashboard/users.svg +6 -0
- data/app/assets/images/kaui/delete.svg +6 -0
- data/app/assets/images/kaui/dots.svg +5 -0
- data/app/assets/images/kaui/download-csv.svg +5 -0
- data/app/assets/images/kaui/download.svg +4 -0
- data/app/assets/images/kaui/eye-off.svg +9 -0
- data/app/assets/images/kaui/eye.svg +7 -0
- data/app/assets/images/kaui/file-upload.svg +34 -0
- data/app/assets/images/kaui/generate.svg +5 -0
- data/app/assets/images/kaui/header/account.svg +4 -0
- data/app/assets/images/kaui/header/cog_icon.svg +4 -0
- data/app/assets/images/kaui/header/invoice.svg +5 -0
- data/app/assets/images/kaui/header/payment.svg +5 -0
- data/app/assets/images/kaui/header/search_icon.svg +4 -0
- data/app/assets/images/kaui/header/subscription.svg +6 -0
- data/app/assets/images/kaui/logout.svg +4 -0
- data/app/assets/images/kaui/modal/close.svg +3 -0
- data/app/assets/images/kaui/modal/plus.svg +3 -0
- data/app/assets/images/kaui/modal/red-close.svg +10 -0
- data/app/assets/images/kaui/modal/search.svg +4 -0
- data/app/assets/images/kaui/payment/payment.svg +4 -0
- data/app/assets/images/kaui/payment/refund.svg +4 -0
- data/app/assets/images/kaui/plus.svg +3 -0
- data/app/assets/images/kaui/search.svg +4 -0
- data/app/assets/images/kaui/setting/account.svg +10 -0
- data/app/assets/images/kaui/setting/analytics.svg +7 -0
- data/app/assets/images/kaui/setting/custom-field.svg +5 -0
- data/app/assets/images/kaui/setting/e-notifications.svg +6 -0
- data/app/assets/images/kaui/setting/plugins.svg +7 -0
- data/app/assets/images/kaui/setting/plus.svg +3 -0
- data/app/assets/images/kaui/setting/reset.svg +4 -0
- data/app/assets/images/kaui/setting/tag-definitions.svg +5 -0
- data/app/assets/images/kaui/setting/tags.svg +4 -0
- data/app/assets/images/kaui/setting/tenants.svg +6 -0
- data/app/assets/images/kaui/setting/users.svg +6 -0
- data/app/assets/images/kaui/setting.svg +4 -0
- data/app/assets/images/kaui/sidebar/account.svg +4 -0
- data/app/assets/images/kaui/sidebar/audit.svg +5 -0
- data/app/assets/images/kaui/sidebar/custom-fields.svg +5 -0
- data/app/assets/images/kaui/sidebar/invoices.svg +5 -0
- data/app/assets/images/kaui/sidebar/payments.svg +5 -0
- data/app/assets/images/kaui/sidebar/queues.svg +5 -0
- data/app/assets/images/kaui/sidebar/subscriptions.svg +6 -0
- data/app/assets/images/kaui/sidebar/tags.svg +5 -0
- data/app/assets/images/kaui/sidebar/timeline.svg +5 -0
- data/app/assets/images/kaui/sign_in_background.svg +57 -0
- data/app/assets/images/kaui/sort-down.svg +3 -0
- data/app/assets/images/kaui/sort-up.svg +3 -0
- data/app/assets/images/kaui/subscription/add-on.svg +7 -0
- data/app/assets/images/kaui/subscription/cancel.svg +6 -0
- data/app/assets/images/kaui/subscription/change.svg +6 -0
- data/app/assets/images/kaui/subscription/date.svg +6 -0
- data/app/assets/images/kaui/subscription/pause.svg +4 -0
- data/app/assets/images/kaui/timeline/authorize.svg +5 -0
- data/app/assets/images/kaui/timeline/capture.svg +5 -0
- data/app/assets/images/kaui/timeline/chargeback.svg +3 -0
- data/app/assets/images/kaui/timeline/credit.svg +6 -0
- data/app/assets/images/kaui/timeline/invoice.svg +5 -0
- data/app/assets/images/kaui/timeline/purchase.svg +5 -0
- data/app/assets/images/kaui/timeline/refund.svg +4 -0
- data/app/assets/images/kaui/timeline/void.svg +4 -0
- data/app/assets/images/kaui/view-doc.svg +6 -0
- data/app/assets/images/kaui/warning.png +0 -0
- data/app/assets/javascripts/application.js +2 -2
- data/app/assets/javascripts/kaui/kaui_override.js +232 -0
- data/app/assets/javascripts/kaui/multi_functions_bar_utils.js +125 -24
- data/app/assets/stylesheets/application.css +13 -1
- data/app/assets/stylesheets/kaui/account.css +2028 -14
- data/app/assets/stylesheets/kaui/account_timeline.css +183 -0
- data/app/assets/stylesheets/kaui/admin_allowed_users.css +260 -0
- data/app/assets/stylesheets/kaui/audit.css +26 -16
- data/app/assets/stylesheets/kaui/audit_logs.css +443 -0
- data/app/assets/stylesheets/kaui/auth_pages.css +72 -0
- data/app/assets/stylesheets/kaui/breadcrumb.css +38 -0
- data/app/assets/stylesheets/kaui/chargebacks.css +118 -0
- data/app/assets/stylesheets/kaui/clock.css +103 -0
- data/app/assets/stylesheets/kaui/common.css +1744 -401
- data/app/assets/stylesheets/kaui/custom_fields.css +546 -0
- data/app/assets/stylesheets/kaui/dashboard.css +26 -0
- data/app/assets/stylesheets/kaui/datatable.css +114 -56
- data/app/assets/stylesheets/kaui/header.css +221 -114
- data/app/assets/stylesheets/kaui/home.css +89 -62
- data/app/assets/stylesheets/kaui/invoice.css +1061 -27
- data/app/assets/stylesheets/kaui/kaui.css +217 -145
- data/app/assets/stylesheets/kaui/overdue.css +5 -3
- data/app/assets/stylesheets/kaui/payment.css +1102 -13
- data/app/assets/stylesheets/kaui/queues.css +269 -0
- data/app/assets/stylesheets/kaui/refunds.css +185 -0
- data/app/assets/stylesheets/kaui/role_definitions.css +111 -0
- data/app/assets/stylesheets/kaui/sidebar.css +122 -0
- data/app/assets/stylesheets/kaui/subscription.css +677 -0
- data/app/assets/stylesheets/kaui/tag_definitions.css +524 -0
- data/app/assets/stylesheets/kaui/tags.css +592 -121
- data/app/assets/stylesheets/kaui/tenants.css +1478 -0
- data/app/assets/stylesheets/kaui/tooltip.css +9 -5
- data/app/assets/stylesheets/kaui/wallets.css +121 -0
- data/app/controllers/kaui/accounts_controller.rb +3 -2
- data/app/controllers/kaui/admin_tenants_controller.rb +33 -0
- data/app/controllers/kaui/custom_fields_controller.rb +1 -1
- data/app/controllers/kaui/engine_controller.rb +1 -2
- data/app/controllers/kaui/engine_controller_util.rb +5 -7
- data/app/controllers/kaui/home_controller.rb +24 -17
- data/app/controllers/kaui/invoices_controller.rb +4 -15
- data/app/controllers/kaui/payments_controller.rb +1 -1
- data/app/controllers/kaui/sessions_controller.rb +1 -0
- data/app/controllers/kaui/tag_definitions_controller.rb +1 -0
- data/app/helpers/kaui/account_helper.rb +13 -0
- data/app/helpers/kaui/plugin_helper.rb +27 -0
- data/app/views/kaui/account_custom_fields/index.html.erb +95 -29
- data/app/views/kaui/account_emails/_account_emails_table.html.erb +13 -3
- data/app/views/kaui/account_emails/_form.html.erb +23 -6
- data/app/views/kaui/account_emails/new.html.erb +12 -6
- data/app/views/kaui/account_tags/_form_bar.html.erb +10 -1
- data/app/views/kaui/account_tags/index.html.erb +103 -24
- data/app/views/kaui/account_timelines/_multi_functions_bar.html.erb +302 -69
- data/app/views/kaui/account_timelines/show.html.erb +360 -254
- data/app/views/kaui/accounts/_account_details.html.erb +165 -0
- data/app/views/kaui/accounts/_account_filterbar.html.erb +70 -80
- data/app/views/kaui/accounts/_add_parent.html.erb +26 -0
- data/app/views/kaui/accounts/_billing_details.html.erb +196 -0
- data/app/views/kaui/accounts/_close_account_modal.html.erb +62 -40
- data/app/views/kaui/accounts/_form_account.html.erb +157 -0
- data/app/views/kaui/accounts/_functions_bar.html.erb +606 -0
- data/app/views/kaui/accounts/_link_parent_modal.html.erb +1 -1
- data/app/views/kaui/accounts/_link_parent_to_modal.html.erb +62 -0
- data/app/views/kaui/accounts/_multi_functions_bar.html.erb +67 -28
- data/app/views/kaui/accounts/_payment_gateways.html.erb +43 -0
- data/app/views/kaui/accounts/_personal_details.html.erb +67 -0
- data/app/views/kaui/accounts/edit.html.erb +15 -9
- data/app/views/kaui/accounts/index.html.erb +77 -27
- data/app/views/kaui/accounts/new.html.erb +14 -8
- data/app/views/kaui/accounts/show.html.erb +17 -11
- data/app/views/kaui/admin/index.html.erb +44 -19
- data/app/views/kaui/admin_allowed_users/_form.html.erb +123 -31
- data/app/views/kaui/admin_allowed_users/edit.html.erb +15 -9
- data/app/views/kaui/admin_allowed_users/index.html.erb +150 -30
- data/app/views/kaui/admin_allowed_users/new.html.erb +14 -8
- data/app/views/kaui/admin_allowed_users/show.html.erb +137 -32
- data/app/views/kaui/admin_tenants/_add_allowed_user_modal.html.erb +42 -15
- data/app/views/kaui/admin_tenants/_clock.html.erb +72 -0
- data/app/views/kaui/admin_tenants/_form.html.erb +32 -20
- data/app/views/kaui/admin_tenants/_form_catalog_translation.erb +21 -8
- data/app/views/kaui/admin_tenants/_form_invoice_template.erb +25 -9
- data/app/views/kaui/admin_tenants/_form_invoice_translation.erb +36 -20
- data/app/views/kaui/admin_tenants/_form_plugin_config.erb +16 -20
- data/app/views/kaui/admin_tenants/_show_catalog.erb +13 -6
- data/app/views/kaui/admin_tenants/_show_catalog_simple.erb +95 -46
- data/app/views/kaui/admin_tenants/_show_catalog_xml.erb +62 -37
- data/app/views/kaui/admin_tenants/_show_overdue.erb +91 -75
- data/app/views/kaui/admin_tenants/_tenant_details.html.erb +106 -17
- data/app/views/kaui/admin_tenants/_tenants_table.html.erb +67 -6
- data/app/views/kaui/admin_tenants/_useful_links.html.erb +21 -16
- data/app/views/kaui/admin_tenants/index.html.erb +35 -11
- data/app/views/kaui/admin_tenants/index.js.erb +3 -0
- data/app/views/kaui/admin_tenants/new.html.erb +19 -13
- data/app/views/kaui/admin_tenants/new_catalog.html.erb +230 -98
- data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +152 -80
- data/app/views/kaui/admin_tenants/new_plan_currency.html.erb +44 -30
- data/app/views/kaui/admin_tenants/show.html.erb +211 -78
- data/app/views/kaui/admin_tenants/show.js.erb +3 -0
- data/app/views/kaui/audit_logs/_multi_functions_bar.html.erb +298 -101
- data/app/views/kaui/audit_logs/index.html.erb +137 -38
- data/app/views/kaui/bundle_tags/_form_bar.html.erb +11 -4
- data/app/views/kaui/bundles/_bundle_details.html.erb +24 -12
- data/app/views/kaui/bundles/index.html.erb +79 -104
- data/app/views/kaui/bundles/pause_resume.html.erb +73 -38
- data/app/views/kaui/chargebacks/_form.html.erb +35 -18
- data/app/views/kaui/chargebacks/new.html.erb +16 -9
- data/app/views/kaui/charges/_form.html.erb +54 -42
- data/app/views/kaui/charges/new.html.erb +15 -8
- data/app/views/kaui/components/breadcrumb/_breadcrumb.html.erb +146 -0
- data/app/views/kaui/components/button/_button.html.erb +16 -0
- data/app/views/kaui/components/dashboard/_card.html.erb +15 -0
- data/app/views/kaui/components/dashboard/_setting.html.erb +15 -0
- data/app/views/kaui/components/form_input/_form_input.html.erb +4 -0
- data/app/views/kaui/components/form_password/_form_password.html.erb +6 -0
- data/app/views/kaui/components/logo/_logo.html.erb +1 -0
- data/app/views/kaui/components/menu_dropdown/_menu_dropdown.html.erb +59 -0
- data/app/views/kaui/components/search_input/_search_input.html.erb +81 -0
- data/app/views/kaui/credits/_form.html.erb +42 -25
- data/app/views/kaui/credits/new.html.erb +15 -8
- data/app/views/kaui/custom_fields/_form.html.erb +37 -25
- data/app/views/kaui/custom_fields/_list_bar.html.erb +11 -10
- data/app/views/kaui/custom_fields/index.html.erb +121 -27
- data/app/views/kaui/custom_fields/new.html.erb +19 -8
- data/app/views/kaui/errors/500.html.erb +1 -1
- data/app/views/kaui/home/index.html.erb +77 -30
- data/app/views/kaui/invoice_items/_edit_form.html.erb +30 -14
- data/app/views/kaui/invoice_items/edit.html.erb +15 -7
- data/app/views/kaui/invoice_tags/_form_bar.html.erb +13 -3
- data/app/views/kaui/invoices/_invoice_filterbar.html.erb +53 -69
- data/app/views/kaui/invoices/_invoice_table.html.erb +77 -92
- data/app/views/kaui/invoices/_multi_functions_bar.html.erb +351 -140
- data/app/views/kaui/invoices/index.html.erb +89 -27
- data/app/views/kaui/invoices/show.html.erb +392 -80
- data/app/views/kaui/layouts/kaui_account_sidebar.html.erb +42 -0
- data/app/views/kaui/layouts/kaui_application.html.erb +29 -15
- data/app/views/kaui/layouts/kaui_flash.html.erb +82 -31
- data/app/views/kaui/layouts/kaui_navbar.html.erb +109 -82
- data/app/views/kaui/layouts/kaui_setting_sidebar.html.erb +36 -0
- data/app/views/kaui/payment_methods/_form.html.erb +32 -11
- data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +35 -34
- data/app/views/kaui/payment_methods/_payment_methods_details_table.html.erb +27 -29
- data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +116 -38
- data/app/views/kaui/payment_methods/_plugin_properties.html.erb +19 -9
- data/app/views/kaui/payment_methods/new.html.erb +14 -8
- data/app/views/kaui/payments/_form.html.erb +30 -13
- data/app/views/kaui/payments/_multi_functions_bar.html.erb +351 -141
- data/app/views/kaui/payments/_payment_filterbar.html.erb +63 -79
- data/app/views/kaui/payments/_payment_invoice_table.html.erb +105 -0
- data/app/views/kaui/payments/_payment_table.html.erb +4 -67
- data/app/views/kaui/payments/index.html.erb +90 -26
- data/app/views/kaui/payments/new.html.erb +15 -8
- data/app/views/kaui/payments/show.html.erb +222 -28
- data/app/views/kaui/queues/index.html.erb +329 -111
- data/app/views/kaui/refunds/_form.html.erb +68 -45
- data/app/views/kaui/refunds/new.html.erb +15 -8
- data/app/views/kaui/role_definitions/_form.html.erb +104 -17
- data/app/views/kaui/role_definitions/new.html.erb +15 -8
- data/app/views/kaui/sessions/_form.html.erb +9 -19
- data/app/views/kaui/sessions/new.html.erb +10 -9
- data/app/views/kaui/subscriptions/_cancel_by_date_modal.html.erb +65 -35
- data/app/views/kaui/subscriptions/_edit_form.html.erb +66 -35
- data/app/views/kaui/subscriptions/_form.html.erb +63 -32
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +215 -57
- data/app/views/kaui/subscriptions/edit.html.erb +19 -8
- data/app/views/kaui/subscriptions/edit_bcd.erb +46 -16
- data/app/views/kaui/subscriptions/new.html.erb +22 -15
- data/app/views/kaui/tag_definitions/_form.html.erb +51 -30
- data/app/views/kaui/tag_definitions/index.html.erb +151 -40
- data/app/views/kaui/tag_definitions/new.html.erb +15 -8
- data/app/views/kaui/tags/index.html.erb +136 -47
- data/app/views/kaui/tenants/_form.html.erb +8 -5
- data/app/views/kaui/tenants/index.html.erb +15 -9
- data/app/views/kaui/transactions/_control_plugin_names.html.erb +18 -10
- data/app/views/kaui/transactions/_form.html.erb +86 -25
- data/app/views/kaui/transactions/new.html.erb +15 -9
- data/config/routes.rb +1 -0
- data/lib/kaui/engine.rb +11 -0
- data/lib/kaui/version.rb +1 -1
- data/lib/kaui.rb +0 -1
- metadata +120 -2
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
<%# Required variables: title (string), actions (array of hashes) %>
|
|
2
|
+
<div class="d-flex justify-content-between align-items-center custom-border-bottom mb-4">
|
|
3
|
+
<h4 class="fw-semibold mb-4 title"><%= title %></h4>
|
|
4
|
+
|
|
5
|
+
<div class="d-flex gap-2 mb-auto">
|
|
6
|
+
<% actions.each_with_index do |action, index| %>
|
|
7
|
+
<% if action[:type] == "dropdown" %>
|
|
8
|
+
<%= render "kaui/components/menu_dropdown/menu_dropdown", {
|
|
9
|
+
label: action[:label],
|
|
10
|
+
icon: action[:icon],
|
|
11
|
+
dropdown_id: "menuDropdown#{index}",
|
|
12
|
+
menu_items: action[:items]
|
|
13
|
+
} %>
|
|
14
|
+
<% else %>
|
|
15
|
+
<%= render "kaui/components/button/button", {
|
|
16
|
+
label: action[:label],
|
|
17
|
+
icon: action[:icon],
|
|
18
|
+
variant: "btn-#{action[:variant] || 'outline-secondary'} d-inline-flex align-items-center gap-1",
|
|
19
|
+
type: "button",
|
|
20
|
+
html_class: action[:html_class],
|
|
21
|
+
html_options: {
|
|
22
|
+
id: action[:id],
|
|
23
|
+
onclick: "window.location='#{action[:path]}'",
|
|
24
|
+
data: action[:data]
|
|
25
|
+
}
|
|
26
|
+
} %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
<div class="dropdown position-relative">
|
|
31
|
+
<ul class="dropdown-menu" id="column-visibility" style="display: none;">
|
|
32
|
+
<% Kaui.account_search_columns.call[0].each_with_index do |title, index| %>
|
|
33
|
+
<li class="list-group-item-manual" data-id="<%= index %>">
|
|
34
|
+
<label class="label-group-item-manual">
|
|
35
|
+
<input type="checkbox" class="column-toggle" draggable="true" data-column="<%= index %>" <%= 'checked' if @dropdown_default[index][:visible] %> >
|
|
36
|
+
<%= title %>
|
|
37
|
+
<span class="icon-drag" aria-hidden="true">
|
|
38
|
+
</span>
|
|
39
|
+
</label>
|
|
40
|
+
</li>
|
|
41
|
+
<% end %>
|
|
42
|
+
</ul>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="modal fade" id="downloadCsvModal" tabindex="-1" role="dialog" aria-labelledby="downloadCsvModalLabel" aria-hidden="true">
|
|
48
|
+
<div class="modal-dialog" role="document">
|
|
49
|
+
<div class="modal-content">
|
|
50
|
+
<div class="modal-header">
|
|
51
|
+
<h5 class="modal-title d-flex align-items-center gap-3" id="downloadCsvModalLabel">
|
|
52
|
+
<span class="icon-container">
|
|
53
|
+
<%= image_tag("kaui/download-csv.svg") %>
|
|
54
|
+
</span>
|
|
55
|
+
Download
|
|
56
|
+
</h5>
|
|
57
|
+
<button type="button" class="close close-button custom-hover" data-bs-dismiss="modal" aria-label="Close">
|
|
58
|
+
<span aria-hidden="true">
|
|
59
|
+
<%= image_tag("kaui/modal/close.svg", width: 20, height: 20) %>
|
|
60
|
+
</span>
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="modal-body">
|
|
64
|
+
<form id="downloadCsvForm">
|
|
65
|
+
<div class="row">
|
|
66
|
+
<div class="d-flex align-items-center">
|
|
67
|
+
<label for="searchFieldSelect" class="field-label col-sm-3">Account Creation Date</label>
|
|
68
|
+
<div class="fake-select-wrapper col-sm-9">
|
|
69
|
+
<input type="checkbox" id="single-toggle" hidden />
|
|
70
|
+
<div class="d-flex align-items-center position-relative">
|
|
71
|
+
<label for="single-toggle" class="fake-select-display">
|
|
72
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
73
|
+
<path d="M14.5833 12.5V18.3333M17.5 15.4167H11.6666" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
74
|
+
<path d="M13.75 1.6665V4.99984M6.25 1.6665V4.99984" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
75
|
+
<path d="M17.5 10.8335V5.00016C17.5 4.07969 16.7538 3.3335 15.8333 3.3335H4.16667C3.24619 3.3335 2.5 4.07969 2.5 5.00016V16.6668C2.5 17.5873 3.24619 18.3335 4.16667 18.3335H10" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
76
|
+
<path d="M2.5 8.3335H17.5" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
77
|
+
</svg>
|
|
78
|
+
</label>
|
|
79
|
+
<input type="text" class="form-control center-input" id="startDate" placeholder="All Accounts" name="startDate">
|
|
80
|
+
<div id="dash" class="dash">–</div>
|
|
81
|
+
<input type="text" class="form-control right-input" id="endDate" placeholder="" name="endDate">
|
|
82
|
+
<div id="toggle-wrapper" class="position-absolute" style="width: 100%; height: 100%;" onclick="document.getElementById('single-toggle').click()"></div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<% today = Date.today %>
|
|
86
|
+
|
|
87
|
+
<% start_of_year = Date.new(today.year, 1, 1) %>
|
|
88
|
+
<% end_of_year = Date.new(today.year, 12, 31) %>
|
|
89
|
+
<% this_year_range = "#{start_of_year.strftime('%b %-d, %Y')} – #{end_of_year.strftime('%b %-d, %Y')}" %>
|
|
90
|
+
|
|
91
|
+
<% start_of_month = Date.new(today.year, today.month, 1) %>
|
|
92
|
+
<% end_of_month = Date.new(today.year, today.month, -1) %>
|
|
93
|
+
<% this_month_range = "#{start_of_month.strftime('%b %-d, %Y')} – #{end_of_month.strftime('%b %-d, %Y')}" %>
|
|
94
|
+
|
|
95
|
+
<% start_of_week = today - ((today.wday - 1) % 7) %>
|
|
96
|
+
<% end_of_week = start_of_week + 6 %>
|
|
97
|
+
<% this_week_range = "#{start_of_week.strftime('%b %-d, %Y')} – #{end_of_week.strftime('%b %-d, %Y')}" %>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<div class="fake-select-dropdown">
|
|
101
|
+
<label class="fake-select-option">
|
|
102
|
+
<input type="radio" name="download_option" id="allData" />
|
|
103
|
+
<span>All accounts</span>
|
|
104
|
+
</label>
|
|
105
|
+
|
|
106
|
+
<label class="fake-select-option">
|
|
107
|
+
<input type="radio" name="download_option" id="thisWeek" />
|
|
108
|
+
<span>This week <small>(<%= this_week_range %>)</small></span>
|
|
109
|
+
</label>
|
|
110
|
+
|
|
111
|
+
<label class="fake-select-option">
|
|
112
|
+
<input type="radio" name="download_option" id="thisMonth" />
|
|
113
|
+
<span>This month <small>(<%= this_month_range %>)</small></span>
|
|
114
|
+
</label>
|
|
115
|
+
|
|
116
|
+
<label class="fake-select-option">
|
|
117
|
+
<input type="radio" name="download_option" id="thisYear" />
|
|
118
|
+
<span>This year <small>(<%= this_year_range %>)</small></span>
|
|
119
|
+
</label>
|
|
120
|
+
<label class="fake-select-option">
|
|
121
|
+
<input type="radio" name="download_option" id="customDate" />
|
|
122
|
+
<span>Custom date</span>
|
|
123
|
+
</label>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="row">
|
|
129
|
+
<div class="d-flex align-items-center">
|
|
130
|
+
<label for="searchFieldSelect" class="field-label col-sm-3">Include fields</label>
|
|
131
|
+
<div class="col-md-9">
|
|
132
|
+
<div class="chip-select">
|
|
133
|
+
<input type="checkbox" id="allFields" hidden />
|
|
134
|
+
<input type="checkbox" id="dropdown-toggle" hidden />
|
|
135
|
+
|
|
136
|
+
<label for="dropdown-toggle" class="chip-input-box position-relative" style="position: relative; overflow: hidden;">
|
|
137
|
+
<div class="chip-list" id="selected-fields-chips">
|
|
138
|
+
<%# This will be dynamically populated with chips for selected fields %>
|
|
139
|
+
<span class="chip" style="color: #999;">No fields selected</span>
|
|
140
|
+
<svg width="16" height="16" class="position-absolute" style="top: 0.625rem; right: 0.625rem;" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
141
|
+
<path d="M4 6L8 10L12 6" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
142
|
+
</svg>
|
|
143
|
+
</div>
|
|
144
|
+
<div id="" class="position-absolute" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;"></div>
|
|
145
|
+
</label>
|
|
146
|
+
<div class="chip-dropdown">
|
|
147
|
+
<label class="chip-option">
|
|
148
|
+
<input type="checkbox" id="allFieldsDropdown" />
|
|
149
|
+
All fields
|
|
150
|
+
</label>
|
|
151
|
+
<div class="mt-2" id="field-selection">
|
|
152
|
+
<% Kaui.account_search_columns.call[0].each_with_index do |title, index| %>
|
|
153
|
+
<label class="chip-option d-flex align-items-center gap-2">
|
|
154
|
+
<input type="checkbox" class="field-toggle" data-field-index="<%= index %>" checked />
|
|
155
|
+
<span><%= title %></span>
|
|
156
|
+
</label>
|
|
157
|
+
<% end %>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</form>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="modal-footer">
|
|
167
|
+
<%= render "kaui/components/button/button", {
|
|
168
|
+
label: 'Close',
|
|
169
|
+
variant: "outline-secondary d-inline-flex align-items-center gap-1",
|
|
170
|
+
type: "button",
|
|
171
|
+
html_class: "kaui-button custom-hover mx-2 my-0",
|
|
172
|
+
html_options: {
|
|
173
|
+
data: {
|
|
174
|
+
bs_dismiss: "modal"
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
} %>
|
|
178
|
+
<%= render "kaui/components/button/button", {
|
|
179
|
+
label: 'Download CSV',
|
|
180
|
+
variant: "outline-secondary d-inline-flex align-items-center gap-1",
|
|
181
|
+
type: "button",
|
|
182
|
+
html_class: "kaui-dropdown custom-hover m-0",
|
|
183
|
+
html_options: {
|
|
184
|
+
id: "downloadButton"
|
|
185
|
+
}
|
|
186
|
+
} %>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
<%= javascript_tag do %>
|
|
194
|
+
$(document).ready(function() {
|
|
195
|
+
$('.dropdown-menu').on('click', 'input[type="checkbox"], label', function(event) {
|
|
196
|
+
event.stopPropagation();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
$('#modalDownloadButton').click(function() {
|
|
200
|
+
$('#downloadCsvModal').modal('show');
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// Native date inputs are used; no jQuery UI datepicker initialization needed
|
|
204
|
+
|
|
205
|
+
// Open native date picker on input click/focus
|
|
206
|
+
$('#startDate, #endDate').on('click focus', function() {
|
|
207
|
+
if (!this.disabled && typeof this.showPicker === 'function') {
|
|
208
|
+
this.showPicker();
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
$('#downloadCsvModal').on('show.bs.modal', function (e) {
|
|
213
|
+
$('#allData').prop('checked', true);
|
|
214
|
+
$('#startDate, #endDate').prop('disabled', true);
|
|
215
|
+
$('#toggle-wrapper').show();
|
|
216
|
+
$('#dash').hide();
|
|
217
|
+
$('#startDate').val(null);
|
|
218
|
+
$('#endDate').val(null);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
$('#allData').change(function() {
|
|
222
|
+
$('#startDate').val(null);
|
|
223
|
+
$('#endDate').val(null);
|
|
224
|
+
$('#toggle-wrapper').show();
|
|
225
|
+
$('#dash').hide();
|
|
226
|
+
$('#startDate, #endDate').prop('disabled', true);
|
|
227
|
+
// Change to text inputs to show placeholder
|
|
228
|
+
$('#startDate, #endDate').attr('type', 'text');
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
$('#thisWeek').change(function() {
|
|
232
|
+
if ($(this).is(':checked')) {
|
|
233
|
+
setDateRange("week");
|
|
234
|
+
$('#toggle-wrapper').show();
|
|
235
|
+
$('#dash').show();
|
|
236
|
+
// Change back to date inputs
|
|
237
|
+
$('#startDate, #endDate').attr('type', 'date');
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
$('#thisMonth').change(function() {
|
|
242
|
+
if ($(this).is(':checked')) {
|
|
243
|
+
setDateRange("month");
|
|
244
|
+
$('#toggle-wrapper').show();
|
|
245
|
+
$('#dash').show();
|
|
246
|
+
// Change back to date inputs
|
|
247
|
+
$('#startDate, #endDate').attr('type', 'date');
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
$('#thisYear').change(function() {
|
|
252
|
+
if ($(this).is(':checked')) {
|
|
253
|
+
setDateRange("year");
|
|
254
|
+
$('#toggle-wrapper').show();
|
|
255
|
+
$('#dash').show();
|
|
256
|
+
// Change back to date inputs
|
|
257
|
+
$('#startDate, #endDate').attr('type', 'date');
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
$('#customDate').change(function() {
|
|
262
|
+
if ($(this).is(':checked')) {
|
|
263
|
+
setDateRange("day");
|
|
264
|
+
$('#startDate, #endDate').prop('disabled', false);
|
|
265
|
+
$('#toggle-wrapper').hide();
|
|
266
|
+
$('#dash').show();
|
|
267
|
+
// Change back to date inputs
|
|
268
|
+
$('#startDate, #endDate').attr('type', 'date');
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
$('#dropdownMenu1').click(function(event) {
|
|
273
|
+
event.stopPropagation();
|
|
274
|
+
$('#column-visibility').toggle();
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// Clicking outside closes the dropdown
|
|
278
|
+
$(document).click(function() {
|
|
279
|
+
$('#column-visibility').hide();
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Clicking inside the dropdown should not close it
|
|
283
|
+
$('#column-visibility').click(function(event) {
|
|
284
|
+
event.stopPropagation();
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// Example: Checkbox column visibility toggle (DataTable logic if needed)
|
|
288
|
+
$('.column-toggle').on('change', function() {
|
|
289
|
+
var columnIdx = $(this).attr('data-column');
|
|
290
|
+
var table = $('#accounts-table').DataTable();
|
|
291
|
+
var column = table.column(columnIdx);
|
|
292
|
+
column.visible(!column.visible());
|
|
293
|
+
table.state.save();
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// Make columns sortable (optional, requires jQuery UI Sortable)
|
|
297
|
+
$('#column-visibility').sortable({
|
|
298
|
+
axis: "y",
|
|
299
|
+
containment: "parent",
|
|
300
|
+
stop: function(event, ui) {
|
|
301
|
+
var order = $("#column-visibility").sortable('toArray', {attribute: 'data-id'});
|
|
302
|
+
reorderTableColumns(order);
|
|
303
|
+
}
|
|
304
|
+
}).disableSelection();
|
|
305
|
+
|
|
306
|
+
function reorderTableColumns(order) {
|
|
307
|
+
var table = $('#accounts-table').DataTable();
|
|
308
|
+
var newOrder = order.map(Number);
|
|
309
|
+
table.colReorder.order(newOrder);
|
|
310
|
+
table.state.save();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
var downloadButton = document.getElementById('downloadButton');
|
|
314
|
+
if (downloadButton) {
|
|
315
|
+
downloadButton.addEventListener('click', function(e) {
|
|
316
|
+
e.preventDefault();
|
|
317
|
+
|
|
318
|
+
var allFieldsChecked = document.getElementById('allFields').checked;
|
|
319
|
+
var startDate = $('#startDate').val();
|
|
320
|
+
var endDate = $('#endDate').val();
|
|
321
|
+
var downloadAll = $('#allData').is(':checked');
|
|
322
|
+
var url = new URL("<%= download_accounts_path %>", window.location.origin);
|
|
323
|
+
var params = new URLSearchParams();
|
|
324
|
+
|
|
325
|
+
if (allFieldsChecked) {
|
|
326
|
+
// Include all table columns when "All fields" is checked
|
|
327
|
+
var thElements = document.querySelectorAll('#accounts-table th');
|
|
328
|
+
var columnTitles = Array.from(thElements).map(function(th) {
|
|
329
|
+
return th.textContent.trim();
|
|
330
|
+
});
|
|
331
|
+
params.append('columnsString', columnTitles.join(','));
|
|
332
|
+
} else {
|
|
333
|
+
// Only include selected fields when "All fields" is unchecked
|
|
334
|
+
var selectedFields = [];
|
|
335
|
+
$('#field-selection input.field-toggle:checked').each(function() {
|
|
336
|
+
var labelText = $(this).closest('label').find('span').text().trim();
|
|
337
|
+
selectedFields.push(labelText);
|
|
338
|
+
});
|
|
339
|
+
params.append('columnsString', selectedFields.join(','));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (!downloadAll) {
|
|
343
|
+
params.append('startDate', startDate);
|
|
344
|
+
params.append('endDate', endDate);
|
|
345
|
+
}
|
|
346
|
+
params.append('allFieldsChecked', allFieldsChecked);
|
|
347
|
+
params.append('search', searchQuery());
|
|
348
|
+
url.search = params.toString();
|
|
349
|
+
window.open(url.toString(), '_blank');
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function searchQuery(){
|
|
354
|
+
var searchFields = $('.search-field');
|
|
355
|
+
var searchLabelsContainer = $('#search-labels-container');
|
|
356
|
+
searchLabelsContainer.empty();
|
|
357
|
+
|
|
358
|
+
var searchLabels = searchFields.map(function() {
|
|
359
|
+
var filter = $(this).find('.search-field-filter').val();
|
|
360
|
+
var value = $(this).find('.search-field-value').val();
|
|
361
|
+
var columnName = $(this).find('.search-field-filter').attr('name').replace('Filter', '').toLowerCase().replace(/\s+/g, '_');
|
|
362
|
+
|
|
363
|
+
if (value !== '') {
|
|
364
|
+
if (filter === 'like') {
|
|
365
|
+
return columnName + encodeURIComponent('[' + filter + ']') + '=' + encodeURIComponent('%' + value + '%');
|
|
366
|
+
} else {
|
|
367
|
+
return columnName + encodeURIComponent('[' + filter + ']') + '=' + encodeURIComponent(value);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}).get().join('&');
|
|
371
|
+
|
|
372
|
+
var searchLabelString = searchLabels.length > 0 ? ('_q=1&' + searchLabels) : '';
|
|
373
|
+
return searchLabelString;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
updateDropdownOrder();
|
|
377
|
+
|
|
378
|
+
function updateDropdownOrder() {
|
|
379
|
+
var state = JSON.parse(localStorage.getItem('DataTables_accounts-table_' + window.location.pathname));
|
|
380
|
+
if (state === null) {
|
|
381
|
+
// On initial load, ensure the existing checkboxes work
|
|
382
|
+
setupColumnToggleEvents();
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
var columnOrder = state.ColReorder;
|
|
386
|
+
var $list = $('#column-visibility');
|
|
387
|
+
var thElements = document.querySelectorAll('#accounts-table th');
|
|
388
|
+
var $columnTitles = Array.from(thElements).map(function(th) {
|
|
389
|
+
return th.textContent.trim();
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
if (columnOrder !== undefined) {
|
|
393
|
+
$list.empty();
|
|
394
|
+
var state = JSON.parse(localStorage.getItem('DataTables_accounts-table_' + window.location.pathname));
|
|
395
|
+
if (state !== null) {
|
|
396
|
+
var colsOrder = state.ColReorder;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
columnOrder.forEach(function(colIdx, index) {
|
|
400
|
+
if (colsOrder) {
|
|
401
|
+
var data_id = colsOrder[index];
|
|
402
|
+
} else {
|
|
403
|
+
var data_id = index;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
var $item = $('<li>', { class: "list-group-item-manual", "data-id": data_id });
|
|
407
|
+
var column = state.columns[colIdx];
|
|
408
|
+
var col_name = $columnTitles[colIdx];
|
|
409
|
+
|
|
410
|
+
var $label = $('<label>', {
|
|
411
|
+
class: "label-group-item-manual",
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
var $checkbox = $("<input>", {
|
|
415
|
+
type: "checkbox",
|
|
416
|
+
value: colIdx,
|
|
417
|
+
checked: column.visible,
|
|
418
|
+
"data-column": colIdx,
|
|
419
|
+
class: "column-toggle"
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
$label.append($checkbox).append(" " + col_name);
|
|
423
|
+
|
|
424
|
+
var $icon = $(`
|
|
425
|
+
<span class="icon-drag" aria-hidden="true">
|
|
426
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
427
|
+
<path d="M6.66669 5H6.67198M6.66669 10H6.67198M6.66669 15H6.67198M13.3281 5H13.3334M13.3281 10H13.3334M13.3281 15H13.3334" stroke="#A4A7AE" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
428
|
+
</svg>
|
|
429
|
+
</span>
|
|
430
|
+
`);
|
|
431
|
+
|
|
432
|
+
$label.append($icon);
|
|
433
|
+
$item.append($label);
|
|
434
|
+
$list.append($item);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
resetDataColumn();
|
|
439
|
+
resetDataId();
|
|
440
|
+
setupColumnToggleEvents();
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
$("#column-visibility").sortable({
|
|
445
|
+
axis: "y",
|
|
446
|
+
containment: "parent",
|
|
447
|
+
stop: function(event, ui) {
|
|
448
|
+
var order = $("#column-visibility").sortable('toArray', {attribute: 'data-id'});
|
|
449
|
+
reorderTableColumns(order);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
$("#column-visibility").disableSelection();
|
|
453
|
+
|
|
454
|
+
function reorderTableColumns(order) {
|
|
455
|
+
var table = $('#accounts-table').DataTable();
|
|
456
|
+
var columnIndexes = order.map(Number);
|
|
457
|
+
table.colReorder.order(columnIndexes);
|
|
458
|
+
table.state.save();
|
|
459
|
+
resetDataColumn();
|
|
460
|
+
resetDataId();
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function resetDataId() {
|
|
464
|
+
var elements = document.querySelectorAll('.list-group-item-manual');
|
|
465
|
+
elements.forEach(function(element, index) {
|
|
466
|
+
element.setAttribute('data-id', index);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function resetDataColumn() {
|
|
471
|
+
var elements = document.querySelectorAll('.column-toggle');
|
|
472
|
+
elements.forEach(function(element, index) {
|
|
473
|
+
element.setAttribute('data-column', index);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function setupColumnToggleEvents() {
|
|
478
|
+
$('.column-toggle').off('change').on('change', function() {
|
|
479
|
+
var table = $('#accounts-table').DataTable();
|
|
480
|
+
var column = table.column($(this).attr('data-column'));
|
|
481
|
+
column.visible(!column.visible());
|
|
482
|
+
table.state.save();
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
document.addEventListener('click', function (e) {
|
|
487
|
+
const wrapper = document.querySelector('.chip-select');
|
|
488
|
+
const toggle = document.getElementById('dropdown-toggle');
|
|
489
|
+
|
|
490
|
+
if (wrapper && !wrapper.contains(e.target)) {
|
|
491
|
+
toggle.checked = false; // close dropdown
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
document.addEventListener('click', function (e) {
|
|
496
|
+
const wrapper = document.querySelector('.fake-select-wrapper');
|
|
497
|
+
const toggle = document.getElementById('single-toggle');
|
|
498
|
+
if (!wrapper.contains(e.target)) toggle.checked = false;
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
// No longer disabling fields - users can freely select/deselect
|
|
502
|
+
function setFieldsDisabled(disabled) {
|
|
503
|
+
// Function kept for compatibility but no longer disables fields
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Initialize on modal open
|
|
507
|
+
$('#downloadCsvModal').on('show.bs.modal', function () {
|
|
508
|
+
$('#allFields').prop('checked', true);
|
|
509
|
+
updateChipLabel();
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// Initial binding
|
|
513
|
+
bindAllFieldsToggle();
|
|
514
|
+
bindDropdownAllFieldsToggle();
|
|
515
|
+
|
|
516
|
+
// Toggle behavior - this will be re-bound in updateChipLabel
|
|
517
|
+
function bindAllFieldsToggle() {
|
|
518
|
+
$('#allFields').off('change').on('change', function() {
|
|
519
|
+
var checked = $(this).is(':checked');
|
|
520
|
+
|
|
521
|
+
// When "All fields" is checked, select all individual fields
|
|
522
|
+
// When unchecked, deselect all individual fields
|
|
523
|
+
$('#field-selection input.field-toggle').prop('checked', checked);
|
|
524
|
+
$('#allFieldsDropdown').prop('checked', checked);
|
|
525
|
+
|
|
526
|
+
updateChipLabel();
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// Also bind to the dropdown "All fields" checkbox
|
|
531
|
+
function bindDropdownAllFieldsToggle() {
|
|
532
|
+
$('#allFieldsDropdown').off('change').on('change', function() {
|
|
533
|
+
var checked = $(this).is(':checked');
|
|
534
|
+
|
|
535
|
+
// Sync with the main checkbox
|
|
536
|
+
$('#allFields').prop('checked', checked);
|
|
537
|
+
|
|
538
|
+
// When "All fields" is checked, select all individual fields
|
|
539
|
+
// When unchecked, deselect all individual fields
|
|
540
|
+
$('#field-selection input.field-toggle').prop('checked', checked);
|
|
541
|
+
|
|
542
|
+
updateChipLabel();
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Update chip display based on selected fields
|
|
547
|
+
function updateChipLabel() {
|
|
548
|
+
var allFieldsChecked = $('#allFields').is(':checked');
|
|
549
|
+
var $chipList = $('#selected-fields-chips');
|
|
550
|
+
|
|
551
|
+
if (allFieldsChecked) {
|
|
552
|
+
// Show "All fields" chip
|
|
553
|
+
$chipList.html(`
|
|
554
|
+
<span class="chip">All fields</span>
|
|
555
|
+
<svg width="16" height="16" class="position-absolute" style="top: 0.625rem; right: 0.625rem;" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
556
|
+
<path d="M4 6L8 10L12 6" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
557
|
+
</svg>
|
|
558
|
+
`);
|
|
559
|
+
} else {
|
|
560
|
+
// Show individual field chips
|
|
561
|
+
var selectedFields = [];
|
|
562
|
+
$('#field-selection input.field-toggle:checked').each(function() {
|
|
563
|
+
var labelText = $(this).closest('label').find('span').text().trim();
|
|
564
|
+
selectedFields.push(labelText);
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
if (selectedFields.length === 0) {
|
|
568
|
+
$chipList.html(`
|
|
569
|
+
<span class="chip" style="color: #999;">No fields selected</span>
|
|
570
|
+
<svg width="16" height="16" class="position-absolute" style="top: 0.625rem; right: 0.625rem;" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
571
|
+
<path d="M4 6L8 10L12 6" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
572
|
+
</svg>
|
|
573
|
+
`);
|
|
574
|
+
} else {
|
|
575
|
+
var chipsHtml = selectedFields.map(function(field) {
|
|
576
|
+
return `<span class="chip">${field}</span>`;
|
|
577
|
+
}).join('');
|
|
578
|
+
chipsHtml = chipsHtml + `
|
|
579
|
+
<svg width="16" height="16" class="position-absolute" style="top: 0.625rem; right: 0.625rem;" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
580
|
+
<path d="M4 6L8 10L12 6" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
581
|
+
</svg>
|
|
582
|
+
`;
|
|
583
|
+
$chipList.html(chipsHtml);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// Update chip label when individual fields change
|
|
589
|
+
$('#field-selection input.field-toggle').on('change', function() {
|
|
590
|
+
// Check if all individual fields are selected
|
|
591
|
+
var totalFields = $('#field-selection input.field-toggle').length;
|
|
592
|
+
var checkedFields = $('#field-selection input.field-toggle:checked').length;
|
|
593
|
+
|
|
594
|
+
// Update "All fields" checkbox based on individual field selections
|
|
595
|
+
if (checkedFields === totalFields) {
|
|
596
|
+
$('#allFields').prop('checked', true);
|
|
597
|
+
$('#allFieldsDropdown').prop('checked', true);
|
|
598
|
+
} else {
|
|
599
|
+
$('#allFields').prop('checked', false);
|
|
600
|
+
$('#allFieldsDropdown').prop('checked', false);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
updateChipLabel();
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
<% end %>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<div class="link-to-parent-account modal fade" id="link_account" tabindex="-1" role="dialog">
|
|
2
|
+
<div class="modal-dialog" role="document">
|
|
3
|
+
<div class="modal-content column-block">
|
|
4
|
+
<div class="modal-header">
|
|
5
|
+
<h5 class="modal-title d-flex align-items-center gap-3">
|
|
6
|
+
<span class="icon-container">
|
|
7
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<path d="M13.3334 5.83333C13.3334 7.67428 11.841 9.16667 10.0001 9.16667C8.15913 9.16667 6.66675 7.67428 6.66675 5.83333C6.66675 3.99238 8.15913 2.5 10.0001 2.5C11.841 2.5 13.3334 3.99238 13.3334 5.83333Z" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9
|
+
<path d="M15.8334 15.8332C15.8334 13.532 13.9679 11.6665 11.6667 11.6665H8.33341C6.03223 11.6665 4.16675 13.532 4.16675 15.8332V17.4998H15.8334V15.8332Z" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10
|
+
</svg>
|
|
11
|
+
</span>
|
|
12
|
+
Link to parent
|
|
13
|
+
</h5>
|
|
14
|
+
<button type="button" class="close close-button custom-hover" data-bs-dismiss="modal" aria-label="Close">
|
|
15
|
+
<span aria-hidden="true">
|
|
16
|
+
<%= image_tag("kaui/modal/close.svg", width: 20, height: 20) %>
|
|
17
|
+
</span>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
<%= form_for @account, :url => link_to_parent_path(@account.account_id), :method => :put, :html => {:class => 'form-horizontal'} do |f| %>
|
|
21
|
+
<div class="modal-body">
|
|
22
|
+
<div class='form-group'>
|
|
23
|
+
<%= f.label :parent_account_id, 'Parent account id', :class => 'col-sm-3 control-label col-form-label' %>
|
|
24
|
+
<div class="col-sm-9">
|
|
25
|
+
<%= f.text_field :parent_account_id, :class => 'form-control', :required => true %>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="form-group">
|
|
29
|
+
<div class="col-sm-3"></div>
|
|
30
|
+
<div class="col-sm-offset-4 col-sm-8">
|
|
31
|
+
<div class="checkbox ">
|
|
32
|
+
<%= f.label :is_payment_delegated_to_parent, :class => 'label-group-item-manual' do %>
|
|
33
|
+
<%= f.check_box :is_payment_delegated_to_parent, {:checked => @account.is_payment_delegated_to_parent} %>Is payment delegated to parent?
|
|
34
|
+
<% end %>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="modal-footer">
|
|
40
|
+
<%= render "kaui/components/button/button", {
|
|
41
|
+
label: 'Close',
|
|
42
|
+
variant: "outline-secondary d-inline-flex align-items-center gap-1 m-0 mx-2",
|
|
43
|
+
type: "button",
|
|
44
|
+
html_class: "kaui-button custom-hover",
|
|
45
|
+
html_options: {
|
|
46
|
+
data: {
|
|
47
|
+
bs_dismiss: "modal"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} %>
|
|
51
|
+
<%= render "kaui/components/button/button", {
|
|
52
|
+
label: 'Save',
|
|
53
|
+
variant: "outline-secondary d-inline-flex align-items-center gap-1 m-0",
|
|
54
|
+
type: "submit",
|
|
55
|
+
html_class: "kaui-dropdown custom-hover"
|
|
56
|
+
} %>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<% end %>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|